]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
Add 'contrib/pnglite/' from commit 'a70c2a23d0d84dfc63a1d9413a7f4aaede7313aa'
[FreeBSD/FreeBSD.git] / contrib / llvm-project / clang / include / clang / Basic / DiagnosticSemaKinds.td
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
13 let Component = "Sema" in {
14 let CategoryName = "Semantic Issue" in {
15 def note_previous_decl : Note<"%0 declared here">;
16 def note_entity_declared_at : Note<"%0 declared here">;
17 def note_callee_decl : Note<"%0 declared here">;
18 def note_defined_here : Note<"%0 defined here">;
19
20 // For loop analysis
21 def 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;
25 def 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;
29 def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31 def 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;
34 def note_duplicate_element : Note<"element %0 also has value %1">;
35
36 // Absolute value functions
37 def warn_unsigned_abs : Warning<
38   "taking the absolute value of unsigned type %0 has no effect">,
39   InGroup<AbsoluteValue>;
40 def note_remove_abs : Note<
41   "remove the call to '%0' since unsigned values cannot be negative">;
42 def 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>;
45 def 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>;
49 def note_replace_abs_function : Note<"use function '%0' instead">;
50 def warn_pointer_abs : Warning<
51   "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52   InGroup<AbsoluteValue>;
53
54 def 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>;
59 def note_remove_max_call : Note<
60   "remove call to max function and unsigned zero argument">;
61
62 def warn_infinite_recursive_function : Warning<
63   "all paths through this function will call itself">,
64   InGroup<InfiniteRecursion>, DefaultIgnore;
65
66 def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67   InGroup<DiagGroup<"comma">>, DefaultIgnore;
68 def note_cast_to_void : Note<"cast expression to void to silence warning">;
69
70 // Constant expressions
71 def err_expr_not_ice : Error<
72   "expression is not an %select{integer|integral}0 constant expression">;
73 def 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>;
76 def err_typecheck_converted_constant_expression : Error<
77   "value of type %0 is not implicitly convertible to %1">;
78 def err_typecheck_converted_constant_expression_disallowed : Error<
79   "conversion from %0 to %1 is not allowed in a converted constant expression">;
80 def err_typecheck_converted_constant_expression_indirect : Error<
81   "conversion from %0 to %1 in converted constant expression would "
82   "bind reference to a temporary">;
83 def 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">;
87 def 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;
93 def err_ice_not_integral : Error<
94   "integral constant expression must have integral or unscoped enumeration "
95   "type, not %0">;
96 def err_ice_incomplete_type : Error<
97   "integral constant expression has incomplete class type %0">;
98 def err_ice_explicit_conversion : Error<
99   "integral constant expression requires explicit conversion from %0 to %1">;
100 def note_ice_conversion_here : Note<
101   "conversion to %select{integral|enumeration}0 type %1 declared here">;
102 def err_ice_ambiguous_conversion : Error<
103   "ambiguous conversion from type %0 to an integral or unscoped "
104   "enumeration type">;
105 def 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">;
108 def err_expr_not_string_literal : Error<"expression is not a string literal">;
109
110 // Semantic analysis of constant literals.
111 def ext_predef_outside_function : Warning<
112   "predefined identifier is only valid inside function">,
113   InGroup<DiagGroup<"predefined-identifier-outside-function">>;
114 def warn_float_overflow : Warning<
115   "magnitude of floating-point constant too large for type %0; maximum is %1">,
116    InGroup<LiteralRange>;
117 def warn_float_underflow : Warning<
118   "magnitude of floating-point constant too small for type %0; minimum is %1">,
119   InGroup<LiteralRange>;
120 def warn_double_const_requires_fp64 : Warning<
121   "double precision constant requires cl_khr_fp64, casting to single precision">;
122 def err_half_const_requires_fp16 : Error<
123   "half precision constant requires cl_khr_fp16">;
124
125 // C99 variable-length arrays
126 def ext_vla : Extension<"variable length arrays are a C99 feature">,
127   InGroup<VLAExtension>;
128 def warn_vla_used : Warning<"variable length array used">,
129   InGroup<VLA>, DefaultIgnore;
130 def err_vla_in_sfinae : Error<
131   "variable length array cannot be formed during template argument deduction">;
132 def err_array_star_in_function_definition : Error<
133   "variable length array must be bound in function definition">;
134 def err_vla_decl_in_file_scope : Error<
135   "variable length array declaration not allowed at file scope">;
136 def err_vla_decl_has_static_storage : Error<
137   "variable length array declaration cannot have 'static' storage duration">;
138 def err_vla_decl_has_extern_linkage : Error<
139   "variable length array declaration cannot have 'extern' linkage">;
140 def ext_vla_folded_to_constant : Extension<
141   "variable length array folded to constant array as an extension">, InGroup<GNUFoldingConstant>;
142 def err_vla_unsupported : Error<
143   "variable length arrays are not supported for the current target">;
144 def note_vla_unsupported : Note<
145   "variable length arrays are not supported for the current target">;
146
147 // C99 variably modified types
148 def err_variably_modified_template_arg : Error<
149   "variably modified type %0 cannot be used as a template argument">;
150 def err_variably_modified_nontype_template_param : Error<
151   "non-type template parameter of variably modified type %0">;
152 def err_variably_modified_new_type : Error<
153   "'new' cannot allocate object of variably modified type %0">;
154
155 // C99 Designated Initializers
156 def ext_designated_init : Extension<
157   "designated initializers are a C99 feature">, InGroup<C99Designator>;
158 def err_array_designator_negative : Error<
159   "array designator value '%0' is negative">;
160 def err_array_designator_empty_range : Error<
161   "array designator range [%0, %1] is empty">;
162 def err_array_designator_non_array : Error<
163   "array designator cannot initialize non-array type %0">;
164 def err_array_designator_too_large : Error<
165   "array designator index (%0) exceeds array bounds (%1)">;
166 def err_field_designator_non_aggr : Error<
167   "field designator cannot initialize a "
168   "%select{non-struct, non-union|non-class}0 type %1">;
169 def err_field_designator_unknown : Error<
170   "field designator %0 does not refer to any field in type %1">;
171 def err_field_designator_nonfield : Error<
172   "field designator %0 does not refer to a non-static data member">;
173 def note_field_designator_found : Note<"field designator refers here">;
174 def err_designator_for_scalar_or_sizeless_init : Error<
175   "designator in initializer for %select{scalar|indivisible sizeless}0 "
176   "type %1">;
177 def warn_initializer_overrides : Warning<
178   "initializer %select{partially |}0overrides prior initialization of "
179   "this subobject">, InGroup<InitializerOverrides>;
180 def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
181   InGroup<InitializerOverrides>, SFINAEFailure;
182 def err_initializer_overrides_destructed : Error<
183   "initializer would partially override prior initialization of object of "
184   "type %1 with non-trivial destruction">;
185 def note_previous_initializer : Note<
186   "previous initialization %select{|with side effects }0is here"
187   "%select{| (side effects will not occur at run time)}0">;
188 def err_designator_into_flexible_array_member : Error<
189   "designator into flexible array member subobject">;
190 def note_flexible_array_member : Note<
191   "initialized flexible array member %0 is here">;
192 def ext_flexible_array_init : Extension<
193   "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
194
195 // C++20 designated initializers
196 def ext_cxx_designated_init : Extension<
197   "designated initializers are a C++20 extension">, InGroup<CXX20Designator>;
198 def warn_cxx17_compat_designated_init : Warning<
199   "designated initializers are incompatible with C++ standards before C++20">,
200   InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
201 def ext_designated_init_mixed : ExtWarn<
202   "mixture of designated and non-designated initializers in the same "
203   "initializer list is a C99 extension">, InGroup<C99Designator>;
204 def note_designated_init_mixed : Note<
205   "first non-designated initializer is here">;
206 def ext_designated_init_array : ExtWarn<
207   "array designators are a C99 extension">, InGroup<C99Designator>;
208 def ext_designated_init_nested : ExtWarn<
209   "nested designators are a C99 extension">, InGroup<C99Designator>;
210 def ext_designated_init_reordered : ExtWarn<
211   "ISO C++ requires field designators to be specified in declaration order; "
212   "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
213   SFINAEFailure;
214 def note_previous_field_init : Note<
215   "previous initialization for field %0 is here">;
216
217 // Declarations.
218 def ext_plain_complex : ExtWarn<
219   "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
220 def ext_imaginary_constant : Extension<
221   "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
222 def ext_integer_complex : Extension<
223   "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
224
225 def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
226   "'_Fract' or '_Accum', not '%0'">;
227 def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
228 def err_invalid_width_spec : Error<
229   "'%select{|short|long|long long}0 %1' is invalid">;
230 def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
231
232 def ext_auto_type_specifier : ExtWarn<
233   "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
234 def warn_auto_storage_class : Warning<
235   "'auto' storage class specifier is redundant and incompatible with C++11">,
236   InGroup<CXX11Compat>, DefaultIgnore;
237
238 def warn_deprecated_register : Warning<
239   "'register' storage class specifier is deprecated "
240   "and incompatible with C++17">, InGroup<DeprecatedRegister>;
241 def ext_register_storage_class : ExtWarn<
242   "ISO C++17 does not allow 'register' storage class specifier">,
243   DefaultError, InGroup<Register>;
244
245 def err_invalid_decl_spec_combination : Error<
246   "cannot combine with previous '%0' declaration specifier">;
247 def err_invalid_vector_decl_spec_combination : Error<
248   "cannot combine with previous '%0' declaration specifier. "
249   "'__vector' must be first">;
250 def err_invalid_pixel_decl_spec_combination : Error<
251   "'__pixel' must be preceded by '__vector'.  "
252   "'%0' declaration specifier not allowed here">;
253 def err_invalid_vector_bool_decl_spec : Error<
254   "cannot use '%0' with '__vector bool'">;
255 def err_invalid_vector_long_decl_spec : Error<
256   "cannot use 'long' with '__vector'">;
257 def err_invalid_vector_float_decl_spec : Error<
258   "cannot use 'float' with '__vector'">;
259 def err_invalid_vector_double_decl_spec : Error <
260   "use of 'double' with '__vector' requires VSX support to be enabled "
261   "(available on POWER7 or later)">;
262 def err_invalid_vector_bool_int128_decl_spec : Error <
263   "use of '__int128' with '__vector bool' requires VSX support enabled (on "
264   "POWER10 or later)">;
265 def err_invalid_vector_long_long_decl_spec : Error <
266   "use of 'long long' with '__vector bool' requires VSX support (available on "
267   "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
268   "to be enabled">;
269 def err_invalid_vector_long_double_decl_spec : Error<
270   "cannot use 'long double' with '__vector'">;
271 def warn_vector_long_decl_spec_combination : Warning<
272   "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
273
274 def err_redeclaration_different_type : Error<
275   "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
276 def err_bad_variable_name : Error<
277   "%0 cannot be the name of a variable or data member">;
278 def err_bad_parameter_name : Error<
279   "%0 cannot be the name of a parameter">;
280 def err_bad_parameter_name_template_id : Error<
281   "parameter name cannot have template arguments">;
282 def ext_parameter_name_omitted_c2x : ExtWarn<
283   "omitting the parameter name in a function definition is a C2x extension">,
284   InGroup<C2x>;
285 def err_anyx86_interrupt_attribute : Error<
286   "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
287   "have %select{a 'void' return type|"
288   "only a pointer parameter optionally followed by an integer parameter|"
289   "a pointer as the first parameter|a %2 type as the second parameter}1">;
290 def err_anyx86_interrupt_called : Error<
291   "interrupt service routine cannot be called directly">;
292 def warn_arm_interrupt_calling_convention : Warning<
293    "call to function without interrupt attribute could clobber interruptee's VFP registers">,
294    InGroup<Extra>;
295 def warn_interrupt_attribute_invalid : Warning<
296    "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
297    "functions that have %select{no parameters|a 'void' return type}1">,
298    InGroup<IgnoredAttributes>;
299 def warn_riscv_repeated_interrupt_attribute : Warning<
300   "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
301 def note_riscv_repeated_interrupt_attribute : Note<
302   "repeated RISC-V 'interrupt' attribute is here">;
303 def warn_unused_parameter : Warning<"unused parameter %0">,
304   InGroup<UnusedParameter>, DefaultIgnore;
305 def warn_unused_variable : Warning<"unused variable %0">,
306   InGroup<UnusedVariable>, DefaultIgnore;
307 def warn_unused_local_typedef : Warning<
308   "unused %select{typedef|type alias}0 %1">,
309   InGroup<UnusedLocalTypedef>, DefaultIgnore;
310 def warn_unused_property_backing_ivar :
311   Warning<"ivar %0 which backs the property is not "
312   "referenced in this property's accessor">,
313   InGroup<UnusedPropertyIvar>, DefaultIgnore;
314 def warn_unused_const_variable : Warning<"unused variable %0">,
315   InGroup<UnusedConstVariable>, DefaultIgnore;
316 def warn_unused_exception_param : Warning<"unused exception parameter %0">,
317   InGroup<UnusedExceptionParameter>, DefaultIgnore;
318 def warn_decl_in_param_list : Warning<
319   "declaration of %0 will not be visible outside of this function">,
320   InGroup<Visibility>;
321 def warn_redefinition_in_param_list : Warning<
322   "redefinition of %0 will not be visible outside of this function">,
323   InGroup<Visibility>;
324 def warn_empty_parens_are_function_decl : Warning<
325   "empty parentheses interpreted as a function declaration">,
326   InGroup<VexingParse>;
327 def warn_parens_disambiguated_as_function_declaration : Warning<
328   "parentheses were disambiguated as a function declaration">,
329   InGroup<VexingParse>;
330 def warn_parens_disambiguated_as_variable_declaration : Warning<
331   "parentheses were disambiguated as redundant parentheses around declaration "
332   "of variable named %0">, InGroup<VexingParse>;
333 def warn_redundant_parens_around_declarator : Warning<
334   "redundant parentheses surrounding declarator">,
335   InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
336 def note_additional_parens_for_variable_declaration : Note<
337   "add a pair of parentheses to declare a variable">;
338 def note_raii_guard_add_name : Note<
339   "add a variable name to declare a %0 initialized with %1">;
340 def note_function_style_cast_add_parentheses : Note<
341   "add enclosing parentheses to perform a function-style cast">;
342 def note_remove_parens_for_variable_declaration : Note<
343   "remove parentheses to silence this warning">;
344 def note_empty_parens_function_call : Note<
345   "change this ',' to a ';' to call %0">;
346 def note_empty_parens_default_ctor : Note<
347   "remove parentheses to declare a variable">;
348 def note_empty_parens_zero_initialize : Note<
349   "replace parentheses with an initializer to declare a variable">;
350 def warn_unused_function : Warning<"unused function %0">,
351   InGroup<UnusedFunction>, DefaultIgnore;
352 def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
353   InGroup<UnusedTemplate>, DefaultIgnore;
354 def warn_unused_member_function : Warning<"unused member function %0">,
355   InGroup<UnusedMemberFunction>, DefaultIgnore;
356 def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
357   InGroup<UsedButMarkedUnused>, DefaultIgnore;
358 def warn_unneeded_internal_decl : Warning<
359   "%select{function|variable}0 %1 is not needed and will not be emitted">,
360   InGroup<UnneededInternalDecl>, DefaultIgnore;
361 def warn_unneeded_static_internal_decl : Warning<
362   "'static' function %0 declared in header file "
363   "should be declared 'static inline'">,
364   InGroup<UnneededInternalDecl>, DefaultIgnore;
365 def warn_unneeded_member_function : Warning<
366   "member function %0 is not needed and will not be emitted">,
367   InGroup<UnneededMemberFunction>, DefaultIgnore;
368 def warn_unused_private_field: Warning<"private field %0 is not used">,
369   InGroup<UnusedPrivateField>, DefaultIgnore;
370 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
371   "%select{used|required to be captured for this use}1">,
372   InGroup<UnusedLambdaCapture>, DefaultIgnore;
373
374 def warn_parameter_size: Warning<
375   "%0 is a large (%1 bytes) pass-by-value argument; "
376   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
377 def warn_return_value_size: Warning<
378   "return value of %0 is a large (%1 bytes) pass-by-value object; "
379   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
380 def warn_return_value_udt: Warning<
381   "%0 has C-linkage specified, but returns user-defined type %1 which is "
382   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
383 def warn_return_value_udt_incomplete: Warning<
384   "%0 has C-linkage specified, but returns incomplete type %1 which could be "
385   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
386 def warn_implicit_function_decl : Warning<
387   "implicit declaration of function %0">,
388   InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
389 def ext_implicit_function_decl : ExtWarn<
390   "implicit declaration of function %0 is invalid in C99">,
391   InGroup<ImplicitFunctionDeclare>;
392 def note_function_suggestion : Note<"did you mean %0?">;
393
394 def err_ellipsis_first_param : Error<
395   "ISO C requires a named parameter before '...'">;
396 def err_declarator_need_ident : Error<"declarator requires an identifier">;
397 def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
398 def err_language_linkage_spec_not_ascii : Error<
399   "string literal in language linkage specifier cannot have an "
400   "encoding-prefix">;
401 def ext_use_out_of_scope_declaration : ExtWarn<
402   "use of out-of-scope declaration of %0%select{| whose type is not "
403   "compatible with that of an implicit declaration}1">,
404   InGroup<DiagGroup<"out-of-scope-function">>;
405 def err_inline_non_function : Error<
406   "'inline' can only appear on functions%select{| and non-local variables}0">;
407 def err_noreturn_non_function : Error<
408   "'_Noreturn' can only appear on functions">;
409 def warn_qual_return_type : Warning<
410   "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
411   InGroup<IgnoredQualifiers>, DefaultIgnore;
412 def warn_deprecated_redundant_constexpr_static_def : Warning<
413   "out-of-line definition of constexpr static data member is redundant "
414   "in C++17 and is deprecated">,
415   InGroup<Deprecated>, DefaultIgnore;
416
417 def warn_decl_shadow :
418   Warning<"declaration shadows a %select{"
419           "local variable|"
420           "variable in %2|"
421           "static data member of %2|"
422           "field of %2|"
423           "typedef in %2|"
424           "type alias in %2}1">,
425   InGroup<Shadow>, DefaultIgnore;
426 def warn_decl_shadow_uncaptured_local :
427   Warning<warn_decl_shadow.Text>,
428   InGroup<ShadowUncapturedLocal>, DefaultIgnore;
429 def warn_ctor_parm_shadows_field:
430   Warning<"constructor parameter %0 shadows the field %1 of %2">,
431   InGroup<ShadowFieldInConstructor>, DefaultIgnore;
432 def warn_modifying_shadowing_decl :
433   Warning<"modifying constructor parameter %0 that shadows a "
434           "field of %1">,
435   InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
436
437 // C++ decomposition declarations
438 def err_decomp_decl_context : Error<
439   "decomposition declaration not permitted in this context">;
440 def warn_cxx14_compat_decomp_decl : Warning<
441   "decomposition declarations are incompatible with "
442   "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
443 def ext_decomp_decl : ExtWarn<
444   "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
445 def ext_decomp_decl_cond : ExtWarn<
446   "ISO C++17 does not permit structured binding declaration in a condition">,
447   InGroup<DiagGroup<"binding-in-condition">>;
448 def err_decomp_decl_spec : Error<
449   "decomposition declaration cannot be declared "
450   "%plural{1:'%1'|:with '%1' specifiers}0">;
451 def ext_decomp_decl_spec : ExtWarn<
452   "decomposition declaration declared "
453   "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
454   InGroup<CXX20>;
455 def warn_cxx17_compat_decomp_decl_spec : Warning<
456   "decomposition declaration declared "
457   "%plural{1:'%1'|:with '%1' specifiers}0 "
458   "is incompatible with C++ standards before C++20">,
459   InGroup<CXXPre20Compat>, DefaultIgnore;
460 def err_decomp_decl_type : Error<
461   "decomposition declaration cannot be declared with type %0; "
462   "declared type must be 'auto' or reference to 'auto'">;
463 def err_decomp_decl_parens : Error<
464   "decomposition declaration cannot be declared with parentheses">;
465 def err_decomp_decl_template : Error<
466   "decomposition declaration template not supported">;
467 def err_decomp_decl_not_alone : Error<
468   "decomposition declaration must be the only declaration in its group">;
469 def err_decomp_decl_requires_init : Error<
470   "decomposition declaration %0 requires an initializer">;
471 def err_decomp_decl_wrong_number_bindings : Error<
472   "type %0 decomposes into %2 elements, but %select{only |}3%1 "
473   "names were provided">;
474 def err_decomp_decl_unbindable_type : Error<
475   "cannot decompose %select{union|non-class, non-array}1 type %2">;
476 def err_decomp_decl_multiple_bases_with_members : Error<
477   "cannot decompose class type %1: "
478   "%select{its base classes %2 and|both it and its base class}0 %3 "
479   "have non-static data members">;
480 def err_decomp_decl_ambiguous_base : Error<
481   "cannot decompose members of ambiguous base class %1 of %0:%2">;
482 def err_decomp_decl_inaccessible_base : Error<
483   "cannot decompose members of inaccessible base class %1 of %0">,
484   AccessControl;
485 def err_decomp_decl_inaccessible_field : Error<
486   "cannot decompose %select{private|protected}0 member %1 of %3">,
487   AccessControl;
488 def err_decomp_decl_anon_union_member : Error<
489   "cannot decompose class type %0 because it has an anonymous "
490   "%select{struct|union}1 member">;
491 def err_decomp_decl_std_tuple_element_not_specialized : Error<
492   "cannot decompose this type; 'std::tuple_element<%0>::type' "
493   "does not name a type">;
494 def err_decomp_decl_std_tuple_size_not_constant : Error<
495   "cannot decompose this type; 'std::tuple_size<%0>::value' "
496   "is not a valid integral constant expression">;
497 def note_in_binding_decl_init : Note<
498   "in implicit initialization of binding declaration %0">;
499
500 def err_std_type_trait_not_class_template : Error<
501   "unsupported standard library implementation: "
502   "'std::%0' is not a class template">;
503
504 // C++ using declarations
505 def err_using_requires_qualname : Error<
506   "using declaration requires a qualified name">;
507 def err_using_typename_non_type : Error<
508   "'typename' keyword used on a non-type">;
509 def err_using_dependent_value_is_type : Error<
510   "dependent using declaration resolved to type without 'typename'">;
511 def err_using_decl_nested_name_specifier_is_not_class : Error<
512   "using declaration in class refers into '%0', which is not a class">;
513 def err_using_decl_nested_name_specifier_is_current_class : Error<
514   "using declaration refers to its own class">;
515 def err_using_decl_nested_name_specifier_is_not_base_class : Error<
516   "using declaration refers into '%0', which is not a base class of %1">;
517 def err_using_decl_constructor_not_in_direct_base : Error<
518   "%0 is not a direct base of %1, cannot inherit constructors">;
519 def err_using_decl_can_not_refer_to_class_member : Error<
520   "using declaration cannot refer to class member">;
521 def err_ambiguous_inherited_constructor : Error<
522   "constructor of %0 inherited from multiple base class subobjects">;
523 def note_ambiguous_inherited_constructor_using : Note<
524   "inherited from base class %0 here">;
525 def note_using_decl_class_member_workaround : Note<
526   "use %select{an alias declaration|a typedef declaration|a reference|"
527   "a const variable|a constexpr variable}0 instead">;
528 def err_using_decl_can_not_refer_to_namespace : Error<
529   "using declaration cannot refer to a namespace">;
530 def err_using_decl_can_not_refer_to_scoped_enum : Error<
531   "using declaration cannot refer to a scoped enumerator">;
532 def err_using_decl_constructor : Error<
533   "using declaration cannot refer to a constructor">;
534 def warn_cxx98_compat_using_decl_constructor : Warning<
535   "inheriting constructors are incompatible with C++98">,
536   InGroup<CXX98Compat>, DefaultIgnore;
537 def err_using_decl_destructor : Error<
538   "using declaration cannot refer to a destructor">;
539 def err_using_decl_template_id : Error<
540   "using declaration cannot refer to a template specialization">;
541 def note_using_decl_target : Note<"target of using declaration">;
542 def note_using_decl_conflict : Note<"conflicting declaration">;
543 def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
544 def err_using_decl_conflict : Error<
545   "target of using declaration conflicts with declaration already in scope">;
546 def err_using_decl_conflict_reverse : Error<
547   "declaration conflicts with target of using declaration already in scope">;
548 def note_using_decl : Note<"%select{|previous }0using declaration">;
549 def err_using_decl_redeclaration_expansion : Error<
550   "using declaration pack expansion at block scope produces multiple values">;
551
552 def warn_access_decl_deprecated : Warning<
553   "access declarations are deprecated; use using declarations instead">,
554   InGroup<Deprecated>;
555 def err_access_decl : Error<
556   "ISO C++11 does not allow access declarations; "
557   "use using declarations instead">;
558 def warn_deprecated_copy_operation : Warning<
559   "definition of implicit copy %select{constructor|assignment operator}1 "
560   "for %0 is deprecated because it has a user-declared copy "
561   "%select{assignment operator|constructor}1">,
562   InGroup<DeprecatedCopy>, DefaultIgnore;
563 def warn_deprecated_copy_dtor_operation : Warning<
564   "definition of implicit copy %select{constructor|assignment operator}1 "
565   "for %0 is deprecated because it has a user-declared destructor">,
566   InGroup<DeprecatedCopyDtor>, DefaultIgnore;
567 def warn_cxx17_compat_exception_spec_in_signature : Warning<
568   "mangled name of %0 will change in C++17 due to non-throwing exception "
569   "specification in function signature">, InGroup<CXX17CompatMangling>;
570
571 def warn_global_constructor : Warning<
572   "declaration requires a global constructor">,
573   InGroup<GlobalConstructors>, DefaultIgnore;
574 def warn_global_destructor : Warning<
575   "declaration requires a global destructor">,
576    InGroup<GlobalConstructors>, DefaultIgnore;
577 def warn_exit_time_destructor : Warning<
578   "declaration requires an exit-time destructor">,
579   InGroup<ExitTimeDestructors>, DefaultIgnore;
580
581 def err_invalid_thread : Error<
582   "'%0' is only allowed on variable declarations">;
583 def err_thread_non_global : Error<
584   "'%0' variables must have global storage">;
585 def err_thread_unsupported : Error<
586   "thread-local storage is not supported for the current target">;
587
588 // FIXME: Combine fallout warnings to just one warning.
589 def warn_maybe_falloff_nonvoid_function : Warning<
590   "non-void function does not return a value in all control paths">,
591   InGroup<ReturnType>;
592 def warn_falloff_nonvoid_function : Warning<
593   "non-void function does not return a value">,
594   InGroup<ReturnType>;
595 def err_maybe_falloff_nonvoid_block : Error<
596   "non-void block does not return a value in all control paths">;
597 def err_falloff_nonvoid_block : Error<
598   "non-void block does not return a value">;
599 def warn_maybe_falloff_nonvoid_coroutine : Warning<
600   "non-void coroutine does not return a value in all control paths">,
601   InGroup<ReturnType>;
602 def warn_falloff_nonvoid_coroutine : Warning<
603   "non-void coroutine does not return a value">,
604   InGroup<ReturnType>;
605 def warn_suggest_noreturn_function : Warning<
606   "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
607   InGroup<MissingNoreturn>, DefaultIgnore;
608 def warn_suggest_noreturn_block : Warning<
609   "block could be declared with attribute 'noreturn'">,
610   InGroup<MissingNoreturn>, DefaultIgnore;
611
612 // Unreachable code.
613 def warn_unreachable : Warning<
614   "code will never be executed">,
615   InGroup<UnreachableCode>, DefaultIgnore;
616 def warn_unreachable_break : Warning<
617   "'break' will never be executed">,
618   InGroup<UnreachableCodeBreak>, DefaultIgnore;
619 def warn_unreachable_return : Warning<
620   "'return' will never be executed">,
621   InGroup<UnreachableCodeReturn>, DefaultIgnore;
622 def warn_unreachable_loop_increment : Warning<
623   "loop will run at most once (loop increment never executed)">,
624   InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
625 def note_unreachable_silence : Note<
626   "silence by adding parentheses to mark code as explicitly dead">;
627
628 /// Built-in functions.
629 def ext_implicit_lib_function_decl : ExtWarn<
630   "implicitly declaring library function '%0' with type %1">,
631   InGroup<ImplicitFunctionDeclare>;
632 def note_include_header_or_declare : Note<
633   "include the header <%0> or explicitly provide a declaration for '%1'">;
634 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
635 def warn_implicit_decl_no_jmp_buf
636     : Warning<"declaration of built-in function '%0' requires the declaration"
637     " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
638       InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
639 def warn_implicit_decl_requires_sysheader : Warning<
640   "declaration of built-in function '%1' requires inclusion of the header <%0>">,
641   InGroup<BuiltinRequiresHeader>;
642 def warn_redecl_library_builtin : Warning<
643   "incompatible redeclaration of library function %0">,
644   InGroup<DiagGroup<"incompatible-library-redeclaration">>;
645 def err_builtin_definition : Error<"definition of builtin function %0">;
646 def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
647 def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
648 def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
649   "%select{GCP|CDE}1">;
650 def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
651 def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
652 def err_invalid_cpu_specific_dispatch_value : Error<
653 "invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
654 def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
655   InGroup<ImplicitFunctionDeclare>, DefaultError;
656 def warn_cstruct_memaccess : Warning<
657   "%select{destination for|source of|first operand of|second operand of}0 this "
658   "%1 call is a pointer to record %2 that is not trivial to "
659   "%select{primitive-default-initialize|primitive-copy}3">,
660   InGroup<NonTrivialMemaccess>;
661 def note_nontrivial_field : Note<
662   "field is non-trivial to %select{copy|default-initialize}0">;
663 def err_non_trivial_c_union_in_invalid_context : Error<
664   "cannot %select{"
665   "use type %1 for a function/method parameter|"
666   "use type %1 for function/method return|"
667   "default-initialize an object of type %1|"
668   "declare an automatic variable of type %1|"
669   "copy-initialize an object of type %1|"
670   "assign to a variable of type %1|"
671   "construct an automatic compound literal of type %1|"
672   "capture a variable of type %1|"
673   "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
674   "}3 "
675   "since it %select{contains|is}2 a union that is non-trivial to "
676   "%select{default-initialize|destruct|copy}0">;
677 def note_non_trivial_c_union : Note<
678   "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
679   "non-trivial to %select{default-initialize|destruct|copy}1">;
680 def warn_dyn_class_memaccess : Warning<
681   "%select{destination for|source of|first operand of|second operand of}0 this "
682   "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
683   "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
684   InGroup<DynamicClassMemaccess>;
685 def note_bad_memaccess_silence : Note<
686   "explicitly cast the pointer to silence this warning">;
687 def warn_sizeof_pointer_expr_memaccess : Warning<
688   "'%0' call operates on objects of type %1 while the size is based on a "
689   "different type %2">,
690   InGroup<SizeofPointerMemaccess>;
691 def warn_sizeof_pointer_expr_memaccess_note : Note<
692   "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
693   "it by the number of elements)|remove the addressof in the argument to "
694   "'sizeof' (and multiply it by the number of elements)|provide an explicit "
695   "length}0?">;
696 def warn_sizeof_pointer_type_memaccess : Warning<
697   "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
698   "%select{destination|source}2; expected %3 or an explicit length">,
699   InGroup<SizeofPointerMemaccess>;
700 def warn_strlcpycat_wrong_size : Warning<
701   "size argument in %0 call appears to be size of the source; "
702   "expected the size of the destination">,
703   InGroup<DiagGroup<"strlcpy-strlcat-size">>;
704 def note_strlcpycat_wrong_size : Note<
705   "change size argument to be the size of the destination">;
706 def warn_memsize_comparison : Warning<
707   "size argument in %0 call is a comparison">,
708   InGroup<DiagGroup<"memsize-comparison">>;
709 def note_memsize_comparison_paren : Note<
710   "did you mean to compare the result of %0 instead?">;
711 def note_memsize_comparison_cast_silence : Note<
712   "explicitly cast the argument to size_t to silence this warning">;
713 def warn_suspicious_sizeof_memset : Warning<
714   "%select{'size' argument to memset is '0'|"
715   "setting buffer to a 'sizeof' expression}0"
716   "; did you mean to transpose the last two arguments?">,
717   InGroup<MemsetTransposedArgs>;
718 def note_suspicious_sizeof_memset_silence : Note<
719   "%select{parenthesize the third argument|"
720   "cast the second argument to 'int'}0 to silence">;
721 def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
722   InGroup<SuspiciousBzero>;
723 def note_suspicious_bzero_size_silence : Note<
724   "parenthesize the second argument to silence">;
725
726 def warn_strncat_large_size : Warning<
727   "the value of the size argument in 'strncat' is too large, might lead to a "
728   "buffer overflow">, InGroup<StrncatSize>;
729 def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
730   "to be size of the source">, InGroup<StrncatSize>;
731 def warn_strncat_wrong_size : Warning<
732   "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
733 def note_strncat_wrong_size : Note<
734   "change the argument to be the free space in the destination buffer minus "
735   "the terminating null byte">;
736
737 def warn_assume_side_effects : Warning<
738   "the argument to %0 has side effects that will be discarded">,
739   InGroup<DiagGroup<"assume">>;
740
741 def warn_builtin_chk_overflow : Warning<
742   "'%0' will always overflow; destination buffer has size %1,"
743   " but size argument is %2">,
744   InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
745
746 def warn_fortify_source_overflow
747   : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
748 def warn_fortify_source_size_mismatch : Warning<
749   "'%0' size argument is too large; destination buffer has size %1,"
750   " but size argument is %2">, InGroup<FortifySource>;
751
752 def warn_fortify_source_format_overflow : Warning<
753   "'%0' will always overflow; destination buffer has size %1,"
754   " but format string expands to at least %2">,
755   InGroup<FortifySource>;
756
757
758 /// main()
759 // static main() is not an error in C, just in C++.
760 def warn_static_main : Warning<"'main' should not be declared static">,
761     InGroup<Main>;
762 def err_static_main : Error<"'main' is not allowed to be declared static">;
763 def err_inline_main : Error<"'main' is not allowed to be declared inline">;
764 def ext_variadic_main : ExtWarn<
765   "'main' is not allowed to be declared variadic">, InGroup<Main>;
766 def ext_noreturn_main : ExtWarn<
767   "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
768 def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
769 def err_constexpr_main : Error<
770   "'main' is not allowed to be declared %select{constexpr|consteval}0">;
771 def err_deleted_main : Error<"'main' is not allowed to be deleted">;
772 def err_mainlike_template_decl : Error<"%0 cannot be a template">;
773 def err_main_returns_nonint : Error<"'main' must return 'int'">;
774 def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
775     InGroup<MainReturnType>;
776 def note_main_change_return_type : Note<"change return type to 'int'">;
777 def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
778     "must be 0, 2, or 3">;
779 def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
780     InGroup<Main>;
781 def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
782     "parameter of 'main' (%select{argument count|argument array|environment|"
783     "platform-specific data}0) must be of type %1">;
784 def warn_main_returns_bool_literal : Warning<"bool literal returned from "
785     "'main'">, InGroup<Main>;
786 def err_main_global_variable :
787     Error<"main cannot be declared as global variable">;
788 def warn_main_redefined : Warning<"variable named 'main' with external linkage "
789     "has undefined behavior">, InGroup<Main>;
790 def ext_main_used : Extension<
791   "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
792
793 /// parser diagnostics
794 def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
795   InGroup<MissingDeclarations>;
796 def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
797   InGroup<MissingDeclarations>;
798 def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
799
800 def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
801   "anonymous non-C-compatible type given name for linkage purposes "
802   "by %select{typedef|alias}0 declaration; "
803   "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
804 def err_non_c_like_anon_struct_in_typedef : Error<
805   "anonymous non-C-compatible type given name for linkage purposes "
806   "by %select{typedef|alias}0 declaration after its linkage was computed; "
807   "add a tag name here to establish linkage prior to definition">;
808 def err_typedef_changes_linkage : Error<
809   "unsupported: anonymous type given name for linkage purposes "
810   "by %select{typedef|alias}0 declaration after its linkage was computed; "
811   "add a tag name here to establish linkage prior to definition">;
812 def note_non_c_like_anon_struct : Note<
813   "type is not C-compatible due to this "
814   "%select{base class|default member initializer|lambda expression|"
815   "friend declaration|member declaration}0">;
816 def note_typedef_for_linkage_here : Note<
817   "type is given name %0 for linkage purposes by this "
818   "%select{typedef|alias}1 declaration">;
819
820 def err_statically_allocated_object : Error<
821   "interface type cannot be statically allocated">;
822 def err_object_cannot_be_passed_returned_by_value : Error<
823   "interface type %1 cannot be %select{returned|passed}0 by value"
824   "; did you forget * in %1?">;
825 def err_parameters_retval_cannot_have_fp16_type : Error<
826   "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
827 def err_opencl_half_load_store : Error<
828   "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
829   "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
830 def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
831 def err_opencl_half_declaration : Error<
832   "declaring variable of type %0 is not allowed">;
833 def err_opencl_invalid_param : Error<
834   "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
835 def err_opencl_invalid_return : Error<
836   "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
837 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
838 def warn_pragma_options_align_reset_failed : Warning<
839   "#pragma options align=reset failed: %0">,
840   InGroup<IgnoredPragmas>;
841 def err_pragma_options_align_mac68k_target_unsupported : Error<
842   "mac68k alignment pragma is not supported on this target">;
843 def warn_pragma_pack_invalid_alignment : Warning<
844   "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
845   InGroup<IgnoredPragmas>;
846 def warn_pragma_pack_non_default_at_include : Warning<
847   "non-default #pragma pack value changes the alignment of struct or union "
848   "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
849   DefaultIgnore;
850 def warn_pragma_pack_modified_after_include : Warning<
851   "the current #pragma pack alignment value is modified in the included "
852   "file">, InGroup<PragmaPack>;
853 def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
854   "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
855 def note_pragma_pack_here : Note<
856   "previous '#pragma pack' directive that modifies alignment is here">;
857 def note_pragma_pack_pop_instead_reset : Note<
858   "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
859 // Follow the Microsoft implementation.
860 def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
861 def warn_pragma_pack_pop_identifier_and_alignment : Warning<
862   "specifying both a name and alignment to 'pop' is undefined">;
863 def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
864   InGroup<IgnoredPragmas>;
865 def err_pragma_fc_pp_scope : Error<
866   "'#pragma float_control push/pop' can only appear at file scope or namespace scope">;
867 def err_pragma_fc_noprecise_requires_nofenv : Error<
868   "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
869 def err_pragma_fc_except_requires_precise : Error<
870   "'#pragma float_control(except, on)' is illegal when precise is disabled">;
871 def err_pragma_fc_noprecise_requires_noexcept : Error<
872   "'#pragma float_control(precise, off)' is illegal when except is enabled">;
873 def err_pragma_fenv_requires_precise : Error<
874   "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
875 def warn_cxx_ms_struct :
876   Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
877           "with base classes or virtual functions">,
878   DefaultError, InGroup<IncompatibleMSStruct>;
879 def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
880 def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
881 def err_invalid_super_scope : Error<"invalid use of '__super', "
882   "this keyword can only be used inside class or member function scope">;
883 def err_super_in_lambda_unsupported : Error<
884   "use of '__super' inside a lambda is unsupported">;
885
886 def warn_pragma_unused_undeclared_var : Warning<
887   "undeclared variable %0 used as an argument for '#pragma unused'">,
888   InGroup<IgnoredPragmas>;
889 def warn_atl_uuid_deprecated : Warning<
890   "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
891   InGroup<DeprecatedDeclarations>;
892 def warn_pragma_unused_expected_var_arg : Warning<
893   "only variables can be arguments to '#pragma unused'">,
894   InGroup<IgnoredPragmas>;
895 def err_pragma_push_visibility_mismatch : Error<
896   "#pragma visibility push with no matching #pragma visibility pop">;
897 def note_surrounding_namespace_ends_here : Note<
898   "surrounding namespace with visibility attribute ends here">;
899 def err_pragma_pop_visibility_mismatch : Error<
900   "#pragma visibility pop with no matching #pragma visibility push">;
901 def note_surrounding_namespace_starts_here : Note<
902   "surrounding namespace with visibility attribute starts here">;
903 def err_pragma_loop_invalid_argument_type : Error<
904   "invalid argument of type %0; expected an integer type">;
905 def err_pragma_loop_invalid_argument_value : Error<
906   "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
907 def err_pragma_loop_compatibility : Error<
908   "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
909 def err_pragma_loop_precedes_nonloop : Error<
910   "expected a for, while, or do-while loop to follow '%0'">;
911
912 def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
913   "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
914   "those declarations">;
915 def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
916   "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
917 def err_pragma_attribute_invalid_matchers : Error<
918   "attribute %0 can't be applied to %1">;
919 def err_pragma_attribute_stack_mismatch : Error<
920   "'#pragma clang attribute %select{%1.|}0pop' with no matching"
921   " '#pragma clang attribute %select{%1.|}0push'">;
922 def warn_pragma_attribute_unused : Warning<
923   "unused attribute %0 in '#pragma clang attribute push' region">,
924   InGroup<PragmaClangAttribute>;
925 def note_pragma_attribute_region_ends_here : Note<
926   "'#pragma clang attribute push' regions ends here">;
927 def err_pragma_attribute_no_pop_eof : Error<"unterminated "
928   "'#pragma clang attribute push' at end of file">;
929 def note_pragma_attribute_applied_decl_here : Note<
930   "when applied to this declaration">;
931 def err_pragma_attr_attr_no_push : Error<
932   "'#pragma clang attribute' attribute with no matching "
933   "'#pragma clang attribute push'">;
934
935 /// Objective-C parser diagnostics
936 def err_duplicate_class_def : Error<
937   "duplicate interface definition for class %0">;
938 def err_undef_superclass : Error<
939   "cannot find interface declaration for %0, superclass of %1">;
940 def err_forward_superclass : Error<
941   "attempting to use the forward class %0 as superclass of %1">;
942 def err_no_nsconstant_string_class : Error<
943   "cannot find interface declaration for %0">;
944 def err_recursive_superclass : Error<
945   "trying to recursively use %0 as superclass of %1">;
946 def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
947 def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
948 def warn_duplicate_protocol_def : Warning<
949   "duplicate protocol definition of %0 is ignored">,
950   InGroup<DiagGroup<"duplicate-protocol">>;
951 def err_protocol_has_circular_dependency : Error<
952   "protocol has circular dependency">;
953 def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
954 def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
955 def err_atprotocol_protocol : Error<
956   "@protocol is using a forward protocol declaration of %0">;
957 def warn_readonly_property : Warning<
958   "attribute 'readonly' of property %0 restricts attribute "
959   "'readwrite' of property inherited from %1">,
960   InGroup<PropertyAttr>;
961
962 def warn_property_attribute : Warning<
963   "'%1' attribute on property %0 does not match the property inherited from %2">,
964   InGroup<PropertyAttr>;
965 def warn_property_types_are_incompatible : Warning<
966   "property type %0 is incompatible with type %1 inherited from %2">,
967   InGroup<DiagGroup<"incompatible-property-type">>;
968 def warn_protocol_property_mismatch : Warning<
969   "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
970   "getter %1|with setter %1}0 was selected for synthesis">,
971   InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
972 def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
973 def err_undef_interface : Error<"cannot find interface declaration for %0">;
974 def err_category_forward_interface : Error<
975   "cannot define %select{category|class extension}0 for undefined class %1">;
976 def err_class_extension_after_impl : Error<
977   "cannot declare class extension for %0 after class implementation">;
978 def note_implementation_declared : Note<
979   "class implementation is declared here">;
980 def note_while_in_implementation : Note<
981   "detected while default synthesizing properties in class implementation">;
982 def note_class_declared : Note<
983   "class is declared here">;
984 def note_receiver_class_declared : Note<
985   "receiver is instance of class declared here">;
986 def note_receiver_expr_here : Note<
987   "receiver expression is here">;
988 def note_receiver_is_id : Note<
989   "receiver is treated with 'id' type for purpose of method lookup">;
990 def note_suppressed_class_declare : Note<
991   "class with specified objc_requires_property_definitions attribute is declared here">;
992 def err_objc_root_class_subclass : Error<
993   "objc_root_class attribute may only be specified on a root class declaration">;
994 def err_restricted_superclass_mismatch : Error<
995   "cannot subclass a class that was declared with the "
996   "'objc_subclassing_restricted' attribute">;
997 def err_class_stub_subclassing_mismatch : Error<
998   "'objc_class_stub' attribute cannot be specified on a class that does not "
999   "have the 'objc_subclassing_restricted' attribute">;
1000 def err_implementation_of_class_stub : Error<
1001   "cannot declare implementation of a class declared with the "
1002   "'objc_class_stub' attribute">;
1003 def warn_objc_root_class_missing : Warning<
1004   "class %0 defined without specifying a base class">,
1005   InGroup<ObjCRootClass>;
1006 def err_objc_runtime_visible_category : Error<
1007   "cannot implement a category for class %0 that is only visible via the "
1008   "Objective-C runtime">;
1009 def err_objc_runtime_visible_subclass : Error<
1010   "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1011   "Objective-C runtime">;
1012 def note_objc_needs_superclass : Note<
1013   "add a super class to fix this problem">;
1014 def err_conflicting_super_class : Error<"conflicting super class name %0">;
1015 def err_dup_implementation_class : Error<"reimplementation of class %0">;
1016 def err_dup_implementation_category : Error<
1017   "reimplementation of category %1 for class %0">;
1018 def err_conflicting_ivar_type : Error<
1019   "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1020 def err_duplicate_ivar_declaration : Error<
1021   "instance variable is already declared">;
1022 def warn_on_superclass_use : Warning<
1023   "class implementation may not have super class">;
1024 def err_conflicting_ivar_bitwidth : Error<
1025   "instance variable %0 has conflicting bit-field width">;
1026 def err_conflicting_ivar_name : Error<
1027   "conflicting instance variable names: %0 vs %1">;
1028 def err_inconsistent_ivar_count : Error<
1029   "inconsistent number of instance variables specified">;
1030 def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1031   InGroup<DiagGroup<"incomplete-implementation">>;
1032 def warn_objc_boxing_invalid_utf8_string : Warning<
1033   "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1034   InGroup<ObjCBoxing>;
1035
1036 def err_objc_direct_on_protocol : Error<
1037   "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1038   "declared in an Objective-C protocol">;
1039 def err_objc_direct_duplicate_decl : Error<
1040   "%select{|direct }0%select{method|property}1 declaration conflicts "
1041   "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1042 def err_objc_direct_impl_decl_mismatch : Error<
1043   "direct method was declared in %select{the primary interface|an extension|a category}0 "
1044   "but is implemented in %select{the primary interface|a category|a different category}1">;
1045 def err_objc_direct_missing_on_decl : Error<
1046   "direct method implementation was previously declared not direct">;
1047 def err_objc_direct_on_override : Error<
1048   "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1049 def err_objc_override_direct_method : Error<
1050   "cannot override a method that is declared direct by a superclass">;
1051 def warn_objc_direct_ignored : Warning<
1052   "%0 attribute isn't implemented by this Objective-C runtime">,
1053   InGroup<IgnoredAttributes>;
1054 def warn_objc_direct_property_ignored : Warning<
1055   "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1056   InGroup<IgnoredAttributes>;
1057 def err_objc_direct_dynamic_property : Error<
1058   "direct property cannot be @dynamic">;
1059
1060 def warn_conflicting_overriding_ret_types : Warning<
1061   "conflicting return type in "
1062   "declaration of %0%diff{: $ vs $|}1,2">,
1063   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1064
1065 def warn_conflicting_ret_types : Warning<
1066   "conflicting return type in "
1067   "implementation of %0%diff{: $ vs $|}1,2">,
1068   InGroup<MismatchedReturnTypes>;
1069
1070 def warn_conflicting_overriding_ret_type_modifiers : Warning<
1071   "conflicting distributed object modifiers on return type "
1072   "in declaration of %0">,
1073   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1074
1075 def warn_conflicting_ret_type_modifiers : Warning<
1076   "conflicting distributed object modifiers on return type "
1077   "in implementation of %0">,
1078   InGroup<DistributedObjectModifiers>;
1079
1080 def warn_non_covariant_overriding_ret_types : Warning<
1081   "conflicting return type in "
1082   "declaration of %0: %1 vs %2">,
1083   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1084
1085 def warn_non_covariant_ret_types : Warning<
1086   "conflicting return type in "
1087   "implementation of %0: %1 vs %2">,
1088   InGroup<MethodSignatures>, DefaultIgnore;
1089
1090 def warn_conflicting_overriding_param_types : Warning<
1091   "conflicting parameter types in "
1092   "declaration of %0%diff{: $ vs $|}1,2">,
1093   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1094
1095 def warn_conflicting_param_types : Warning<
1096   "conflicting parameter types in "
1097   "implementation of %0%diff{: $ vs $|}1,2">,
1098   InGroup<MismatchedParameterTypes>;
1099
1100 def warn_conflicting_param_modifiers : Warning<
1101   "conflicting distributed object modifiers on parameter type "
1102   "in implementation of %0">,
1103   InGroup<DistributedObjectModifiers>;
1104
1105 def warn_conflicting_overriding_param_modifiers : Warning<
1106   "conflicting distributed object modifiers on parameter type "
1107   "in declaration of %0">,
1108   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1109
1110 def warn_non_contravariant_overriding_param_types : Warning<
1111   "conflicting parameter types in "
1112   "declaration of %0: %1 vs %2">,
1113   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1114
1115 def warn_non_contravariant_param_types : Warning<
1116   "conflicting parameter types in "
1117   "implementation of %0: %1 vs %2">,
1118   InGroup<MethodSignatures>, DefaultIgnore;
1119
1120 def warn_conflicting_overriding_variadic :Warning<
1121   "conflicting variadic declaration of method and its "
1122   "implementation">,
1123   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1124
1125 def warn_conflicting_variadic :Warning<
1126   "conflicting variadic declaration of method and its "
1127   "implementation">;
1128
1129 def warn_category_method_impl_match:Warning<
1130   "category is implementing a method which will also be implemented"
1131   " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1132
1133 def warn_implements_nscopying : Warning<
1134 "default assign attribute on property %0 which implements "
1135 "NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1136
1137 def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1138   InGroup<ObjCMultipleMethodNames>;
1139 def warn_strict_multiple_method_decl : Warning<
1140   "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1141 def warn_accessor_property_type_mismatch : Warning<
1142   "type of property %0 does not match type of accessor %1">;
1143 def note_conv_function_declared_at : Note<"type conversion function declared here">;
1144 def note_method_declared_at : Note<"method %0 declared here">;
1145 def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1146 def note_property_attribute : Note<"property %0 is declared "
1147   "%select{deprecated|unavailable|partial}1 here">;
1148 def err_setter_type_void : Error<"type of setter must be void">;
1149 def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1150 def warn_duplicate_method_decl :
1151   Warning<"multiple declarations of method %0 found and ignored">,
1152   InGroup<MethodDuplicate>, DefaultIgnore;
1153 def warn_objc_cdirective_format_string :
1154   Warning<"using %0 directive in %select{NSString|CFString}1 "
1155           "which is being passed as a formatting argument to the formatting "
1156           "%select{method|CFfunction}2">,
1157   InGroup<ObjCCStringFormat>, DefaultIgnore;
1158 def err_objc_var_decl_inclass :
1159     Error<"cannot declare variable inside @interface or @protocol">;
1160 def err_missing_method_context : Error<
1161   "missing context for method declaration">;
1162 def err_objc_property_attr_mutually_exclusive : Error<
1163   "property attributes '%0' and '%1' are mutually exclusive">;
1164 def err_objc_property_requires_object : Error<
1165   "property with '%0' attribute must be of object type">;
1166 def warn_objc_property_assign_on_object : Warning<
1167   "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1168   InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1169 def warn_objc_property_no_assignment_attribute : Warning<
1170   "no 'assign', 'retain', or 'copy' attribute is specified - "
1171   "'assign' is assumed">,
1172   InGroup<ObjCPropertyNoAttribute>;
1173 def warn_objc_isa_use : Warning<
1174   "direct access to Objective-C's isa is deprecated in favor of "
1175   "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1176 def warn_objc_isa_assign : Warning<
1177   "assignment to Objective-C's isa is deprecated in favor of "
1178   "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1179 def warn_objc_pointer_masking : Warning<
1180   "bitmasking for introspection of Objective-C object pointers is strongly "
1181   "discouraged">,
1182   InGroup<ObjCPointerIntrospect>;
1183 def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1184   InGroup<ObjCPointerIntrospectPerformSelector>;
1185 def warn_objc_property_default_assign_on_object : Warning<
1186   "default property attribute 'assign' not appropriate for object">,
1187   InGroup<ObjCPropertyNoAttribute>;
1188 def warn_property_attr_mismatch : Warning<
1189   "property attribute in class extension does not match the primary class">,
1190   InGroup<PropertyAttr>;
1191 def warn_property_implicitly_mismatched : Warning <
1192   "primary property declaration is implicitly strong while redeclaration "
1193   "in class extension is weak">,
1194   InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1195 def warn_objc_property_copy_missing_on_block : Warning<
1196     "'copy' attribute must be specified for the block property "
1197     "when -fobjc-gc-only is specified">;
1198 def warn_objc_property_retain_of_block : Warning<
1199     "retain'ed block property does not copy the block "
1200     "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1201 def warn_objc_readonly_property_has_setter : Warning<
1202     "setter cannot be specified for a readonly property">,
1203     InGroup<ObjCReadonlyPropertyHasSetter>;
1204 def warn_atomic_property_rule : Warning<
1205   "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1206   "with a user defined %select{getter|setter}2">,
1207   InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1208 def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1209   "synthesized, or both be user defined,or the property must be nonatomic">;
1210 def err_atomic_property_nontrivial_assign_op : Error<
1211   "atomic property of reference type %0 cannot have non-trivial assignment"
1212   " operator">;
1213 def warn_cocoa_naming_owned_rule : Warning<
1214   "property follows Cocoa naming"
1215   " convention for returning 'owned' objects">,
1216   InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1217 def err_cocoa_naming_owned_rule : Error<
1218   "property follows Cocoa naming"
1219   " convention for returning 'owned' objects">;
1220 def note_cocoa_naming_declare_family : Note<
1221   "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1222   "object">;
1223 def warn_auto_synthesizing_protocol_property :Warning<
1224   "auto property synthesis will not synthesize property %0"
1225   " declared in protocol %1">,
1226   InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1227 def note_add_synthesize_directive : Note<
1228   "add a '@synthesize' directive">;
1229 def warn_no_autosynthesis_shared_ivar_property : Warning <
1230   "auto property synthesis will not synthesize property "
1231   "%0 because it cannot share an ivar with another synthesized property">,
1232   InGroup<ObjCNoPropertyAutoSynthesis>;
1233 def warn_no_autosynthesis_property : Warning<
1234   "auto property synthesis will not synthesize property "
1235   "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1236   "via another property">,
1237   InGroup<ObjCNoPropertyAutoSynthesis>;
1238 def warn_autosynthesis_property_in_superclass : Warning<
1239   "auto property synthesis will not synthesize property "
1240   "%0; it will be implemented by its superclass, use @dynamic to "
1241   "acknowledge intention">,
1242   InGroup<ObjCNoPropertyAutoSynthesis>;
1243 def warn_autosynthesis_property_ivar_match :Warning<
1244   "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1245   "%2, not existing instance variable %3">,
1246   InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1247 def warn_missing_explicit_synthesis : Warning <
1248   "auto property synthesis is synthesizing property not explicitly synthesized">,
1249   InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1250 def warn_property_getter_owning_mismatch : Warning<
1251   "property declared as returning non-retained objects"
1252   "; getter returning retained objects">;
1253 def warn_property_redecl_getter_mismatch : Warning<
1254   "getter name mismatch between property redeclaration (%1) and its original "
1255   "declaration (%0)">, InGroup<PropertyAttr>;
1256 def err_property_setter_ambiguous_use : Error<
1257   "synthesized properties %0 and %1 both claim setter %2 -"
1258   " use of this setter will cause unexpected behavior">;
1259 def warn_default_atomic_custom_getter_setter : Warning<
1260   "atomic by default property %0 has a user defined %select{getter|setter}1 "
1261   "(property should be marked 'atomic' if this is intended)">,
1262   InGroup<CustomAtomic>, DefaultIgnore;
1263 def err_use_continuation_class : Error<
1264   "illegal redeclaration of property in class extension %0"
1265   " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1266 def err_type_mismatch_continuation_class : Error<
1267   "type of property %0 in class extension does not match "
1268   "property type in primary class">;
1269 def err_use_continuation_class_redeclaration_readwrite : Error<
1270   "illegal redeclaration of 'readwrite' property in class extension %0"
1271   " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1272   "'readonly' public property?)">;
1273 def err_continuation_class : Error<"class extension has no primary class">;
1274 def err_property_type : Error<"property cannot have array or function type %0">;
1275 def err_missing_property_context : Error<
1276   "missing context for property implementation declaration">;
1277 def err_bad_property_decl : Error<
1278   "property implementation must have its declaration in interface %0 or one of "
1279   "its extensions">;
1280 def err_category_property : Error<
1281   "property declared in category %0 cannot be implemented in "
1282   "class implementation">;
1283 def note_property_declare : Note<
1284   "property declared here">;
1285 def note_protocol_property_declare : Note<
1286   "it could also be property "
1287   "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1288   "%1|with setter %1}0 declared here">;
1289 def note_property_synthesize : Note<
1290   "property synthesized here">;
1291 def err_synthesize_category_decl : Error<
1292   "@synthesize not allowed in a category's implementation">;
1293 def err_synthesize_on_class_property : Error<
1294   "@synthesize not allowed on a class property %0">;
1295 def err_missing_property_interface : Error<
1296   "property implementation in a category with no category declaration">;
1297 def err_bad_category_property_decl : Error<
1298   "property implementation must have its declaration in the category %0">;
1299 def err_bad_property_context : Error<
1300   "property implementation must be in a class or category implementation">;
1301 def err_missing_property_ivar_decl : Error<
1302   "synthesized property %0 must either be named the same as a compatible"
1303   " instance variable or must explicitly name an instance variable">;
1304 def err_arc_perform_selector_retains : Error<
1305   "performSelector names a selector which retains the object">;
1306 def warn_arc_perform_selector_leaks : Warning<
1307   "performSelector may cause a leak because its selector is unknown">,
1308   InGroup<DiagGroup<"arc-performSelector-leaks">>;
1309 def warn_dealloc_in_category : Warning<
1310 "-dealloc is being overridden in a category">,
1311 InGroup<DeallocInCategory>;
1312 def err_gc_weak_property_strong_type : Error<
1313   "weak attribute declared on a __strong type property in GC mode">;
1314 def warn_arc_repeated_use_of_weak : Warning <
1315   "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1316   "accessed multiple times in this %select{function|method|block|lambda}2 "
1317   "but may be unpredictably set to nil; assign to a strong variable to keep "
1318   "the object alive">,
1319   InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1320 def warn_implicitly_retains_self : Warning <
1321   "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1322   "this is intended behavior">,
1323   InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1324 def warn_arc_possible_repeated_use_of_weak : Warning <
1325   "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1326   "be accessed multiple times in this %select{function|method|block|lambda}2 "
1327   "and may be unpredictably set to nil; assign to a strong variable to keep "
1328   "the object alive">,
1329   InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1330 def note_arc_weak_also_accessed_here : Note<
1331   "also accessed here">;
1332 def err_incomplete_synthesized_property : Error<
1333   "cannot synthesize property %0 with incomplete type %1">;
1334
1335 def err_property_ivar_type : Error<
1336   "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1337 def err_property_accessor_type : Error<
1338   "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1339 def err_ivar_in_superclass_use : Error<
1340   "property %0 attempting to use instance variable %1 declared in super class %2">;
1341 def err_weak_property : Error<
1342   "existing instance variable %1 for __weak property %0 must be __weak">;
1343 def err_strong_property : Error<
1344   "existing instance variable %1 for strong property %0 may not be __weak">;
1345 def err_dynamic_property_ivar_decl : Error<
1346   "dynamic property cannot have instance variable specification">;
1347 def err_duplicate_ivar_use : Error<
1348   "synthesized properties %0 and %1 both claim instance variable %2">;
1349 def err_property_implemented : Error<"property %0 is already implemented">;
1350 def warn_objc_missing_super_call : Warning<
1351   "method possibly missing a [super %0] call">,
1352   InGroup<ObjCMissingSuperCalls>;
1353 def err_dealloc_bad_result_type : Error<
1354   "dealloc return type must be correctly specified as 'void' under ARC, "
1355   "instead of %0">;
1356 def warn_undeclared_selector : Warning<
1357   "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1358 def warn_undeclared_selector_with_typo : Warning<
1359   "undeclared selector %0; did you mean %1?">,
1360   InGroup<UndeclaredSelector>, DefaultIgnore;
1361 def warn_implicit_atomic_property : Warning<
1362   "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1363 def note_auto_readonly_iboutlet_fixup_suggest : Note<
1364   "property should be changed to be readwrite">;
1365 def warn_auto_readonly_iboutlet_property : Warning<
1366   "readonly IBOutlet property %0 when auto-synthesized may "
1367   "not work correctly with 'nib' loader">,
1368   InGroup<DiagGroup<"readonly-iboutlet-property">>;
1369 def warn_auto_implicit_atomic_property : Warning<
1370   "property is assumed atomic when auto-synthesizing the property">,
1371   InGroup<ImplicitAtomic>, DefaultIgnore;
1372 def warn_unimplemented_selector:  Warning<
1373   "no method with selector %0 is implemented in this translation unit">,
1374   InGroup<Selector>, DefaultIgnore;
1375 def warn_unimplemented_protocol_method : Warning<
1376   "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1377 def warn_multiple_selectors: Warning<
1378   "several methods with selector %0 of mismatched types are found "
1379   "for the @selector expression">,
1380   InGroup<SelectorTypeMismatch>, DefaultIgnore;
1381 def err_direct_selector_expression : Error<
1382   "@selector expression formed with direct selector %0">;
1383 def warn_potentially_direct_selector_expression : Warning<
1384   "@selector expression formed with potentially direct selector %0">,
1385   InGroup<ObjCPotentiallyDirectSelector>;
1386 def warn_strict_potentially_direct_selector_expression : Warning<
1387   warn_potentially_direct_selector_expression.Text>,
1388   InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1389
1390 def err_objc_kindof_nonobject : Error<
1391   "'__kindof' specifier cannot be applied to non-object type %0">;
1392 def err_objc_kindof_wrong_position : Error<
1393   "'__kindof' type specifier must precede the declarator">;
1394
1395 def err_objc_method_unsupported_param_ret_type : Error<
1396   "%0 %select{parameter|return}1 type is unsupported; "
1397   "support for vector types for this target is introduced in %2">;
1398
1399 def warn_messaging_unqualified_id : Warning<
1400   "messaging unqualified id">, DefaultIgnore,
1401   InGroup<DiagGroup<"objc-messaging-id">>;
1402 def err_messaging_unqualified_id_with_direct_method : Error<
1403   "messaging unqualified id with a method that is possibly direct">;
1404 def err_messaging_super_with_direct_method : Error<
1405   "messaging super with a direct method">;
1406 def err_messaging_class_with_direct_method : Error<
1407   "messaging a Class with a method that is possibly direct">;
1408
1409 // C++ declarations
1410 def err_static_assert_expression_is_not_constant : Error<
1411   "static_assert expression is not an integral constant expression">;
1412 def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1413 def err_static_assert_requirement_failed : Error<
1414   "static_assert failed due to requirement '%0'%select{ %2|}1">;
1415
1416 def ext_inline_variable : ExtWarn<
1417   "inline variables are a C++17 extension">, InGroup<CXX17>;
1418 def warn_cxx14_compat_inline_variable : Warning<
1419   "inline variables are incompatible with C++ standards before C++17">,
1420   DefaultIgnore, InGroup<CXXPre17Compat>;
1421
1422 def warn_inline_namespace_reopened_noninline : Warning<
1423   "inline namespace reopened as a non-inline namespace">,
1424   InGroup<InlineNamespaceReopenedNoninline>;
1425 def err_inline_namespace_mismatch : Error<
1426   "non-inline namespace cannot be reopened as inline">;
1427
1428 def err_unexpected_friend : Error<
1429   "friends can only be classes or functions">;
1430 def ext_enum_friend : ExtWarn<
1431   "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1432 def warn_cxx98_compat_enum_friend : Warning<
1433   "befriending enumeration type %0 is incompatible with C++98">,
1434   InGroup<CXX98Compat>, DefaultIgnore;
1435 def ext_nonclass_type_friend : ExtWarn<
1436   "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1437 def warn_cxx98_compat_nonclass_type_friend : Warning<
1438   "non-class friend type %0 is incompatible with C++98">,
1439   InGroup<CXX98Compat>, DefaultIgnore;
1440 def err_friend_is_member : Error<
1441   "friends cannot be members of the declaring class">;
1442 def warn_cxx98_compat_friend_is_member : Warning<
1443   "friend declaration naming a member of the declaring class is incompatible "
1444   "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1445 def ext_unelaborated_friend_type : ExtWarn<
1446   "unelaborated friend declaration is a C++11 extension; specify "
1447   "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1448   InGroup<CXX11>;
1449 def warn_cxx98_compat_unelaborated_friend_type : Warning<
1450   "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1451   "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1452 def err_qualified_friend_no_match : Error<
1453   "friend declaration of %0 does not match any declaration in %1">;
1454 def err_introducing_special_friend : Error<
1455   "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1456   " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1457   "as a friend">;
1458 def err_tagless_friend_type_template : Error<
1459   "friend type templates must use an elaborated type">;
1460 def err_no_matching_local_friend : Error<
1461   "no matching function found in local scope">;
1462 def err_no_matching_local_friend_suggest : Error<
1463   "no matching function %0 found in local scope; did you mean %3?">;
1464 def err_partial_specialization_friend : Error<
1465   "partial specialization cannot be declared as a friend">;
1466 def err_qualified_friend_def : Error<
1467   "friend function definition cannot be qualified with '%0'">;
1468 def err_friend_def_in_local_class : Error<
1469   "friend function cannot be defined in a local class">;
1470 def err_friend_not_first_in_declaration : Error<
1471   "'friend' must appear first in a non-function declaration">;
1472 def err_using_decl_friend : Error<
1473   "cannot befriend target of using declaration">;
1474 def warn_template_qualified_friend_unsupported : Warning<
1475   "dependent nested name specifier '%0' for friend class declaration is "
1476   "not supported; turning off access control for %1">,
1477   InGroup<UnsupportedFriend>;
1478 def warn_template_qualified_friend_ignored : Warning<
1479   "dependent nested name specifier '%0' for friend template declaration is "
1480   "not supported; ignoring this friend declaration">,
1481   InGroup<UnsupportedFriend>;
1482 def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1483   "unqualified friend declaration referring to type outside of the nearest "
1484   "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1485   InGroup<MicrosoftUnqualifiedFriend>;
1486 def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1487
1488 def err_invalid_base_in_interface : Error<
1489   "interface type cannot inherit from "
1490   "%select{struct|non-public interface|class}0 %1">;
1491
1492 def err_abstract_type_in_decl : Error<
1493   "%select{return|parameter|variable|field|instance variable|"
1494   "synthesized instance variable}0 type %1 is an abstract class">;
1495 def err_allocation_of_abstract_type : Error<
1496   "allocating an object of abstract class type %0">;
1497 def err_throw_abstract_type : Error<
1498   "cannot throw an object of abstract type %0">;
1499 def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1500 def err_capture_of_abstract_type : Error<
1501   "by-copy capture of value of abstract type %0">;
1502 def err_capture_of_incomplete_or_sizeless_type : Error<
1503   "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1504 def err_capture_default_non_local : Error<
1505   "non-local lambda expression cannot have a capture-default">;
1506
1507 def err_multiple_final_overriders : Error<
1508   "virtual function %q0 has more than one final overrider in %1">;
1509 def note_final_overrider : Note<"final overrider of %q0 in %1">;
1510
1511 def err_type_defined_in_type_specifier : Error<
1512   "%0 cannot be defined in a type specifier">;
1513 def err_type_defined_in_result_type : Error<
1514   "%0 cannot be defined in the result type of a function">;
1515 def err_type_defined_in_param_type : Error<
1516   "%0 cannot be defined in a parameter type">;
1517 def err_type_defined_in_alias_template : Error<
1518   "%0 cannot be defined in a type alias template">;
1519 def err_type_defined_in_condition : Error<
1520   "%0 cannot be defined in a condition">;
1521 def err_type_defined_in_enum : Error<
1522   "%0 cannot be defined in an enumeration">;
1523
1524 def note_pure_virtual_function : Note<
1525   "unimplemented pure virtual method %0 in %1">;
1526
1527 def note_pure_qualified_call_kext : Note<
1528   "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1529
1530 def err_deleted_decl_not_first : Error<
1531   "deleted definition must be first declaration">;
1532
1533 def err_deleted_override : Error<
1534   "deleted function %0 cannot override a non-deleted function">;
1535 def err_non_deleted_override : Error<
1536   "non-deleted function %0 cannot override a deleted function">;
1537 def err_consteval_override : Error<
1538   "consteval function %0 cannot override a non-consteval function">;
1539 def err_non_consteval_override : Error<
1540   "non-consteval function %0 cannot override a consteval function">;
1541
1542 def warn_weak_vtable : Warning<
1543   "%0 has no out-of-line virtual method definitions; its vtable will be "
1544   "emitted in every translation unit">,
1545   InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1546 def warn_weak_template_vtable : Warning<
1547   "explicit template instantiation %0 will emit a vtable in every "
1548   "translation unit">,
1549   InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1550
1551 def ext_using_undefined_std : ExtWarn<
1552   "using directive refers to implicitly-defined namespace 'std'">;
1553
1554 // C++ exception specifications
1555 def err_exception_spec_in_typedef : Error<
1556   "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1557 def err_distant_exception_spec : Error<
1558   "exception specifications are not allowed beyond a single level "
1559   "of indirection">;
1560 def err_incomplete_in_exception_spec : Error<
1561   "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1562   "in exception specification">;
1563 def err_sizeless_in_exception_spec : Error<
1564   "%select{|reference to }0sizeless type %1 is not allowed "
1565   "in exception specification">;
1566 def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1567   InGroup<MicrosoftExceptionSpec>;
1568 def err_rref_in_exception_spec : Error<
1569   "rvalue reference type %0 is not allowed in exception specification">;
1570 def err_mismatched_exception_spec : Error<
1571   "exception specification in declaration does not match previous declaration">;
1572 def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1573   InGroup<MicrosoftExceptionSpec>;
1574 def err_override_exception_spec : Error<
1575   "exception specification of overriding function is more lax than "
1576   "base version">;
1577 def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1578   InGroup<MicrosoftExceptionSpec>;
1579 def err_incompatible_exception_specs : Error<
1580   "target exception specification is not superset of source">;
1581 def warn_incompatible_exception_specs : Warning<
1582   err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1583 def err_deep_exception_specs_differ : Error<
1584   "exception specifications of %select{return|argument}0 types differ">;
1585 def warn_deep_exception_specs_differ : Warning<
1586   err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1587 def err_missing_exception_specification : Error<
1588   "%0 is missing exception specification '%1'">;
1589 def ext_missing_exception_specification : ExtWarn<
1590   err_missing_exception_specification.Text>,
1591   InGroup<DiagGroup<"missing-exception-spec">>;
1592 def ext_ms_missing_exception_specification : ExtWarn<
1593   err_missing_exception_specification.Text>,
1594   InGroup<MicrosoftExceptionSpec>;
1595 def err_noexcept_needs_constant_expression : Error<
1596   "argument to noexcept specifier must be a constant expression">;
1597 def err_exception_spec_not_parsed : Error<
1598   "exception specification is not available until end of class definition">;
1599 def err_exception_spec_cycle : Error<
1600   "exception specification of %0 uses itself">;
1601 def err_exception_spec_incomplete_type : Error<
1602   "exception specification needed for member of incomplete class %0">;
1603 def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1604   "dynamic exception specifications with types are currently ignored in wasm">,
1605   InGroup<WebAssemblyExceptionSpec>;
1606
1607 // C++ access checking
1608 def err_class_redeclared_with_different_access : Error<
1609   "%0 redeclared with '%1' access">;
1610 def err_access : Error<
1611   "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1612 def ext_ms_using_declaration_inaccessible : ExtWarn<
1613   "using declaration referring to inaccessible member '%0' (which refers "
1614   "to accessible member '%1') is a Microsoft compatibility extension">,
1615     AccessControl, InGroup<MicrosoftUsingDecl>;
1616 def err_access_ctor : Error<
1617   "calling a %select{private|protected}0 constructor of class %2">,
1618   AccessControl;
1619 def ext_rvalue_to_reference_access_ctor : Extension<
1620   "C++98 requires an accessible copy constructor for class %2 when binding "
1621   "a reference to a temporary; was %select{private|protected}0">,
1622   AccessControl, InGroup<BindToTemporaryCopy>;
1623 def err_access_base_ctor : Error<
1624   // The ERRORs represent other special members that aren't constructors, in
1625   // hopes that someone will bother noticing and reporting if they appear
1626   "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1627   "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1628   "|*ERROR*|}2constructor">, AccessControl;
1629 def err_access_field_ctor : Error<
1630   // The ERRORs represent other special members that aren't constructors, in
1631   // hopes that someone will bother noticing and reporting if they appear
1632   "field of type %0 has %select{private|protected}2 "
1633   "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1634   AccessControl;
1635 def err_access_friend_function : Error<
1636   "friend function %1 is a %select{private|protected}0 member of %3">,
1637   AccessControl;
1638
1639 def err_access_dtor : Error<
1640   "calling a %select{private|protected}1 destructor of class %0">,
1641   AccessControl;
1642 def err_access_dtor_base :
1643     Error<"base class %0 has %select{private|protected}1 destructor">,
1644     AccessControl;
1645 def err_access_dtor_vbase :
1646     Error<"inherited virtual base class %1 has "
1647     "%select{private|protected}2 destructor">,
1648     AccessControl;
1649 def err_access_dtor_temp :
1650     Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1651     AccessControl;
1652 def err_access_dtor_exception :
1653     Error<"exception object of type %0 has %select{private|protected}1 "
1654           "destructor">, AccessControl;
1655 def err_access_dtor_field :
1656     Error<"field of type %1 has %select{private|protected}2 destructor">,
1657     AccessControl;
1658 def err_access_dtor_var :
1659     Error<"variable of type %1 has %select{private|protected}2 destructor">,
1660     AccessControl;
1661 def err_access_dtor_ivar :
1662     Error<"instance variable of type %0 has %select{private|protected}1 "
1663           "destructor">,
1664     AccessControl;
1665 def note_previous_access_declaration : Note<
1666   "previously declared '%1' here">;
1667 def note_access_natural : Note<
1668   "%select{|implicitly }1declared %select{private|protected}0 here">;
1669 def note_access_constrained_by_path : Note<
1670   "constrained by %select{|implicitly }1%select{private|protected}0"
1671   " inheritance here">;
1672 def note_access_protected_restricted_noobject : Note<
1673   "must name member using the type of the current context %0">;
1674 def note_access_protected_restricted_ctordtor : Note<
1675   "protected %select{constructor|destructor}0 can only be used to "
1676   "%select{construct|destroy}0 a base class subobject">;
1677 def note_access_protected_restricted_object : Note<
1678   "can only access this member on an object of type %0">;
1679 def warn_cxx98_compat_sfinae_access_control : Warning<
1680   "substitution failure due to access control is incompatible with C++98">,
1681   InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1682
1683 // C++ name lookup
1684 def err_incomplete_nested_name_spec : Error<
1685   "incomplete type %0 named in nested name specifier">;
1686 def err_dependent_nested_name_spec : Error<
1687   "nested name specifier for a declaration cannot depend on a template "
1688   "parameter">;
1689 def err_nested_name_member_ref_lookup_ambiguous : Error<
1690   "lookup of %0 in member access expression is ambiguous">;
1691 def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1692   "lookup of %0 in member access expression is ambiguous; using member of %1">,
1693   InGroup<AmbigMemberTemplate>;
1694 def note_ambig_member_ref_object_type : Note<
1695   "lookup in the object type %0 refers here">;
1696 def note_ambig_member_ref_scope : Note<
1697   "lookup from the current scope refers here">;
1698 def err_qualified_member_nonclass : Error<
1699   "qualified member access refers to a member in %0">;
1700 def err_incomplete_member_access : Error<
1701   "member access into incomplete type %0">;
1702 def err_incomplete_type : Error<
1703   "incomplete type %0 where a complete type is required">;
1704 def warn_cxx98_compat_enum_nested_name_spec : Warning<
1705   "enumeration type in nested name specifier is incompatible with C++98">,
1706   InGroup<CXX98Compat>, DefaultIgnore;
1707 def err_nested_name_spec_is_not_class : Error<
1708   "%0 cannot appear before '::' because it is not a class"
1709   "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1710 def ext_nested_name_spec_is_enum : ExtWarn<
1711   "use of enumeration in a nested name specifier is a C++11 extension">,
1712   InGroup<CXX11>;
1713 def err_out_of_line_qualified_id_type_names_constructor : Error<
1714   "qualified reference to %0 is a constructor name rather than a "
1715   "%select{template name|type}1 in this context">;
1716 def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1717   "ISO C++ specifies that "
1718   "qualified reference to %0 is a constructor name rather than a "
1719   "%select{template name|type}1 in this context, despite preceding "
1720   "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1721   InGroup<DiagGroup<"injected-class-name">>;
1722
1723 // C++ class members
1724 def err_storageclass_invalid_for_member : Error<
1725   "storage class specified for a member declaration">;
1726 def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1727 def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1728 def ext_mutable_reference : ExtWarn<
1729   "'mutable' on a reference type is a Microsoft extension">,
1730   InGroup<MicrosoftMutableReference>;
1731 def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1732 def err_mutable_nonmember : Error<
1733   "'mutable' can only be applied to member variables">;
1734 def err_virtual_in_union : Error<
1735   "unions cannot have virtual functions">;
1736 def err_virtual_non_function : Error<
1737   "'virtual' can only appear on non-static member functions">;
1738 def err_virtual_out_of_class : Error<
1739   "'virtual' can only be specified inside the class definition">;
1740 def err_virtual_member_function_template : Error<
1741   "'virtual' cannot be specified on member function templates">;
1742 def err_static_overrides_virtual : Error<
1743   "'static' member function %0 overrides a virtual function in a base class">;
1744 def err_explicit_non_function : Error<
1745   "'explicit' can only appear on non-static member functions">;
1746 def err_explicit_out_of_class : Error<
1747   "'explicit' can only be specified inside the class definition">;
1748 def err_explicit_non_ctor_or_conv_function : Error<
1749   "'explicit' can only be applied to a constructor or conversion function">;
1750 def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1751 def err_static_out_of_line : Error<
1752   "'static' can only be specified inside the class definition">;
1753 def ext_static_out_of_line : ExtWarn<
1754   err_static_out_of_line.Text>,
1755   InGroup<MicrosoftTemplate>;
1756 def err_storage_class_for_static_member : Error<
1757   "static data member definition cannot specify a storage class">;
1758 def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1759 def err_not_integral_type_bitfield : Error<
1760   "bit-field %0 has non-integral type %1">;
1761 def err_not_integral_type_anon_bitfield : Error<
1762   "anonymous bit-field has non-integral type %0">;
1763 def err_anon_bitfield_qualifiers : Error<
1764   "anonymous bit-field cannot have qualifiers">;
1765 def err_member_function_initialization : Error<
1766   "initializer on function does not look like a pure-specifier">;
1767 def err_non_virtual_pure : Error<
1768   "%0 is not virtual and cannot be declared pure">;
1769 def ext_pure_function_definition : ExtWarn<
1770   "function definition with pure-specifier is a Microsoft extension">,
1771   InGroup<MicrosoftPureDefinition>;
1772 def err_qualified_member_of_unrelated : Error<
1773   "%q0 is not a member of class %1">;
1774
1775 def err_member_function_call_bad_cvr : Error<
1776   "'this' argument to member function %0 has type %1, but function is not marked "
1777   "%select{const|restrict|const or restrict|volatile|const or volatile|"
1778   "volatile or restrict|const, volatile, or restrict}2">;
1779 def err_member_function_call_bad_ref : Error<
1780   "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1781   "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1782 def err_member_function_call_bad_type : Error<
1783   "cannot initialize object parameter of type %0 with an expression "
1784   "of type %1">;
1785
1786 def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1787   "call to pure virtual member function %0 has undefined behavior; "
1788   "overrides of %0 in subclasses are not available in the "
1789   "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1790
1791 def select_special_member_kind : TextSubstitution<
1792   "%select{default constructor|copy constructor|move constructor|"
1793   "copy assignment operator|move assignment operator|destructor}0">;
1794
1795 def note_member_declared_at : Note<"member is declared here">;
1796 def note_ivar_decl : Note<"instance variable is declared here">;
1797 def note_bitfield_decl : Note<"bit-field is declared here">;
1798 def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1799 def note_member_synthesized_at : Note<
1800   "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1801   "first required here">;
1802 def note_comparison_synthesized_at : Note<
1803   "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1804   "first required here">;
1805 def err_missing_default_ctor : Error<
1806   "%select{constructor for %1 must explicitly initialize the|"
1807   "implicit default constructor for %1 must explicitly initialize the|"
1808   "cannot use constructor inherited from base class %4;}0 "
1809   "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1810   "does not have a default constructor">;
1811 def note_due_to_dllexported_class : Note<
1812   "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1813
1814 def err_illegal_union_or_anon_struct_member : Error<
1815   "%select{anonymous struct|union}0 member %1 has a non-trivial "
1816   "%sub{select_special_member_kind}2">;
1817
1818 def warn_frame_address : Warning<
1819   "calling '%0' with a nonzero argument is unsafe">,
1820   InGroup<FrameAddress>, DefaultIgnore;
1821
1822 def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1823   "%select{anonymous struct|union}0 member %1 with a non-trivial "
1824   "%sub{select_special_member_kind}2 is incompatible with C++98">,
1825   InGroup<CXX98Compat>, DefaultIgnore;
1826
1827 def note_nontrivial_virtual_dtor : Note<
1828   "destructor for %0 is not trivial because it is virtual">;
1829 def note_nontrivial_has_virtual : Note<
1830   "because type %0 has a virtual %select{member function|base class}1">;
1831 def note_nontrivial_no_def_ctor : Note<
1832   "because %select{base class of |field of |}0type %1 has no "
1833   "default constructor">;
1834 def note_user_declared_ctor : Note<
1835   "implicit default constructor suppressed by user-declared constructor">;
1836 def note_nontrivial_no_copy : Note<
1837   "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1838   "assignment operator|<<ERROR>>}2 can be used to "
1839   "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1840   "%select{base class|field|an object}0 of type %3">;
1841 def note_nontrivial_user_provided : Note<
1842   "because %select{base class of |field of |}0type %1 has a user-provided "
1843   "%sub{select_special_member_kind}2">;
1844 def note_nontrivial_in_class_init : Note<
1845   "because field %0 has an initializer">;
1846 def note_nontrivial_param_type : Note<
1847   "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1848 def note_nontrivial_default_arg : Note<"because it has a default argument">;
1849 def note_nontrivial_variadic : Note<"because it is a variadic function">;
1850 def note_nontrivial_subobject : Note<
1851   "because the function selected to %select{construct|copy|move|copy|move|"
1852   "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1853 def note_nontrivial_objc_ownership : Note<
1854   "because type %0 has a member with %select{no|no|__strong|__weak|"
1855   "__autoreleasing}1 ownership">;
1856
1857 /// Selector for a TagTypeKind value.
1858 def select_tag_type_kind : TextSubstitution<
1859   "%select{struct|interface|union|class|enum}0">;
1860
1861 def err_static_data_member_not_allowed_in_anon_struct : Error<
1862   "static data member %0 not allowed in anonymous "
1863   "%sub{select_tag_type_kind}1">;
1864 def ext_static_data_member_in_union : ExtWarn<
1865   "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1866 def warn_cxx98_compat_static_data_member_in_union : Warning<
1867   "static data member %0 in union is incompatible with C++98">,
1868   InGroup<CXX98Compat>, DefaultIgnore;
1869 def ext_union_member_of_reference_type : ExtWarn<
1870   "union member %0 has reference type %1, which is a Microsoft extension">,
1871   InGroup<MicrosoftUnionMemberReference>;
1872 def err_union_member_of_reference_type : Error<
1873   "union member %0 has reference type %1">;
1874 def ext_anonymous_struct_union_qualified : Extension<
1875   "anonymous %select{struct|union}0 cannot be '%1'">;
1876 def err_different_return_type_for_overriding_virtual_function : Error<
1877   "virtual function %0 has a different return type "
1878   "%diff{($) than the function it overrides (which has return type $)|"
1879   "than the function it overrides}1,2">;
1880 def note_overridden_virtual_function : Note<
1881   "overridden virtual function is here">;
1882 def err_conflicting_overriding_cc_attributes : Error<
1883   "virtual function %0 has different calling convention attributes "
1884   "%diff{($) than the function it overrides (which has calling convention $)|"
1885   "than the function it overrides}1,2">;
1886 def warn_overriding_method_missing_noescape : Warning<
1887   "parameter of overriding method should be annotated with "
1888   "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1889 def note_overridden_marked_noescape : Note<
1890   "parameter of overridden method is annotated with __attribute__((noescape))">;
1891 def note_cat_conform_to_noescape_prot : Note<
1892   "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1893
1894 def err_covariant_return_inaccessible_base : Error<
1895   "invalid covariant return for virtual function: %1 is a "
1896   "%select{private|protected}2 base class of %0">, AccessControl;
1897 def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1898   "return type of virtual function %3 is not covariant with the return type of "
1899   "the function it overrides (ambiguous conversion from derived class "
1900   "%0 to base class %1:%2)">;
1901 def err_covariant_return_not_derived : Error<
1902   "return type of virtual function %0 is not covariant with the return type of "
1903   "the function it overrides (%1 is not derived from %2)">;
1904 def err_covariant_return_incomplete : Error<
1905   "return type of virtual function %0 is not covariant with the return type of "
1906   "the function it overrides (%1 is incomplete)">;
1907 def err_covariant_return_type_different_qualifications : Error<
1908   "return type of virtual function %0 is not covariant with the return type of "
1909   "the function it overrides (%1 has different qualifiers than %2)">;
1910 def err_covariant_return_type_class_type_more_qualified : Error<
1911   "return type of virtual function %0 is not covariant with the return type of "
1912   "the function it overrides (class type %1 is more qualified than class "
1913   "type %2">;
1914
1915 // C++ implicit special member functions
1916 def note_in_declaration_of_implicit_special_member : Note<
1917   "while declaring the implicit %sub{select_special_member_kind}1"
1918   " for %0">;
1919
1920 // C++ constructors
1921 def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1922 def err_invalid_qualified_constructor : Error<
1923   "'%0' qualifier is not allowed on a constructor">;
1924 def err_ref_qualifier_constructor : Error<
1925   "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1926
1927 def err_constructor_return_type : Error<
1928   "constructor cannot have a return type">;
1929 def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1930 def err_constructor_byvalue_arg : Error<
1931   "copy constructor must pass its first argument by reference">;
1932 def warn_no_constructor_for_refconst : Warning<
1933   "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1934   "constructor to initialize its non-modifiable members">;
1935 def note_refconst_member_not_initialized : Note<
1936   "%select{const|reference}0 member %1 will never be initialized">;
1937 def ext_ms_explicit_constructor_call : ExtWarn<
1938   "explicit constructor calls are a Microsoft extension">,
1939   InGroup<MicrosoftExplicitConstructorCall>;
1940
1941 // C++ destructors
1942 def err_destructor_not_member : Error<
1943   "destructor must be a non-static member function">;
1944 def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1945 def err_invalid_qualified_destructor : Error<
1946   "'%0' qualifier is not allowed on a destructor">;
1947 def err_ref_qualifier_destructor : Error<
1948   "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1949 def err_destructor_return_type : Error<"destructor cannot have a return type">;
1950 def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1951 def err_destructor_with_params : Error<"destructor cannot have any parameters">;
1952 def err_destructor_variadic : Error<"destructor cannot be variadic">;
1953 def ext_destructor_typedef_name : ExtWarn<
1954   "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
1955   "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
1956 def err_undeclared_destructor_name : Error<
1957   "undeclared identifier %0 in destructor name">;
1958 def err_destructor_name : Error<
1959   "expected the class name after '~' to name the enclosing class">;
1960 def err_destructor_name_nontype : Error<
1961   "identifier %0 after '~' in destructor name does not name a type">;
1962 def err_destructor_expr_mismatch : Error<
1963   "identifier %0 in object destruction expression does not name the type "
1964   "%1 of the object being destroyed">;
1965 def err_destructor_expr_nontype : Error<
1966   "identifier %0 in object destruction expression does not name a type">;
1967 def err_destructor_expr_type_mismatch : Error<
1968   "destructor type %0 in object destruction expression does not match the "
1969   "type %1 of the object being destroyed">;
1970 def note_destructor_type_here : Note<
1971   "type %0 found by destructor name lookup">;
1972 def note_destructor_nontype_here : Note<
1973   "non-type declaration found by destructor name lookup">;
1974 def ext_dtor_named_in_wrong_scope : Extension<
1975   "ISO C++ requires the name after '::~' to be found in the same scope as "
1976   "the name before '::~'">, InGroup<DtorName>;
1977 def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
1978   "qualified destructor name only found in lexical scope; omit the qualifier "
1979   "to find this type name by unqualified lookup">, InGroup<DtorName>;
1980 def ext_dtor_name_ambiguous : Extension<
1981   "ISO C++ considers this destructor name lookup to be ambiguous">,
1982   InGroup<DtorName>;
1983
1984 def err_destroy_attr_on_non_static_var : Error<
1985   "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
1986   " variable with static or thread storage duration">;
1987
1988 def err_destructor_template : Error<
1989   "destructor cannot be declared as a template">;
1990
1991 // C++ initialization
1992 def err_init_conversion_failed : Error<
1993   "cannot initialize %select{a variable|a parameter|return object|"
1994   "statement expression result|an "
1995   "exception object|a member subobject|an array element|a new value|a value|a "
1996   "base class|a constructor delegation|a vector element|a block element|a "
1997   "block element|a complex element|a lambda capture|a compound literal "
1998   "initializer|a related result|a parameter of CF audited function}0 "
1999   "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2000   "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2001   "%select{|: different classes%diff{ ($ vs $)|}5,6"
2002   "|: different number of parameters (%5 vs %6)"
2003   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2004   "|: different return type%diff{ ($ vs $)|}5,6"
2005   "|: different qualifiers (%5 vs %6)"
2006   "|: different exception specifications}4">;
2007
2008 def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2009   "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2010 def err_lvalue_reference_bind_to_initlist : Error<
2011   "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2012   "initializer list temporary">;
2013 def err_lvalue_reference_bind_to_temporary : Error<
2014   "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2015   "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2016 def err_lvalue_reference_bind_to_unrelated : Error<
2017   "%select{non-const|volatile}0 lvalue reference "
2018   "%diff{to type $ cannot bind to a value of unrelated type $|"
2019   "cannot bind to a value of unrelated type}1,2">;
2020 def err_reference_bind_drops_quals : Error<
2021   "binding reference %diff{of type $ to value of type $|to value}0,1 "
2022   "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2023   "not permitted due to incompatible qualifiers}2">;
2024 def err_reference_bind_failed : Error<
2025   "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2026   "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2027   "incompatible type}0,3">;
2028 def err_reference_bind_temporary_addrspace : Error<
2029   "reference of type %0 cannot bind to a temporary object because of "
2030   "address space mismatch">;
2031 def err_reference_bind_init_list : Error<
2032   "reference to type %0 cannot bind to an initializer list">;
2033 def err_init_list_bad_dest_type : Error<
2034   "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2035   "list">;
2036 def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2037   "aggregate initialization of type %0 with user-declared constructors "
2038   "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2039
2040 def err_reference_bind_to_bitfield : Error<
2041   "%select{non-const|volatile}0 reference cannot bind to "
2042   "bit-field%select{| %1}2">;
2043 def err_reference_bind_to_vector_element : Error<
2044   "%select{non-const|volatile}0 reference cannot bind to vector element">;
2045 def err_reference_bind_to_matrix_element : Error<
2046   "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2047 def err_reference_var_requires_init : Error<
2048   "declaration of reference variable %0 requires an initializer">;
2049 def err_reference_without_init : Error<
2050   "reference to type %0 requires an initializer">;
2051 def note_value_initialization_here : Note<
2052   "in value-initialization of type %0 here">;
2053 def err_reference_has_multiple_inits : Error<
2054   "reference cannot be initialized with multiple values">;
2055 def err_init_non_aggr_init_list : Error<
2056   "initialization of non-aggregate type %0 with an initializer list">;
2057 def err_init_reference_member_uninitialized : Error<
2058   "reference member of type %0 uninitialized">;
2059 def note_uninit_reference_member : Note<
2060   "uninitialized reference member is here">;
2061 def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2062   InGroup<Uninitialized>;
2063 def warn_base_class_is_uninit : Warning<
2064   "base class %0 is uninitialized when used here to access %q1">,
2065   InGroup<Uninitialized>;
2066 def warn_reference_field_is_uninit : Warning<
2067   "reference %0 is not yet bound to a value when used here">,
2068   InGroup<Uninitialized>;
2069 def note_uninit_in_this_constructor : Note<
2070   "during field initialization in %select{this|the implicit default}0 "
2071   "constructor">;
2072 def warn_static_self_reference_in_init : Warning<
2073   "static variable %0 is suspiciously used within its own initialization">,
2074   InGroup<UninitializedStaticSelfInit>;
2075 def warn_uninit_self_reference_in_init : Warning<
2076   "variable %0 is uninitialized when used within its own initialization">,
2077   InGroup<Uninitialized>;
2078 def warn_uninit_self_reference_in_reference_init : Warning<
2079   "reference %0 is not yet bound to a value when used within its own"
2080   " initialization">,
2081   InGroup<Uninitialized>;
2082 def warn_uninit_var : Warning<
2083   "variable %0 is uninitialized when %select{used here|captured by block}1">,
2084   InGroup<Uninitialized>, DefaultIgnore;
2085 def warn_sometimes_uninit_var : Warning<
2086   "variable %0 is %select{used|captured}1 uninitialized whenever "
2087   "%select{'%3' condition is %select{true|false}4|"
2088   "'%3' loop %select{is entered|exits because its condition is false}4|"
2089   "'%3' loop %select{condition is true|exits because its condition is false}4|"
2090   "switch %3 is taken|"
2091   "its declaration is reached|"
2092   "%3 is called}2">,
2093   InGroup<UninitializedSometimes>, DefaultIgnore;
2094 def warn_maybe_uninit_var : Warning<
2095   "variable %0 may be uninitialized when "
2096   "%select{used here|captured by block}1">,
2097   InGroup<UninitializedMaybe>, DefaultIgnore;
2098 def note_var_declared_here : Note<"variable %0 is declared here">;
2099 def note_uninit_var_use : Note<
2100   "%select{uninitialized use occurs|variable is captured by block}0 here">;
2101 def warn_uninit_byref_blockvar_captured_by_block : Warning<
2102   "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2103   "block">, InGroup<Uninitialized>, DefaultIgnore;
2104 def note_block_var_fixit_add_initialization : Note<
2105   "did you mean to use __block %0?">;
2106 def note_in_omitted_aggregate_initializer : Note<
2107   "in implicit initialization of %select{"
2108   "array element %1 with omitted initializer|"
2109   "field %1 with omitted initializer|"
2110   "trailing array elements in runtime-sized array new}0">;
2111 def note_in_reference_temporary_list_initializer : Note<
2112   "in initialization of temporary of type %0 created to "
2113   "list-initialize this reference">;
2114 def note_var_fixit_add_initialization : Note<
2115   "initialize the variable %0 to silence this warning">;
2116 def note_uninit_fixit_remove_cond : Note<
2117   "remove the %select{'%1' if its condition|condition if it}0 "
2118   "is always %select{false|true}2">;
2119 def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2120 def err_list_init_in_parens : Error<
2121   "cannot initialize %select{non-class|reference}0 type %1 with a "
2122   "parenthesized initializer list">;
2123
2124 def warn_uninit_const_reference : Warning<
2125   "variable %0 is uninitialized when passed as a const reference argument "
2126   "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2127
2128 def warn_unsequenced_mod_mod : Warning<
2129   "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2130 def warn_unsequenced_mod_use : Warning<
2131   "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2132
2133 def select_initialized_entity_kind : TextSubstitution<
2134   "%select{copying variable|copying parameter|"
2135   "returning object|initializing statement expression result|"
2136   "throwing object|copying member subobject|copying array element|"
2137   "allocating object|copying temporary|initializing base subobject|"
2138   "initializing vector element|capturing value}0">;
2139
2140 def err_temp_copy_no_viable : Error<
2141   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2142 def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2143   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2144   "C++98 requires a copy constructor when binding a reference to a temporary">,
2145   InGroup<BindToTemporaryCopy>;
2146 def err_temp_copy_ambiguous : Error<
2147   "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2148   "of type %1">;
2149 def err_temp_copy_deleted : Error<
2150   "%sub{select_initialized_entity_kind}0 of type %1 "
2151   "invokes deleted constructor">;
2152 def err_temp_copy_incomplete : Error<
2153   "copying a temporary object of incomplete type %0">;
2154 def warn_cxx98_compat_temp_copy : Warning<
2155   "%sub{select_initialized_entity_kind}1 "
2156   "of type %2 when binding a reference to a temporary would %select{invoke "
2157   "an inaccessible constructor|find no viable constructor|find ambiguous "
2158   "constructors|invoke a deleted constructor}0 in C++98">,
2159   InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2160 def err_selected_explicit_constructor : Error<
2161   "chosen constructor is explicit in copy-initialization">;
2162 def note_explicit_ctor_deduction_guide_here : Note<
2163   "explicit %select{constructor|deduction guide}0 declared here">;
2164
2165 // C++11 decltype
2166 def err_decltype_in_declarator : Error<
2167     "'decltype' cannot be used to name a declaration">;
2168
2169 // C++11 auto
2170 def warn_cxx98_compat_auto_type_specifier : Warning<
2171   "'auto' type specifier is incompatible with C++98">,
2172   InGroup<CXX98Compat>, DefaultIgnore;
2173 def err_auto_variable_cannot_appear_in_own_initializer : Error<
2174   "variable %0 declared with deduced type %1 "
2175   "cannot appear in its own initializer">;
2176 def err_binding_cannot_appear_in_own_initializer : Error<
2177   "binding %0 cannot appear in the initializer of its own "
2178   "decomposition declaration">;
2179 def err_illegal_decl_array_of_auto : Error<
2180   "'%0' declared as array of %1">;
2181 def err_new_array_of_auto : Error<
2182   "cannot allocate array of 'auto'">;
2183 def err_auto_not_allowed : Error<
2184   "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2185   "use of "
2186   "%select{class template|function template|variable template|alias template|"
2187   "template template parameter|concept|template}2 %3 requires template "
2188   "arguments; argument deduction}0 not allowed "
2189   "%select{in function prototype"
2190   "|in non-static struct member|in struct member"
2191   "|in non-static union member|in union member"
2192   "|in non-static class member|in interface member"
2193   "|in exception declaration|in template parameter until C++17|in block literal"
2194   "|in template argument|in typedef|in type alias|in function return type"
2195   "|in conversion function type|here|in lambda parameter"
2196   "|in type allocated by 'new'|in K&R-style function parameter"
2197   "|in template parameter|in friend declaration|in function prototype that is "
2198   "not a function declaration|in requires expression parameter}1">;
2199 def err_dependent_deduced_tst : Error<
2200   "typename specifier refers to "
2201   "%select{class template|function template|variable template|alias template|"
2202   "template template parameter|template}0 member in %1; "
2203   "argument deduction not allowed here">;
2204 def err_deduced_tst : Error<
2205   "typename specifier refers to "
2206   "%select{class template|function template|variable template|alias template|"
2207   "template template parameter|template}0; argument deduction not allowed "
2208   "here">;
2209 def err_auto_not_allowed_var_inst : Error<
2210   "'auto' variable template instantiation is not allowed">;
2211 def err_auto_var_requires_init : Error<
2212   "declaration of variable %0 with deduced type %1 requires an initializer">;
2213 def err_auto_new_requires_ctor_arg : Error<
2214   "new expression for type %0 requires a constructor argument">;
2215 def ext_auto_new_list_init : Extension<
2216   "ISO C++ standards before C++17 do not allow new expression for "
2217   "type %0 to use list-initialization">, InGroup<CXX17>;
2218 def err_auto_var_init_no_expression : Error<
2219   "initializer for variable %0 with type %1 is empty">;
2220 def err_auto_var_init_multiple_expressions : Error<
2221   "initializer for variable %0 with type %1 contains multiple expressions">;
2222 def err_auto_var_init_paren_braces : Error<
2223   "cannot deduce type for variable %1 with type %2 from "
2224   "%select{parenthesized|nested}0 initializer list">;
2225 def err_auto_new_ctor_multiple_expressions : Error<
2226   "new expression for type %0 contains multiple constructor arguments">;
2227 def err_auto_missing_trailing_return : Error<
2228   "'auto' return without trailing return type; deduced return types are a "
2229   "C++14 extension">;
2230 def err_deduced_return_type : Error<
2231   "deduced return types are a C++14 extension">;
2232 def err_trailing_return_without_auto : Error<
2233   "function with trailing return type must specify return type 'auto', not %0">;
2234 def err_trailing_return_in_parens : Error<
2235   "trailing return type may not be nested within parentheses">;
2236 def err_auto_var_deduction_failure : Error<
2237   "variable %0 with type %1 has incompatible initializer of type %2">;
2238 def err_auto_var_deduction_failure_from_init_list : Error<
2239   "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2240 def err_auto_new_deduction_failure : Error<
2241   "new expression for type %0 has incompatible constructor argument of type %1">;
2242 def err_auto_inconsistent_deduction : Error<
2243   "deduced conflicting types %diff{($ vs $) |}0,1"
2244   "for initializer list element type">;
2245 def err_auto_different_deductions : Error<
2246   "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2247   "deduced as %1 in declaration of %2 and "
2248   "deduced as %3 in declaration of %4">;
2249 def err_auto_non_deduced_not_alone : Error<
2250   "%select{function with deduced return type|"
2251   "declaration with trailing return type}0 "
2252   "must be the only declaration in its group">;
2253 def err_implied_std_initializer_list_not_found : Error<
2254   "cannot deduce type of initializer list because std::initializer_list was "
2255   "not found; include <initializer_list>">;
2256 def err_malformed_std_initializer_list : Error<
2257   "std::initializer_list must be a class template with a single type parameter">;
2258 def err_auto_init_list_from_c : Error<
2259   "cannot use __auto_type with initializer list in C">;
2260 def err_auto_bitfield : Error<
2261   "cannot pass bit-field as __auto_type initializer in C">;
2262
2263 // C++1y decltype(auto) type
2264 def err_decltype_auto_invalid : Error<
2265   "'decltype(auto)' not allowed here">;
2266 def err_decltype_auto_cannot_be_combined : Error<
2267   "'decltype(auto)' cannot be combined with other type specifiers">;
2268 def err_decltype_auto_function_declarator_not_declaration : Error<
2269   "'decltype(auto)' can only be used as a return type "
2270   "in a function declaration">;
2271 def err_decltype_auto_compound_type : Error<
2272   "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2273 def err_decltype_auto_initializer_list : Error<
2274   "cannot deduce 'decltype(auto)' from initializer list">;
2275
2276 // C++17 deduced class template specialization types
2277 def err_deduced_class_template_compound_type : Error<
2278   "cannot %select{form pointer to|form reference to|form array of|"
2279   "form function returning|use parentheses when declaring variable with}0 "
2280   "deduced class template specialization type">;
2281 def err_deduced_non_class_template_specialization_type : Error<
2282   "%select{<error>|function template|variable template|alias template|"
2283   "template template parameter|concept|template}0 %1 requires template "
2284   "arguments; argument deduction only allowed for class templates">;
2285 def err_deduced_class_template_ctor_ambiguous : Error<
2286   "ambiguous deduction for template arguments of %0">;
2287 def err_deduced_class_template_ctor_no_viable : Error<
2288   "no viable constructor or deduction guide for deduction of "
2289   "template arguments of %0">;
2290 def err_deduced_class_template_incomplete : Error<
2291   "template %0 has no definition and no %select{|viable }1deduction guides "
2292   "for deduction of template arguments">;
2293 def err_deduced_class_template_deleted : Error<
2294   "class template argument deduction for %0 selected a deleted constructor">;
2295 def err_deduced_class_template_explicit : Error<
2296   "class template argument deduction for %0 selected an explicit "
2297   "%select{constructor|deduction guide}1 for copy-list-initialization">;
2298 def err_deduction_guide_no_trailing_return_type : Error<
2299   "deduction guide declaration without trailing return type">;
2300 def err_deduction_guide_bad_trailing_return_type : Error<
2301   "deduced type %1 of deduction guide is not %select{|written as }2"
2302   "a specialization of template %0">;
2303 def err_deduction_guide_with_complex_decl : Error<
2304   "cannot specify any part of a return type in the "
2305   "declaration of a deduction guide">;
2306 def err_deduction_guide_invalid_specifier : Error<
2307   "deduction guide cannot be declared '%0'">;
2308 def err_deduction_guide_name_not_class_template : Error<
2309   "cannot specify deduction guide for "
2310   "%select{<error>|function template|variable template|alias template|"
2311   "template template parameter|concept|dependent template name}0 %1">;
2312 def err_deduction_guide_wrong_scope : Error<
2313   "deduction guide must be declared in the same scope as template %q0">;
2314 def err_deduction_guide_defines_function : Error<
2315   "deduction guide cannot have a function definition">;
2316 def err_deduction_guide_redeclared : Error<
2317   "redeclaration of deduction guide">;
2318 def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2319   "%select{explicitly instantiated|explicitly specialized}0">;
2320 def err_deduction_guide_template_not_deducible : Error<
2321   "deduction guide template contains "
2322   "%select{a template parameter|template parameters}0 that cannot be "
2323   "deduced">;
2324 def err_deduction_guide_wrong_access : Error<
2325   "deduction guide has different access from the corresponding "
2326   "member template">;
2327 def note_deduction_guide_template_access : Note<
2328   "member template declared %0 here">;
2329 def note_deduction_guide_access : Note<
2330   "deduction guide declared %0 by intervening access specifier">;
2331 def warn_cxx14_compat_class_template_argument_deduction : Warning<
2332   "class template argument deduction is incompatible with C++ standards "
2333   "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2334   InGroup<CXXPre17Compat>, DefaultIgnore;
2335 def warn_ctad_maybe_unsupported : Warning<
2336   "%0 may not intend to support class template argument deduction">,
2337   InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2338 def note_suppress_ctad_maybe_unsupported : Note<
2339   "add a deduction guide to suppress this warning">;
2340
2341
2342 // C++14 deduced return types
2343 def err_auto_fn_deduction_failure : Error<
2344   "cannot deduce return type %0 from returned value of type %1">;
2345 def err_auto_fn_different_deductions : Error<
2346   "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2347   "deduced as %2 in earlier return statement">;
2348 def err_auto_fn_used_before_defined : Error<
2349   "function %0 with deduced return type cannot be used before it is defined">;
2350 def err_auto_fn_no_return_but_not_auto : Error<
2351   "cannot deduce return type %0 for function with no return statements">;
2352 def err_auto_fn_return_void_but_not_auto : Error<
2353   "cannot deduce return type %0 from omitted return expression">;
2354 def err_auto_fn_return_init_list : Error<
2355   "cannot deduce return type from initializer list">;
2356 def err_auto_fn_virtual : Error<
2357   "function with deduced return type cannot be virtual">;
2358 def warn_cxx11_compat_deduced_return_type : Warning<
2359   "return type deduction is incompatible with C++ standards before C++14">,
2360   InGroup<CXXPre14Compat>, DefaultIgnore;
2361
2362 // C++11 override control
2363 def override_keyword_only_allowed_on_virtual_member_functions : Error<
2364   "only virtual member functions can be marked '%0'">;
2365 def override_keyword_hides_virtual_member_function : Error<
2366   "non-virtual member function marked '%0' hides virtual member "
2367   "%select{function|functions}1">;
2368 def err_function_marked_override_not_overriding : Error<
2369   "%0 marked 'override' but does not override any member functions">;
2370 def warn_destructor_marked_not_override_overriding : TextSubstitution <
2371   "%0 overrides a destructor but is not marked 'override'">;
2372 def warn_function_marked_not_override_overriding : TextSubstitution <
2373   "%0 overrides a member function but is not marked 'override'">;
2374 def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2375   "%sub{warn_destructor_marked_not_override_overriding}0">,
2376   InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2377 def warn_inconsistent_function_marked_not_override_overriding : Warning <
2378   "%sub{warn_function_marked_not_override_overriding}0">,
2379   InGroup<CXX11WarnInconsistentOverrideMethod>;
2380 def warn_suggest_destructor_marked_not_override_overriding : Warning <
2381   "%sub{warn_destructor_marked_not_override_overriding}0">,
2382   InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2383 def warn_suggest_function_marked_not_override_overriding : Warning <
2384   "%sub{warn_function_marked_not_override_overriding}0">,
2385   InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2386 def err_class_marked_final_used_as_base : Error<
2387   "base %0 is marked '%select{final|sealed}1'">;
2388 def warn_abstract_final_class : Warning<
2389   "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2390 def warn_final_dtor_non_final_class : Warning<
2391   "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2392   InGroup<FinalDtorNonFinalClass>;
2393 def note_final_dtor_non_final_class_silence : Note<
2394   "mark %0 as '%select{final|sealed}1' to silence this warning">;
2395
2396 // C++11 attributes
2397 def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2398
2399 // C++11 final
2400 def err_final_function_overridden : Error<
2401   "declaration of %0 overrides a '%select{final|sealed}1' function">;
2402
2403 // C++11 scoped enumerations
2404 def err_enum_invalid_underlying : Error<
2405   "non-integral type %0 is an invalid underlying type">;
2406 def err_enumerator_too_large : Error<
2407   "enumerator value is not representable in the underlying type %0">;
2408 def ext_enumerator_too_large : Extension<
2409   "enumerator value is not representable in the underlying type %0">,
2410   InGroup<MicrosoftEnumValue>;
2411 def err_enumerator_wrapped : Error<
2412   "enumerator value %0 is not representable in the underlying type %1">;
2413 def err_enum_redeclare_type_mismatch : Error<
2414   "enumeration redeclared with different underlying type %0 (was %1)">;
2415 def err_enum_redeclare_fixed_mismatch : Error<
2416   "enumeration previously declared with %select{non|}0fixed underlying type">;
2417 def err_enum_redeclare_scoped_mismatch : Error<
2418   "enumeration previously declared as %select{un|}0scoped">;
2419 def err_only_enums_have_underlying_types : Error<
2420   "only enumeration types have underlying types">;
2421 def err_underlying_type_of_incomplete_enum : Error<
2422   "cannot determine underlying type of incomplete enumeration type %0">;
2423
2424 // C++11 delegating constructors
2425 def err_delegating_ctor : Error<
2426   "delegating constructors are permitted only in C++11">;
2427 def warn_cxx98_compat_delegating_ctor : Warning<
2428   "delegating constructors are incompatible with C++98">,
2429   InGroup<CXX98Compat>, DefaultIgnore;
2430 def err_delegating_initializer_alone : Error<
2431   "an initializer for a delegating constructor must appear alone">;
2432 def warn_delegating_ctor_cycle : Warning<
2433   "constructor for %0 creates a delegation cycle">, DefaultError,
2434   InGroup<DelegatingCtorCycles>;
2435 def note_it_delegates_to : Note<"it delegates to">;
2436 def note_which_delegates_to : Note<"which delegates to">;
2437
2438 // C++11 range-based for loop
2439 def err_for_range_decl_must_be_var : Error<
2440   "for range declaration must declare a variable">;
2441 def err_for_range_storage_class : Error<
2442   "loop variable %0 may not be declared %select{'extern'|'static'|"
2443   "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
2444 def err_type_defined_in_for_range : Error<
2445   "types may not be defined in a for range declaration">;
2446 def err_for_range_deduction_failure : Error<
2447   "cannot use type %0 as a range">;
2448 def err_for_range_incomplete_type : Error<
2449   "cannot use incomplete type %0 as a range">;
2450 def err_for_range_iter_deduction_failure : Error<
2451   "cannot use type %0 as an iterator">;
2452 def ext_for_range_begin_end_types_differ : ExtWarn<
2453   "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2454   InGroup<CXX17>;
2455 def warn_for_range_begin_end_types_differ : Warning<
2456   "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2457   "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2458 def note_in_for_range: Note<
2459   "when looking up '%select{begin|end}0' function for range expression "
2460   "of type %1">;
2461 def err_for_range_invalid: Error<
2462   "invalid range expression of type %0; no viable '%select{begin|end}1' "
2463   "function available">;
2464 def note_for_range_member_begin_end_ignored : Note<
2465   "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2466 def err_range_on_array_parameter : Error<
2467   "cannot build range expression with array function parameter %0 since "
2468   "parameter with array type %1 is treated as pointer type %2">;
2469 def err_for_range_dereference : Error<
2470   "invalid range expression of type %0; did you mean to dereference it "
2471   "with '*'?">;
2472 def note_for_range_invalid_iterator : Note <
2473   "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2474 def note_for_range_begin_end : Note<
2475   "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2476 def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2477   "loop variable %0 "
2478   "%diff{of type $ binds to a temporary constructed from type $"
2479   "|binds to a temporary constructed from a different type}1,2">,
2480   InGroup<RangeLoopConstruct>, DefaultIgnore;
2481 def note_use_type_or_non_reference : Note<
2482   "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2483 def warn_for_range_ref_binds_ret_temp : Warning<
2484   "loop variable %0 binds to a temporary value produced by a range of type %1">,
2485   InGroup<RangeLoopBindReference>, DefaultIgnore;
2486 def note_use_non_reference_type : Note<"use non-reference type %0">;
2487 def warn_for_range_copy : Warning<
2488   "loop variable %0 creates a copy from type %1">,
2489   InGroup<RangeLoopConstruct>, DefaultIgnore;
2490 def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2491 def err_objc_for_range_init_stmt : Error<
2492   "initialization statement is not supported when iterating over Objective-C "
2493   "collection">;
2494
2495 // C++11 constexpr
2496 def warn_cxx98_compat_constexpr : Warning<
2497   "'constexpr' specifier is incompatible with C++98">,
2498   InGroup<CXX98Compat>, DefaultIgnore;
2499 // FIXME: Maybe this should also go in -Wc++14-compat?
2500 def warn_cxx14_compat_constexpr_not_const : Warning<
2501   "'constexpr' non-static member function will not be implicitly 'const' "
2502   "in C++14; add 'const' to avoid a change in behavior">,
2503   InGroup<DiagGroup<"constexpr-not-const">>;
2504 def err_invalid_consteval_take_address : Error<
2505   "cannot take address of consteval function %0 outside"
2506   " of an immediate invocation">;
2507 def err_invalid_consteval_call : Error<
2508   "call to consteval function %q0 is not a constant expression">;
2509 def err_invalid_consteval_decl_kind : Error<
2510   "%0 cannot be declared consteval">;
2511 def err_invalid_constexpr : Error<
2512   "%select{function parameter|typedef}0 "
2513   "cannot be %sub{select_constexpr_spec_kind}1">;
2514 def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2515   "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2516 def err_constexpr_tag : Error<
2517   "%select{class|struct|interface|union|enum}0 "
2518   "cannot be marked %sub{select_constexpr_spec_kind}1">;
2519 def err_constexpr_dtor : Error<
2520   "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2521 def err_constexpr_dtor_subobject : Error<
2522   "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2523   "%select{data member %2|base class %3}1 does not have a "
2524   "constexpr destructor">;
2525 def note_constexpr_dtor_subobject : Note<
2526   "%select{data member %1|base class %2}0 declared here">;
2527 def err_constexpr_wrong_decl_kind : Error<
2528   "%sub{select_constexpr_spec_kind}0 can only be used "
2529   "in %select{|variable and function|function|variable}0 declarations">;
2530 def err_invalid_constexpr_var_decl : Error<
2531   "constexpr variable declaration must be a definition">;
2532 def err_constexpr_static_mem_var_requires_init : Error<
2533   "declaration of constexpr static data member %0 requires an initializer">;
2534 def err_constexpr_var_non_literal : Error<
2535   "constexpr variable cannot have non-literal type %0">;
2536 def err_constexpr_var_requires_const_init : Error<
2537   "constexpr variable %0 must be initialized by a constant expression">;
2538 def err_constexpr_var_requires_const_destruction : Error<
2539   "constexpr variable %0 must have constant destruction">;
2540 def err_constexpr_redecl_mismatch : Error<
2541   "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2542   " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2543 def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2544 def warn_cxx17_compat_constexpr_virtual : Warning<
2545   "virtual constexpr functions are incompatible with "
2546   "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2547 def err_constexpr_virtual_base : Error<
2548   "constexpr %select{member function|constructor}0 not allowed in "
2549   "%select{struct|interface|class}1 with virtual base "
2550   "%plural{1:class|:classes}2">;
2551 def note_non_literal_incomplete : Note<
2552   "incomplete type %0 is not a literal type">;
2553 def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2554   "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2555 def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2556 def err_constexpr_non_literal_return : Error<
2557   "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2558 def err_constexpr_non_literal_param : Error<
2559   "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2560   "not a literal type">;
2561 def err_constexpr_body_invalid_stmt : Error<
2562   "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2563 def ext_constexpr_body_invalid_stmt : ExtWarn<
2564   "use of this statement in a constexpr %select{function|constructor}0 "
2565   "is a C++14 extension">, InGroup<CXX14>;
2566 def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2567   "use of this statement in a constexpr %select{function|constructor}0 "
2568   "is incompatible with C++ standards before C++14">,
2569   InGroup<CXXPre14Compat>, DefaultIgnore;
2570 def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2571   "use of this statement in a constexpr %select{function|constructor}0 "
2572   "is a C++20 extension">, InGroup<CXX20>;
2573 def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2574   "use of this statement in a constexpr %select{function|constructor}0 "
2575   "is incompatible with C++ standards before C++20">,
2576   InGroup<CXXPre20Compat>, DefaultIgnore;
2577 def ext_constexpr_type_definition : ExtWarn<
2578   "type definition in a constexpr %select{function|constructor}0 "
2579   "is a C++14 extension">, InGroup<CXX14>;
2580 def warn_cxx11_compat_constexpr_type_definition : Warning<
2581   "type definition in a constexpr %select{function|constructor}0 "
2582   "is incompatible with C++ standards before C++14">,
2583   InGroup<CXXPre14Compat>, DefaultIgnore;
2584 def err_constexpr_vla : Error<
2585   "variably-modified type %0 cannot be used in a constexpr "
2586   "%select{function|constructor}1">;
2587 def ext_constexpr_local_var : ExtWarn<
2588   "variable declaration in a constexpr %select{function|constructor}0 "
2589   "is a C++14 extension">, InGroup<CXX14>;
2590 def warn_cxx11_compat_constexpr_local_var : Warning<
2591   "variable declaration in a constexpr %select{function|constructor}0 "
2592   "is incompatible with C++ standards before C++14">,
2593   InGroup<CXXPre14Compat>, DefaultIgnore;
2594 def err_constexpr_local_var_static : Error<
2595   "%select{static|thread_local}1 variable not permitted in a constexpr "
2596   "%select{function|constructor}0">;
2597 def err_constexpr_local_var_non_literal_type : Error<
2598   "variable of non-literal type %1 cannot be defined in a constexpr "
2599   "%select{function|constructor}0">;
2600 def ext_constexpr_local_var_no_init : ExtWarn<
2601   "uninitialized variable in a constexpr %select{function|constructor}0 "
2602   "is a C++20 extension">, InGroup<CXX20>;
2603 def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2604   "uninitialized variable in a constexpr %select{function|constructor}0 "
2605   "is incompatible with C++ standards before C++20">,
2606   InGroup<CXXPre20Compat>, DefaultIgnore;
2607 def ext_constexpr_function_never_constant_expr : ExtWarn<
2608   "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2609   "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2610 def err_attr_cond_never_constant_expr : Error<
2611   "%0 attribute expression never produces a constant expression">;
2612 def err_diagnose_if_invalid_diagnostic_type : Error<
2613   "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2614   "instead">;
2615 def err_constexpr_body_no_return : Error<
2616   "no return statement in %select{constexpr|consteval}0 function">;
2617 def err_constexpr_return_missing_expr : Error<
2618   "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2619 def warn_cxx11_compat_constexpr_body_no_return : Warning<
2620   "constexpr function with no return statements is incompatible with C++ "
2621   "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2622 def ext_constexpr_body_multiple_return : ExtWarn<
2623   "multiple return statements in constexpr function is a C++14 extension">,
2624   InGroup<CXX14>;
2625 def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2626   "multiple return statements in constexpr function "
2627   "is incompatible with C++ standards before C++14">,
2628   InGroup<CXXPre14Compat>, DefaultIgnore;
2629 def note_constexpr_body_previous_return : Note<
2630   "previous return statement is here">;
2631
2632 // C++20 function try blocks in constexpr
2633 def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2634   "function try block in constexpr %select{function|constructor}0 is "
2635   "a C++20 extension">, InGroup<CXX20>;
2636 def warn_cxx17_compat_constexpr_function_try_block : Warning<
2637   "function try block in constexpr %select{function|constructor}0 is "
2638   "incompatible with C++ standards before C++20">,
2639   InGroup<CXXPre20Compat>, DefaultIgnore;
2640
2641 def ext_constexpr_union_ctor_no_init : ExtWarn<
2642   "constexpr union constructor that does not initialize any member "
2643   "is a C++20 extension">, InGroup<CXX20>;
2644 def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2645   "constexpr union constructor that does not initialize any member "
2646   "is incompatible with C++ standards before C++20">,
2647   InGroup<CXXPre20Compat>, DefaultIgnore;
2648 def ext_constexpr_ctor_missing_init : ExtWarn<
2649   "constexpr constructor that does not initialize all members "
2650   "is a C++20 extension">, InGroup<CXX20>;
2651 def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2652   "constexpr constructor that does not initialize all members "
2653   "is incompatible with C++ standards before C++20">,
2654   InGroup<CXXPre20Compat>, DefaultIgnore;
2655 def note_constexpr_ctor_missing_init : Note<
2656   "member not initialized by constructor">;
2657 def note_non_literal_no_constexpr_ctors : Note<
2658   "%0 is not literal because it is not an aggregate and has no constexpr "
2659   "constructors other than copy or move constructors">;
2660 def note_non_literal_base_class : Note<
2661   "%0 is not literal because it has base class %1 of non-literal type">;
2662 def note_non_literal_field : Note<
2663   "%0 is not literal because it has data member %1 of "
2664   "%select{non-literal|volatile}3 type %2">;
2665 def note_non_literal_user_provided_dtor : Note<
2666   "%0 is not literal because it has a user-provided destructor">;
2667 def note_non_literal_nontrivial_dtor : Note<
2668   "%0 is not literal because it has a non-trivial destructor">;
2669 def note_non_literal_non_constexpr_dtor : Note<
2670   "%0 is not literal because its destructor is not constexpr">;
2671 def note_non_literal_lambda : Note<
2672   "lambda closure types are non-literal types before C++17">;
2673 def warn_private_extern : Warning<
2674   "use of __private_extern__ on a declaration may not produce external symbol "
2675   "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2676 def note_private_extern : Note<
2677   "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2678
2679 // C++ Concepts
2680 def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2681   "concept declarations may only appear in global or namespace scope">;
2682 def err_concept_no_parameters : Error<
2683   "concept template parameter list must have at least one parameter; explicit "
2684   "specialization of concepts is not allowed">;
2685 def err_concept_extra_headers : Error<
2686   "extraneous template parameter list in concept definition">;
2687 def err_concept_no_associated_constraints : Error<
2688   "concept cannot have associated constraints">;
2689 def err_non_constant_constraint_expression : Error<
2690   "substitution into constraint expression resulted in a non-constant "
2691   "expression">;
2692 def err_non_bool_atomic_constraint : Error<
2693   "atomic constraint must be of type 'bool' (found %0)">;
2694 def err_template_arg_list_constraints_not_satisfied : Error<
2695   "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2696   "template template parameter|template}0 %1%2">;
2697 def note_substituted_constraint_expr_is_ill_formed : Note<
2698   "because substituted constraint expression is ill-formed%0">;
2699 def note_atomic_constraint_evaluated_to_false : Note<
2700   "%select{and|because}0 '%1' evaluated to false">;
2701 def note_concept_specialization_constraint_evaluated_to_false : Note<
2702   "%select{and|because}0 '%1' evaluated to false">;
2703 def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2704   "%select{and|because}0 %1 does not satisfy %2">;
2705 def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2706   "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2707 def err_constrained_virtual_method : Error<
2708   "virtual function cannot have a requires clause">;
2709 def err_trailing_requires_clause_on_deduction_guide : Error<
2710   "deduction guide cannot have a requires clause">;
2711 def err_reference_to_function_with_unsatisfied_constraints : Error<
2712   "invalid reference to function %0: constraints not satisfied">;
2713 def err_requires_expr_local_parameter_default_argument : Error<
2714   "default arguments not allowed for parameters of a requires expression">;
2715 def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2716   "constraint variable %0 cannot be used in an evaluated context">;
2717 def note_expr_requirement_expr_substitution_error : Note<
2718   "%select{and|because}0 '%1' would be invalid: %2">;
2719 def note_expr_requirement_expr_unknown_substitution_error : Note<
2720   "%select{and|because}0 '%1' would be invalid">;
2721 def note_expr_requirement_noexcept_not_met : Note<
2722   "%select{and|because}0 '%1' may throw an exception">;
2723 def note_expr_requirement_type_requirement_substitution_error : Note<
2724   "%select{and|because}0 '%1' would be invalid: %2">;
2725 def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2726   "%select{and|because}0 '%1' would be invalid">;
2727 def note_expr_requirement_constraints_not_satisfied : Note<
2728   "%select{and|because}0 type constraint '%1' was not satisfied:">;
2729 def note_expr_requirement_constraints_not_satisfied_simple : Note<
2730   "%select{and|because}0 %1 does not satisfy %2:">;
2731 def note_type_requirement_substitution_error : Note<
2732   "%select{and|because}0 '%1' would be invalid: %2">;
2733 def note_type_requirement_unknown_substitution_error : Note<
2734   "%select{and|because}0 '%1' would be invalid">;
2735 def note_nested_requirement_substitution_error : Note<
2736   "%select{and|because}0 '%1' would be invalid: %2">;
2737 def note_nested_requirement_unknown_substitution_error : Note<
2738   "%select{and|because}0 '%1' would be invalid">;
2739 def note_ambiguous_atomic_constraints : Note<
2740   "similar constraint expressions not considered equivalent; constraint "
2741   "expressions cannot be considered equivalent unless they originate from the "
2742   "same concept">;
2743 def note_ambiguous_atomic_constraints_similar_expression : Note<
2744   "similar constraint expression here">;
2745 def err_unsupported_placeholder_constraint : Error<
2746   "constrained placeholder types other than simple 'auto' on non-type template "
2747   "parameters not supported yet">;
2748
2749 def err_template_different_requires_clause : Error<
2750   "requires clause differs in template redeclaration">;
2751 def err_template_different_type_constraint : Error<
2752   "type constraint differs in template redeclaration">;
2753 def err_template_template_parameter_not_at_least_as_constrained : Error<
2754   "template template argument %0 is more constrained than template template "
2755   "parameter %1">;
2756
2757 def err_type_constraint_non_type_concept : Error<
2758   "concept named in type constraint is not a type concept">;
2759 def err_type_constraint_missing_arguments : Error<
2760   "%0 requires more than 1 template argument; provide the remaining arguments "
2761   "explicitly to use it here">;
2762 def err_placeholder_constraints_not_satisfied : Error<
2763   "deduced type %0 does not satisfy %1">;
2764
2765 // C++11 char16_t/char32_t
2766 def warn_cxx98_compat_unicode_type : Warning<
2767   "'%0' type specifier is incompatible with C++98">,
2768   InGroup<CXX98Compat>, DefaultIgnore;
2769 def warn_cxx17_compat_unicode_type : Warning<
2770   "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2771   InGroup<CXXPre20Compat>, DefaultIgnore;
2772
2773 // __make_integer_seq
2774 def err_integer_sequence_negative_length : Error<
2775   "integer sequences must have non-negative sequence length">;
2776 def err_integer_sequence_integral_element_type : Error<
2777   "integer sequences must have integral element type">;
2778
2779 // __type_pack_element
2780 def err_type_pack_element_out_of_bounds : Error<
2781   "a parameter pack may not be accessed at an out of bounds index">;
2782
2783 // Objective-C++
2784 def err_objc_decls_may_only_appear_in_global_scope : Error<
2785   "Objective-C declarations may only appear in global scope">;
2786 def warn_auto_var_is_id : Warning<
2787   "'auto' deduced as 'id' in declaration of %0">,
2788   InGroup<DiagGroup<"auto-var-id">>;
2789
2790 // Attributes
2791 def warn_nomerge_attribute_ignored_in_stmt: Warning<
2792   "%0 attribute is ignored because there exists no call expression inside the "
2793   "statement">,
2794   InGroup<IgnoredAttributes>;
2795 def err_nsobject_attribute : Error<
2796   "'NSObject' attribute is for pointer types only">;
2797 def err_attributes_are_not_compatible : Error<
2798   "%0 and %1 attributes are not compatible">;
2799 def err_attribute_invalid_argument : Error<
2800   "%select{a reference type|an array type|a non-vector or "
2801   "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2802 def err_attribute_wrong_number_arguments : Error<
2803   "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2804   ":requires exactly %1 arguments}1">;
2805 def err_attribute_too_many_arguments : Error<
2806   "%0 attribute takes no more than %1 argument%s1">;
2807 def err_attribute_too_few_arguments : Error<
2808   "%0 attribute takes at least %1 argument%s1">;
2809 def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2810 def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
2811 def err_attribute_bad_neon_vector_size : Error<
2812   "Neon vector size must be 64 or 128 bits">;
2813 def err_attribute_requires_positive_integer : Error<
2814   "%0 attribute requires a %select{positive|non-negative}1 "
2815   "integral compile time constant expression">;
2816 def err_attribute_requires_opencl_version : Error<
2817   "%0 attribute requires OpenCL version %1%select{| or above}2">;
2818 def err_invalid_branch_protection_spec : Error<
2819   "invalid or misplaced branch protection specification '%0'">;
2820 def warn_unsupported_target_attribute
2821     : Warning<"%select{unsupported|duplicate}0%select{| architecture}1 '%2' in"
2822               " the 'target' attribute string; 'target' attribute ignored">,
2823       InGroup<IgnoredAttributes>;
2824 def err_attribute_unsupported
2825     : Error<"%0 attribute is not supported for this target">;
2826 // The err_*_attribute_argument_not_int are separate because they're used by
2827 // VerifyIntegerConstantExpression.
2828 def err_aligned_attribute_argument_not_int : Error<
2829   "'aligned' attribute requires integer constant">;
2830 def err_align_value_attribute_argument_not_int : Error<
2831   "'align_value' attribute requires integer constant">;
2832 def err_alignas_attribute_wrong_decl_type : Error<
2833   "%0 attribute cannot be applied to a %select{function parameter|"
2834   "variable with 'register' storage class|'catch' variable|bit-field}1">;
2835 def err_alignas_missing_on_definition : Error<
2836   "%0 must be specified on definition if it is specified on any declaration">;
2837 def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2838 def err_alignas_mismatch : Error<
2839   "redeclaration has different alignment requirement (%1 vs %0)">;
2840 def err_alignas_underaligned : Error<
2841   "requested alignment is less than minimum alignment of %1 for type %0">;
2842 def err_attribute_sizeless_type : Error<
2843   "%0 attribute cannot be applied to sizeless type %1">;
2844 def err_attribute_argument_n_type : Error<
2845   "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2846   "constant|a string|an identifier}2">;
2847 def err_attribute_argument_type : Error<
2848   "%0 attribute requires %select{int or bool|an integer "
2849   "constant|a string|an identifier}1">;
2850 def err_attribute_argument_out_of_range : Error<
2851   "%0 attribute requires integer constant between %1 and %2 inclusive">;
2852 def err_init_priority_object_attr : Error<
2853   "can only use 'init_priority' attribute on file-scope definitions "
2854   "of objects of class type">;
2855 def err_attribute_argument_out_of_bounds : Error<
2856   "%0 attribute parameter %1 is out of bounds">;
2857 def err_attribute_only_once_per_parameter : Error<
2858   "%0 attribute can only be applied once per parameter">;
2859 def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2860 def note_previous_uuid : Note<"previous uuid specified here">;
2861 def warn_attribute_pointers_only : Warning<
2862   "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2863   InGroup<IgnoredAttributes>;
2864 def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2865 def err_attribute_integers_only : Error<
2866   "%0 attribute argument may only refer to a function parameter of integer "
2867   "type">;
2868 def warn_attribute_return_pointers_only : Warning<
2869   "%0 attribute only applies to return values that are pointers">,
2870   InGroup<IgnoredAttributes>;
2871 def warn_attribute_return_pointers_refs_only : Warning<
2872   "%0 attribute only applies to return values that are pointers or references">,
2873   InGroup<IgnoredAttributes>;
2874 def warn_attribute_pointer_or_reference_only : Warning<
2875   "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2876   InGroup<IgnoredAttributes>;
2877 def err_attribute_no_member_pointers : Error<
2878   "%0 attribute cannot be used with pointers to members">;
2879 def err_attribute_invalid_implicit_this_argument : Error<
2880   "%0 attribute is invalid for the implicit this argument">;
2881 def err_ownership_type : Error<
2882   "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2883 def err_ownership_returns_index_mismatch : Error<
2884   "'ownership_returns' attribute index does not match; here it is %0">;
2885 def note_ownership_returns_index_mismatch : Note<
2886   "declared with index %0 here">;
2887 def err_format_strftime_third_parameter : Error<
2888   "strftime format attribute requires 3rd parameter to be 0">;
2889 def err_format_attribute_requires_variadic : Error<
2890   "format attribute requires variadic function">;
2891 def err_format_attribute_not : Error<"format argument not %0">;
2892 def err_format_attribute_result_not : Error<"function does not return %0">;
2893 def err_format_attribute_implicit_this_format_string : Error<
2894   "format attribute cannot specify the implicit this argument as the format "
2895   "string">;
2896 def err_callback_attribute_no_callee : Error<
2897   "'callback' attribute specifies no callback callee">;
2898 def err_callback_attribute_invalid_callee : Error<
2899   "'callback' attribute specifies invalid callback callee">;
2900 def err_callback_attribute_multiple : Error<
2901   "multiple 'callback' attributes specified">;
2902 def err_callback_attribute_argument_unknown : Error<
2903   "'callback' attribute argument %0 is not a known function parameter">;
2904 def err_callback_callee_no_function_type : Error<
2905   "'callback' attribute callee does not have function type">;
2906 def err_callback_callee_is_variadic : Error<
2907   "'callback' attribute callee may not be variadic">;
2908 def err_callback_implicit_this_not_available : Error<
2909   "'callback' argument at position %0 references unavailable implicit 'this'">;
2910 def err_init_method_bad_return_type : Error<
2911   "init methods must return an object pointer type, not %0">;
2912 def err_attribute_invalid_size : Error<
2913   "vector size not an integral multiple of component size">;
2914 def err_attribute_zero_size : Error<"zero %0 size">;
2915 def err_attribute_size_too_large : Error<"%0 size too large">;
2916 def err_typecheck_vector_not_convertable_implict_truncation : Error<
2917    "cannot convert between %select{scalar|vector}0 type %1 and vector type"
2918    " %2 as implicit conversion would cause truncation">;
2919 def err_typecheck_vector_not_convertable : Error<
2920   "cannot convert between vector values of different size (%0 and %1)">;
2921 def err_typecheck_vector_not_convertable_non_scalar : Error<
2922   "cannot convert between vector and non-scalar values (%0 and %1)">;
2923 def err_typecheck_vector_lengths_not_equal : Error<
2924   "vector operands do not have the same number of elements (%0 and %1)">;
2925 def warn_typecheck_vector_element_sizes_not_equal : Warning<
2926   "vector operands do not have the same elements sizes (%0 and %1)">,
2927   InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
2928 def err_ext_vector_component_exceeds_length : Error<
2929   "vector component access exceeds type %0">;
2930 def err_ext_vector_component_name_illegal : Error<
2931   "illegal vector component name '%0'">;
2932 def err_attribute_address_space_negative : Error<
2933   "address space is negative">;
2934 def err_attribute_address_space_too_high : Error<
2935   "address space is larger than the maximum supported (%0)">;
2936 def err_attribute_address_multiple_qualifiers : Error<
2937   "multiple address spaces specified for type">;
2938 def warn_attribute_address_multiple_identical_qualifiers : Warning<
2939   "multiple identical address spaces specified for type">,
2940   InGroup<DuplicateDeclSpecifier>;
2941 def err_attribute_not_clinkage : Error<
2942   "function type with %0 attribute must have C linkage">;
2943 def err_function_decl_cmse_ns_call : Error<
2944   "functions may not be declared with 'cmse_nonsecure_call' attribute">;
2945 def err_attribute_address_function_type : Error<
2946   "function type may not be qualified with an address space">;
2947 def err_as_qualified_auto_decl : Error<
2948   "automatic variable qualified with an%select{| invalid}0 address space">;
2949 def err_arg_with_address_space : Error<
2950   "parameter may not be qualified with an address space">;
2951 def err_field_with_address_space : Error<
2952   "field may not be qualified with an address space">;
2953 def err_compound_literal_with_address_space : Error<
2954   "compound literal in function scope may not be qualified with an address space">;
2955 def err_address_space_mismatch_templ_inst : Error<
2956   "conflicting address space qualifiers are provided between types %0 and %1">;
2957 def err_attr_objc_ownership_redundant : Error<
2958   "the type %0 is already explicitly ownership-qualified">;
2959 def err_invalid_nsnumber_type : Error<
2960   "%0 is not a valid literal type for NSNumber">;
2961 def err_objc_illegal_boxed_expression_type : Error<
2962   "illegal type %0 used in a boxed expression">;
2963 def err_objc_non_trivially_copyable_boxed_expression_type : Error<
2964   "non-trivially copyable type %0 cannot be used in a boxed expression">;
2965 def err_objc_incomplete_boxed_expression_type : Error<
2966   "incomplete type %0 used in a boxed expression">;
2967 def err_undeclared_objc_literal_class : Error<
2968   "definition of class %0 must be available to use Objective-C "
2969   "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
2970   "string literals}1">;
2971 def err_undeclared_boxing_method : Error<
2972   "declaration of %0 is missing in %1 class">;
2973 def err_objc_literal_method_sig : Error<
2974   "literal construction method %0 has incompatible signature">;
2975 def note_objc_literal_method_param : Note<
2976   "%select{first|second|third}0 parameter has unexpected type %1 "
2977   "(should be %2)">;
2978 def note_objc_literal_method_return : Note<
2979   "method returns unexpected type %0 (should be an object type)">;
2980 def err_invalid_collection_element : Error<
2981   "collection element of type %0 is not an Objective-C object">;
2982 def err_box_literal_collection : Error<
2983   "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
2984   "in a collection">;
2985 def warn_objc_literal_comparison : Warning<
2986   "direct comparison of %select{an array literal|a dictionary literal|"
2987   "a numeric literal|a boxed expression|}0 has undefined behavior">,
2988   InGroup<ObjCLiteralComparison>;
2989 def err_missing_atsign_prefix : Error<
2990   "%select{string|numeric}0 literal must be prefixed by '@'">;
2991 def warn_objc_string_literal_comparison : Warning<
2992   "direct comparison of a string literal has undefined behavior">,
2993   InGroup<ObjCStringComparison>;
2994 def warn_concatenated_nsarray_literal : Warning<
2995   "concatenated NSString literal for an NSArray expression - "
2996   "possibly missing a comma">,
2997   InGroup<ObjCStringConcatenation>;
2998 def note_objc_literal_comparison_isequal : Note<
2999   "use 'isEqual:' instead">;
3000 def warn_objc_collection_literal_element : Warning<
3001   "object of type %0 is not compatible with "
3002   "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3003   InGroup<ObjCLiteralConversion>;
3004 def warn_nsdictionary_duplicate_key : Warning<
3005   "duplicate key in dictionary literal">,
3006   InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3007 def note_nsdictionary_duplicate_key_here : Note<
3008   "previous equal key is here">;
3009 def err_swift_param_attr_not_swiftcall : Error<
3010   "'%0' parameter can only be used with swiftcall calling convention">;
3011 def err_swift_indirect_result_not_first : Error<
3012   "'swift_indirect_result' parameters must be first parameters of function">;
3013 def err_swift_error_result_not_after_swift_context : Error<
3014   "'swift_error_result' parameter must follow 'swift_context' parameter">;
3015 def err_swift_abi_parameter_wrong_type : Error<
3016   "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3017   "type here is %2">;
3018
3019 def err_attribute_argument_invalid : Error<
3020   "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3021   "min must not be greater than max}1">;
3022 def err_attribute_argument_is_zero : Error<
3023   "%0 attribute must be greater than 0">;
3024 def warn_attribute_argument_n_negative : Warning<
3025   "%0 attribute parameter %1 is negative and will be ignored">,
3026   InGroup<CudaCompat>;
3027 def err_property_function_in_objc_container : Error<
3028   "use of Objective-C property in function nested in Objective-C "
3029   "container not supported, move function outside its container">;
3030
3031 let CategoryName = "Cocoa API Issue" in {
3032 def warn_objc_redundant_literal_use : Warning<
3033   "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3034 }
3035
3036 def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3037   "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3038
3039 def err_tls_var_aligned_over_maximum : Error<
3040   "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3041   "alignment (%2) for a thread-local variable on this target">;
3042
3043 def err_only_annotate_after_access_spec : Error<
3044   "access specifier can only have annotation attributes">;
3045
3046 def err_attribute_section_invalid_for_target : Error<
3047   "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3048 def warn_attribute_section_drectve : Warning<
3049   "#pragma %0(\".drectve\") has undefined behavior, "
3050   "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3051 def warn_mismatched_section : Warning<
3052   "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3053 def warn_attribute_section_on_redeclaration : Warning<
3054   "section attribute is specified on redeclared variable">, InGroup<Section>;
3055 def err_mismatched_code_seg_base : Error<
3056   "derived class must specify the same code segment as its base classes">;
3057 def err_mismatched_code_seg_override : Error<
3058   "overriding virtual function must specify the same code segment as its overridden function">;
3059 def err_conflicting_codeseg_attribute : Error<
3060   "conflicting code segment specifiers">;
3061 def warn_duplicate_codeseg_attribute : Warning<
3062   "duplicate code segment specifiers">, InGroup<Section>;
3063
3064 def err_anonymous_property: Error<
3065   "anonymous property is not supported">;
3066 def err_property_is_variably_modified : Error<
3067   "property %0 has a variably modified type">;
3068 def err_no_accessor_for_property : Error<
3069   "no %select{getter|setter}0 defined for property %1">;
3070 def err_cannot_find_suitable_accessor : Error<
3071   "cannot find suitable %select{getter|setter}0 for property %1">;
3072
3073 def warn_alloca : Warning<
3074   "use of function %0 is discouraged; there is no way to check for failure but "
3075   "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3076   InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3077
3078 def warn_alloca_align_alignof : Warning<
3079   "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3080   InGroup<DiagGroup<"alloca-with-align-alignof">>;
3081
3082 def err_alignment_too_small : Error<
3083   "requested alignment must be %0 or greater">;
3084 def err_alignment_too_big : Error<
3085   "requested alignment must be %0 or smaller">;
3086 def err_alignment_not_power_of_two : Error<
3087   "requested alignment is not a power of 2">;
3088 def warn_alignment_not_power_of_two : Warning<
3089   err_alignment_not_power_of_two.Text>,
3090   InGroup<DiagGroup<"non-power-of-two-alignment">>;
3091 def err_alignment_dependent_typedef_name : Error<
3092   "requested alignment is dependent but declaration is not dependent">;
3093
3094 def warn_alignment_builtin_useless : Warning<
3095   "%select{aligning a value|the result of checking whether a value is aligned}0"
3096   " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3097 def err_attribute_aligned_too_great : Error<
3098   "requested alignment must be %0 bytes or smaller">;
3099 def warn_assume_aligned_too_great
3100     : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3101               "alignment assumed">,
3102       InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3103 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3104   "%q0 redeclared without %1 attribute: previous %1 ignored">,
3105   InGroup<MicrosoftInconsistentDllImport>;
3106 def warn_redeclaration_without_import_attribute : Warning<
3107   "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3108   InGroup<MicrosoftInconsistentDllImport>;
3109 def warn_dllimport_dropped_from_inline_function : Warning<
3110   "%q0 redeclared inline; %1 attribute ignored">,
3111   InGroup<IgnoredAttributes>;
3112 def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3113   InGroup<IgnoredAttributes>;
3114 def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3115   " exception specification; attribute ignored">,
3116   InGroup<IgnoredAttributes>;
3117 def warn_attribute_ignored_on_inline :
3118   Warning<"%0 attribute ignored on inline function">,
3119   InGroup<IgnoredAttributes>;
3120 def warn_nocf_check_attribute_ignored :
3121   Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3122   InGroup<IgnoredAttributes>;
3123 def warn_attribute_after_definition_ignored : Warning<
3124   "attribute %0 after definition is ignored">,
3125    InGroup<IgnoredAttributes>;
3126 def warn_cxx11_gnu_attribute_on_type : Warning<
3127   "attribute %0 ignored, because it cannot be applied to a type">,
3128   InGroup<IgnoredAttributes>;
3129 def warn_unhandled_ms_attribute_ignored : Warning<
3130   "__declspec attribute %0 is not supported">,
3131   InGroup<IgnoredAttributes>;
3132 def err_decl_attribute_invalid_on_stmt : Error<
3133   "%0 attribute cannot be applied to a statement">;
3134 def err_stmt_attribute_invalid_on_decl : Error<
3135   "%0 attribute cannot be applied to a declaration">;
3136 def warn_declspec_attribute_ignored : Warning<
3137   "attribute %0 is ignored, place it after "
3138   "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3139   "type declaration">, InGroup<IgnoredAttributes>;
3140 def warn_attribute_precede_definition : Warning<
3141   "attribute declaration must precede definition">,
3142   InGroup<IgnoredAttributes>;
3143 def warn_attribute_void_function_method : Warning<
3144   "attribute %0 cannot be applied to "
3145   "%select{functions|Objective-C method}1 without return value">,
3146   InGroup<IgnoredAttributes>;
3147 def warn_attribute_weak_on_field : Warning<
3148   "__weak attribute cannot be specified on a field declaration">,
3149   InGroup<IgnoredAttributes>;
3150 def warn_gc_attribute_weak_on_local : Warning<
3151   "Objective-C GC does not allow weak variables on the stack">,
3152   InGroup<IgnoredAttributes>;
3153 def warn_nsobject_attribute : Warning<
3154   "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3155   InGroup<NSobjectAttribute>;
3156 def warn_independentclass_attribute : Warning<
3157   "'objc_independent_class' attribute may be put on a typedef only; "
3158   "attribute is ignored">,
3159   InGroup<IndependentClassAttribute>;
3160 def warn_ptr_independentclass_attribute : Warning<
3161   "'objc_independent_class' attribute may be put on Objective-C object "
3162   "pointer type only; attribute is ignored">,
3163   InGroup<IndependentClassAttribute>;
3164 def warn_attribute_weak_on_local : Warning<
3165   "__weak attribute cannot be specified on an automatic variable when ARC "
3166   "is not enabled">,
3167   InGroup<IgnoredAttributes>;
3168 def warn_weak_identifier_undeclared : Warning<
3169   "weak identifier %0 never declared">;
3170 def warn_attribute_cmse_entry_static : Warning<
3171   "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3172   InGroup<IgnoredAttributes>;
3173 def warn_cmse_nonsecure_union : Warning<
3174   "passing union across security boundary via %select{parameter %1|return value}0 "
3175   "may leak information">,
3176   InGroup<DiagGroup<"cmse-union-leak">>;
3177 def err_attribute_weak_static : Error<
3178   "weak declaration cannot have internal linkage">;
3179 def err_attribute_selectany_non_extern_data : Error<
3180   "'selectany' can only be applied to data items with external linkage">;
3181 def err_declspec_thread_on_thread_variable : Error<
3182   "'__declspec(thread)' applied to variable that already has a "
3183   "thread-local storage specifier">;
3184 def err_attribute_dll_not_extern : Error<
3185   "%q0 must have external linkage when declared %q1">;
3186 def err_attribute_dll_thread_local : Error<
3187   "%q0 cannot be thread local when declared %q1">;
3188 def err_attribute_dll_lambda : Error<
3189   "lambda cannot be declared %0">;
3190 def warn_attribute_invalid_on_definition : Warning<
3191   "'%0' attribute cannot be specified on a definition">,
3192   InGroup<IgnoredAttributes>;
3193 def err_attribute_dll_redeclaration : Error<
3194   "redeclaration of %q0 cannot add %q1 attribute">;
3195 def warn_attribute_dll_redeclaration : Warning<
3196   "redeclaration of %q0 should not add %q1 attribute">,
3197   InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3198 def err_attribute_dllimport_function_definition : Error<
3199   "dllimport cannot be applied to non-inline function definition">;
3200 def err_attribute_dll_deleted : Error<
3201   "attribute %q0 cannot be applied to a deleted function">;
3202 def err_attribute_dllimport_data_definition : Error<
3203   "definition of dllimport data">;
3204 def err_attribute_dllimport_static_field_definition : Error<
3205   "definition of dllimport static field not allowed">;
3206 def warn_attribute_dllimport_static_field_definition : Warning<
3207   "definition of dllimport static field">,
3208   InGroup<DiagGroup<"dllimport-static-field-def">>;
3209 def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3210   "explicit instantiation declaration should not be 'dllexport'">,
3211   InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
3212 def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3213   "'dllexport' attribute ignored on explicit instantiation definition">,
3214   InGroup<IgnoredAttributes>;
3215 def warn_invalid_initializer_from_system_header : Warning<
3216   "invalid constructor form class in system header, should not be explicit">,
3217   InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3218 def note_used_in_initialization_here : Note<"used in initialization here">;
3219 def err_attribute_dll_member_of_dll_class : Error<
3220   "attribute %q0 cannot be applied to member of %q1 class">;
3221 def warn_attribute_dll_instantiated_base_class : Warning<
3222   "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3223   "base class template without dll attribute is not supported">,
3224   InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3225 def err_attribute_dll_ambiguous_default_ctor : Error<
3226   "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3227 def err_attribute_weakref_not_static : Error<
3228   "weakref declaration must have internal linkage">;
3229 def err_attribute_weakref_not_global_context : Error<
3230   "weakref declaration of %0 must be in a global context">;
3231 def err_attribute_weakref_without_alias : Error<
3232   "weakref declaration of %0 must also have an alias attribute">;
3233 def err_alias_not_supported_on_darwin : Error <
3234   "aliases are not supported on darwin">;
3235 def warn_attribute_wrong_decl_type_str : Warning<
3236   "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3237 def err_attribute_wrong_decl_type_str : Error<
3238   warn_attribute_wrong_decl_type_str.Text>;
3239 def warn_attribute_wrong_decl_type : Warning<
3240   "%0 attribute only applies to %select{"
3241   "functions"
3242   "|unions"
3243   "|variables and functions"
3244   "|functions and methods"
3245   "|functions, methods and blocks"
3246   "|functions, methods, and parameters"
3247   "|variables"
3248   "|variables and fields"
3249   "|variables, data members and tag types"
3250   "|types and namespaces"
3251   "|variables, functions and classes"
3252   "|kernel functions"
3253   "|non-K&R-style functions}1">,
3254   InGroup<IgnoredAttributes>;
3255 def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3256 def warn_type_attribute_wrong_type : Warning<
3257   "'%0' only applies to %select{function|pointer|"
3258   "Objective-C object or block pointer}1 types; type here is %2">,
3259   InGroup<IgnoredAttributes>;
3260 def warn_incomplete_encoded_type : Warning<
3261   "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3262   InGroup<DiagGroup<"encode-type">>;
3263 def warn_gnu_inline_attribute_requires_inline : Warning<
3264   "'gnu_inline' attribute requires function to be marked 'inline',"
3265   " attribute ignored">,
3266   InGroup<IgnoredAttributes>;
3267 def warn_gnu_inline_cplusplus_without_extern : Warning<
3268   "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3269   " available, this changed in Clang 10">,
3270   InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3271 def err_attribute_vecreturn_only_vector_member : Error<
3272   "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3273 def err_attribute_vecreturn_only_pod_record : Error<
3274   "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3275 def err_cconv_change : Error<
3276   "function declared '%0' here was previously declared "
3277   "%select{'%2'|without calling convention}1">;
3278 def warn_cconv_unsupported : Warning<
3279   "%0 calling convention is not supported %select{"
3280   // Use CallingConventionIgnoredReason Enum to specify these.
3281   "for this target"
3282   "|on variadic function"
3283   "|on constructor/destructor"
3284   "|on builtin function"
3285   "}1">,
3286   InGroup<IgnoredAttributes>;
3287 def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3288 def err_cconv_knr : Error<
3289   "function with no prototype cannot use the %0 calling convention">;
3290 def warn_cconv_knr : Warning<
3291   err_cconv_knr.Text>,
3292   InGroup<DiagGroup<"missing-prototype-for-cc">>;
3293 def err_cconv_varargs : Error<
3294   "variadic function cannot use %0 calling convention">;
3295 def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3296   "attribute was previously declared "
3297   "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3298 def err_function_attribute_mismatch : Error<
3299   "function declared with %0 attribute "
3300   "was previously declared without the %0 attribute">;
3301 def err_objc_precise_lifetime_bad_type : Error<
3302   "objc_precise_lifetime only applies to retainable types; type here is %0">;
3303 def warn_objc_precise_lifetime_meaningless : Error<
3304   "objc_precise_lifetime is not meaningful for "
3305   "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3306 def err_invalid_pcs : Error<"invalid PCS type">;
3307 def warn_attribute_not_on_decl : Warning<
3308   "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3309 def err_base_specifier_attribute : Error<
3310   "%0 attribute cannot be applied to a base specifier">;
3311 def err_invalid_attribute_on_virtual_function : Error<
3312   "%0 attribute cannot be applied to virtual functions">;
3313 def warn_declspec_allocator_nonpointer : Warning<
3314   "ignoring __declspec(allocator) because the function return type %0 is not "
3315   "a pointer or reference type">, InGroup<IgnoredAttributes>;
3316 def err_cconv_incomplete_param_type : Error<
3317   "parameter %0 must have a complete type to use function %1 with the %2 "
3318   "calling convention">;
3319 def err_attribute_output_parameter : Error<
3320   "attribute only applies to output parameters">;
3321
3322 def ext_cannot_use_trivial_abi : ExtWarn<
3323   "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3324 def note_cannot_use_trivial_abi_reason : Note<
3325   "'trivial_abi' is disallowed on %0 because %select{"
3326   "its copy constructors and move constructors are all deleted|"
3327   "it is polymorphic|"
3328   "it has a base of a non-trivial class type|it has a virtual base|"
3329   "it has a __weak field|it has a field of a non-trivial class type}1">;
3330
3331 // Availability attribute
3332 def warn_availability_unknown_platform : Warning<
3333   "unknown platform %0 in availability macro">, InGroup<Availability>;
3334 def warn_availability_version_ordering : Warning<
3335   "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3336   "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3337   "attribute ignored">, InGroup<Availability>;
3338 def warn_mismatched_availability: Warning<
3339   "availability does not match previous declaration">, InGroup<Availability>;
3340 def warn_mismatched_availability_override : Warning<
3341   "%select{|overriding }4method %select{introduced after|"
3342   "deprecated before|obsoleted before}0 "
3343   "%select{the protocol method it implements|overridden method}4 "
3344   "on %1 (%2 vs. %3)">, InGroup<Availability>;
3345 def warn_mismatched_availability_override_unavail : Warning<
3346   "%select{|overriding }1method cannot be unavailable on %0 when "
3347   "%select{the protocol method it implements|its overridden method}1 is "
3348   "available">,
3349   InGroup<Availability>;
3350 def warn_availability_on_static_initializer : Warning<
3351   "ignoring availability attribute %select{on '+load' method|"
3352   "with constructor attribute|with destructor attribute}0">,
3353   InGroup<Availability>;
3354 def note_overridden_method : Note<
3355   "overridden method is here">;
3356 def warn_availability_swift_unavailable_deprecated_only : Warning<
3357   "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3358   InGroup<Availability>;
3359 def note_protocol_method : Note<
3360   "protocol method is here">;
3361
3362 def warn_unguarded_availability :
3363   Warning<"%0 is only available on %1 %2 or newer">,
3364   InGroup<UnguardedAvailability>, DefaultIgnore;
3365 def warn_unguarded_availability_new :
3366   Warning<warn_unguarded_availability.Text>,
3367   InGroup<UnguardedAvailabilityNew>;
3368 def note_decl_unguarded_availability_silence : Note<
3369   "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3370 def note_unguarded_available_silence : Note<
3371   "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3372   " this warning">;
3373 def warn_at_available_unchecked_use : Warning<
3374   "%select{@available|__builtin_available}0 does not guard availability here; "
3375   "use if (%select{@available|__builtin_available}0) instead">,
3376   InGroup<DiagGroup<"unsupported-availability-guard">>;
3377
3378 // Thread Safety Attributes
3379 def warn_thread_attribute_ignored : Warning<
3380   "ignoring %0 attribute because its argument is invalid">,
3381   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3382 def warn_thread_attribute_not_on_non_static_member : Warning<
3383   "%0 attribute without capability arguments can only be applied to non-static "
3384   "methods of a class">,
3385   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3386 def warn_thread_attribute_not_on_capability_member : Warning<
3387   "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3388   "annotated with 'capability' or 'scoped_lockable' attribute">,
3389   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3390 def warn_thread_attribute_argument_not_lockable : Warning<
3391   "%0 attribute requires arguments whose type is annotated "
3392   "with 'capability' attribute; type here is %1">,
3393   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3394 def warn_thread_attribute_decl_not_lockable : Warning<
3395   "%0 attribute can only be applied in a context annotated "
3396   "with 'capability' attribute">,
3397   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3398 def warn_thread_attribute_decl_not_pointer : Warning<
3399   "%0 only applies to pointer types; type here is %1">,
3400   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3401 def err_attribute_argument_out_of_bounds_extra_info : Error<
3402   "%0 attribute parameter %1 is out of bounds: "
3403   "%plural{0:no parameters to index into|"
3404   "1:can only be 1, since there is one parameter|"
3405   ":must be between 1 and %2}2">;
3406
3407 // Thread Safety Analysis
3408 def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3409   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3410 def warn_unlock_kind_mismatch : Warning<
3411   "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3412   "%select{shared|exclusive}3 access">,
3413   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3414 def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3415   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3416 def warn_no_unlock : Warning<
3417   "%0 '%1' is still held at the end of function">,
3418   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3419 def warn_expecting_locked : Warning<
3420   "expecting %0 '%1' to be held at the end of function">,
3421   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3422 // FIXME: improve the error message about locks not in scope
3423 def warn_lock_some_predecessors : Warning<
3424   "%0 '%1' is not held on every path through here">,
3425   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3426 def warn_expecting_lock_held_on_loop : Warning<
3427   "expecting %0 '%1' to be held at start of each loop">,
3428   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3429 def note_locked_here : Note<"%0 acquired here">;
3430 def note_unlocked_here : Note<"%0 released here">;
3431 def warn_lock_exclusive_and_shared : Warning<
3432   "%0 '%1' is acquired exclusively and shared in the same scope">,
3433   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3434 def note_lock_exclusive_and_shared : Note<
3435   "the other acquisition of %0 '%1' is here">;
3436 def warn_variable_requires_any_lock : Warning<
3437   "%select{reading|writing}1 variable %0 requires holding "
3438   "%select{any mutex|any mutex exclusively}1">,
3439   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3440 def warn_var_deref_requires_any_lock : Warning<
3441   "%select{reading|writing}1 the value pointed to by %0 requires holding "
3442   "%select{any mutex|any mutex exclusively}1">,
3443   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3444 def warn_fun_excludes_mutex : Warning<
3445   "cannot call function '%1' while %0 '%2' is held">,
3446   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3447 def warn_cannot_resolve_lock : Warning<
3448   "cannot resolve lock expression">,
3449   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3450 def warn_acquired_before : Warning<
3451   "%0 '%1' must be acquired before '%2'">,
3452   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3453 def warn_acquired_before_after_cycle : Warning<
3454   "Cycle in acquired_before/after dependencies, starting with '%0'">,
3455   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3456
3457
3458 // Thread safety warnings negative capabilities
3459 def warn_acquire_requires_negative_cap : Warning<
3460   "acquiring %0 '%1' requires negative capability '%2'">,
3461   InGroup<ThreadSafetyNegative>, DefaultIgnore;
3462
3463 // Thread safety warnings on pass by reference
3464 def warn_guarded_pass_by_reference : Warning<
3465   "passing variable %1 by reference requires holding %0 "
3466   "%select{'%2'|'%2' exclusively}3">,
3467   InGroup<ThreadSafetyReference>, DefaultIgnore;
3468 def warn_pt_guarded_pass_by_reference : Warning<
3469   "passing the value that %1 points to by reference requires holding %0 "
3470   "%select{'%2'|'%2' exclusively}3">,
3471   InGroup<ThreadSafetyReference>, DefaultIgnore;
3472
3473 // Imprecise thread safety warnings
3474 def warn_variable_requires_lock : Warning<
3475   "%select{reading|writing}3 variable %1 requires holding %0 "
3476   "%select{'%2'|'%2' exclusively}3">,
3477   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3478 def warn_var_deref_requires_lock : Warning<
3479   "%select{reading|writing}3 the value pointed to by %1 requires "
3480   "holding %0 %select{'%2'|'%2' exclusively}3">,
3481   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3482 def warn_fun_requires_lock : Warning<
3483   "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3484   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3485
3486 // Precise thread safety warnings
3487 def warn_variable_requires_lock_precise :
3488   Warning<warn_variable_requires_lock.Text>,
3489   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3490 def warn_var_deref_requires_lock_precise :
3491   Warning<warn_var_deref_requires_lock.Text>,
3492   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3493 def warn_fun_requires_lock_precise :
3494   Warning<warn_fun_requires_lock.Text>,
3495   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3496 def note_found_mutex_near_match : Note<"found near match '%0'">;
3497
3498 // Verbose thread safety warnings
3499 def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3500   InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3501 def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3502 def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3503
3504 // Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3505 def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3506   InGroup<ThreadSafetyBeta>, DefaultIgnore;
3507
3508 // Consumed warnings
3509 def warn_use_in_invalid_state : Warning<
3510   "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3511   "state">, InGroup<Consumed>, DefaultIgnore;
3512 def warn_use_of_temp_in_invalid_state : Warning<
3513   "invalid invocation of method '%0' on a temporary object while it is in the "
3514   "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3515 def warn_attr_on_unconsumable_class : Warning<
3516   "consumed analysis attribute is attached to member of class %0 which isn't "
3517   "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3518 def warn_return_typestate_for_unconsumable_type : Warning<
3519   "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3520   DefaultIgnore;
3521 def warn_return_typestate_mismatch : Warning<
3522   "return value not in expected state; expected '%0', observed '%1'">,
3523   InGroup<Consumed>, DefaultIgnore;
3524 def warn_loop_state_mismatch : Warning<
3525   "state of variable '%0' must match at the entry and exit of loop">,
3526   InGroup<Consumed>, DefaultIgnore;
3527 def warn_param_return_typestate_mismatch : Warning<
3528   "parameter '%0' not in expected state when the function returns: expected "
3529   "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3530 def warn_param_typestate_mismatch : Warning<
3531   "argument not in expected state; expected '%0', observed '%1'">,
3532   InGroup<Consumed>, DefaultIgnore;
3533
3534 // no_sanitize attribute
3535 def warn_unknown_sanitizer_ignored : Warning<
3536   "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3537
3538 def warn_impcast_vector_scalar : Warning<
3539   "implicit conversion turns vector to scalar: %0 to %1">,
3540   InGroup<Conversion>, DefaultIgnore;
3541 def warn_impcast_complex_scalar : Warning<
3542   "implicit conversion discards imaginary component: %0 to %1">,
3543   InGroup<Conversion>, DefaultIgnore;
3544 def err_impcast_complex_scalar : Error<
3545   "implicit conversion from %0 to %1 is not permitted in C++">;
3546 def warn_impcast_float_precision : Warning<
3547   "implicit conversion loses floating-point precision: %0 to %1">,
3548   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3549 def warn_impcast_float_result_precision : Warning<
3550   "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3551   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3552 def warn_impcast_double_promotion : Warning<
3553   "implicit conversion increases floating-point precision: %0 to %1">,
3554   InGroup<DoublePromotion>, DefaultIgnore;
3555 def warn_impcast_integer_sign : Warning<
3556   "implicit conversion changes signedness: %0 to %1">,
3557   InGroup<SignConversion>, DefaultIgnore;
3558 def warn_impcast_integer_sign_conditional : Warning<
3559   "operand of ? changes signedness: %0 to %1">,
3560   InGroup<SignConversion>, DefaultIgnore;
3561 def warn_impcast_integer_precision : Warning<
3562   "implicit conversion loses integer precision: %0 to %1">,
3563   InGroup<ImplicitIntConversion>, DefaultIgnore;
3564 def warn_impcast_high_order_zero_bits : Warning<
3565   "higher order bits are zeroes after implicit conversion">,
3566   InGroup<ImplicitIntConversion>, DefaultIgnore;
3567 def warn_impcast_nonnegative_result : Warning<
3568   "the resulting value is always non-negative after implicit conversion">,
3569   InGroup<SignConversion>, DefaultIgnore;
3570 def warn_impcast_integer_64_32 : Warning<
3571   "implicit conversion loses integer precision: %0 to %1">,
3572   InGroup<Shorten64To32>, DefaultIgnore;
3573 def warn_impcast_integer_precision_constant : Warning<
3574   "implicit conversion from %2 to %3 changes value from %0 to %1">,
3575   InGroup<ConstantConversion>;
3576 def warn_impcast_bitfield_precision_constant : Warning<
3577   "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3578   InGroup<BitFieldConstantConversion>;
3579 def warn_impcast_constant_value_to_objc_bool : Warning<
3580   "implicit conversion from constant value %0 to 'BOOL'; "
3581   "the only well defined values for 'BOOL' are YES and NO">,
3582   InGroup<ObjCBoolConstantConversion>;
3583
3584 def warn_impcast_fixed_point_range : Warning<
3585   "implicit conversion from %0 cannot fit within the range of values for %1">,
3586   InGroup<ImplicitFixedPointConversion>;
3587
3588 def warn_impcast_literal_float_to_integer : Warning<
3589   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3590   InGroup<LiteralConversion>;
3591 def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3592   "implicit conversion of out of range value from %0 to %1 is undefined">,
3593   InGroup<LiteralConversion>;
3594 def warn_impcast_float_integer : Warning<
3595   "implicit conversion turns floating-point number into integer: %0 to %1">,
3596   InGroup<FloatConversion>, DefaultIgnore;
3597 def warn_impcast_float_to_objc_signed_char_bool : Warning<
3598   "implicit conversion from floating-point type %0 to 'BOOL'">,
3599   InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3600 def warn_impcast_int_to_objc_signed_char_bool : Warning<
3601   "implicit conversion from integral type %0 to 'BOOL'">,
3602   InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3603
3604 // Implicit int -> float conversion precision loss warnings.
3605 def warn_impcast_integer_float_precision : Warning<
3606   "implicit conversion from %0 to %1 may lose precision">,
3607   InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3608 def warn_impcast_integer_float_precision_constant : Warning<
3609   "implicit conversion from %2 to %3 changes value from %0 to %1">,
3610   InGroup<ImplicitConstIntFloatConversion>;
3611
3612 def warn_impcast_float_to_integer : Warning<
3613   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3614   InGroup<FloatOverflowConversion>, DefaultIgnore;
3615 def warn_impcast_float_to_integer_out_of_range : Warning<
3616   "implicit conversion of out of range value from %0 to %1 is undefined">,
3617   InGroup<FloatOverflowConversion>, DefaultIgnore;
3618 def warn_impcast_float_to_integer_zero : Warning<
3619   "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3620   InGroup<FloatZeroConversion>, DefaultIgnore;
3621
3622 def warn_impcast_string_literal_to_bool : Warning<
3623   "implicit conversion turns string literal into bool: %0 to %1">,
3624   InGroup<StringConversion>, DefaultIgnore;
3625 def warn_impcast_different_enum_types : Warning<
3626   "implicit conversion from enumeration type %0 to different enumeration type "
3627   "%1">, InGroup<EnumConversion>;
3628 def warn_impcast_bool_to_null_pointer : Warning<
3629     "initialization of pointer of type %0 to null from a constant boolean "
3630     "expression">, InGroup<BoolConversion>;
3631 def warn_non_literal_null_pointer : Warning<
3632     "expression which evaluates to zero treated as a null pointer constant of "
3633     "type %0">, InGroup<NonLiteralNullConversion>;
3634 def warn_pointer_compare : Warning<
3635     "comparing a pointer to a null character constant; did you mean "
3636     "to compare to %select{NULL|(void *)0}0?">,
3637     InGroup<DiagGroup<"pointer-compare">>;
3638 def warn_impcast_null_pointer_to_integer : Warning<
3639     "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3640     InGroup<NullConversion>;
3641 def warn_impcast_floating_point_to_bool : Warning<
3642     "implicit conversion turns floating-point number into bool: %0 to %1">,
3643     InGroup<ImplicitConversionFloatingPointToBool>;
3644 def ext_ms_impcast_fn_obj : ExtWarn<
3645   "implicit conversion between pointer-to-function and pointer-to-object is a "
3646   "Microsoft extension">, InGroup<MicrosoftCast>;
3647
3648 def warn_impcast_pointer_to_bool : Warning<
3649     "address of%select{| function| array}0 '%1' will always evaluate to "
3650     "'true'">,
3651     InGroup<PointerBoolConversion>;
3652 def warn_cast_nonnull_to_bool : Warning<
3653     "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3654     "'true' on first encounter">,
3655     InGroup<PointerBoolConversion>;
3656 def warn_this_bool_conversion : Warning<
3657   "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3658   "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3659 def warn_address_of_reference_bool_conversion : Warning<
3660   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3661   "code; pointer may be assumed to always convert to true">,
3662   InGroup<UndefinedBoolConversion>;
3663
3664 def warn_xor_used_as_pow : Warning<
3665   "result of '%0' is %1; did you mean exponentiation?">,
3666   InGroup<XorUsedAsPow>;
3667 def warn_xor_used_as_pow_base_extra : Warning<
3668   "result of '%0' is %1; did you mean '%2' (%3)?">,
3669   InGroup<XorUsedAsPow>;
3670 def warn_xor_used_as_pow_base : Warning<
3671   "result of '%0' is %1; did you mean '%2'?">,
3672   InGroup<XorUsedAsPow>;
3673 def note_xor_used_as_pow_silence : Note<
3674   "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3675
3676 def warn_null_pointer_compare : Warning<
3677     "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3678     "equal to a null pointer is always %select{true|false}2">,
3679     InGroup<TautologicalPointerCompare>;
3680 def warn_nonnull_expr_compare : Warning<
3681     "comparison of nonnull %select{function call|parameter}0 '%1' "
3682     "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3683     "encounter">,
3684     InGroup<TautologicalPointerCompare>;
3685 def warn_this_null_compare : Warning<
3686   "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3687   "assumed to always evaluate to %select{true|false}0">,
3688   InGroup<TautologicalUndefinedCompare>;
3689 def warn_address_of_reference_null_compare : Warning<
3690   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3691   "code; comparison may be assumed to always evaluate to "
3692   "%select{true|false}0">,
3693   InGroup<TautologicalUndefinedCompare>;
3694 def note_reference_is_return_value : Note<"%0 returns a reference">;
3695
3696 def note_pointer_declared_here : Note<
3697   "pointer %0 declared here">;
3698 def warn_division_sizeof_ptr : Warning<
3699   "'%0' will return the size of the pointer, not the array itself">,
3700   InGroup<DiagGroup<"sizeof-pointer-div">>;
3701 def warn_division_sizeof_array : Warning<
3702   "expression does not compute the number of elements in this array; element "
3703   "type is %0, not %1">,
3704   InGroup<DiagGroup<"sizeof-array-div">>;
3705
3706 def note_function_warning_silence : Note<
3707     "prefix with the address-of operator to silence this warning">;
3708 def note_function_to_function_call : Note<
3709     "suffix with parentheses to turn this into a function call">;
3710 def warn_impcast_objective_c_literal_to_bool : Warning<
3711     "implicit boolean conversion of Objective-C object literal always "
3712     "evaluates to true">,
3713     InGroup<ObjCLiteralConversion>;
3714
3715 def warn_cast_align : Warning<
3716   "cast from %0 to %1 increases required alignment from %2 to %3">,
3717   InGroup<CastAlign>, DefaultIgnore;
3718 def warn_old_style_cast : Warning<
3719   "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3720
3721 // Separate between casts to void* and non-void* pointers.
3722 // Some APIs use (abuse) void* for something like a user context,
3723 // and often that value is an integer even if it isn't a pointer itself.
3724 // Having a separate warning flag allows users to control the warning
3725 // for their workflow.
3726 def warn_int_to_pointer_cast : Warning<
3727   "cast to %1 from smaller integer type %0">,
3728   InGroup<IntToPointerCast>;
3729 def warn_int_to_void_pointer_cast : Warning<
3730   "cast to %1 from smaller integer type %0">,
3731   InGroup<IntToVoidPointerCast>;
3732 def warn_pointer_to_int_cast : Warning<
3733   "cast to smaller integer type %1 from %0">,
3734   InGroup<PointerToIntCast>;
3735 def warn_pointer_to_enum_cast : Warning<
3736   warn_pointer_to_int_cast.Text>,
3737   InGroup<PointerToEnumCast>;
3738 def warn_void_pointer_to_int_cast : Warning<
3739   "cast to smaller integer type %1 from %0">,
3740   InGroup<VoidPointerToIntCast>;
3741 def warn_void_pointer_to_enum_cast : Warning<
3742   warn_void_pointer_to_int_cast.Text>,
3743   InGroup<VoidPointerToEnumCast>;
3744
3745 def warn_attribute_ignored_for_field_of_type : Warning<
3746   "%0 attribute ignored for field of type %1">,
3747   InGroup<IgnoredAttributes>;
3748 def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3749   "enums in the Microsoft ABI are signed integers by default; consider giving "
3750   "the enum %0 an unsigned underlying type to make this code portable">,
3751   InGroup<SignedEnumBitfield>, DefaultIgnore;
3752 def warn_attribute_packed_for_bitfield : Warning<
3753   "'packed' attribute was ignored on bit-fields with single-byte alignment "
3754   "in older versions of GCC and Clang">,
3755   InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3756 def warn_transparent_union_attribute_field_size_align : Warning<
3757   "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3758   "%select{alignment|size}0 of the first field in transparent union; "
3759   "transparent_union attribute ignored">,
3760   InGroup<IgnoredAttributes>;
3761 def note_transparent_union_first_field_size_align : Note<
3762   "%select{alignment|size}0 of first field is %1 bits">;
3763 def warn_transparent_union_attribute_not_definition : Warning<
3764   "transparent_union attribute can only be applied to a union definition; "
3765   "attribute ignored">,
3766   InGroup<IgnoredAttributes>;
3767 def warn_transparent_union_attribute_floating : Warning<
3768   "first field of a transparent union cannot have %select{floating point|"
3769   "vector}0 type %1; transparent_union attribute ignored">,
3770   InGroup<IgnoredAttributes>;
3771 def warn_transparent_union_attribute_zero_fields : Warning<
3772   "transparent union definition must contain at least one field; "
3773   "transparent_union attribute ignored">,
3774   InGroup<IgnoredAttributes>;
3775 def warn_attribute_type_not_supported : Warning<
3776   "%0 attribute argument not supported: %1">,
3777   InGroup<IgnoredAttributes>;
3778 def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3779   InGroup<IgnoredAttributes>;
3780 def warn_attribute_protected_visibility :
3781   Warning<"target does not support 'protected' visibility; using 'default'">,
3782   InGroup<DiagGroup<"unsupported-visibility">>;
3783 def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3784 def note_previous_attribute : Note<"previous attribute is here">;
3785 def note_conflicting_attribute : Note<"conflicting attribute is here">;
3786 def note_attribute : Note<"attribute is here">;
3787 def err_mismatched_ms_inheritance : Error<
3788   "inheritance model does not match %select{definition|previous declaration}0">;
3789 def warn_ignored_ms_inheritance : Warning<
3790   "inheritance model ignored on %select{primary template|partial specialization}0">,
3791   InGroup<IgnoredAttributes>;
3792 def note_previous_ms_inheritance : Note<
3793   "previous inheritance model specified here">;
3794 def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3795 def err_mode_not_primitive : Error<
3796   "mode attribute only supported for integer and floating-point types">;
3797 def err_mode_wrong_type : Error<
3798   "type of machine mode does not match type of base type">;
3799 def warn_vector_mode_deprecated : Warning<
3800   "specifying vector types with the 'mode' attribute is deprecated; "
3801   "use the 'vector_size' attribute instead">,
3802   InGroup<DeprecatedAttributes>;
3803 def err_complex_mode_vector_type : Error<
3804   "type of machine mode does not support base vector types">;
3805 def err_enum_mode_vector_type : Error<
3806   "mode %0 is not supported for enumeration types">;
3807 def warn_attribute_nonnull_no_pointers : Warning<
3808   "'nonnull' attribute applied to function with no pointer arguments">,
3809   InGroup<IgnoredAttributes>;
3810 def warn_attribute_nonnull_parm_no_args : Warning<
3811   "'nonnull' attribute when used on parameters takes no arguments">,
3812   InGroup<IgnoredAttributes>;
3813 def note_declared_nonnull : Note<
3814   "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3815 def warn_attribute_sentinel_named_arguments : Warning<
3816   "'sentinel' attribute requires named arguments">,
3817   InGroup<IgnoredAttributes>;
3818 def warn_attribute_sentinel_not_variadic : Warning<
3819   "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3820   InGroup<IgnoredAttributes>;
3821 def err_attribute_sentinel_less_than_zero : Error<
3822   "'sentinel' parameter 1 less than zero">;
3823 def err_attribute_sentinel_not_zero_or_one : Error<
3824   "'sentinel' parameter 2 not 0 or 1">;
3825 def warn_cleanup_ext : Warning<
3826   "GCC does not allow the 'cleanup' attribute argument to be anything other "
3827   "than a simple identifier">,
3828   InGroup<GccCompat>;
3829 def err_attribute_cleanup_arg_not_function : Error<
3830   "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3831 def err_attribute_cleanup_func_must_take_one_arg : Error<
3832   "'cleanup' function %0 must take 1 parameter">;
3833 def err_attribute_cleanup_func_arg_incompatible_type : Error<
3834   "'cleanup' function %0 parameter has "
3835   "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3836 def err_attribute_regparm_wrong_platform : Error<
3837   "'regparm' is not valid on this platform">;
3838 def err_attribute_regparm_invalid_number : Error<
3839   "'regparm' parameter must be between 0 and %0 inclusive">;
3840 def err_attribute_not_supported_in_lang : Error<
3841   "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3842 def err_attribute_not_supported_on_arch
3843     : Error<"%0 attribute is not supported on '%1'">;
3844 def warn_gcc_ignores_type_attr : Warning<
3845   "GCC does not allow the %0 attribute to be written on a type">,
3846   InGroup<GccCompat>;
3847
3848 // Clang-Specific Attributes
3849 def warn_attribute_iboutlet : Warning<
3850   "%0 attribute can only be applied to instance variables or properties">,
3851   InGroup<IgnoredAttributes>;
3852 def err_iboutletcollection_type : Error<
3853   "invalid type %0 as argument of iboutletcollection attribute">;
3854 def err_iboutletcollection_builtintype : Error<
3855   "type argument of iboutletcollection attribute cannot be a builtin type">;
3856 def warn_iboutlet_object_type : Warning<
3857   "%select{instance variable|property}2 with %0 attribute must "
3858   "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3859 def warn_iboutletcollection_property_assign : Warning<
3860   "IBOutletCollection properties should be copy/strong and not assign">,
3861   InGroup<ObjCInvalidIBOutletProperty>;
3862
3863 def err_attribute_overloadable_mismatch : Error<
3864   "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
3865 def note_attribute_overloadable_prev_overload : Note<
3866   "previous %select{unmarked |}0overload of function is here">;
3867 def err_attribute_overloadable_no_prototype : Error<
3868   "'overloadable' function %0 must have a prototype">;
3869 def err_attribute_overloadable_multiple_unmarked_overloads : Error<
3870   "at most one overload for a given name may lack the 'overloadable' "
3871   "attribute">;
3872 def warn_attribute_no_builtin_invalid_builtin_name : Warning<
3873   "'%0' is not a valid builtin name for %1">,
3874   InGroup<DiagGroup<"invalid-no-builtin-names">>;
3875 def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
3876   "empty %0 cannot be composed with named ones">;
3877 def err_attribute_no_builtin_on_non_definition : Error<
3878   "%0 attribute is permitted on definitions only">;
3879 def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
3880   "%0 attribute has no effect on defaulted or deleted functions">;
3881 def warn_ns_attribute_wrong_return_type : Warning<
3882   "%0 attribute only applies to %select{functions|methods|properties}1 that "
3883   "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
3884   InGroup<IgnoredAttributes>;
3885 def err_ns_attribute_wrong_parameter_type : Error<
3886   "%0 attribute only applies to "
3887   "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
3888 def warn_ns_attribute_wrong_parameter_type : Warning<
3889   "%0 attribute only applies to "
3890   "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
3891   InGroup<IgnoredAttributes>;
3892 def warn_objc_requires_super_protocol : Warning<
3893   "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
3894   InGroup<DiagGroup<"requires-super-attribute">>;
3895 def note_protocol_decl : Note<
3896   "protocol is declared here">;
3897 def note_protocol_decl_undefined : Note<
3898   "protocol %0 has no definition">;
3899
3900 // objc_designated_initializer attribute diagnostics.
3901 def warn_objc_designated_init_missing_super_call : Warning<
3902   "designated initializer missing a 'super' call to a designated initializer of the super class">,
3903   InGroup<ObjCDesignatedInit>;
3904 def note_objc_designated_init_marked_here : Note<
3905   "method marked as designated initializer of the class here">;
3906 def warn_objc_designated_init_non_super_designated_init_call : Warning<
3907   "designated initializer should only invoke a designated initializer on 'super'">,
3908   InGroup<ObjCDesignatedInit>;
3909 def warn_objc_designated_init_non_designated_init_call : Warning<
3910   "designated initializer invoked a non-designated initializer">,
3911   InGroup<ObjCDesignatedInit>;
3912 def warn_objc_secondary_init_super_init_call : Warning<
3913   "convenience initializer should not invoke an initializer on 'super'">,
3914   InGroup<ObjCDesignatedInit>;
3915 def warn_objc_secondary_init_missing_init_call : Warning<
3916   "convenience initializer missing a 'self' call to another initializer">,
3917   InGroup<ObjCDesignatedInit>;
3918 def warn_objc_implementation_missing_designated_init_override : Warning<
3919   "method override for the designated initializer of the superclass %objcinstance0 not found">,
3920   InGroup<ObjCDesignatedInit>;
3921 def err_designated_init_attr_non_init : Error<
3922   "'objc_designated_initializer' attribute only applies to init methods "
3923   "of interface or class extension declarations">;
3924
3925 // objc_bridge attribute diagnostics.
3926 def err_objc_attr_not_id : Error<
3927   "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
3928 def err_objc_attr_typedef_not_id : Error<
3929   "parameter of %0 attribute must be 'id' when used on a typedef">;
3930 def err_objc_attr_typedef_not_void_pointer : Error<
3931   "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
3932 def err_objc_cf_bridged_not_interface : Error<
3933   "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
3934 def err_objc_ns_bridged_invalid_cfobject : Error<
3935   "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
3936 def warn_objc_invalid_bridge : Warning<
3937   "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
3938 def warn_objc_invalid_bridge_to_cf : Warning<
3939   "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
3940
3941 // objc_bridge_related attribute diagnostics.
3942 def err_objc_bridged_related_invalid_class : Error<
3943   "could not find Objective-C class %0 to convert %1 to %2">;
3944 def err_objc_bridged_related_invalid_class_name : Error<
3945   "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
3946 def err_objc_bridged_related_known_method : Error<
3947  "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
3948  "method for this conversion">;
3949
3950 def err_objc_attr_protocol_requires_definition : Error<
3951   "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
3952
3953 def warn_ignored_objc_externally_retained : Warning<
3954   "'objc_externally_retained' can only be applied to local variables "
3955   "%select{of retainable type|with strong ownership}0">,
3956   InGroup<IgnoredAttributes>;
3957
3958 // Function Parameter Semantic Analysis.
3959 def err_param_with_void_type : Error<"argument may not have 'void' type">;
3960 def err_void_only_param : Error<
3961   "'void' must be the first and only parameter if specified">;
3962 def err_void_param_qualified : Error<
3963   "'void' as parameter must not have type qualifiers">;
3964 def err_ident_list_in_fn_declaration : Error<
3965   "a parameter list without types is only allowed in a function definition">;
3966 def ext_param_not_declared : Extension<
3967   "parameter %0 was not declared, defaulting to type 'int'">;
3968 def err_param_default_argument : Error<
3969   "C does not support default arguments">;
3970 def err_param_default_argument_redefinition : Error<
3971   "redefinition of default argument">;
3972 def ext_param_default_argument_redefinition : ExtWarn<
3973   err_param_default_argument_redefinition.Text>,
3974   InGroup<MicrosoftDefaultArgRedefinition>;
3975 def err_param_default_argument_missing : Error<
3976   "missing default argument on parameter">;
3977 def err_param_default_argument_missing_name : Error<
3978   "missing default argument on parameter %0">;
3979 def err_param_default_argument_references_param : Error<
3980   "default argument references parameter %0">;
3981 def err_param_default_argument_references_local : Error<
3982   "default argument references local variable %0 of enclosing function">;
3983 def err_param_default_argument_references_this : Error<
3984   "default argument references 'this'">;
3985 def err_param_default_argument_nonfunc : Error<
3986   "default arguments can only be specified for parameters in a function "
3987   "declaration">;
3988 def err_param_default_argument_template_redecl : Error<
3989   "default arguments cannot be added to a function template that has already "
3990   "been declared">;
3991 def err_param_default_argument_member_template_redecl : Error<
3992   "default arguments cannot be added to an out-of-line definition of a member "
3993   "of a %select{class template|class template partial specialization|nested "
3994   "class in a template}0">;
3995 def err_param_default_argument_on_parameter_pack : Error<
3996   "parameter pack cannot have a default argument">;
3997 def err_uninitialized_member_for_assign : Error<
3998   "cannot define the implicit copy assignment operator for %0, because "
3999   "non-static %select{reference|const}1 member %2 cannot use copy "
4000   "assignment operator">;
4001 def err_uninitialized_member_in_ctor : Error<
4002   "%select{constructor for %1|"
4003   "implicit default constructor for %1|"
4004   "cannot use constructor inherited from %1:}0 must explicitly "
4005   "initialize the %select{reference|const}2 member %3">;
4006 def err_default_arg_makes_ctor_special : Error<
4007   "addition of default argument on redeclaration makes this constructor a "
4008   "%select{default|copy|move}0 constructor">;
4009
4010 def err_use_of_default_argument_to_function_declared_later : Error<
4011   "use of default argument to function %0 that is declared later in class %1">;
4012 def note_default_argument_declared_here : Note<
4013   "default argument declared here">;
4014 def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4015 def note_recursive_default_argument_used_here : Note<
4016   "default argument used here">;
4017
4018 def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4019   "%diff{promoted type $ of K&R function parameter is not compatible with the "
4020   "parameter type $|promoted type of K&R function parameter is not compatible "
4021   "with parameter type}0,1 declared in a previous prototype">,
4022   InGroup<KNRPromotedParameter>;
4023
4024
4025 // C++ Overloading Semantic Analysis.
4026 def err_ovl_diff_return_type : Error<
4027   "functions that differ only in their return type cannot be overloaded">;
4028 def err_ovl_static_nonstatic_member : Error<
4029   "static and non-static member functions with the same parameter types "
4030   "cannot be overloaded">;
4031
4032 def err_ovl_no_viable_function_in_call : Error<
4033   "no matching function for call to %0">;
4034 def err_ovl_no_viable_member_function_in_call : Error<
4035   "no matching member function for call to %0">;
4036 def err_ovl_ambiguous_call : Error<
4037   "call to %0 is ambiguous">;
4038 def err_ovl_deleted_call : Error<"call to deleted function %0">;
4039 def err_ovl_ambiguous_member_call : Error<
4040   "call to member function %0 is ambiguous">;
4041 def err_ovl_deleted_member_call : Error<
4042   "call to deleted member function %0">;
4043 def note_ovl_too_many_candidates : Note<
4044     "remaining %0 candidate%s0 omitted; "
4045     "pass -fshow-overloads=all to show them">;
4046
4047 def select_ovl_candidate_kind : TextSubstitution<
4048   "%select{function|function|function (with reversed parameter order)|"
4049     "constructor|"
4050     "constructor (the implicit default constructor)|"
4051     "constructor (the implicit copy constructor)|"
4052     "constructor (the implicit move constructor)|"
4053     "function (the implicit copy assignment operator)|"
4054     "function (the implicit move assignment operator)|"
4055     "function (the implicit 'operator==' for this 'operator<=>)'|"
4056     "inherited constructor}0%select{| template| %2}1">;
4057
4058 def note_ovl_candidate : Note<
4059     "candidate %sub{select_ovl_candidate_kind}0,1,3"
4060     "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4061     "| has different number of parameters (expected %5 but has %6)"
4062     "| has type mismatch at %ordinal5 parameter"
4063     "%diff{ (expected $ but has $)|}6,7"
4064     "| has different return type%diff{ ($ expected but has $)|}5,6"
4065     "| has different qualifiers (expected %5 but found %6)"
4066     "| has different exception specification}4">;
4067
4068 def note_ovl_candidate_explicit : Note<
4069     "explicit %select{constructor|conversion function|deduction guide}0 "
4070     "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4071 def note_ovl_candidate_inherited_constructor : Note<
4072     "constructor from base class %0 inherited here">;
4073 def note_ovl_candidate_inherited_constructor_slice : Note<
4074     "candidate %select{constructor|template}0 ignored: "
4075     "inherited constructor cannot be used to %select{copy|move}1 object">;
4076 def note_ovl_candidate_illegal_constructor : Note<
4077     "candidate %select{constructor|template}0 ignored: "
4078     "instantiation %select{takes|would take}0 its own class type by value">;
4079 def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4080     "candidate constructor ignored: cannot be used to construct an object "
4081     "in address space %0">;
4082 def note_ovl_candidate_bad_deduction : Note<
4083     "candidate template ignored: failed template argument deduction">;
4084 def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4085     "couldn't infer template argument %0">;
4086 def note_ovl_candidate_incomplete_deduction_pack : Note<
4087     "candidate template ignored: "
4088     "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4089     "expanded parameter in deduced argument pack %2">;
4090 def note_ovl_candidate_inconsistent_deduction : Note<
4091     "candidate template ignored: deduced %select{conflicting types|"
4092     "conflicting values|conflicting templates|packs of different lengths}0 "
4093     "for parameter %1%diff{ ($ vs. $)|}2,3">;
4094 def note_ovl_candidate_inconsistent_deduction_types : Note<
4095     "candidate template ignored: deduced values %diff{"
4096     "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4097     "%1 and %3 of conflicting types for parameter %0}2,4">;
4098 def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4099     "candidate template ignored: invalid explicitly-specified argument "
4100     "for template parameter %0">;
4101 def note_ovl_candidate_unsatisfied_constraints : Note<
4102     "candidate template ignored: constraints not satisfied%0">;
4103 def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4104     "candidate template ignored: invalid explicitly-specified argument "
4105     "for %ordinal0 template parameter">;
4106 def note_ovl_candidate_instantiation_depth : Note<
4107     "candidate template ignored: substitution exceeded maximum template "
4108     "instantiation depth">;
4109 def note_ovl_candidate_underqualified : Note<
4110     "candidate template ignored: cannot deduce a type for %0 that would "
4111     "make %2 equal %1">;
4112 def note_ovl_candidate_substitution_failure : Note<
4113     "candidate template ignored: substitution failure%0%1">;
4114 def note_ovl_candidate_disabled_by_enable_if : Note<
4115     "candidate template ignored: disabled by %0%1">;
4116 def note_ovl_candidate_disabled_by_requirement : Note<
4117     "candidate template ignored: requirement '%0' was not satisfied%1">;
4118 def note_ovl_candidate_has_pass_object_size_params: Note<
4119     "candidate address cannot be taken because parameter %0 has "
4120     "pass_object_size attribute">;
4121 def err_diagnose_if_succeeded : Error<"%0">;
4122 def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4123     ShowInSystemHeader;
4124 def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4125     "candidate disabled: %0">;
4126 def note_ovl_candidate_disabled_by_extension : Note<
4127     "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
4128 def err_addrof_function_disabled_by_enable_if_attr : Error<
4129     "cannot take address of function %0 because it has one or more "
4130     "non-tautological enable_if conditions">;
4131 def err_addrof_function_constraints_not_satisfied : Error<
4132     "cannot take address of function %0 because its constraints are not "
4133     "satisfied">;
4134 def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4135     "candidate function made ineligible by enable_if">;
4136 def note_ovl_candidate_deduced_mismatch : Note<
4137     "candidate template ignored: deduced type "
4138     "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4139     "adjusted type $ of %select{|element of }4argument"
4140     "|of %select{|element of }4%ordinal0 parameter does not match "
4141     "adjusted type of %select{|element of }4argument}1,2%3">;
4142 def note_ovl_candidate_non_deduced_mismatch : Note<
4143     "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4144 // This note is needed because the above note would sometimes print two
4145 // different types with the same name.  Remove this note when the above note
4146 // can handle that case properly.
4147 def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4148     "candidate template ignored: could not match %q0 against %q1">;
4149
4150 // Note that we don't treat templates differently for this diagnostic.
4151 def note_ovl_candidate_arity : Note<"candidate "
4152     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4153     "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4154     "%plural{1:was|:were}5 provided">;
4155
4156 def note_ovl_candidate_arity_one : Note<"candidate "
4157     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4158     "%select{requires at least|allows at most single|requires single}3 "
4159     "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4160
4161 def note_ovl_candidate_deleted : Note<
4162     "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4163     "%select{explicitly made unavailable|explicitly deleted|"
4164     "implicitly deleted}3">;
4165
4166 // Giving the index of the bad argument really clutters this message, and
4167 // it's relatively unimportant because 1) it's generally obvious which
4168 // argument(s) are of the given object type and 2) the fix is usually
4169 // to complete the type, which doesn't involve changes to the call line
4170 // anyway.  If people complain, we can change it.
4171 def note_ovl_candidate_bad_conv_incomplete : Note<
4172     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4173     "cannot convert argument of incomplete type "
4174     "%diff{$ to $|to parameter type}3,4 for "
4175     "%select{%ordinal6 argument|object argument}5"
4176     "%select{|; dereference the argument with *|"
4177     "; take the address of the argument with &|"
4178     "; remove *|"
4179     "; remove &}7">;
4180 def note_ovl_candidate_bad_list_argument : Note<
4181     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4182     "cannot convert initializer list argument to %4">;
4183 def note_ovl_candidate_bad_overload : Note<
4184     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4185     "no overload of %4 matching %3 for %ordinal5 argument">;
4186 def note_ovl_candidate_bad_conv : Note<
4187     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4188     "no known conversion "
4189     "%diff{from $ to $|from argument type to parameter type}3,4 for "
4190     "%select{%ordinal6 argument|object argument}5"
4191     "%select{|; dereference the argument with *|"
4192     "; take the address of the argument with &|"
4193     "; remove *|"
4194     "; remove &}7">;
4195 def note_ovl_candidate_bad_arc_conv : Note<
4196     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4197     "cannot implicitly convert argument "
4198     "%diff{of type $ to $|type to parameter type}3,4 for "
4199     "%select{%ordinal6 argument|object argument}5 under ARC">;
4200 def note_ovl_candidate_bad_lvalue : Note<
4201     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4202     "expects an l-value for "
4203     "%select{%ordinal4 argument|object argument}3">;
4204 def note_ovl_candidate_bad_addrspace : Note<
4205     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4206     "cannot %select{pass pointer to|bind reference in}5 %3 "
4207     "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4208     "argument">;
4209 def note_ovl_candidate_bad_addrspace_this : Note<
4210     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4211     "'this' object is in %3, but method expects object in %4">;
4212 def note_ovl_candidate_bad_gc : Note<
4213     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4214     "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4215     "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4216 def note_ovl_candidate_bad_ownership : Note<
4217     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4218     "%select{%ordinal7|'this'}6 argument (%3) has "
4219     "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4220     " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4221     "__autoreleasing}5 ownership">;
4222 def note_ovl_candidate_bad_cvr_this : Note<
4223     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4224     "'this' argument has type %3, but method is not marked "
4225     "%select{const|restrict|const or restrict|volatile|const or volatile|"
4226     "volatile or restrict|const, volatile, or restrict}4">;
4227 def note_ovl_candidate_bad_cvr : Note<
4228     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4229     "%ordinal5 argument (%3) would lose "
4230     "%select{const|restrict|const and restrict|volatile|const and volatile|"
4231     "volatile and restrict|const, volatile, and restrict}4 qualifier"
4232     "%select{||s||s|s|s}4">;
4233 def note_ovl_candidate_bad_unaligned : Note<
4234     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4235     "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4236 def note_ovl_candidate_bad_base_to_derived_conv : Note<
4237     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4238     "cannot %select{convert from|convert from|bind}3 "
4239     "%select{base class pointer|superclass|base class object of type}3 %4 to "
4240     "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4241     "%ordinal6 argument">;
4242 def note_ovl_candidate_bad_target : Note<
4243     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4244     "call to "
4245     "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4246     " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4247 def note_ovl_candidate_constraints_not_satisfied : Note<
4248     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4249     "not satisfied">;
4250 def note_implicit_member_target_infer_collision : Note<
4251     "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4252     "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4253     "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4254
4255 def note_ambiguous_type_conversion: Note<
4256     "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4257 def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4258 def err_ovl_no_viable_function_in_init : Error<
4259   "no matching constructor for initialization of %0">;
4260 def err_ovl_no_conversion_in_cast : Error<
4261   "cannot convert %1 to %2 without a conversion operator">;
4262 def err_ovl_no_viable_conversion_in_cast : Error<
4263   "no matching conversion for %select{|static_cast|reinterpret_cast|"
4264   "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4265 def err_ovl_ambiguous_conversion_in_cast : Error<
4266   "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4267   "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4268 def err_ovl_deleted_conversion_in_cast : Error<
4269   "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4270   "functional-style cast|}0 from %1 to %2 uses deleted function">;
4271 def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4272 def err_ref_init_ambiguous : Error<
4273   "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4274 def err_ovl_deleted_init : Error<
4275   "call to deleted constructor of %0">;
4276 def err_ovl_deleted_special_init : Error<
4277   "call to implicitly-deleted %select{default constructor|copy constructor|"
4278   "move constructor|copy assignment operator|move assignment operator|"
4279   "destructor|function}0 of %1">;
4280 def err_ovl_ambiguous_oper_unary : Error<
4281   "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4282 def err_ovl_ambiguous_oper_binary : Error<
4283   "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4284 def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4285   "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4286   "and %2) to be ambiguous despite there being a unique best viable function"
4287   "%select{ with non-reversed arguments|}3">,
4288   InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4289 def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4290   "ambiguity is between a regular call to this operator and a call with the "
4291   "argument order reversed">;
4292 def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4293   "candidate function with non-reversed arguments">;
4294 def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4295   "ambiguous candidate function with reversed arguments">;
4296 def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4297 def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4298 def err_ovl_deleted_oper : Error<
4299   "overload resolution selected deleted operator '%0'">;
4300 def err_ovl_deleted_special_oper : Error<
4301   "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4302   "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4303   "implicitly deleted">;
4304 def err_ovl_deleted_comparison : Error<
4305   "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4306 def err_ovl_rewrite_equalequal_not_bool : Error<
4307   "return type %0 of selected 'operator==' function for rewritten "
4308   "'%1' comparison is not 'bool'">;
4309 def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4310   "ISO C++20 requires return type of selected 'operator==' function for "
4311   "rewritten '%1' comparison to be 'bool', not %0">,
4312   InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4313 def err_ovl_no_viable_subscript :
4314     Error<"no viable overloaded operator[] for type %0">;
4315 def err_ovl_no_oper :
4316     Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4317 def err_ovl_unresolvable : Error<
4318   "reference to %select{overloaded|multiversioned}1 function could not be "
4319   "resolved; did you mean to call it%select{| with no arguments}0?">;
4320 def err_bound_member_function : Error<
4321   "reference to non-static member function must be called"
4322   "%select{|; did you mean to call it with no arguments?}0">;
4323 def note_possible_target_of_call : Note<"possible target for call">;
4324
4325 def err_ovl_no_viable_object_call : Error<
4326   "no matching function for call to object of type %0">;
4327 def err_ovl_ambiguous_object_call : Error<
4328   "call to object of type %0 is ambiguous">;
4329 def err_ovl_deleted_object_call : Error<
4330   "call to deleted function call operator in type %0">;
4331 def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4332 def err_member_call_without_object : Error<
4333   "call to non-static member function without an object argument">;
4334
4335 // C++ Address of Overloaded Function
4336 def err_addr_ovl_no_viable : Error<
4337   "address of overloaded function %0 does not match required type %1">;
4338 def err_addr_ovl_ambiguous : Error<
4339   "address of overloaded function %0 is ambiguous">;
4340 def err_addr_ovl_not_func_ptrref : Error<
4341   "address of overloaded function %0 cannot be converted to type %1">;
4342 def err_addr_ovl_no_qualifier : Error<
4343   "cannot form member pointer of type %0 without '&' and class name">;
4344
4345 // C++11 Literal Operators
4346 def err_ovl_no_viable_literal_operator : Error<
4347   "no matching literal operator for call to %0"
4348   "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4349   "%select{| or 'const char *'}4"
4350   "%select{|, and no matching literal operator template}5">;
4351
4352 // C++ Template Declarations
4353 def err_template_param_shadow : Error<
4354   "declaration of %0 shadows template parameter">;
4355 def ext_template_param_shadow : ExtWarn<
4356   err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4357 def note_template_param_here : Note<"template parameter is declared here">;
4358 def warn_template_export_unsupported : Warning<
4359   "exported templates are unsupported">;
4360 def err_template_outside_namespace_or_class_scope : Error<
4361   "templates can only be declared in namespace or class scope">;
4362 def err_template_inside_local_class : Error<
4363   "templates cannot be declared inside of a local class">;
4364 def err_template_linkage : Error<"templates must have C++ linkage">;
4365 def err_template_typedef : Error<"a typedef cannot be a template">;
4366 def err_template_unnamed_class : Error<
4367   "cannot declare a class template with no name">;
4368 def err_template_param_list_different_arity : Error<
4369   "%select{too few|too many}0 template parameters in template "
4370   "%select{|template parameter }1redeclaration">;
4371 def note_template_param_list_different_arity : Note<
4372   "%select{too few|too many}0 template parameters in template template "
4373   "argument">;
4374 def note_template_prev_declaration : Note<
4375   "previous template %select{declaration|template parameter}0 is here">;
4376 def err_template_param_different_kind : Error<
4377   "template parameter has a different kind in template "
4378   "%select{|template parameter }0redeclaration">;
4379 def note_template_param_different_kind : Note<
4380   "template parameter has a different kind in template argument">;
4381
4382 def err_invalid_decl_specifier_in_nontype_parm : Error<
4383   "invalid declaration specifier in template non-type parameter">;
4384
4385 def err_template_nontype_parm_different_type : Error<
4386   "template non-type parameter has a different type %0 in template "
4387   "%select{|template parameter }1redeclaration">;
4388
4389 def note_template_nontype_parm_different_type : Note<
4390   "template non-type parameter has a different type %0 in template argument">;
4391 def note_template_nontype_parm_prev_declaration : Note<
4392   "previous non-type template parameter with type %0 is here">;
4393 def err_template_nontype_parm_bad_type : Error<
4394   "a non-type template parameter cannot have type %0">;
4395 def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4396   "non-type template parameters declared with %0 are incompatible with C++ "
4397   "standards before C++17">,
4398   DefaultIgnore, InGroup<CXXPre17Compat>;
4399 def err_template_param_default_arg_redefinition : Error<
4400   "template parameter redefines default argument">;
4401 def note_template_param_prev_default_arg : Note<
4402   "previous default template argument defined here">;
4403 def err_template_param_default_arg_missing : Error<
4404   "template parameter missing a default argument">;
4405 def ext_template_parameter_default_in_function_template : ExtWarn<
4406   "default template arguments for a function template are a C++11 extension">,
4407   InGroup<CXX11>;
4408 def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4409   "default template arguments for a function template are incompatible with C++98">,
4410   InGroup<CXX98Compat>, DefaultIgnore;
4411 def err_template_parameter_default_template_member : Error<
4412   "cannot add a default template argument to the definition of a member of a "
4413   "class template">;
4414 def err_template_parameter_default_friend_template : Error<
4415   "default template argument not permitted on a friend template">;
4416 def err_template_template_parm_no_parms : Error<
4417   "template template parameter must have its own template parameters">;
4418
4419 def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4420   InGroup<CXX14>;
4421 def warn_cxx11_compat_variable_template : Warning<
4422   "variable templates are incompatible with C++ standards before C++14">,
4423   InGroup<CXXPre14Compat>, DefaultIgnore;
4424 def err_template_variable_noparams : Error<
4425   "extraneous 'template<>' in declaration of variable %0">;
4426 def err_template_member : Error<"member %0 declared as a template">;
4427 def err_template_member_noparams : Error<
4428   "extraneous 'template<>' in declaration of member %0">;
4429 def err_template_tag_noparams : Error<
4430   "extraneous 'template<>' in declaration of %0 %1">;
4431
4432 def warn_cxx17_compat_adl_only_template_id : Warning<
4433   "use of function template name with no prior function template "
4434   "declaration in function call with explicit template arguments "
4435   "is incompatible with C++ standards before C++20">,
4436   InGroup<CXXPre20Compat>, DefaultIgnore;
4437 def ext_adl_only_template_id : ExtWarn<
4438   "use of function template name with no prior declaration in function call "
4439   "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4440
4441 // C++ Template Argument Lists
4442 def err_template_missing_args : Error<
4443   "use of "
4444   "%select{class template|function template|variable template|alias template|"
4445   "template template parameter|concept|template}0 %1 requires template "
4446   "arguments">;
4447 def err_template_arg_list_different_arity : Error<
4448   "%select{too few|too many}0 template arguments for "
4449   "%select{class template|function template|variable template|alias template|"
4450   "template template parameter|concept|template}1 %2">;
4451 def note_template_decl_here : Note<"template is declared here">;
4452 def err_template_arg_must_be_type : Error<
4453   "template argument for template type parameter must be a type">;
4454 def err_template_arg_must_be_type_suggest : Error<
4455   "template argument for template type parameter must be a type; "
4456   "did you forget 'typename'?">;
4457 def ext_ms_template_type_arg_missing_typename : ExtWarn<
4458   "template argument for template type parameter must be a type; "
4459   "omitted 'typename' is a Microsoft extension">,
4460   InGroup<MicrosoftTemplate>;
4461 def err_template_arg_must_be_expr : Error<
4462   "template argument for non-type template parameter must be an expression">;
4463 def err_template_arg_nontype_ambig : Error<
4464   "template argument for non-type template parameter is treated as function type %0">;
4465 def err_template_arg_must_be_template : Error<
4466   "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4467 def ext_template_arg_local_type : ExtWarn<
4468   "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4469 def ext_template_arg_unnamed_type : ExtWarn<
4470   "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4471 def warn_cxx98_compat_template_arg_local_type : Warning<
4472   "local type %0 as template argument is incompatible with C++98">,
4473   InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4474 def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4475   "unnamed type as template argument is incompatible with C++98">,
4476   InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4477 def note_template_unnamed_type_here : Note<
4478   "unnamed type used in template argument was declared here">;
4479 def err_template_arg_overload_type : Error<
4480   "template argument is the type of an unresolved overloaded function">;
4481 def err_template_arg_not_valid_template : Error<
4482   "template argument does not refer to a class or alias template, or template "
4483   "template parameter">;
4484 def note_template_arg_refers_here_func : Note<
4485   "template argument refers to function template %0, here">;
4486 def err_template_arg_template_params_mismatch : Error<
4487   "template template argument has different template parameters than its "
4488   "corresponding template template parameter">;
4489 def err_template_arg_not_integral_or_enumeral : Error<
4490   "non-type template argument of type %0 must have an integral or enumeration"
4491   " type">;
4492 def err_template_arg_not_ice : Error<
4493   "non-type template argument of type %0 is not an integral constant "
4494   "expression">;
4495 def err_template_arg_not_address_constant : Error<
4496   "non-type template argument of type %0 is not a constant expression">;
4497 def warn_cxx98_compat_template_arg_null : Warning<
4498   "use of null pointer as non-type template argument is incompatible with "
4499   "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4500 def err_template_arg_untyped_null_constant : Error<
4501   "null non-type template argument must be cast to template parameter type %0">;
4502 def err_template_arg_wrongtype_null_constant : Error<
4503   "null non-type template argument of type %0 does not match template parameter "
4504   "of type %1">;
4505 def err_non_type_template_parm_type_deduction_failure : Error<
4506   "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4507 def err_deduced_non_type_template_arg_type_mismatch : Error<
4508   "deduced non-type template argument does not have the same type as the "
4509   "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4510 def err_non_type_template_arg_subobject : Error<
4511   "non-type template argument refers to subobject '%0'">;
4512 def err_non_type_template_arg_addr_label_diff : Error<
4513   "template argument / label address difference / what did you expect?">;
4514 def err_template_arg_not_convertible : Error<
4515   "non-type template argument of type %0 cannot be converted to a value "
4516   "of type %1">;
4517 def warn_template_arg_negative : Warning<
4518   "non-type template argument with value '%0' converted to '%1' for unsigned "
4519   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4520 def warn_template_arg_too_large : Warning<
4521   "non-type template argument value '%0' truncated to '%1' for "
4522   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4523 def err_template_arg_no_ref_bind : Error<
4524   "non-type template parameter of reference type "
4525   "%diff{$ cannot bind to template argument of type $"
4526   "|cannot bind to template of incompatible argument type}0,1">;
4527 def err_template_arg_ref_bind_ignores_quals : Error<
4528   "reference binding of non-type template parameter "
4529   "%diff{of type $ to template argument of type $|to template argument}0,1 "
4530   "ignores qualifiers">;
4531 def err_template_arg_not_decl_ref : Error<
4532   "non-type template argument does not refer to any declaration">;
4533 def err_template_arg_not_address_of : Error<
4534   "non-type template argument for template parameter of pointer type %0 must "
4535   "have its address taken">;
4536 def err_template_arg_address_of_non_pointer : Error<
4537   "address taken in non-type template argument for template parameter of "
4538   "reference type %0">;
4539 def err_template_arg_reference_var : Error<
4540   "non-type template argument of reference type %0 is not an object">;
4541 def err_template_arg_field : Error<
4542   "non-type template argument refers to non-static data member %0">;
4543 def err_template_arg_method : Error<
4544   "non-type template argument refers to non-static member function %0">;
4545 def err_template_arg_object_no_linkage : Error<
4546   "non-type template argument refers to %select{function|object}0 %1 that "
4547   "does not have linkage">;
4548 def warn_cxx98_compat_template_arg_object_internal : Warning<
4549   "non-type template argument referring to %select{function|object}0 %1 with "
4550   "internal linkage is incompatible with C++98">,
4551   InGroup<CXX98Compat>, DefaultIgnore;
4552 def ext_template_arg_object_internal : ExtWarn<
4553   "non-type template argument referring to %select{function|object}0 %1 with "
4554   "internal linkage is a C++11 extension">, InGroup<CXX11>;
4555 def err_template_arg_thread_local : Error<
4556   "non-type template argument refers to thread-local object">;
4557 def note_template_arg_internal_object : Note<
4558   "non-type template argument refers to %select{function|object}0 here">;
4559 def note_template_arg_refers_here : Note<
4560   "non-type template argument refers here">;
4561 def err_template_arg_not_object_or_func : Error<
4562   "non-type template argument does not refer to an object or function">;
4563 def err_template_arg_not_pointer_to_member_form : Error<
4564   "non-type template argument is not a pointer to member constant">;
4565 def err_template_arg_member_ptr_base_derived_not_supported : Error<
4566   "sorry, non-type template argument of pointer-to-member type %1 that refers "
4567   "to member %q0 of a different class is not supported yet">;
4568 def ext_template_arg_extra_parens : ExtWarn<
4569   "address non-type template argument cannot be surrounded by parentheses">;
4570 def warn_cxx98_compat_template_arg_extra_parens : Warning<
4571   "redundant parentheses surrounding address non-type template argument are "
4572   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4573 def err_pointer_to_member_type : Error<
4574   "invalid use of pointer to member type after %select{.*|->*}0">;
4575 def err_pointer_to_member_call_drops_quals : Error<
4576   "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4577 def err_pointer_to_member_oper_value_classify: Error<
4578   "pointer-to-member function type %0 can only be called on an "
4579   "%select{rvalue|lvalue}1">;
4580 def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4581   "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4582   InGroup<CXX20>, SFINAEFailure;
4583 def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4584   "invoking a pointer to a 'const &' member function on an rvalue is "
4585   "incompatible with C++ standards before C++20">,
4586   InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4587 def ext_ms_deref_template_argument: ExtWarn<
4588   "non-type template argument containing a dereference operation is a "
4589   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4590 def ext_ms_delayed_template_argument: ExtWarn<
4591   "using the undeclared type %0 as a default template argument is a "
4592   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4593 def err_template_arg_deduced_incomplete_pack : Error<
4594   "deduced incomplete pack %0 for template parameter %1">;
4595
4596 // C++ template specialization
4597 def err_template_spec_unknown_kind : Error<
4598   "can only provide an explicit specialization for a class template, function "
4599   "template, variable template, or a member function, static data member, "
4600   "%select{or member class|member class, or member enumeration}0 of a "
4601   "class template">;
4602 def note_specialized_entity : Note<
4603   "explicitly specialized declaration is here">;
4604 def note_explicit_specialization_declared_here : Note<
4605   "explicit specialization declared here">;
4606 def err_template_spec_decl_function_scope : Error<
4607   "explicit specialization of %0 in function scope">;
4608 def err_template_spec_decl_friend : Error<
4609   "cannot declare an explicit specialization in a friend">;
4610 def err_template_spec_redecl_out_of_scope : Error<
4611   "%select{class template|class template partial|variable template|"
4612   "variable template partial|function template|member "
4613   "function|static data member|member class|member enumeration}0 "
4614   "specialization of %1 not in %select{a namespace enclosing %2|"
4615   "class %2 or an enclosing namespace}3">;
4616 def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4617   "%select{class template|class template partial|variable template|"
4618   "variable template partial|function template|member "
4619   "function|static data member|member class|member enumeration}0 "
4620   "specialization of %1 not in %select{a namespace enclosing %2|"
4621   "class %2 or an enclosing namespace}3 "
4622   "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4623 def err_template_spec_redecl_global_scope : Error<
4624   "%select{class template|class template partial|variable template|"
4625   "variable template partial|function template|member "
4626   "function|static data member|member class|member enumeration}0 "
4627   "specialization of %1 must occur at global scope">;
4628 def err_spec_member_not_instantiated : Error<
4629   "specialization of member %q0 does not specialize an instantiated member">;
4630 def note_specialized_decl : Note<"attempt to specialize declaration here">;
4631 def err_specialization_after_instantiation : Error<
4632   "explicit specialization of %0 after instantiation">;
4633 def note_instantiation_required_here : Note<
4634   "%select{implicit|explicit}0 instantiation first required here">;
4635 def err_template_spec_friend : Error<
4636   "template specialization declaration cannot be a friend">;
4637 def err_template_spec_default_arg : Error<
4638   "default argument not permitted on an explicit "
4639   "%select{instantiation|specialization}0 of function %1">;
4640 def err_not_class_template_specialization : Error<
4641   "cannot specialize a %select{dependent template|template template "
4642   "parameter}0">;
4643 def ext_explicit_specialization_storage_class : ExtWarn<
4644   "explicit specialization cannot have a storage class">;
4645 def err_explicit_specialization_inconsistent_storage_class : Error<
4646   "explicit specialization has extraneous, inconsistent storage class "
4647   "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4648 def err_dependent_function_template_spec_no_match : Error<
4649   "no candidate function template was found for dependent"
4650   " friend function template specialization">;
4651 def note_dependent_function_template_spec_discard_reason : Note<
4652   "candidate ignored: %select{not a function template"
4653   "|not a member of the enclosing namespace;"
4654   " did you mean to explicitly qualify the specialization?}0">;
4655
4656 // C++ class template specializations and out-of-line definitions
4657 def err_template_spec_needs_header : Error<
4658   "template specialization requires 'template<>'">;
4659 def err_template_spec_needs_template_parameters : Error<
4660   "template specialization or definition requires a template parameter list "
4661   "corresponding to the nested type %0">;
4662 def err_template_param_list_matches_nontemplate : Error<
4663   "template parameter list matching the non-templated nested type %0 should "
4664   "be empty ('template<>')">;
4665 def err_alias_template_extra_headers : Error<
4666   "extraneous template parameter list in alias template declaration">;
4667 def err_template_spec_extra_headers : Error<
4668   "extraneous template parameter list in template specialization or "
4669   "out-of-line template definition">;
4670 def warn_template_spec_extra_headers : Warning<
4671   "extraneous template parameter list in template specialization">;
4672 def note_explicit_template_spec_does_not_need_header : Note<
4673   "'template<>' header not required for explicitly-specialized class %0 "
4674   "declared here">;
4675 def err_template_qualified_declarator_no_match : Error<
4676   "nested name specifier '%0' for declaration does not refer into a class, "
4677   "class template or class template partial specialization">;
4678 def err_specialize_member_of_template : Error<
4679   "cannot specialize %select{|(with 'template<>') }0a member of an "
4680   "unspecialized template">;
4681
4682 // C++ Class Template Partial Specialization
4683 def err_default_arg_in_partial_spec : Error<
4684     "default template argument in a class template partial specialization">;
4685 def err_dependent_non_type_arg_in_partial_spec : Error<
4686     "type of specialized non-type template argument depends on a template "
4687     "parameter of the partial specialization">;
4688 def note_dependent_non_type_default_arg_in_partial_spec : Note<
4689     "template parameter is used in default argument declared here">;
4690 def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4691     "non-type template argument specializes a template parameter with "
4692     "dependent type %0">;
4693 def err_partial_spec_args_match_primary_template : Error<
4694     "%select{class|variable}0 template partial specialization does not "
4695     "specialize any template argument; to %select{declare|define}1 the "
4696     "primary template, remove the template argument list">;
4697 def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4698     "%select{class|variable}0 template partial specialization is not "
4699     "more specialized than the primary template">, DefaultError,
4700     InGroup<DiagGroup<"invalid-partial-specialization">>;
4701 def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4702 def ext_partial_specs_not_deducible : ExtWarn<
4703     "%select{class|variable}0 template partial specialization contains "
4704     "%select{a template parameter|template parameters}1 that cannot be "
4705     "deduced; this partial specialization will never be used">,
4706     DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4707 def note_non_deducible_parameter : Note<
4708     "non-deducible template parameter %0">;
4709 def err_partial_spec_ordering_ambiguous : Error<
4710     "ambiguous partial specializations of %0">;
4711 def note_partial_spec_match : Note<"partial specialization matches %0">;
4712 def err_partial_spec_redeclared : Error<
4713   "class template partial specialization %0 cannot be redeclared">;
4714 def note_partial_specialization_declared_here : Note<
4715   "explicit specialization declared here">;
4716 def note_prev_partial_spec_here : Note<
4717   "previous declaration of class template partial specialization %0 is here">;
4718 def err_partial_spec_fully_specialized : Error<
4719   "partial specialization of %0 does not use any of its template parameters">;
4720
4721 // C++ Variable Template Partial Specialization
4722 def err_var_partial_spec_redeclared : Error<
4723   "variable template partial specialization %0 cannot be redefined">;
4724 def note_var_prev_partial_spec_here : Note<
4725   "previous declaration of variable template partial specialization is here">;
4726 def err_var_spec_no_template : Error<
4727   "no variable template matches%select{| partial}0 specialization">;
4728 def err_var_spec_no_template_but_method : Error<
4729   "no variable template matches specialization; "
4730   "did you mean to use %0 as function template instead?">;
4731
4732 // C++ Function template specializations
4733 def err_function_template_spec_no_match : Error<
4734     "no function template matches function template specialization %0">;
4735 def err_function_template_spec_ambiguous : Error<
4736     "function template specialization %0 ambiguously refers to more than one "
4737     "function template; explicitly specify%select{| additional}1 template "
4738     "arguments to identify a particular function template">;
4739 def note_function_template_spec_matched : Note<
4740     "function template %q0 matches specialization %1">;
4741 def err_function_template_partial_spec : Error<
4742     "function template partial specialization is not allowed">;
4743
4744 // C++ Template Instantiation
4745 def err_template_recursion_depth_exceeded : Error<
4746   "recursive template instantiation exceeded maximum depth of %0">,
4747   DefaultFatal, NoSFINAE;
4748 def note_template_recursion_depth : Note<
4749   "use -ftemplate-depth=N to increase recursive template instantiation depth">;
4750
4751 def err_template_instantiate_within_definition : Error<
4752   "%select{implicit|explicit}0 instantiation of template %1 within its"
4753   " own definition">;
4754 def err_template_instantiate_undefined : Error<
4755   "%select{implicit|explicit}0 instantiation of undefined template %1">;
4756 def err_implicit_instantiate_member_undefined : Error<
4757   "implicit instantiation of undefined member %0">;
4758 def note_template_class_instantiation_was_here : Note<
4759   "class template %0 was instantiated here">;
4760 def note_template_class_explicit_specialization_was_here : Note<
4761   "class template %0 was explicitly specialized here">;
4762 def note_template_class_instantiation_here : Note<
4763   "in instantiation of template class %q0 requested here">;
4764 def note_template_member_class_here : Note<
4765   "in instantiation of member class %q0 requested here">;
4766 def note_template_member_function_here : Note<
4767   "in instantiation of member function %q0 requested here">;
4768 def note_function_template_spec_here : Note<
4769   "in instantiation of function template specialization %q0 requested here">;
4770 def note_template_static_data_member_def_here : Note<
4771   "in instantiation of static data member %q0 requested here">;
4772 def note_template_variable_def_here : Note<
4773   "in instantiation of variable template specialization %q0 requested here">;
4774 def note_template_enum_def_here : Note<
4775   "in instantiation of enumeration %q0 requested here">;
4776 def note_template_nsdmi_here : Note<
4777   "in instantiation of default member initializer %q0 requested here">;
4778 def note_template_type_alias_instantiation_here : Note<
4779   "in instantiation of template type alias %0 requested here">;
4780 def note_template_exception_spec_instantiation_here : Note<
4781   "in instantiation of exception specification for %0 requested here">;
4782 def note_template_requirement_instantiation_here : Note<
4783   "in instantiation of requirement here">;
4784 def warn_var_template_missing : Warning<"instantiation of variable %q0 "
4785   "required here, but no definition is available">,
4786   InGroup<UndefinedVarTemplate>;
4787 def warn_func_template_missing : Warning<"instantiation of function %q0 "
4788   "required here, but no definition is available">,
4789   InGroup<UndefinedFuncTemplate>, DefaultIgnore;
4790 def note_forward_template_decl : Note<
4791   "forward declaration of template entity is here">;
4792 def note_inst_declaration_hint : Note<"add an explicit instantiation "
4793   "declaration to suppress this warning if %q0 is explicitly instantiated in "
4794   "another translation unit">;
4795 def note_evaluating_exception_spec_here : Note<
4796   "in evaluation of exception specification for %q0 needed here">;
4797
4798 def note_default_arg_instantiation_here : Note<
4799   "in instantiation of default argument for '%0' required here">;
4800 def note_default_function_arg_instantiation_here : Note<
4801   "in instantiation of default function argument expression "
4802   "for '%0' required here">;
4803 def note_explicit_template_arg_substitution_here : Note<
4804   "while substituting explicitly-specified template arguments into function "
4805   "template %0 %1">;
4806 def note_function_template_deduction_instantiation_here : Note<
4807   "while substituting deduced template arguments into function template %0 "
4808   "%1">;
4809 def note_deduced_template_arg_substitution_here : Note<
4810   "during template argument deduction for %select{class|variable}0 template "
4811   "%select{partial specialization |}1%2 %3">;
4812 def note_prior_template_arg_substitution : Note<
4813   "while substituting prior template arguments into %select{non-type|template}0"
4814   " template parameter%1 %2">;
4815 def note_template_default_arg_checking : Note<
4816   "while checking a default template argument used here">;
4817 def note_concept_specialization_here : Note<
4818   "while checking the satisfaction of concept '%0' requested here">;
4819 def note_nested_requirement_here : Note<
4820   "while checking the satisfaction of nested requirement requested here">;
4821 def note_checking_constraints_for_template_id_here : Note<
4822   "while checking constraint satisfaction for template '%0' required here">;
4823 def note_checking_constraints_for_var_spec_id_here : Note<
4824   "while checking constraint satisfaction for variable template "
4825   "partial specialization '%0' required here">;
4826 def note_checking_constraints_for_class_spec_id_here : Note<
4827   "while checking constraint satisfaction for class template partial "
4828   "specialization '%0' required here">;
4829 def note_checking_constraints_for_function_here : Note<
4830   "while checking constraint satisfaction for function '%0' required here">;
4831 def note_constraint_substitution_here : Note<
4832   "while substituting template arguments into constraint expression here">;
4833 def note_constraint_normalization_here : Note<
4834   "while calculating associated constraint of template '%0' here">;
4835 def note_parameter_mapping_substitution_here : Note<
4836   "while substituting into concept arguments here; substitution failures not "
4837   "allowed in concept arguments">;
4838 def note_instantiation_contexts_suppressed : Note<
4839   "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
4840   "see all)">;
4841
4842 def err_field_instantiates_to_function : Error<
4843   "data member instantiated with function type %0">;
4844 def err_variable_instantiates_to_function : Error<
4845   "%select{variable|static data member}0 instantiated with function type %1">;
4846 def err_nested_name_spec_non_tag : Error<
4847   "type %0 cannot be used prior to '::' because it has no members">;
4848
4849 def err_using_pack_expansion_empty : Error<
4850   "%select{|member}0 using declaration %1 instantiates to an empty pack">;
4851
4852 // C++ Explicit Instantiation
4853 def err_explicit_instantiation_duplicate : Error<
4854     "duplicate explicit instantiation of %0">;
4855 def ext_explicit_instantiation_duplicate : ExtWarn<
4856     "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
4857     InGroup<MicrosoftTemplate>;
4858 def note_previous_explicit_instantiation : Note<
4859     "previous explicit instantiation is here">;
4860 def warn_explicit_instantiation_after_specialization : Warning<
4861   "explicit instantiation of %0 that occurs after an explicit "
4862   "specialization has no effect">,
4863   InGroup<DiagGroup<"instantiation-after-specialization">>;
4864 def note_previous_template_specialization : Note<
4865     "previous template specialization is here">;
4866 def err_explicit_instantiation_nontemplate_type : Error<
4867     "explicit instantiation of non-templated type %0">;
4868 def note_nontemplate_decl_here : Note<
4869     "non-templated declaration is here">;
4870 def err_explicit_instantiation_in_class : Error<
4871   "explicit instantiation of %0 in class scope">;
4872 def err_explicit_instantiation_out_of_scope : Error<
4873   "explicit instantiation of %0 not in a namespace enclosing %1">;
4874 def err_explicit_instantiation_must_be_global : Error<
4875   "explicit instantiation of %0 must occur at global scope">;
4876 def warn_explicit_instantiation_out_of_scope_0x : Warning<
4877   "explicit instantiation of %0 not in a namespace enclosing %1">,
4878   InGroup<CXX11Compat>, DefaultIgnore;
4879 def warn_explicit_instantiation_must_be_global_0x : Warning<
4880   "explicit instantiation of %0 must occur at global scope">,
4881   InGroup<CXX11Compat>, DefaultIgnore;
4882
4883 def err_explicit_instantiation_requires_name : Error<
4884   "explicit instantiation declaration requires a name">;
4885 def err_explicit_instantiation_of_typedef : Error<
4886   "explicit instantiation of typedef %0">;
4887 def err_explicit_instantiation_storage_class : Error<
4888   "explicit instantiation cannot have a storage class">;
4889 def err_explicit_instantiation_internal_linkage : Error<
4890   "explicit instantiation declaration of %0 with internal linkage">;
4891 def err_explicit_instantiation_not_known : Error<
4892   "explicit instantiation of %0 does not refer to a function template, "
4893   "variable template, member function, member class, or static data member">;
4894 def note_explicit_instantiation_here : Note<
4895   "explicit instantiation refers here">;
4896 def err_explicit_instantiation_data_member_not_instantiated : Error<
4897   "explicit instantiation refers to static data member %q0 that is not an "
4898   "instantiation">;
4899 def err_explicit_instantiation_member_function_not_instantiated : Error<
4900   "explicit instantiation refers to member function %q0 that is not an "
4901   "instantiation">;
4902 def err_explicit_instantiation_ambiguous : Error<
4903   "partial ordering for explicit instantiation of %0 is ambiguous">;
4904 def note_explicit_instantiation_candidate : Note<
4905   "explicit instantiation candidate function %q0 template here %1">;
4906 def err_explicit_instantiation_inline : Error<
4907   "explicit instantiation cannot be 'inline'">;
4908 def warn_explicit_instantiation_inline_0x : Warning<
4909   "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
4910   DefaultIgnore;
4911 def err_explicit_instantiation_constexpr : Error<
4912   "explicit instantiation cannot be 'constexpr'">;
4913 def ext_explicit_instantiation_without_qualified_id : Extension<
4914   "qualifier in explicit instantiation of %q0 requires a template-id "
4915   "(a typedef is not permitted)">;
4916 def err_explicit_instantiation_without_template_id : Error<
4917   "explicit instantiation of %q0 must specify a template argument list">;
4918 def err_explicit_instantiation_unqualified_wrong_namespace : Error<
4919   "explicit instantiation of %q0 must occur in namespace %1">;
4920 def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
4921   "explicit instantiation of %q0 must occur in namespace %1">,
4922   InGroup<CXX11Compat>, DefaultIgnore;
4923 def err_explicit_instantiation_undefined_member : Error<
4924   "explicit instantiation of undefined %select{member class|member function|"
4925   "static data member}0 %1 of class template %2">;
4926 def err_explicit_instantiation_undefined_func_template : Error<
4927   "explicit instantiation of undefined function template %0">;
4928 def err_explicit_instantiation_undefined_var_template : Error<
4929   "explicit instantiation of undefined variable template %q0">;
4930 def err_explicit_instantiation_declaration_after_definition : Error<
4931   "explicit instantiation declaration (with 'extern') follows explicit "
4932   "instantiation definition (without 'extern')">;
4933 def note_explicit_instantiation_definition_here : Note<
4934   "explicit instantiation definition is here">;
4935 def err_invalid_var_template_spec_type : Error<"type %2 "
4936   "of %select{explicit instantiation|explicit specialization|"
4937   "partial specialization|redeclaration}0 of %1 does not match"
4938   " expected type %3">;
4939 def err_mismatched_exception_spec_explicit_instantiation : Error<
4940   "exception specification in explicit instantiation does not match "
4941   "instantiated one">;
4942 def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
4943   err_mismatched_exception_spec_explicit_instantiation.Text>,
4944   InGroup<MicrosoftExceptionSpec>;
4945
4946 // C++ typename-specifiers
4947 def err_typename_nested_not_found : Error<"no type named %0 in %1">;
4948 def err_typename_nested_not_found_enable_if : Error<
4949   "no type named 'type' in %0; 'enable_if' cannot be used to disable "
4950   "this declaration">;
4951 def err_typename_nested_not_found_requirement : Error<
4952   "failed requirement '%0'; 'enable_if' cannot be used to disable this "
4953   "declaration">;
4954 def err_typename_nested_not_type : Error<
4955     "typename specifier refers to non-type member %0 in %1">;
4956 def err_typename_not_type : Error<
4957     "typename specifier refers to non-type %0">;
4958 def note_typename_member_refers_here : Note<
4959     "referenced member %0 is declared here">;
4960 def note_typename_refers_here : Note<
4961     "referenced %0 is declared here">;
4962 def err_typename_missing : Error<
4963   "missing 'typename' prior to dependent type name '%0%1'">;
4964 def err_typename_missing_template : Error<
4965   "missing 'typename' prior to dependent type template name '%0%1'">;
4966 def ext_typename_missing : ExtWarn<
4967   "missing 'typename' prior to dependent type name '%0%1'">,
4968   InGroup<DiagGroup<"typename-missing">>;
4969 def ext_typename_outside_of_template : ExtWarn<
4970   "'typename' occurs outside of a template">, InGroup<CXX11>;
4971 def warn_cxx98_compat_typename_outside_of_template : Warning<
4972   "use of 'typename' outside of a template is incompatible with C++98">,
4973   InGroup<CXX98Compat>, DefaultIgnore;
4974 def err_typename_refers_to_using_value_decl : Error<
4975   "typename specifier refers to a dependent using declaration for a value "
4976   "%0 in %1">;
4977 def note_using_value_decl_missing_typename : Note<
4978   "add 'typename' to treat this using declaration as a type">;
4979
4980 def err_template_kw_refers_to_non_template : Error<
4981   "%0%select{| following the 'template' keyword}1 "
4982   "does not refer to a template">;
4983 def note_template_kw_refers_to_non_template : Note<
4984   "declared as a non-template here">;
4985 def err_template_kw_refers_to_dependent_non_template : Error<
4986   "%0%select{| following the 'template' keyword}1 "
4987   "cannot refer to a dependent template">;
4988 def err_template_kw_refers_to_class_template : Error<
4989   "'%0%1' instantiated to a class template, not a function template">;
4990 def note_referenced_class_template : Note<
4991   "class template declared here">;
4992 def err_template_kw_missing : Error<
4993   "missing 'template' keyword prior to dependent template name '%0%1'">;
4994 def ext_template_outside_of_template : ExtWarn<
4995   "'template' keyword outside of a template">, InGroup<CXX11>;
4996 def warn_cxx98_compat_template_outside_of_template : Warning<
4997   "use of 'template' keyword outside of a template is incompatible with C++98">,
4998   InGroup<CXX98Compat>, DefaultIgnore;
4999
5000 def err_non_type_template_in_nested_name_specifier : Error<
5001   "qualified name refers into a specialization of %select{function|variable}0 "
5002   "template %1">;
5003 def err_template_id_not_a_type : Error<
5004   "template name refers to non-type template %0">;
5005 def note_template_declared_here : Note<
5006   "%select{function template|class template|variable template"
5007   "|type alias template|template template parameter}0 "
5008   "%1 declared here">;
5009 def err_template_expansion_into_fixed_list : Error<
5010   "pack expansion used as argument for non-pack parameter of %select{alias "
5011   "template|concept}0">;
5012 def note_parameter_type : Note<
5013   "parameter of type %0 is declared here">;
5014
5015 // C++11 Variadic Templates
5016 def err_template_param_pack_default_arg : Error<
5017   "template parameter pack cannot have a default argument">;
5018 def err_template_param_pack_must_be_last_template_parameter : Error<
5019   "template parameter pack must be the last template parameter">;
5020
5021 def err_template_parameter_pack_non_pack : Error<
5022   "%select{template type|non-type template|template template}0 parameter"
5023   "%select{| pack}1 conflicts with previous %select{template type|"
5024   "non-type template|template template}0 parameter%select{ pack|}1">;
5025 def note_template_parameter_pack_non_pack : Note<
5026   "%select{template type|non-type template|template template}0 parameter"
5027   "%select{| pack}1 does not match %select{template type|non-type template"
5028   "|template template}0 parameter%select{ pack|}1 in template argument">;
5029 def note_template_parameter_pack_here : Note<
5030   "previous %select{template type|non-type template|template template}0 "
5031   "parameter%select{| pack}1 declared here">;
5032
5033 def err_unexpanded_parameter_pack : Error<
5034   "%select{expression|base type|declaration type|data member type|bit-field "
5035   "size|static assertion|fixed underlying type|enumerator value|"
5036   "using declaration|friend declaration|qualifier|initializer|default argument|"
5037   "non-type template parameter type|exception type|partial specialization|"
5038   "__if_exists name|__if_not_exists name|lambda|block|type constraint}0 "
5039   "contains%plural{0: an|:}1 unexpanded parameter pack"
5040   "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5041
5042 def err_pack_expansion_without_parameter_packs : Error<
5043   "pack expansion does not contain any unexpanded parameter packs">;
5044 def err_pack_expansion_length_conflict : Error<
5045   "pack expansion contains parameter packs %0 and %1 that have different "
5046   "lengths (%2 vs. %3)">;
5047 def err_pack_expansion_length_conflict_multilevel : Error<
5048   "pack expansion contains parameter pack %0 that has a different "
5049   "length (%1 vs. %2) from outer parameter packs">;
5050 def err_pack_expansion_length_conflict_partial : Error<
5051   "pack expansion contains parameter pack %0 that has a different "
5052   "length (at least %1 vs. %2) from outer parameter packs">;
5053 def err_pack_expansion_member_init : Error<
5054   "pack expansion for initialization of member %0">;
5055
5056 def err_function_parameter_pack_without_parameter_packs : Error<
5057   "type %0 of function parameter pack does not contain any unexpanded "
5058   "parameter packs">;
5059 def err_ellipsis_in_declarator_not_parameter : Error<
5060   "only function and template parameters can be parameter packs">;
5061
5062 def err_sizeof_pack_no_pack_name : Error<
5063   "%0 does not refer to the name of a parameter pack">;
5064
5065 def err_fold_expression_packs_both_sides : Error<
5066   "binary fold expression has unexpanded parameter packs in both operands">;
5067 def err_fold_expression_empty : Error<
5068   "unary fold expression has empty expansion for operator '%0' "
5069   "with no fallback value">;
5070 def err_fold_expression_bad_operand : Error<
5071   "expression not permitted as operand of fold expression">;
5072
5073 def err_unexpected_typedef : Error<
5074   "unexpected type name %0: expected expression">;
5075 def err_unexpected_namespace : Error<
5076   "unexpected namespace name %0: expected expression">;
5077 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5078 def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5079   "use of undeclared identifier %0; "
5080   "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5081   InGroup<MicrosoftTemplate>;
5082 def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
5083   "found via unqualified lookup into dependent bases of class templates is a "
5084   "Microsoft extension">, InGroup<MicrosoftTemplate>;
5085 def note_dependent_var_use : Note<"must qualify identifier to find this "
5086     "declaration in dependent base class">;
5087 def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5088     "visible in the template definition nor found by argument-dependent lookup">;
5089 def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5090     "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5091 def err_undeclared_use : Error<"use of undeclared %0">;
5092 def warn_deprecated : Warning<"%0 is deprecated">,
5093     InGroup<DeprecatedDeclarations>;
5094 def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5095 def warn_property_method_deprecated :
5096     Warning<"property access is using %0 method which is deprecated">,
5097     InGroup<DeprecatedDeclarations>;
5098 def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5099     InGroup<DeprecatedDeclarations>;
5100 def warn_deprecated_anonymous_namespace : Warning<
5101   "'deprecated' attribute on anonymous namespace ignored">,
5102   InGroup<IgnoredAttributes>;
5103 def warn_deprecated_fwdclass_message : Warning<
5104     "%0 may be deprecated because the receiver type is unknown">,
5105     InGroup<DeprecatedDeclarations>;
5106 def warn_deprecated_def : Warning<
5107   "implementing deprecated %select{method|class|category}0">,
5108   InGroup<DeprecatedImplementations>, DefaultIgnore;
5109 def warn_unavailable_def : Warning<
5110   "implementing unavailable method">,
5111   InGroup<DeprecatedImplementations>, DefaultIgnore;
5112 def err_unavailable : Error<"%0 is unavailable">;
5113 def err_property_method_unavailable :
5114     Error<"property access is using %0 method which is unavailable">;
5115 def err_unavailable_message : Error<"%0 is unavailable: %1">;
5116 def warn_unavailable_fwdclass_message : Warning<
5117     "%0 may be unavailable because the receiver type is unknown">,
5118     InGroup<UnavailableDeclarations>;
5119 def note_availability_specified_here : Note<
5120   "%0 has been explicitly marked "
5121   "%select{unavailable|deleted|deprecated}1 here">;
5122 def note_partial_availability_specified_here : Note<
5123   "%0 has been marked as being introduced in %1 %2 here, "
5124   "but the deployment target is %1 %3">;
5125 def note_implicitly_deleted : Note<
5126   "explicitly defaulted function was implicitly deleted here">;
5127 def warn_not_enough_argument : Warning<
5128   "not enough variable arguments in %0 declaration to fit a sentinel">,
5129   InGroup<Sentinel>;
5130 def warn_missing_sentinel : Warning <
5131   "missing sentinel in %select{function call|method dispatch|block call}0">,
5132   InGroup<Sentinel>;
5133 def note_sentinel_here : Note<
5134   "%select{function|method|block}0 has been explicitly marked sentinel here">;
5135 def warn_missing_prototype : Warning<
5136   "no previous prototype for function %0">,
5137   InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5138 def note_declaration_not_a_prototype : Note<
5139   "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5140   "to make it %select{a prototype for a zero-parameter function|one}0">;
5141 def warn_strict_prototypes : Warning<
5142   "this %select{function declaration is not|block declaration is not|"
5143   "old-style function definition is not preceded by}0 a prototype">,
5144   InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
5145 def warn_missing_variable_declarations : Warning<
5146   "no previous extern declaration for non-static variable %0">,
5147   InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5148 def note_static_for_internal_linkage : Note<
5149   "declare 'static' if the %select{variable|function}0 is not intended to be "
5150   "used outside of this translation unit">;
5151 def err_static_data_member_reinitialization :
5152   Error<"static data member %0 already has an initializer">;
5153 def err_redefinition : Error<"redefinition of %0">;
5154 def err_alias_after_tentative :
5155   Error<"alias definition of %0 after tentative definition">;
5156 def err_alias_is_definition :
5157   Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5158 def err_definition_of_implicitly_declared_member : Error<
5159   "definition of implicitly declared %select{default constructor|copy "
5160   "constructor|move constructor|copy assignment operator|move assignment "
5161   "operator|destructor|function}1">;
5162 def err_definition_of_explicitly_defaulted_member : Error<
5163   "definition of explicitly defaulted %select{default constructor|copy "
5164   "constructor|move constructor|copy assignment operator|move assignment "
5165   "operator|destructor|function}0">;
5166 def err_redefinition_extern_inline : Error<
5167   "redefinition of a 'extern inline' function %0 is not supported in "
5168   "%select{C99 mode|C++}1">;
5169 def warn_attr_abi_tag_namespace : Warning<
5170   "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5171   InGroup<IgnoredAttributes>;
5172 def err_abi_tag_on_redeclaration : Error<
5173   "cannot add 'abi_tag' attribute in a redeclaration">;
5174 def err_new_abi_tag_on_redeclaration : Error<
5175   "'abi_tag' %0 missing in original declaration">;
5176 def note_use_ifdef_guards : Note<
5177   "unguarded header; consider using #ifdef guards or #pragma once">;
5178
5179 def note_deleted_dtor_no_operator_delete : Note<
5180   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5181 def note_deleted_special_member_class_subobject : Note<
5182   "%select{default constructor of|copy constructor of|move constructor of|"
5183   "copy assignment operator of|move assignment operator of|destructor of|"
5184   "constructor inherited by}0 "
5185   "%1 is implicitly deleted because "
5186   "%select{base class %3|%select{||||variant }4field %3}2 "
5187   "%select{has "
5188   "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5189   "%select{%select{default constructor|copy constructor|move constructor|copy "
5190   "assignment operator|move assignment operator|destructor|"
5191   "%select{default|corresponding|default|default|default}4 constructor}0|"
5192   "destructor}5"
5193   "%select{||s||}4"
5194   "|is an ObjC pointer}6">;
5195 def note_deleted_default_ctor_uninit_field : Note<
5196   "%select{default constructor of|constructor inherited by}0 "
5197   "%1 is implicitly deleted because field %2 of "
5198   "%select{reference|const-qualified}4 type %3 would not be initialized">;
5199 def note_deleted_default_ctor_all_const : Note<
5200   "%select{default constructor of|constructor inherited by}0 "
5201   "%1 is implicitly deleted because all "
5202   "%select{data members|data members of an anonymous union member}2"
5203   " are const-qualified">;
5204 def note_deleted_copy_ctor_rvalue_reference : Note<
5205   "copy constructor of %0 is implicitly deleted because field %1 is of "
5206   "rvalue reference type %2">;
5207 def note_deleted_copy_user_declared_move : Note<
5208   "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5209   " %1 has a user-declared move %select{constructor|assignment operator}2">;
5210 def note_deleted_assign_field : Note<
5211   "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5212   "because field %2 is of %select{reference|const-qualified}4 type %3">;
5213
5214 // These should be errors.
5215 def warn_undefined_internal : Warning<
5216   "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5217   InGroup<DiagGroup<"undefined-internal">>;
5218 def err_undefined_internal_type : Error<
5219   "%select{function|variable}0 %q1 is used but not defined in this "
5220   "translation unit, and cannot be defined in any other translation unit "
5221   "because its type does not have linkage">;
5222 def ext_undefined_internal_type : Extension<
5223   "ISO C++ requires a definition in this translation unit for "
5224   "%select{function|variable}0 %q1 because its type does not have linkage">,
5225   InGroup<DiagGroup<"undefined-internal-type">>;
5226 def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5227   InGroup<DiagGroup<"undefined-inline">>;
5228 def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5229 def note_used_here : Note<"used here">;
5230
5231 def err_internal_linkage_redeclaration : Error<
5232   "'internal_linkage' attribute does not appear on the first declaration of %0">;
5233 def warn_internal_linkage_local_storage : Warning<
5234   "'internal_linkage' attribute on a non-static local variable is ignored">,
5235   InGroup<IgnoredAttributes>;
5236
5237 def ext_internal_in_extern_inline : ExtWarn<
5238   "static %select{function|variable}0 %1 is used in an inline function with "
5239   "external linkage">, InGroup<StaticInInline>;
5240 def ext_internal_in_extern_inline_quiet : Extension<
5241   "static %select{function|variable}0 %1 is used in an inline function with "
5242   "external linkage">, InGroup<StaticInInline>;
5243 def warn_static_local_in_extern_inline : Warning<
5244   "non-constant static local variable in inline function may be different "
5245   "in different files">, InGroup<StaticLocalInInline>;
5246 def note_convert_inline_to_static : Note<
5247   "use 'static' to give inline function %0 internal linkage">;
5248
5249 def ext_redefinition_of_typedef : ExtWarn<
5250   "redefinition of typedef %0 is a C11 feature">,
5251   InGroup<DiagGroup<"typedef-redefinition"> >;
5252 def err_redefinition_variably_modified_typedef : Error<
5253   "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5254
5255 def err_inline_decl_follows_def : Error<
5256   "inline declaration of %0 follows non-inline definition">;
5257 def err_inline_declaration_block_scope : Error<
5258   "inline declaration of %0 not allowed in block scope">;
5259 def err_static_non_static : Error<
5260   "static declaration of %0 follows non-static declaration">;
5261 def err_different_language_linkage : Error<
5262   "declaration of %0 has a different language linkage">;
5263 def ext_retained_language_linkage : Extension<
5264   "friend function %0 retaining previous language linkage is an extension">,
5265   InGroup<DiagGroup<"retained-language-linkage">>;
5266 def err_extern_c_global_conflict : Error<
5267   "declaration of %1 %select{with C language linkage|in global scope}0 "
5268   "conflicts with declaration %select{in global scope|with C language linkage}0">;
5269 def note_extern_c_global_conflict : Note<
5270   "declared %select{in global scope|with C language linkage}0 here">;
5271 def note_extern_c_begins_here : Note<
5272   "extern \"C\" language linkage specification begins here">;
5273 def warn_weak_import : Warning <
5274   "an already-declared variable is made a weak_import declaration %0">;
5275 def ext_static_non_static : Extension<
5276   "redeclaring non-static %0 as static is a Microsoft extension">,
5277   InGroup<MicrosoftRedeclareStatic>;
5278 def err_non_static_static : Error<
5279   "non-static declaration of %0 follows static declaration">;
5280 def err_extern_non_extern : Error<
5281   "extern declaration of %0 follows non-extern declaration">;
5282 def err_non_extern_extern : Error<
5283   "non-extern declaration of %0 follows extern declaration">;
5284 def err_non_thread_thread : Error<
5285   "non-thread-local declaration of %0 follows thread-local declaration">;
5286 def err_thread_non_thread : Error<
5287   "thread-local declaration of %0 follows non-thread-local declaration">;
5288 def err_thread_thread_different_kind : Error<
5289   "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5290   "follows declaration with %select{dynamic|static}1 initialization">;
5291 def err_mismatched_owning_module : Error<
5292   "declaration of %0 in %select{the global module|module %2}1 follows "
5293   "declaration in %select{the global module|module %4}3">;
5294 def err_redefinition_different_type : Error<
5295   "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5296 def err_redefinition_different_kind : Error<
5297   "redefinition of %0 as different kind of symbol">;
5298 def err_redefinition_different_namespace_alias : Error<
5299   "redefinition of %0 as an alias for a different namespace">;
5300 def note_previous_namespace_alias : Note<
5301   "previously defined as an alias for %0">;
5302 def warn_forward_class_redefinition : Warning<
5303   "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5304   InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5305 def err_redefinition_different_typedef : Error<
5306   "%select{typedef|type alias|type alias template}0 "
5307   "redefinition with different types%diff{ ($ vs $)|}1,2">;
5308 def err_tag_reference_non_tag : Error<
5309   "%select{non-struct type|non-class type|non-union type|non-enum "
5310   "type|typedef|type alias|template|type alias template|template "
5311   "template argument}1 %0 cannot be referenced with a "
5312   "%select{struct|interface|union|class|enum}2 specifier">;
5313 def err_tag_reference_conflict : Error<
5314   "implicit declaration introduced by elaborated type conflicts with a "
5315   "%select{non-struct type|non-class type|non-union type|non-enum "
5316   "type|typedef|type alias|template|type alias template|template "
5317   "template argument}0 of the same name">;
5318 def err_dependent_tag_decl : Error<
5319   "%select{declaration|definition}0 of "
5320   "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5321 def err_tag_definition_of_typedef : Error<
5322   "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5323 def err_conflicting_types : Error<"conflicting types for %0">;
5324 def err_different_pass_object_size_params : Error<
5325   "conflicting pass_object_size attributes on parameters">;
5326 def err_late_asm_label_name : Error<
5327   "cannot apply asm label to %select{variable|function}0 after its first use">;
5328 def err_different_asm_label : Error<"conflicting asm label">;
5329 def err_nested_redefinition : Error<"nested redefinition of %0">;
5330 def err_use_with_wrong_tag : Error<
5331   "use of %0 with tag type that does not match previous declaration">;
5332 def warn_struct_class_tag_mismatch : Warning<
5333   "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5334   "declared as a %select{struct|interface|class}3%select{| template}1; "
5335   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5336   InGroup<MismatchedTags>, DefaultIgnore;
5337 def warn_struct_class_previous_tag_mismatch : Warning<
5338   "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5339   "here but previously declared as "
5340   "%select{a struct|an interface|a class}3%select{| template}1; "
5341   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5342   InGroup<MismatchedTags>, DefaultIgnore;
5343 def note_struct_class_suggestion : Note<
5344   "did you mean %select{struct|interface|class}0 here?">;
5345 def ext_forward_ref_enum : Extension<
5346   "ISO C forbids forward references to 'enum' types">;
5347 def err_forward_ref_enum : Error<
5348   "ISO C++ forbids forward references to 'enum' types">;
5349 def ext_ms_forward_ref_enum : ExtWarn<
5350   "forward references to 'enum' types are a Microsoft extension">,
5351   InGroup<MicrosoftEnumForwardReference>;
5352 def ext_forward_ref_enum_def : Extension<
5353   "redeclaration of already-defined enum %0 is a GNU extension">,
5354   InGroup<GNURedeclaredEnum>;
5355
5356 def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5357 def err_duplicate_member : Error<"duplicate member %0">;
5358 def err_misplaced_ivar : Error<
5359   "instance variables may not be placed in %select{categories|class extension}0">;
5360 def warn_ivars_in_interface : Warning<
5361   "declaration of instance variables in the interface is deprecated">,
5362   InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5363 def ext_enum_value_not_int : Extension<
5364   "ISO C restricts enumerator values to range of 'int' (%0 is too "
5365   "%select{small|large}1)">;
5366 def ext_enum_too_large : ExtWarn<
5367   "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5368 def ext_enumerator_increment_too_large : ExtWarn<
5369   "incremented enumerator value %0 is not representable in the "
5370   "largest integer type">, InGroup<EnumTooLarge>;
5371 def warn_flag_enum_constant_out_of_range : Warning<
5372   "enumeration value %0 is out of range of flags in enumeration type %1">,
5373   InGroup<FlagEnum>;
5374
5375 def warn_illegal_constant_array_size : Extension<
5376   "size of static array must be an integer constant expression">;
5377 def err_vm_decl_in_file_scope : Error<
5378   "variably modified type declaration not allowed at file scope">;
5379 def err_vm_decl_has_extern_linkage : Error<
5380   "variably modified type declaration cannot have 'extern' linkage">;
5381 def err_typecheck_field_variable_size : Error<
5382   "fields must have a constant size: 'variable length array in structure' "
5383   "extension will never be supported">;
5384 def err_vm_func_decl : Error<
5385   "function declaration cannot have variably modified type">;
5386 def err_array_too_large : Error<
5387   "array is too large (%0 elements)">;
5388
5389 def err_typecheck_negative_array_size : Error<"array size is negative">;
5390 def warn_typecheck_function_qualifiers_ignored : Warning<
5391   "'%0' qualifier on function type %1 has no effect">,
5392   InGroup<IgnoredQualifiers>;
5393 def warn_typecheck_function_qualifiers_unspecified : Warning<
5394   "'%0' qualifier on function type %1 has unspecified behavior">;
5395 def warn_typecheck_reference_qualifiers : Warning<
5396   "'%0' qualifier on reference type %1 has no effect">,
5397   InGroup<IgnoredQualifiers>;
5398 def err_typecheck_invalid_restrict_not_pointer : Error<
5399   "restrict requires a pointer or reference (%0 is invalid)">;
5400 def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5401   "restrict requires a pointer or reference">;
5402 def err_typecheck_invalid_restrict_invalid_pointee : Error<
5403   "pointer to function type %0 may not be 'restrict' qualified">;
5404 def ext_typecheck_zero_array_size : Extension<
5405   "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5406 def err_typecheck_zero_array_size : Error<
5407   "zero-length arrays are not permitted in C++">;
5408 def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5409 def err_init_element_not_constant : Error<
5410   "initializer element is not a compile-time constant">;
5411 def ext_aggregate_init_not_constant : Extension<
5412   "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5413 def err_local_cant_init : Error<
5414   "'__local' variable cannot have an initializer">;
5415 def err_loader_uninitialized_cant_init
5416     : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5417             "initializer">;
5418 def err_loader_uninitialized_trivial_ctor
5419     : Error<"variable with 'loader_uninitialized' attribute must have a "
5420             "trivial default constructor">;
5421 def err_loader_uninitialized_redeclaration
5422     : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5423 def err_loader_uninitialized_extern_decl
5424     : Error<"variable %0 cannot be declared both 'extern' and with the "
5425             "'loader_uninitialized' attribute">;
5426 def err_block_extern_cant_init : Error<
5427   "'extern' variable cannot have an initializer">;
5428 def warn_extern_init : Warning<"'extern' variable has an initializer">,
5429   InGroup<DiagGroup<"extern-initializer">>;
5430 def err_variable_object_no_init : Error<
5431   "variable-sized object may not be initialized">;
5432 def err_excess_initializers : Error<
5433   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5434 def ext_excess_initializers : ExtWarn<
5435   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5436   InGroup<ExcessInitializers>;
5437 def err_excess_initializers_for_sizeless_type : Error<
5438   "excess elements in initializer for indivisible sizeless type %0">;
5439 def ext_excess_initializers_for_sizeless_type : ExtWarn<
5440   "excess elements in initializer for indivisible sizeless type %0">,
5441   InGroup<ExcessInitializers>;
5442 def err_excess_initializers_in_char_array_initializer : Error<
5443   "excess elements in char array initializer">;
5444 def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5445   "excess elements in char array initializer">,
5446   InGroup<ExcessInitializers>;
5447 def err_initializer_string_for_char_array_too_long : Error<
5448   "initializer-string for char array is too long">;
5449 def ext_initializer_string_for_char_array_too_long : ExtWarn<
5450   "initializer-string for char array is too long">,
5451   InGroup<ExcessInitializers>;
5452 def warn_missing_field_initializers : Warning<
5453   "missing field %0 initializer">,
5454   InGroup<MissingFieldInitializers>, DefaultIgnore;
5455 def warn_braces_around_init : Warning<
5456   "braces around %select{scalar |}0initializer">,
5457   InGroup<DiagGroup<"braced-scalar-init">>;
5458 def ext_many_braces_around_init : ExtWarn<
5459   "too many braces around %select{scalar |}0initializer">,
5460   InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5461 def ext_complex_component_init : Extension<
5462   "complex initialization specifying real and imaginary components "
5463   "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5464 def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5465 def err_empty_sizeless_initializer : Error<
5466   "initializer for sizeless type %0 cannot be empty">;
5467 def warn_cxx98_compat_empty_scalar_initializer : Warning<
5468   "scalar initialized from empty initializer list is incompatible with C++98">,
5469   InGroup<CXX98Compat>, DefaultIgnore;
5470 def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5471   "initializing %0 from an empty initializer list is incompatible with C++98">,
5472   InGroup<CXX98Compat>, DefaultIgnore;
5473 def warn_cxx98_compat_reference_list_init : Warning<
5474   "reference initialized from initializer list is incompatible with C++98">,
5475   InGroup<CXX98Compat>, DefaultIgnore;
5476 def warn_cxx98_compat_initializer_list_init : Warning<
5477   "initialization of initializer_list object is incompatible with C++98">,
5478   InGroup<CXX98Compat>, DefaultIgnore;
5479 def warn_cxx98_compat_ctor_list_init : Warning<
5480   "constructor call from initializer list is incompatible with C++98">,
5481   InGroup<CXX98Compat>, DefaultIgnore;
5482 def err_illegal_initializer : Error<
5483   "illegal initializer (only variables can be initialized)">;
5484 def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5485 def ext_init_list_type_narrowing : ExtWarn<
5486   "type %0 cannot be narrowed to %1 in initializer list">,
5487   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5488 def ext_init_list_variable_narrowing : ExtWarn<
5489   "non-constant-expression cannot be narrowed from type %0 to %1 in "
5490   "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5491 def ext_init_list_constant_narrowing : ExtWarn<
5492   "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5493   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5494 def warn_init_list_type_narrowing : Warning<
5495   "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5496   InGroup<CXX11Narrowing>, DefaultIgnore;
5497 def warn_init_list_variable_narrowing : Warning<
5498   "non-constant-expression cannot be narrowed from type %0 to %1 in "
5499   "initializer list in C++11">,
5500   InGroup<CXX11Narrowing>, DefaultIgnore;
5501 def warn_init_list_constant_narrowing : Warning<
5502   "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5503   "C++11">,
5504   InGroup<CXX11Narrowing>, DefaultIgnore;
5505 def note_init_list_narrowing_silence : Note<
5506   "insert an explicit cast to silence this issue">;
5507 def err_init_objc_class : Error<
5508   "cannot initialize Objective-C class type %0">;
5509 def err_implicit_empty_initializer : Error<
5510   "initializer for aggregate with no elements requires explicit braces">;
5511 def err_bitfield_has_negative_width : Error<
5512   "bit-field %0 has negative width (%1)">;
5513 def err_anon_bitfield_has_negative_width : Error<
5514   "anonymous bit-field has negative width (%0)">;
5515 def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5516 def err_bitfield_width_exceeds_type_width : Error<
5517   "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
5518   "of its type (%3 bit%s3)">;
5519 def err_anon_bitfield_width_exceeds_type_width : Error<
5520   "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
5521   "of its type (%2 bit%s2)">;
5522 def err_anon_bitfield_init : Error<
5523   "anonymous bit-field cannot have a default member initializer">;
5524 def err_incorrect_number_of_vector_initializers : Error<
5525   "number of elements must be either one or match the size of the vector">;
5526
5527 // Used by C++ which allows bit-fields that are wider than the type.
5528 def warn_bitfield_width_exceeds_type_width: Warning<
5529   "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5530   "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5531 def warn_anon_bitfield_width_exceeds_type_width : Warning<
5532   "width of anonymous bit-field (%0 bits) exceeds width of its type; value "
5533   "will be truncated to %1 bit%s1">, InGroup<BitFieldWidth>;
5534 def warn_bitfield_too_small_for_enum : Warning<
5535   "bit-field %0 is not wide enough to store all enumerators of %1">,
5536   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5537 def note_widen_bitfield : Note<
5538   "widen this field to %0 bits to store all values of %1">;
5539 def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5540   "assigning value of signed enum type %1 to unsigned bit-field %0; "
5541   "negative enumerators of enum %1 will be converted to positive values">,
5542   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5543 def warn_signed_bitfield_enum_conversion : Warning<
5544   "signed bit-field %0 needs an extra bit to represent the largest positive "
5545   "enumerators of %1">,
5546   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5547 def note_change_bitfield_sign : Note<
5548   "consider making the bitfield type %select{unsigned|signed}0">;
5549
5550 def warn_missing_braces : Warning<
5551   "suggest braces around initialization of subobject">,
5552   InGroup<MissingBraces>, DefaultIgnore;
5553
5554 def err_redefinition_of_label : Error<"redefinition of label %0">;
5555 def err_undeclared_label_use : Error<"use of undeclared label %0">;
5556 def err_goto_ms_asm_label : Error<
5557   "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5558 def note_goto_ms_asm_label : Note<
5559   "inline assembly label %0 declared here">;
5560 def warn_unused_label : Warning<"unused label %0">,
5561   InGroup<UnusedLabel>, DefaultIgnore;
5562
5563 def err_goto_into_protected_scope : Error<
5564   "cannot jump from this goto statement to its label">;
5565 def ext_goto_into_protected_scope : ExtWarn<
5566   "jump from this goto statement to its label is a Microsoft extension">,
5567   InGroup<MicrosoftGoto>;
5568 def warn_cxx98_compat_goto_into_protected_scope : Warning<
5569   "jump from this goto statement to its label is incompatible with C++98">,
5570   InGroup<CXX98Compat>, DefaultIgnore;
5571 def err_switch_into_protected_scope : Error<
5572   "cannot jump from switch statement to this case label">;
5573 def warn_cxx98_compat_switch_into_protected_scope : Warning<
5574   "jump from switch statement to this case label is incompatible with C++98">,
5575   InGroup<CXX98Compat>, DefaultIgnore;
5576 def err_indirect_goto_without_addrlabel : Error<
5577   "indirect goto in function with no address-of-label expressions">;
5578 def err_indirect_goto_in_protected_scope : Error<
5579   "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5580 def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5581   "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5582   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5583 def note_indirect_goto_target : Note<
5584   "possible target of %select{indirect|asm}0 goto statement">;
5585 def note_protected_by_variable_init : Note<
5586   "jump bypasses variable initialization">;
5587 def note_protected_by_variable_nontriv_destructor : Note<
5588   "jump bypasses variable with a non-trivial destructor">;
5589 def note_protected_by_variable_non_pod : Note<
5590   "jump bypasses initialization of non-POD variable">;
5591 def note_protected_by_cleanup : Note<
5592   "jump bypasses initialization of variable with __attribute__((cleanup))">;
5593 def note_protected_by_vla_typedef : Note<
5594   "jump bypasses initialization of VLA typedef">;
5595 def note_protected_by_vla_type_alias : Note<
5596   "jump bypasses initialization of VLA type alias">;
5597 def note_protected_by_constexpr_if : Note<
5598   "jump enters controlled statement of constexpr if">;
5599 def note_protected_by_if_available : Note<
5600   "jump enters controlled statement of if available">;
5601 def note_protected_by_vla : Note<
5602   "jump bypasses initialization of variable length array">;
5603 def note_protected_by_objc_fast_enumeration : Note<
5604   "jump enters Objective-C fast enumeration loop">;
5605 def note_protected_by_objc_try : Note<
5606   "jump bypasses initialization of @try block">;
5607 def note_protected_by_objc_catch : Note<
5608   "jump bypasses initialization of @catch block">;
5609 def note_protected_by_objc_finally : Note<
5610   "jump bypasses initialization of @finally block">;
5611 def note_protected_by_objc_synchronized : Note<
5612   "jump bypasses initialization of @synchronized block">;
5613 def note_protected_by_objc_autoreleasepool : Note<
5614   "jump bypasses auto release push of @autoreleasepool block">;
5615 def note_protected_by_cxx_try : Note<
5616   "jump bypasses initialization of try block">;
5617 def note_protected_by_cxx_catch : Note<
5618   "jump bypasses initialization of catch block">;
5619 def note_protected_by_seh_try : Note<
5620   "jump bypasses initialization of __try block">;
5621 def note_protected_by_seh_except : Note<
5622   "jump bypasses initialization of __except block">;
5623 def note_protected_by_seh_finally : Note<
5624   "jump bypasses initialization of __finally block">;
5625 def note_protected_by___block : Note<
5626   "jump bypasses setup of __block variable">;
5627 def note_protected_by_objc_strong_init : Note<
5628   "jump bypasses initialization of __strong variable">;
5629 def note_protected_by_objc_weak_init : Note<
5630   "jump bypasses initialization of __weak variable">;
5631 def note_protected_by_non_trivial_c_struct_init : Note<
5632   "jump bypasses initialization of variable of non-trivial C struct type">;
5633 def note_enters_block_captures_cxx_obj : Note<
5634   "jump enters lifetime of block which captures a destructible C++ object">;
5635 def note_enters_block_captures_strong : Note<
5636   "jump enters lifetime of block which strongly captures a variable">;
5637 def note_enters_block_captures_weak : Note<
5638   "jump enters lifetime of block which weakly captures a variable">;
5639 def note_enters_block_captures_non_trivial_c_struct : Note<
5640   "jump enters lifetime of block which captures a C struct that is non-trivial "
5641   "to destroy">;
5642 def note_enters_compound_literal_scope : Note<
5643   "jump enters lifetime of a compound literal that is non-trivial to destruct">;
5644
5645 def note_exits_cleanup : Note<
5646   "jump exits scope of variable with __attribute__((cleanup))">;
5647 def note_exits_dtor : Note<
5648   "jump exits scope of variable with non-trivial destructor">;
5649 def note_exits_temporary_dtor : Note<
5650   "jump exits scope of lifetime-extended temporary with non-trivial "
5651   "destructor">;
5652 def note_exits___block : Note<
5653   "jump exits scope of __block variable">;
5654 def note_exits_objc_try : Note<
5655   "jump exits @try block">;
5656 def note_exits_objc_catch : Note<
5657   "jump exits @catch block">;
5658 def note_exits_objc_finally : Note<
5659   "jump exits @finally block">;
5660 def note_exits_objc_synchronized : Note<
5661   "jump exits @synchronized block">;
5662 def note_exits_cxx_try : Note<
5663   "jump exits try block">;
5664 def note_exits_cxx_catch : Note<
5665   "jump exits catch block">;
5666 def note_exits_seh_try : Note<
5667   "jump exits __try block">;
5668 def note_exits_seh_except : Note<
5669   "jump exits __except block">;
5670 def note_exits_seh_finally : Note<
5671   "jump exits __finally block">;
5672 def note_exits_objc_autoreleasepool : Note<
5673   "jump exits autoreleasepool block">;
5674 def note_exits_objc_strong : Note<
5675   "jump exits scope of __strong variable">;
5676 def note_exits_objc_weak : Note<
5677   "jump exits scope of __weak variable">;
5678 def note_exits_block_captures_cxx_obj : Note<
5679   "jump exits lifetime of block which captures a destructible C++ object">;
5680 def note_exits_block_captures_strong : Note<
5681   "jump exits lifetime of block which strongly captures a variable">;
5682 def note_exits_block_captures_weak : Note<
5683   "jump exits lifetime of block which weakly captures a variable">;
5684 def note_exits_block_captures_non_trivial_c_struct : Note<
5685   "jump exits lifetime of block which captures a C struct that is non-trivial "
5686   "to destroy">;
5687 def note_exits_compound_literal_scope : Note<
5688   "jump exits lifetime of a compound literal that is non-trivial to destruct">;
5689
5690 def err_func_returning_qualified_void : ExtWarn<
5691   "function cannot return qualified void type %0">,
5692   InGroup<DiagGroup<"qualified-void-return-type">>;
5693 def err_func_returning_array_function : Error<
5694   "function cannot return %select{array|function}0 type %1">;
5695 def err_field_declared_as_function : Error<"field %0 declared as a function">;
5696 def err_field_incomplete_or_sizeless : Error<
5697   "field has %select{incomplete|sizeless}0 type %1">;
5698 def ext_variable_sized_type_in_struct : ExtWarn<
5699   "field %0 with variable sized type %1 not at the end of a struct or class is"
5700   " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5701
5702 def ext_c99_flexible_array_member : Extension<
5703   "flexible array members are a C99 feature">, InGroup<C99>;
5704 def err_flexible_array_virtual_base : Error<
5705   "flexible array member %0 not allowed in "
5706   "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5707 def err_flexible_array_empty_aggregate : Error<
5708   "flexible array member %0 not allowed in otherwise empty "
5709   "%select{struct|interface|union|class|enum}1">;
5710 def err_flexible_array_has_nontrivial_dtor : Error<
5711   "flexible array member %0 of type %1 with non-trivial destruction">;
5712 def ext_flexible_array_in_struct : Extension<
5713   "%0 may not be nested in a struct due to flexible array member">,
5714   InGroup<FlexibleArrayExtensions>;
5715 def ext_flexible_array_in_array : Extension<
5716   "%0 may not be used as an array element due to flexible array member">,
5717   InGroup<FlexibleArrayExtensions>;
5718 def err_flexible_array_init : Error<
5719   "initialization of flexible array member is not allowed">;
5720 def ext_flexible_array_empty_aggregate_ms : Extension<
5721   "flexible array member %0 in otherwise empty "
5722   "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
5723   InGroup<MicrosoftFlexibleArray>;
5724 def err_flexible_array_union : Error<
5725   "flexible array member %0 in a union is not allowed">;
5726 def ext_flexible_array_union_ms : Extension<
5727   "flexible array member %0 in a union is a Microsoft extension">,
5728   InGroup<MicrosoftFlexibleArray>;
5729 def ext_flexible_array_empty_aggregate_gnu : Extension<
5730   "flexible array member %0 in otherwise empty "
5731   "%select{struct|interface|union|class|enum}1 is a GNU extension">,
5732   InGroup<GNUEmptyStruct>;
5733 def ext_flexible_array_union_gnu : Extension<
5734   "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
5735
5736 def err_flexible_array_not_at_end : Error<
5737   "flexible array member %0 with type %1 is not at the end of"
5738   " %select{struct|interface|union|class|enum}2">;
5739 def err_objc_variable_sized_type_not_at_end : Error<
5740   "field %0 with variable sized type %1 is not at the end of class">;
5741 def note_next_field_declaration : Note<
5742   "next field declaration is here">;
5743 def note_next_ivar_declaration : Note<
5744   "next %select{instance variable declaration|synthesized instance variable}0"
5745   " is here">;
5746 def err_synthesize_variable_sized_ivar : Error<
5747   "synthesized property with variable size type %0"
5748   " requires an existing instance variable">;
5749 def err_flexible_array_arc_retainable : Error<
5750   "ARC forbids flexible array members with retainable object type">;
5751 def warn_variable_sized_ivar_visibility : Warning<
5752   "field %0 with variable sized type %1 is not visible to subclasses and"
5753   " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
5754 def warn_superclass_variable_sized_type_not_at_end : Warning<
5755   "field %0 can overwrite instance variable %1 with variable sized type %2"
5756   " in superclass %3">, InGroup<ObjCFlexibleArray>;
5757
5758 let CategoryName = "ARC Semantic Issue" in {
5759
5760 // ARC-mode diagnostics.
5761
5762 let CategoryName = "ARC Weak References" in {
5763
5764 def err_arc_weak_no_runtime : Error<
5765   "cannot create __weak reference because the current deployment target "
5766   "does not support weak references">;
5767 def err_arc_weak_disabled : Error<
5768   "cannot create __weak reference in file using manual reference counting">;
5769 def err_synthesizing_arc_weak_property_disabled : Error<
5770   "cannot synthesize weak property in file using manual reference counting">;
5771 def err_synthesizing_arc_weak_property_no_runtime : Error<
5772   "cannot synthesize weak property because the current deployment target "
5773   "does not support weak references">;
5774 def err_arc_unsupported_weak_class : Error<
5775   "class is incompatible with __weak references">;
5776 def err_arc_weak_unavailable_assign : Error<
5777   "assignment of a weak-unavailable object to a __weak object">;
5778 def err_arc_weak_unavailable_property : Error<
5779   "synthesizing __weak instance variable of type %0, which does not "
5780   "support weak references">;
5781 def note_implemented_by_class : Note<
5782   "when implemented by class %0">;
5783 def err_arc_convesion_of_weak_unavailable : Error<
5784   "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
5785   " a __weak object of type %2">;
5786
5787 } // end "ARC Weak References" category
5788
5789 let CategoryName = "ARC Restrictions" in {
5790
5791 def err_unavailable_in_arc : Error<
5792   "%0 is unavailable in ARC">;
5793 def note_arc_forbidden_type : Note<
5794   "declaration uses type that is ill-formed in ARC">;
5795 def note_performs_forbidden_arc_conversion : Note<
5796   "inline function performs a conversion which is forbidden in ARC">;
5797 def note_arc_init_returns_unrelated : Note<
5798   "init method must return a type related to its receiver type">;
5799 def note_arc_weak_disabled : Note<
5800   "declaration uses __weak, but ARC is disabled">;
5801 def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
5802   "the current deployment target does not support">;
5803 def note_arc_field_with_ownership : Note<
5804   "field has non-trivial ownership qualification">;
5805
5806 def err_arc_illegal_explicit_message : Error<
5807   "ARC forbids explicit message send of %0">;
5808 def err_arc_unused_init_message : Error<
5809   "the result of a delegate init call must be immediately returned "
5810   "or assigned to 'self'">;
5811 def err_arc_mismatched_cast : Error<
5812   "%select{implicit conversion|cast}0 of "
5813   "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
5814   "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
5815   " to %3 is disallowed with ARC">;
5816 def err_arc_nolifetime_behavior : Error<
5817   "explicit ownership qualifier on cast result has no effect">;
5818 def err_arc_objc_property_default_assign_on_object : Error<
5819   "ARC forbids synthesizing a property of an Objective-C object "
5820   "with unspecified ownership or storage attribute">;
5821 def err_arc_illegal_selector : Error<
5822   "ARC forbids use of %0 in a @selector">;
5823 def err_arc_illegal_method_def : Error<
5824   "ARC forbids %select{implementation|synthesis}0 of %1">;
5825 def warn_arc_strong_pointer_objc_pointer : Warning<
5826   "method parameter of type %0 with no explicit ownership">,
5827   InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
5828
5829 } // end "ARC Restrictions" category
5830
5831 def err_arc_lost_method_convention : Error<
5832   "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
5833   "method, but its implementation doesn't match because %select{"
5834   "its result type is not an object pointer|"
5835   "its result type is unrelated to its receiver type}1">;
5836 def note_arc_lost_method_convention : Note<"declaration in interface">;
5837 def err_arc_gained_method_convention : Error<
5838   "method implementation does not match its declaration">;
5839 def note_arc_gained_method_convention : Note<
5840   "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
5841   "family because %select{its result type is not an object pointer|"
5842   "its result type is unrelated to its receiver type}1">;
5843 def err_typecheck_arc_assign_self : Error<
5844   "cannot assign to 'self' outside of a method in the init family">;
5845 def err_typecheck_arc_assign_self_class_method : Error<
5846   "cannot assign to 'self' in a class method">;
5847 def err_typecheck_arr_assign_enumeration : Error<
5848   "fast enumeration variables cannot be modified in ARC by default; "
5849   "declare the variable __strong to allow this">;
5850 def err_typecheck_arc_assign_externally_retained : Error<
5851   "variable declared with 'objc_externally_retained' "
5852   "cannot be modified in ARC">;
5853 def warn_arc_retained_assign : Warning<
5854   "assigning retained object to %select{weak|unsafe_unretained}0 "
5855   "%select{property|variable}1"
5856   "; object will be released after assignment">,
5857   InGroup<ARCUnsafeRetainedAssign>;
5858 def warn_arc_retained_property_assign : Warning<
5859   "assigning retained object to unsafe property"
5860   "; object will be released after assignment">,
5861   InGroup<ARCUnsafeRetainedAssign>;
5862 def warn_arc_literal_assign : Warning<
5863   "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
5864   " to a weak %select{property|variable}1"
5865   "; object will be released after assignment">,
5866   InGroup<ARCUnsafeRetainedAssign>;
5867 def err_arc_new_array_without_ownership : Error<
5868   "'new' cannot allocate an array of %0 with no explicit ownership">;
5869 def err_arc_autoreleasing_var : Error<
5870   "%select{__block variables|global variables|fields|instance variables}0 cannot have "
5871   "__autoreleasing ownership">;
5872 def err_arc_autoreleasing_capture : Error<
5873   "cannot capture __autoreleasing variable in a "
5874   "%select{block|lambda by copy}0">;
5875 def err_arc_thread_ownership : Error<
5876   "thread-local variable has non-trivial ownership: type is %0">;
5877 def err_arc_indirect_no_ownership : Error<
5878   "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
5879 def err_arc_array_param_no_ownership : Error<
5880   "must explicitly describe intended ownership of an object array parameter">;
5881 def err_arc_pseudo_dtor_inconstant_quals : Error<
5882   "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
5883   "type %1">;
5884 def err_arc_init_method_unrelated_result_type : Error<
5885   "init methods must return a type related to the receiver type">;
5886 def err_arc_nonlocal_writeback : Error<
5887   "passing address of %select{non-local|non-scalar}0 object to "
5888   "__autoreleasing parameter for write-back">;
5889 def err_arc_method_not_found : Error<
5890   "no known %select{instance|class}1 method for selector %0">;
5891 def err_arc_receiver_forward_class : Error<
5892   "receiver %0 for class message is a forward declaration">;
5893 def err_arc_may_not_respond : Error<
5894   "no visible @interface for %0 declares the selector %1">;
5895 def err_arc_receiver_forward_instance : Error<
5896   "receiver type %0 for instance message is a forward declaration">;
5897 def warn_receiver_forward_instance : Warning<
5898   "receiver type %0 for instance message is a forward declaration">,
5899   InGroup<ForwardClassReceiver>, DefaultIgnore;
5900 def err_arc_collection_forward : Error<
5901   "collection expression type %0 is a forward declaration">;
5902 def err_arc_multiple_method_decl : Error<
5903   "multiple methods named %0 found with mismatched result, "
5904   "parameter type or attributes">;
5905 def warn_arc_lifetime_result_type : Warning<
5906   "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
5907   "lifetime qualifier on return type is ignored">,
5908   InGroup<IgnoredQualifiers>;
5909
5910 let CategoryName = "ARC Retain Cycle" in {
5911
5912 def warn_arc_retain_cycle : Warning<
5913   "capturing %0 strongly in this block is likely to lead to a retain cycle">,
5914   InGroup<ARCRetainCycles>;
5915 def note_arc_retain_cycle_owner : Note<
5916   "block will be retained by %select{the captured object|an object strongly "
5917   "retained by the captured object}0">;
5918
5919 } // end "ARC Retain Cycle" category
5920
5921 def warn_arc_object_memaccess : Warning<
5922   "%select{destination for|source of}0 this %1 call is a pointer to "
5923   "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
5924
5925 let CategoryName = "ARC and @properties" in {
5926
5927 def err_arc_strong_property_ownership : Error<
5928   "existing instance variable %1 for strong property %0 may not be "
5929   "%select{|__unsafe_unretained||__weak}2">;
5930 def err_arc_assign_property_ownership : Error<
5931   "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
5932   "attribute must be __unsafe_unretained">;
5933 def err_arc_inconsistent_property_ownership : Error<
5934   "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
5935   "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
5936
5937 } // end "ARC and @properties" category
5938
5939 def warn_block_capture_autoreleasing : Warning<
5940   "block captures an autoreleasing out-parameter, which may result in "
5941   "use-after-free bugs">,
5942   InGroup<BlockCaptureAutoReleasing>;
5943 def note_declare_parameter_strong : Note<
5944   "declare the parameter __strong or capture a __block __strong variable to "
5945   "keep values alive across autorelease pools">;
5946
5947 def err_arc_atomic_ownership : Error<
5948   "cannot perform atomic operation on a pointer to type %0: type has "
5949   "non-trivial ownership">;
5950
5951 let CategoryName = "ARC Casting Rules" in {
5952
5953 def err_arc_bridge_cast_incompatible : Error<
5954   "incompatible types casting %0 to %1 with a %select{__bridge|"
5955   "__bridge_transfer|__bridge_retained}2 cast">;
5956 def err_arc_bridge_cast_wrong_kind : Error<
5957   "cast of %select{Objective-C|block|C}0 pointer type %1 to "
5958   "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
5959   "__bridge_transfer|__bridge_retained}4">;
5960 def err_arc_cast_requires_bridge : Error<
5961   "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
5962   "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
5963   "requires a bridged cast">;
5964 def note_arc_bridge : Note<
5965   "use __bridge to convert directly (no change in ownership)">;
5966 def note_arc_cstyle_bridge : Note<
5967   "use __bridge with C-style cast to convert directly (no change in ownership)">;
5968 def note_arc_bridge_transfer : Note<
5969   "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
5970   "ownership of a +1 %0 into ARC">;
5971 def note_arc_cstyle_bridge_transfer : Note<
5972   "use __bridge_transfer with C-style cast to transfer "
5973   "ownership of a +1 %0 into ARC">;
5974 def note_arc_bridge_retained : Note<
5975   "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
5976   "ARC object available as a +1 %0">;
5977 def note_arc_cstyle_bridge_retained : Note<
5978   "use __bridge_retained with C-style cast to make an "
5979   "ARC object available as a +1 %0">;
5980
5981 } // ARC Casting category
5982
5983 } // ARC category name
5984
5985 def err_flexible_array_init_needs_braces : Error<
5986   "flexible array requires brace-enclosed initializer">;
5987 def err_illegal_decl_array_of_functions : Error<
5988   "'%0' declared as array of functions of type %1">;
5989 def err_array_incomplete_or_sizeless_type : Error<
5990   "array has %select{incomplete|sizeless}0 element type %1">;
5991 def err_illegal_message_expr_incomplete_type : Error<
5992   "Objective-C message has incomplete result type %0">;
5993 def err_illegal_decl_array_of_references : Error<
5994   "'%0' declared as array of references of type %1">;
5995 def err_decl_negative_array_size : Error<
5996   "'%0' declared as an array with a negative size">;
5997 def err_array_static_outside_prototype : Error<
5998   "%0 used in array declarator outside of function prototype">;
5999 def err_array_static_not_outermost : Error<
6000   "%0 used in non-outermost array type derivation">;
6001 def err_array_star_outside_prototype : Error<
6002   "star modifier used outside of function prototype">;
6003 def err_illegal_decl_pointer_to_reference : Error<
6004   "'%0' declared as a pointer to a reference of type %1">;
6005 def err_illegal_decl_mempointer_to_reference : Error<
6006   "'%0' declared as a member pointer to a reference of type %1">;
6007 def err_illegal_decl_mempointer_to_void : Error<
6008   "'%0' declared as a member pointer to void">;
6009 def err_illegal_decl_mempointer_in_nonclass : Error<
6010   "'%0' does not point into a class">;
6011 def err_mempointer_in_nonclass_type : Error<
6012   "member pointer refers into non-class type %0">;
6013 def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6014 def err_nonfunction_block_type : Error<
6015   "block pointer to non-function type is invalid">;
6016 def err_return_block_has_expr : Error<"void block should not return a value">;
6017 def err_block_return_missing_expr : Error<
6018   "non-void block should return a value">;
6019 def err_func_def_incomplete_result : Error<
6020   "incomplete result type %0 in function definition">;
6021 def err_atomic_specifier_bad_type
6022     : Error<"_Atomic cannot be applied to "
6023             "%select{incomplete |array |function |reference |atomic |qualified "
6024             "|sizeless ||integer }0type "
6025             "%1 %select{|||||||which is not trivially copyable|}0">;
6026
6027 // Expressions.
6028 def ext_sizeof_alignof_function_type : Extension<
6029   "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6030 def ext_sizeof_alignof_void_type : Extension<
6031   "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6032 def err_opencl_sizeof_alignof_type : Error<
6033   "invalid application of '%0' to a void type">;
6034 def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6035   "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6036 def err_sizeof_alignof_function_type : Error<
6037   "invalid application of '%0' to a function type">;
6038 def err_openmp_default_simd_align_expr : Error<
6039   "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6040 def err_sizeof_alignof_typeof_bitfield : Error<
6041   "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6042 def err_alignof_member_of_incomplete_type : Error<
6043   "invalid application of 'alignof' to a field of a class still being defined">;
6044 def err_vecstep_non_scalar_vector_type : Error<
6045   "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6046 def err_offsetof_incomplete_type : Error<
6047   "offsetof of incomplete type %0">;
6048 def err_offsetof_record_type : Error<
6049   "offsetof requires struct, union, or class type, %0 invalid">;
6050 def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6051 def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6052   InGroup<InvalidOffsetof>;
6053 def ext_offsetof_non_standardlayout_type : ExtWarn<
6054   "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6055 def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6056 def err_offsetof_field_of_virtual_base : Error<
6057   "invalid application of 'offsetof' to a field of a virtual base">;
6058 def warn_sub_ptr_zero_size_types : Warning<
6059   "subtraction of pointers to type %0 of zero size has undefined behavior">,
6060   InGroup<PointerArith>;
6061 def warn_pointer_arith_null_ptr : Warning<
6062   "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6063   InGroup<NullPointerArithmetic>, DefaultIgnore;
6064 def warn_gnu_null_ptr_arith : Warning<
6065   "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6066   InGroup<NullPointerArithmetic>, DefaultIgnore;
6067
6068 def warn_floatingpoint_eq : Warning<
6069   "comparing floating point with == or != is unsafe">,
6070   InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6071
6072 def warn_remainder_division_by_zero : Warning<
6073   "%select{remainder|division}0 by zero is undefined">,
6074   InGroup<DivZero>;
6075 def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6076   InGroup<DiagGroup<"shift-negative-value">>;
6077 def warn_shift_negative : Warning<"shift count is negative">,
6078   InGroup<DiagGroup<"shift-count-negative">>;
6079 def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6080   InGroup<DiagGroup<"shift-count-overflow">>;
6081 def warn_shift_result_gt_typewidth : Warning<
6082   "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6083   "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6084 def warn_shift_result_sets_sign_bit : Warning<
6085   "signed shift result (%0) sets the sign bit of the shift expression's "
6086   "type (%1) and becomes negative">,
6087   InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6088
6089 def warn_precedence_bitwise_rel : Warning<
6090   "%0 has lower precedence than %1; %1 will be evaluated first">,
6091   InGroup<Parentheses>;
6092 def note_precedence_bitwise_first : Note<
6093   "place parentheses around the %0 expression to evaluate it first">;
6094 def note_precedence_silence : Note<
6095   "place parentheses around the '%0' expression to silence this warning">;
6096
6097 def warn_precedence_conditional : Warning<
6098   "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6099   InGroup<Parentheses>;
6100 def warn_precedence_bitwise_conditional : Warning<
6101   "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6102   InGroup<BitwiseConditionalParentheses>;
6103 def note_precedence_conditional_first : Note<
6104   "place parentheses around the '?:' expression to evaluate it first">;
6105
6106 def warn_enum_constant_in_bool_context : Warning<
6107   "converting the enum constant to a boolean">,
6108   InGroup<IntInBoolContext>, DefaultIgnore;
6109 def warn_left_shift_in_bool_context : Warning<
6110   "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6111   InGroup<IntInBoolContext>, DefaultIgnore;
6112 def warn_logical_instead_of_bitwise : Warning<
6113   "use of logical '%0' with constant operand">,
6114   InGroup<DiagGroup<"constant-logical-operand">>;
6115 def note_logical_instead_of_bitwise_change_operator : Note<
6116   "use '%0' for a bitwise operation">;
6117 def note_logical_instead_of_bitwise_remove_constant : Note<
6118   "remove constant to silence this warning">;
6119
6120 def warn_bitwise_op_in_bitwise_op : Warning<
6121   "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6122
6123 def warn_logical_and_in_logical_or : Warning<
6124   "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6125
6126 def warn_overloaded_shift_in_comparison :Warning<
6127   "overloaded operator %select{>>|<<}0 has higher precedence than "
6128   "comparison operator">,
6129   InGroup<OverloadedShiftOpParentheses>;
6130 def note_evaluate_comparison_first :Note<
6131   "place parentheses around comparison expression to evaluate it first">;
6132
6133 def warn_addition_in_bitshift : Warning<
6134   "operator '%0' has lower precedence than '%1'; "
6135   "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6136
6137 def warn_self_assignment_builtin : Warning<
6138   "explicitly assigning value of variable of type %0 to itself">,
6139   InGroup<SelfAssignment>, DefaultIgnore;
6140 def warn_self_assignment_overloaded : Warning<
6141   "explicitly assigning value of variable of type %0 to itself">,
6142   InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6143 def warn_self_move : Warning<
6144   "explicitly moving variable of type %0 to itself">,
6145   InGroup<SelfMove>, DefaultIgnore;
6146
6147 def warn_redundant_move_on_return : Warning<
6148   "redundant move in return statement">,
6149   InGroup<RedundantMove>, DefaultIgnore;
6150 def warn_pessimizing_move_on_return : Warning<
6151   "moving a local object in a return statement prevents copy elision">,
6152   InGroup<PessimizingMove>, DefaultIgnore;
6153 def warn_pessimizing_move_on_initialization : Warning<
6154   "moving a temporary object prevents copy elision">,
6155   InGroup<PessimizingMove>, DefaultIgnore;
6156 def note_remove_move : Note<"remove std::move call here">;
6157
6158 def warn_return_std_move : Warning<
6159   "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
6160   InGroup<ReturnStdMove>, DefaultIgnore;
6161 def note_add_std_move : Note<
6162   "call 'std::move' explicitly to avoid copying">;
6163 def warn_return_std_move_in_cxx11 : Warning<
6164   "prior to the resolution of a defect report against ISO C++11, "
6165   "local variable %0 would have been copied despite being returned by name, "
6166   "due to its not matching the function return type%diff{ ($ vs $)|}1,2">,
6167   InGroup<ReturnStdMoveInCXX11>, DefaultIgnore;
6168 def note_add_std_move_in_cxx11 : Note<
6169   "call 'std::move' explicitly to avoid copying on older compilers">;
6170
6171 def warn_string_plus_int : Warning<
6172   "adding %0 to a string does not append to the string">,
6173   InGroup<StringPlusInt>;
6174 def warn_string_plus_char : Warning<
6175   "adding %0 to a string pointer does not append to the string">,
6176   InGroup<StringPlusChar>;
6177 def note_string_plus_scalar_silence : Note<
6178   "use array indexing to silence this warning">;
6179
6180 def warn_sizeof_array_param : Warning<
6181   "sizeof on array function parameter will return size of %0 instead of %1">,
6182   InGroup<SizeofArrayArgument>;
6183
6184 def warn_sizeof_array_decay : Warning<
6185   "sizeof on pointer operation will return size of %0 instead of %1">,
6186   InGroup<SizeofArrayDecay>;
6187
6188 def err_sizeof_nonfragile_interface : Error<
6189   "application of '%select{alignof|sizeof}1' to interface %0 is "
6190   "not supported on this architecture and platform">;
6191 def err_atdef_nonfragile_interface : Error<
6192   "use of @defs is not supported on this architecture and platform">;
6193 def err_subscript_nonfragile_interface : Error<
6194   "subscript requires size of interface %0, which is not constant for "
6195   "this architecture and platform">;
6196
6197 def err_arithmetic_nonfragile_interface : Error<
6198   "arithmetic on pointer to interface %0, which is not a constant size for "
6199   "this architecture and platform">;
6200
6201 def warn_deprecated_comma_subscript : Warning<
6202   "top-level comma expression in array subscript is deprecated">,
6203   InGroup<DeprecatedCommaSubscript>;
6204
6205 def ext_subscript_non_lvalue : Extension<
6206   "ISO C90 does not allow subscripting non-lvalue array">;
6207 def err_typecheck_subscript_value : Error<
6208   "subscripted value is not an array, pointer, or vector">;
6209 def err_typecheck_subscript_not_integer : Error<
6210   "array subscript is not an integer">;
6211 def err_subscript_function_type : Error<
6212   "subscript of pointer to function type %0">;
6213 def err_subscript_incomplete_or_sizeless_type : Error<
6214   "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6215 def err_dereference_incomplete_type : Error<
6216   "dereference of pointer to incomplete type %0">;
6217 def ext_gnu_subscript_void_type : Extension<
6218   "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6219 def err_typecheck_member_reference_struct_union : Error<
6220   "member reference base type %0 is not a structure or union">;
6221 def err_typecheck_member_reference_ivar : Error<
6222   "%0 does not have a member named %1">;
6223 def err_arc_weak_ivar_access : Error<
6224   "dereferencing a __weak pointer is not allowed due to possible "
6225   "null value caused by race condition, assign it to strong variable first">;
6226 def err_typecheck_member_reference_arrow : Error<
6227   "member reference type %0 is not a pointer">;
6228 def err_typecheck_member_reference_suggestion : Error<
6229   "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6230 def note_typecheck_member_reference_suggestion : Note<
6231   "did you mean to use '.' instead?">;
6232 def note_member_reference_arrow_from_operator_arrow : Note<
6233   "'->' applied to return value of the operator->() declared here">;
6234 def err_typecheck_member_reference_type : Error<
6235   "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6236 def err_typecheck_member_reference_unknown : Error<
6237   "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6238 def err_member_reference_needs_call : Error<
6239   "base of member reference is a function; perhaps you meant to call "
6240   "it%select{| with no arguments}0?">;
6241 def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6242   InGroup<CharSubscript>, DefaultIgnore;
6243
6244 def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6245 def err_no_member : Error<"no member named %0 in %1">;
6246 def err_no_member_overloaded_arrow : Error<
6247   "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6248
6249 def err_member_not_yet_instantiated : Error<
6250   "no member %0 in %1; it has not yet been instantiated">;
6251 def note_non_instantiated_member_here : Note<
6252   "not-yet-instantiated member is declared here">;
6253
6254 def err_enumerator_does_not_exist : Error<
6255   "enumerator %0 does not exist in instantiation of %1">;
6256 def note_enum_specialized_here : Note<
6257   "enum %0 was explicitly specialized here">;
6258
6259 def err_specialization_not_primary_template : Error<
6260   "cannot reference member of primary template because deduced class "
6261   "template specialization %0 is %select{instantiated from a partial|"
6262   "an explicit}1 specialization">;
6263
6264 def err_member_redeclared : Error<"class member cannot be redeclared">;
6265 def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6266   InGroup<RedeclaredClassMember>;
6267 def err_member_redeclared_in_instantiation : Error<
6268   "multiple overloads of %0 instantiate to the same signature %1">;
6269 def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6270 def err_member_def_undefined_record : Error<
6271   "out-of-line definition of %0 from class %1 without definition">;
6272 def err_member_decl_does_not_match : Error<
6273   "out-of-line %select{declaration|definition}2 of %0 "
6274   "does not match any declaration in %1">;
6275 def err_friend_decl_with_def_arg_must_be_def : Error<
6276   "friend declaration specifying a default argument must be a definition">;
6277 def err_friend_decl_with_def_arg_redeclared : Error<
6278   "friend declaration specifying a default argument must be the only declaration">;
6279 def err_friend_decl_does_not_match : Error<
6280   "friend declaration of %0 does not match any declaration in %1">;
6281 def err_member_decl_does_not_match_suggest : Error<
6282   "out-of-line %select{declaration|definition}2 of %0 "
6283   "does not match any declaration in %1; did you mean %3?">;
6284 def err_member_def_does_not_match_ret_type : Error<
6285   "return type of out-of-line definition of %q0 differs from "
6286   "that in the declaration">;
6287 def err_nonstatic_member_out_of_line : Error<
6288   "non-static data member defined out-of-line">;
6289 def err_qualified_typedef_declarator : Error<
6290   "typedef declarator cannot be qualified">;
6291 def err_qualified_param_declarator : Error<
6292   "parameter declarator cannot be qualified">;
6293 def ext_out_of_line_declaration : ExtWarn<
6294   "out-of-line declaration of a member must be a definition">,
6295   InGroup<OutOfLineDeclaration>, DefaultError;
6296 def err_member_extra_qualification : Error<
6297   "extra qualification on member %0">;
6298 def warn_member_extra_qualification : Warning<
6299   err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6300 def warn_namespace_member_extra_qualification : Warning<
6301   "extra qualification on member %0">,
6302   InGroup<DiagGroup<"extra-qualification">>;
6303 def err_member_qualification : Error<
6304   "non-friend class member %0 cannot have a qualified name">;
6305 def note_member_def_close_match : Note<"member declaration nearly matches">;
6306 def note_member_def_close_const_match : Note<
6307   "member declaration does not match because "
6308   "it %select{is|is not}0 const qualified">;
6309 def note_member_def_close_param_match : Note<
6310   "type of %ordinal0 parameter of member declaration does not match definition"
6311   "%diff{ ($ vs $)|}1,2">;
6312 def note_local_decl_close_match : Note<"local declaration nearly matches">;
6313 def note_local_decl_close_param_match : Note<
6314   "type of %ordinal0 parameter of local declaration does not match definition"
6315   "%diff{ ($ vs $)|}1,2">;
6316 def err_typecheck_ivar_variable_size : Error<
6317   "instance variables must have a constant size">;
6318 def err_ivar_reference_type : Error<
6319   "instance variables cannot be of reference type">;
6320 def err_typecheck_illegal_increment_decrement : Error<
6321   "cannot %select{decrement|increment}1 value of type %0">;
6322 def err_typecheck_expect_int : Error<
6323   "used type %0 where integer is required">;
6324 def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6325   "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6326 def err_typecheck_pointer_arith_function_type : Error<
6327   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6328   "function type%select{|s}2 %1%select{| and %3}2">;
6329 def err_typecheck_pointer_arith_void_type : Error<
6330   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6331 def err_typecheck_decl_incomplete_type : Error<
6332   "variable has incomplete type %0">;
6333 def ext_typecheck_decl_incomplete_type : ExtWarn<
6334   "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6335   InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6336 def err_tentative_def_incomplete_type : Error<
6337   "tentative definition has type %0 that is never completed">;
6338 def warn_tentative_incomplete_array : Warning<
6339   "tentative array definition assumed to have one element">;
6340 def err_typecheck_incomplete_array_needs_initializer : Error<
6341   "definition of variable with array type needs an explicit size "
6342   "or an initializer">;
6343 def err_array_init_not_init_list : Error<
6344   "array initializer must be an initializer "
6345   "list%select{| or string literal| or wide string literal}0">;
6346 def err_array_init_narrow_string_into_wchar : Error<
6347   "initializing wide char array with non-wide string literal">;
6348 def err_array_init_wide_string_into_char : Error<
6349   "initializing char array with wide string literal">;
6350 def err_array_init_incompat_wide_string_into_wchar : Error<
6351   "initializing wide char array with incompatible wide string literal">;
6352 def err_array_init_plain_string_into_char8_t : Error<
6353   "initializing 'char8_t' array with plain string literal">;
6354 def note_array_init_plain_string_into_char8_t : Note<
6355   "add 'u8' prefix to form a 'char8_t' string literal">;
6356 def err_array_init_utf8_string_into_char : Error<
6357   "%select{|ISO C++20 does not permit }0initialization of char array with "
6358   "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6359 def warn_cxx20_compat_utf8_string : Warning<
6360   "type of UTF-8 string literal will change from array of const char to "
6361   "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6362 def note_cxx20_compat_utf8_string_remove_u8 : Note<
6363   "remove 'u8' prefix to avoid a change of behavior; "
6364   "Clang encodes unprefixed narrow string literals as UTF-8">;
6365 def err_array_init_different_type : Error<
6366   "cannot initialize array %diff{of type $ with array of type $|"
6367   "with different type of array}0,1">;
6368 def err_array_init_non_constant_array : Error<
6369   "cannot initialize array %diff{of type $ with non-constant array of type $|"
6370   "with different type of array}0,1">;
6371 def ext_array_init_copy : Extension<
6372   "initialization of an array "
6373   "%diff{of type $ from a compound literal of type $|"
6374   "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6375 // This is intentionally not disabled by -Wno-gnu.
6376 def ext_array_init_parens : ExtWarn<
6377   "parenthesized initialization of a member array is a GNU extension">,
6378   InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6379 def warn_deprecated_string_literal_conversion : Warning<
6380   "conversion from string literal to %0 is deprecated">,
6381   InGroup<CXX11CompatDeprecatedWritableStr>;
6382 def ext_deprecated_string_literal_conversion : ExtWarn<
6383   "ISO C++11 does not allow conversion from string literal to %0">,
6384   InGroup<WritableStrings>, SFINAEFailure;
6385 def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6386 def err_typecheck_sclass_fscope : Error<
6387   "illegal storage class on file-scoped variable">;
6388 def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6389   InGroup<MissingDeclarations>;
6390 def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6391   "of a type">, InGroup<MissingDeclarations>;
6392 def err_standalone_class_nested_name_specifier : Error<
6393   "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6394   "have a nested name specifier">;
6395 def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6396 def err_static_block_func : Error<
6397   "function declared in block scope cannot have 'static' storage class">;
6398 def err_typecheck_address_of : Error<"address of %select{bit-field"
6399   "|vector element|property expression|register variable|matrix element}0 requested">;
6400 def ext_typecheck_addrof_void : Extension<
6401   "ISO C forbids taking the address of an expression of type 'void'">;
6402 def err_unqualified_pointer_member_function : Error<
6403   "must explicitly qualify name of member function when taking its address">;
6404 def err_invalid_form_pointer_member_function : Error<
6405   "cannot create a non-constant pointer to member function">;
6406 def err_address_of_function_with_pass_object_size_params: Error<
6407   "cannot take address of function %0 because parameter %1 has "
6408   "pass_object_size attribute">;
6409 def err_parens_pointer_member_function : Error<
6410   "cannot parenthesize the name of a method when forming a member pointer">;
6411 def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6412   "extra '&' taking address of overloaded function">;
6413 def err_typecheck_invalid_lvalue_addrof : Error<
6414   "cannot take the address of an rvalue of type %0">;
6415 def ext_typecheck_addrof_temporary : ExtWarn<
6416   "taking the address of a temporary object of type %0">,
6417   InGroup<AddressOfTemporary>, DefaultError;
6418 def err_typecheck_addrof_temporary : Error<
6419   "taking the address of a temporary object of type %0">;
6420 def err_typecheck_addrof_dtor : Error<
6421   "taking the address of a destructor">;
6422 def err_typecheck_unary_expr : Error<
6423   "invalid argument type %0 to unary expression">;
6424 def err_typecheck_indirection_requires_pointer : Error<
6425   "indirection requires pointer operand (%0 invalid)">;
6426 def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6427   "ISO C++ does not allow indirection on operand of type %0">,
6428   InGroup<DiagGroup<"void-ptr-dereference">>;
6429 def warn_indirection_through_null : Warning<
6430   "indirection of non-volatile null pointer will be deleted, not trap">,
6431   InGroup<NullDereference>;
6432 def warn_binding_null_to_reference : Warning<
6433   "binding dereferenced null pointer to reference has undefined behavior">,
6434   InGroup<NullDereference>;
6435 def note_indirection_through_null : Note<
6436   "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6437 def warn_pointer_indirection_from_incompatible_type : Warning<
6438   "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6439   "behavior">,
6440   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6441 def warn_taking_address_of_packed_member : Warning<
6442   "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6443   InGroup<DiagGroup<"address-of-packed-member">>;
6444
6445 def err_objc_object_assignment : Error<
6446   "cannot assign to class object (%0 invalid)">;
6447 def err_typecheck_invalid_operands : Error<
6448   "invalid operands to binary expression (%0 and %1)">;
6449 def note_typecheck_invalid_operands_converted : Note<
6450   "%select{first|second}0 operand was implicitly converted to type %1">;
6451 def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6452   "logical expression with vector %select{type %1 and non-vector type %2|types"
6453   " %1 and %2}0 is only supported in C++">;
6454 def err_typecheck_sub_ptr_compatible : Error<
6455   "%diff{$ and $ are not pointers to compatible types|"
6456   "pointers to incompatible types}0,1">;
6457 def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6458   "ordered comparison between pointer and integer (%0 and %1)">;
6459 def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6460   "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6461 def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6462   "ordered comparison between pointer and zero (%0 and %1)">;
6463 def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6464   "three-way comparison between pointer and zero">;
6465 def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6466   "pointer comparisons before C11 "
6467   "need to be between two complete or two incomplete types; "
6468   "%0 is %select{|in}2complete and "
6469   "%1 is %select{|in}3complete">,
6470   InGroup<C11>;
6471 def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6472   "ordered comparison of function pointers (%0 and %1)">,
6473   InGroup<DiagGroup<"ordered-compare-function-pointers">>;
6474 def ext_typecheck_comparison_of_fptr_to_void : Extension<
6475   "equality comparison between function pointer and void pointer (%0 and %1)">;
6476 def err_typecheck_comparison_of_fptr_to_void : Error<
6477   "equality comparison between function pointer and void pointer (%0 and %1)">;
6478 def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6479   "comparison between pointer and integer (%0 and %1)">,
6480   InGroup<DiagGroup<"pointer-integer-compare">>;
6481 def err_typecheck_comparison_of_pointer_integer : Error<
6482   "comparison between pointer and integer (%0 and %1)">;
6483 def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6484   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6485   InGroup<CompareDistinctPointerType>;
6486 def ext_typecheck_cond_incompatible_operands : ExtWarn<
6487   "incompatible operand types (%0 and %1)">;
6488 def err_cond_voidptr_arc : Error <
6489   "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6490   "in ARC mode">;
6491 def err_typecheck_comparison_of_distinct_pointers : Error<
6492   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6493 def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6494   "%select{comparison between %diff{ ($ and $)|}0,1"
6495   "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6496   "|conditional operator with the second and third operands of type "
6497   "%diff{ ($ and $)|}0,1}2"
6498   " which are pointers to non-overlapping address spaces">;
6499
6500 def select_arith_conv_kind : TextSubstitution<
6501   "%select{arithmetic between|bitwise operation between|comparison of|"
6502   "conditional expression between|compound assignment of}0">;
6503 def warn_arith_conv_enum_float : Warning<
6504   "%sub{select_arith_conv_kind}0 "
6505   "%select{floating-point|enumeration}1 type %2 "
6506   "%plural{2:with|4:from|:and}0 "
6507   "%select{enumeration|floating-point}1 type %3">,
6508   InGroup<EnumFloatConversion>, DefaultIgnore;
6509 def warn_arith_conv_enum_float_cxx20 : Warning<
6510   "%sub{select_arith_conv_kind}0 "
6511   "%select{floating-point|enumeration}1 type %2 "
6512   "%plural{2:with|4:from|:and}0 "
6513   "%select{enumeration|floating-point}1 type %3 is deprecated">,
6514   InGroup<DeprecatedEnumFloatConversion>;
6515 def warn_arith_conv_mixed_enum_types : Warning<
6516   "%sub{select_arith_conv_kind}0 "
6517   "different enumeration types%diff{ ($ and $)|}1,2">,
6518   InGroup<EnumEnumConversion>, DefaultIgnore;
6519 def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
6520   "%sub{select_arith_conv_kind}0 "
6521   "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6522   InGroup<DeprecatedEnumEnumConversion>;
6523 def warn_arith_conv_mixed_anon_enum_types : Warning<
6524   warn_arith_conv_mixed_enum_types.Text>,
6525   InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6526 def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
6527   warn_arith_conv_mixed_enum_types_cxx20.Text>,
6528   InGroup<DeprecatedAnonEnumEnumConversion>;
6529 def warn_conditional_mixed_enum_types : Warning<
6530   warn_arith_conv_mixed_enum_types.Text>,
6531   InGroup<EnumCompareConditional>, DefaultIgnore;
6532 def warn_conditional_mixed_enum_types_cxx20 : Warning<
6533   warn_arith_conv_mixed_enum_types_cxx20.Text>,
6534   InGroup<DeprecatedEnumCompareConditional>;
6535 def warn_comparison_mixed_enum_types : Warning<
6536   warn_arith_conv_mixed_enum_types.Text>,
6537   InGroup<EnumCompare>;
6538 def warn_comparison_mixed_enum_types_cxx20 : Warning<
6539   warn_arith_conv_mixed_enum_types_cxx20.Text>,
6540   InGroup<DeprecatedEnumCompare>;
6541 def warn_comparison_of_mixed_enum_types_switch : Warning<
6542   "comparison of different enumeration types in switch statement"
6543   "%diff{ ($ and $)|}0,1">,
6544   InGroup<EnumCompareSwitch>;
6545
6546 def err_typecheck_assign_const : Error<
6547   "%select{"
6548   "cannot assign to return value because function %1 returns a const value|"
6549   "cannot assign to variable %1 with const-qualified type %2|"
6550   "cannot assign to %select{non-|}1static data member %2 "
6551   "with const-qualified type %3|"
6552   "cannot assign to non-static data member within const member function %1|"
6553   "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6554   "with %select{|nested }3const-qualified data member %4|"
6555   "read-only variable is not assignable}0">;
6556
6557 def note_typecheck_assign_const : Note<
6558   "%select{"
6559   "function %1 which returns const-qualified type %2 declared here|"
6560   "variable %1 declared const here|"
6561   "%select{non-|}1static data member %2 declared const here|"
6562   "member function %q1 is declared const here|"
6563   "%select{|nested }1data member %2 declared const here}0">;
6564
6565 def warn_unsigned_always_true_comparison : Warning<
6566   "result of comparison of %select{%3|unsigned expression}0 %2 "
6567   "%select{unsigned expression|%3}0 is always %4">,
6568   InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6569 def warn_unsigned_enum_always_true_comparison : Warning<
6570   "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6571   "%select{unsigned enum expression|%3}0 is always %4">,
6572   InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6573 def warn_tautological_constant_compare : Warning<
6574   "result of comparison %select{%3|%1}0 %2 "
6575   "%select{%1|%3}0 is always %4">,
6576   InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6577 def warn_tautological_compare_objc_bool : Warning<
6578   "result of comparison of constant %0 with expression of type 'BOOL'"
6579   " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6580   InGroup<TautologicalObjCBoolCompare>;
6581
6582 def warn_mixed_sign_comparison : Warning<
6583   "comparison of integers of different signs: %0 and %1">,
6584   InGroup<SignCompare>, DefaultIgnore;
6585 def warn_out_of_range_compare : Warning<
6586   "result of comparison of %select{constant %0|true|false}1 with "
6587   "%select{expression of type %2|boolean expression}3 is always %4">,
6588   InGroup<TautologicalOutOfRangeCompare>;
6589 def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6590   InGroup<TautologicalConstantCompare>;
6591 def warn_integer_constants_in_conditional_always_true : Warning<
6592   "converting the result of '?:' with integer constants to a boolean always "
6593   "evaluates to 'true'">,
6594   InGroup<TautologicalConstantCompare>;
6595 def warn_left_shift_always : Warning<
6596   "converting the result of '<<' to a boolean always evaluates "
6597   "to %select{false|true}0">,
6598   InGroup<TautologicalConstantCompare>;
6599 def warn_null_in_arithmetic_operation : Warning<
6600   "use of NULL in arithmetic operation">,
6601   InGroup<NullArithmetic>;
6602 def warn_null_in_comparison_operation : Warning<
6603   "comparison between NULL and non-pointer "
6604   "%select{(%1 and NULL)|(NULL and %1)}0">,
6605   InGroup<NullArithmetic>;
6606 def err_shift_rhs_only_vector : Error<
6607   "requested shift is a vector of type %0 but the first operand is not a "
6608   "vector (%1)">;
6609
6610 def warn_logical_not_on_lhs_of_check : Warning<
6611   "logical not is only applied to the left hand side of this "
6612   "%select{comparison|bitwise operator}0">,
6613   InGroup<LogicalNotParentheses>;
6614 def note_logical_not_fix : Note<
6615   "add parentheses after the '!' to evaluate the "
6616   "%select{comparison|bitwise operator}0 first">;
6617 def note_logical_not_silence_with_parens : Note<
6618   "add parentheses around left hand side expression to silence this warning">;
6619
6620 def err_invalid_this_use : Error<
6621   "invalid use of 'this' outside of a non-static member function">;
6622 def err_this_static_member_func : Error<
6623   "'this' cannot be%select{| implicitly}0 used in a static member function "
6624   "declaration">;
6625 def err_invalid_member_use_in_static_method : Error<
6626   "invalid use of member %0 in static member function">;
6627 def err_invalid_qualified_function_type : Error<
6628   "%select{non-member function|static member function|deduction guide}0 "
6629   "%select{of type %2 |}1cannot have '%3' qualifier">;
6630 def err_compound_qualified_function_type : Error<
6631   "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6632   "cannot have '%3' qualifier">;
6633 def err_qualified_function_typeid : Error<
6634   "type operand %0 of 'typeid' cannot have '%1' qualifier">;
6635
6636 def err_ref_qualifier_overload : Error<
6637   "cannot overload a member function %select{without a ref-qualifier|with "
6638   "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6639   "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6640
6641 def err_invalid_non_static_member_use : Error<
6642   "invalid use of non-static data member %0">;
6643 def err_nested_non_static_member_use : Error<
6644   "%select{call to non-static member function|use of non-static data member}0 "
6645   "%2 of %1 from nested type %3">;
6646 def warn_cxx98_compat_non_static_member_use : Warning<
6647   "use of non-static data member %0 in an unevaluated context is "
6648   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6649 def err_invalid_incomplete_type_use : Error<
6650   "invalid use of incomplete type %0">;
6651 def err_builtin_func_cast_more_than_one_arg : Error<
6652   "function-style cast to a builtin type can only take one argument">;
6653 def err_value_init_for_array_type : Error<
6654   "array types cannot be value-initialized">;
6655 def err_init_for_function_type : Error<
6656   "cannot create object of function type %0">;
6657 def warn_format_nonliteral_noargs : Warning<
6658   "format string is not a string literal (potentially insecure)">,
6659   InGroup<FormatSecurity>;
6660 def warn_format_nonliteral : Warning<
6661   "format string is not a string literal">,
6662   InGroup<FormatNonLiteral>, DefaultIgnore;
6663
6664 def err_unexpected_interface : Error<
6665   "unexpected interface name %0: expected expression">;
6666 def err_ref_non_value : Error<"%0 does not refer to a value">;
6667 def err_ref_vm_type : Error<
6668   "cannot refer to declaration with a variably modified type inside block">;
6669 def err_ref_flexarray_type : Error<
6670   "cannot refer to declaration of structure variable with flexible array member "
6671   "inside block">;
6672 def err_ref_array_type : Error<
6673   "cannot refer to declaration with an array type inside block">;
6674 def err_property_not_found : Error<
6675   "property %0 not found on object of type %1">;
6676 def err_invalid_property_name : Error<
6677   "%0 is not a valid property name (accessing an object of type %1)">;
6678 def err_getter_not_found : Error<
6679   "no getter method for read from property">;
6680 def err_objc_subscript_method_not_found : Error<
6681   "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6682   "found on object of type %0">;
6683 def err_objc_subscript_index_type : Error<
6684   "method index parameter type %0 is not integral type">;
6685 def err_objc_subscript_key_type : Error<
6686   "method key parameter type %0 is not object type">;
6687 def err_objc_subscript_dic_object_type : Error<
6688   "method object parameter type %0 is not object type">;
6689 def err_objc_subscript_object_type : Error<
6690   "cannot assign to this %select{dictionary|array}1 because assigning method's "
6691   "2nd parameter of type %0 is not an Objective-C pointer type">;
6692 def err_objc_subscript_base_type : Error<
6693   "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6694 def err_objc_multiple_subscript_type_conversion : Error<
6695   "indexing expression is invalid because subscript type %0 has "
6696   "multiple type conversion functions">;
6697 def err_objc_subscript_type_conversion : Error<
6698   "indexing expression is invalid because subscript type %0 is not an integral"
6699   " or Objective-C pointer type">;
6700 def err_objc_subscript_pointer : Error<
6701   "indexing expression is invalid because subscript type %0 is not an"
6702   " Objective-C pointer">;
6703 def err_objc_indexing_method_result_type : Error<
6704   "method for accessing %select{dictionary|array}1 element must have Objective-C"
6705   " object return type instead of %0">;
6706 def err_objc_index_incomplete_class_type : Error<
6707   "Objective-C index expression has incomplete class type %0">;
6708 def err_illegal_container_subscripting_op : Error<
6709   "illegal operation on Objective-C container subscripting">;
6710 def err_property_not_found_forward_class : Error<
6711   "property %0 cannot be found in forward class object %1">;
6712 def err_property_not_as_forward_class : Error<
6713   "property %0 refers to an incomplete Objective-C class %1 "
6714   "(with no @interface available)">;
6715 def note_forward_class : Note<
6716   "forward declaration of class here">;
6717 def err_duplicate_property : Error<
6718   "property has a previous declaration">;
6719 def ext_gnu_void_ptr : Extension<
6720   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
6721   InGroup<PointerArith>;
6722 def ext_gnu_ptr_func_arith : Extension<
6723   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
6724   "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
6725   InGroup<PointerArith>;
6726 def err_readonly_message_assignment : Error<
6727   "assigning to 'readonly' return result of an Objective-C message not allowed">;
6728 def ext_integer_increment_complex : Extension<
6729   "ISO C does not support '++'/'--' on complex integer type %0">;
6730 def ext_integer_complement_complex : Extension<
6731   "ISO C does not support '~' for complex conjugation of %0">;
6732 def err_nosetter_property_assignment : Error<
6733   "%select{assignment to readonly property|"
6734   "no setter method %1 for assignment to property}0">;
6735 def err_nosetter_property_incdec : Error<
6736   "%select{%select{increment|decrement}1 of readonly property|"
6737   "no setter method %2 for %select{increment|decrement}1 of property}0">;
6738 def err_nogetter_property_compound_assignment : Error<
6739   "a getter method is needed to perform a compound assignment on a property">;
6740 def err_nogetter_property_incdec : Error<
6741   "no getter method %1 for %select{increment|decrement}0 of property">;
6742 def err_no_subobject_property_setting : Error<
6743   "expression is not assignable">;
6744 def err_qualified_objc_access : Error<
6745   "%select{property|instance variable}0 access cannot be qualified with '%1'">;
6746
6747 def ext_freestanding_complex : Extension<
6748   "complex numbers are an extension in a freestanding C99 implementation">;
6749
6750 // FIXME: Remove when we support imaginary.
6751 def err_imaginary_not_supported : Error<"imaginary types are not supported">;
6752
6753 // Obj-c expressions
6754 def warn_root_inst_method_not_found : Warning<
6755   "instance method %0 is being used on 'Class' which is not in the root class">,
6756   InGroup<MethodAccess>;
6757 def warn_class_method_not_found : Warning<
6758   "class method %objcclass0 not found (return type defaults to 'id')">,
6759   InGroup<MethodAccess>;
6760 def warn_instance_method_on_class_found : Warning<
6761   "instance method %0 found instead of class method %1">,
6762   InGroup<MethodAccess>;
6763 def warn_inst_method_not_found : Warning<
6764   "instance method %objcinstance0 not found (return type defaults to 'id')">,
6765   InGroup<MethodAccess>;
6766 def warn_instance_method_not_found_with_typo : Warning<
6767   "instance method %objcinstance0 not found (return type defaults to 'id')"
6768   "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
6769 def warn_class_method_not_found_with_typo : Warning<
6770   "class method %objcclass0 not found (return type defaults to 'id')"
6771   "; did you mean %objcclass2?">, InGroup<MethodAccess>;
6772 def err_method_not_found_with_typo : Error<
6773   "%select{instance|class}1 method %0 not found "
6774   "; did you mean %2?">;
6775 def err_no_super_class_message : Error<
6776   "no @interface declaration found in class messaging of %0">;
6777 def err_root_class_cannot_use_super : Error<
6778   "%0 cannot use 'super' because it is a root class">;
6779 def err_invalid_receiver_to_message_super : Error<
6780   "'super' is only valid in a method body">;
6781 def err_invalid_receiver_class_message : Error<
6782   "receiver type %0 is not an Objective-C class">;
6783 def err_missing_open_square_message_send : Error<
6784   "missing '[' at start of message send expression">;
6785 def warn_bad_receiver_type : Warning<
6786   "receiver type %0 is not 'id' or interface pointer, consider "
6787   "casting it to 'id'">,InGroup<ObjCReceiver>;
6788 def err_bad_receiver_type : Error<"bad receiver type %0">;
6789 def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
6790 def err_unknown_receiver_suggest : Error<
6791   "unknown receiver %0; did you mean %1?">;
6792 def err_objc_throw_expects_object : Error<
6793   "@throw requires an Objective-C object type (%0 invalid)">;
6794 def err_objc_synchronized_expects_object : Error<
6795   "@synchronized requires an Objective-C object type (%0 invalid)">;
6796 def err_rethrow_used_outside_catch : Error<
6797   "@throw (rethrow) used outside of a @catch block">;
6798 def err_attribute_multiple_objc_gc : Error<
6799   "multiple garbage collection attributes specified for type">;
6800 def err_catch_param_not_objc_type : Error<
6801   "@catch parameter is not a pointer to an interface type">;
6802 def err_illegal_qualifiers_on_catch_parm : Error<
6803   "illegal qualifiers on @catch parameter">;
6804 def err_storage_spec_on_catch_parm : Error<
6805   "@catch parameter cannot have storage specifier '%0'">;
6806 def warn_register_objc_catch_parm : Warning<
6807   "'register' storage specifier on @catch parameter will be ignored">;
6808 def err_qualified_objc_catch_parm : Error<
6809   "@catch parameter declarator cannot be qualified">;
6810 def warn_objc_pointer_cxx_catch_fragile : Warning<
6811   "cannot catch an exception thrown with @throw in C++ in the non-unified "
6812   "exception model">, InGroup<ObjCNonUnifiedException>;
6813 def err_objc_object_catch : Error<
6814   "cannot catch an Objective-C object by value">;
6815 def err_incomplete_type_objc_at_encode : Error<
6816   "'@encode' of incomplete type %0">;
6817 def warn_objc_circular_container : Warning<
6818   "adding %0 to %1 might cause circular dependency in container">,
6819   InGroup<DiagGroup<"objc-circular-container">>;
6820 def note_objc_circular_container_declared_here : Note<"%0 declared here">;
6821 def warn_objc_unsafe_perform_selector : Warning<
6822   "%0 is incompatible with selectors that return a "
6823   "%select{struct|union|vector}1 type">,
6824   InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
6825 def note_objc_unsafe_perform_selector_method_declared_here :  Note<
6826   "method %0 that returns %1 declared here">;
6827 def err_attribute_arm_builtin_alias : Error<
6828   "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
6829 def err_attribute_arm_mve_polymorphism : Error<
6830   "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
6831
6832 def warn_setter_getter_impl_required : Warning<
6833   "property %0 requires method %1 to be defined - "
6834   "use @synthesize, @dynamic or provide a method implementation "
6835   "in this class implementation">,
6836   InGroup<ObjCPropertyImpl>;
6837 def warn_setter_getter_impl_required_in_category : Warning<
6838   "property %0 requires method %1 to be defined - "
6839   "use @dynamic or provide a method implementation in this category">,
6840   InGroup<ObjCPropertyImpl>;
6841 def note_parameter_named_here : Note<
6842   "passing argument to parameter %0 here">;
6843 def note_parameter_here : Note<
6844   "passing argument to parameter here">;
6845 def note_method_return_type_change : Note<
6846   "compiler has implicitly changed method %0 return type">;
6847
6848 def warn_impl_required_for_class_property : Warning<
6849   "class property %0 requires method %1 to be defined - "
6850   "use @dynamic or provide a method implementation "
6851   "in this class implementation">,
6852   InGroup<ObjCPropertyImpl>;
6853 def warn_impl_required_in_category_for_class_property : Warning<
6854   "class property %0 requires method %1 to be defined - "
6855   "use @dynamic or provide a method implementation in this category">,
6856   InGroup<ObjCPropertyImpl>;
6857
6858 // C++ casts
6859 // These messages adhere to the TryCast pattern: %0 is an int specifying the
6860 // cast type, %1 is the source type, %2 is the destination type.
6861 def err_bad_reinterpret_cast_overload : Error<
6862   "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
6863
6864 def warn_reinterpret_different_from_static : Warning<
6865   "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
6866   "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
6867   "'static_cast'">, InGroup<ReinterpretBaseClass>;
6868 def note_reinterpret_updowncast_use_static: Note<
6869   "use 'static_cast' to adjust the pointer correctly while "
6870   "%select{upcasting|downcasting}0">;
6871
6872 def err_bad_static_cast_overload : Error<
6873   "address of overloaded function %0 cannot be static_cast to type %1">;
6874
6875 def err_bad_cstyle_cast_overload : Error<
6876   "address of overloaded function %0 cannot be cast to type %1">;
6877
6878
6879 def err_bad_cxx_cast_generic : Error<
6880   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
6881   "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
6882 def err_bad_cxx_cast_unrelated_class : Error<
6883   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6884   "functional-style cast|}0 from %1 to %2, which are not related by "
6885   "inheritance, is not allowed">;
6886 def note_type_incomplete : Note<"%0 is incomplete">;
6887 def err_bad_cxx_cast_rvalue : Error<
6888   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6889   "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
6890 def err_bad_cxx_cast_bitfield : Error<
6891   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6892   "functional-style cast|}0 from bit-field lvalue to reference type %2">;
6893 def err_bad_cxx_cast_qualifiers_away : Error<
6894   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6895   "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
6896 def err_bad_cxx_cast_addr_space_mismatch : Error<
6897   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
6898   "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
6899   " spaces">;
6900 def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
6901   "ISO C++ does not allow "
6902   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6903   "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
6904   "even though the source and destination types are unrelated">,
6905   SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
6906 def err_bad_const_cast_dest : Error<
6907   "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
6908   "which is not a reference, pointer-to-object, or pointer-to-data-member">;
6909 def ext_cast_fn_obj : Extension<
6910   "cast between pointer-to-function and pointer-to-object is an extension">;
6911 def ext_ms_cast_fn_obj : ExtWarn<
6912   "static_cast between pointer-to-function and pointer-to-object is a "
6913   "Microsoft extension">, InGroup<MicrosoftCast>;
6914 def warn_cxx98_compat_cast_fn_obj : Warning<
6915   "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
6916   InGroup<CXX98CompatPedantic>, DefaultIgnore;
6917 def err_bad_reinterpret_cast_small_int : Error<
6918   "cast from pointer to smaller type %2 loses information">;
6919 def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
6920   "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
6921   "to scalar %2 of different size">;
6922 def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
6923   "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
6924   "to vector %2 of different size">;
6925 def err_bad_cxx_cast_vector_to_vector_different_size : Error<
6926   "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
6927   "to vector %2 of different size">;
6928 def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
6929   "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
6930   "changes address space of nested pointers">,
6931   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6932 def err_bad_lvalue_to_rvalue_cast : Error<
6933   "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
6934   "not compatible">;
6935 def err_bad_rvalue_to_rvalue_cast : Error<
6936   "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
6937   "not compatible">;
6938 def err_bad_static_cast_pointer_nonpointer : Error<
6939   "cannot cast from type %1 to pointer type %2">;
6940 def err_bad_static_cast_member_pointer_nonmp : Error<
6941   "cannot cast from type %1 to member pointer type %2">;
6942 def err_bad_cxx_cast_member_pointer_size : Error<
6943   "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
6944   "type %1 to member pointer type %2 of different size">;
6945 def err_bad_reinterpret_cast_reference : Error<
6946   "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
6947 def warn_undefined_reinterpret_cast : Warning<
6948   "reinterpret_cast from %0 to %1 has undefined behavior">,
6949   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6950
6951 // These messages don't adhere to the pattern.
6952 // FIXME: Display the path somehow better.
6953 def err_ambiguous_base_to_derived_cast : Error<
6954   "ambiguous cast from base %0 to derived %1:%2">;
6955 def err_static_downcast_via_virtual : Error<
6956   "cannot cast %0 to %1 via virtual base %2">;
6957 def err_downcast_from_inaccessible_base : Error<
6958   "cannot cast %select{private|protected}2 base class %1 to %0">;
6959 def err_upcast_to_inaccessible_base : Error<
6960   "cannot cast %0 to its %select{private|protected}2 base class %1">;
6961 def err_bad_dynamic_cast_not_ref_or_ptr : Error<
6962   "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
6963 def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
6964 def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
6965 def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
6966 def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
6967
6968 // Other C++ expressions
6969 def err_need_header_before_typeid : Error<
6970   "you need to include <typeinfo> before using the 'typeid' operator">;
6971 def err_need_header_before_ms_uuidof : Error<
6972   "you need to include <guiddef.h> before using the '__uuidof' operator">;
6973 def err_ms___leave_not_in___try : Error<
6974   "'__leave' statement not in __try block">;
6975 def err_uuidof_without_guid : Error<
6976   "cannot call operator __uuidof on a type with no GUID">;
6977 def err_uuidof_with_multiple_guids : Error<
6978   "cannot call operator __uuidof on a type with multiple GUIDs">;
6979 def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
6980 def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
6981 def err_static_illegal_in_new : Error<
6982   "the 'static' modifier for the array size is not legal in new expressions">;
6983 def err_array_new_needs_size : Error<
6984   "array size must be specified in new expression with no initializer">;
6985 def err_bad_new_type : Error<
6986   "cannot allocate %select{function|reference}1 type %0 with new">;
6987 def err_new_incomplete_or_sizeless_type : Error<
6988   "allocation of %select{incomplete|sizeless}0 type %1">;
6989 def err_new_array_nonconst : Error<
6990   "only the first dimension of an allocated array may have dynamic size">;
6991 def err_new_array_size_unknown_from_init : Error<
6992   "cannot determine allocated array size from initializer">;
6993 def err_new_array_init_args : Error<
6994   "array 'new' cannot have initialization arguments">;
6995 def ext_new_paren_array_nonconst : ExtWarn<
6996   "when type is in parentheses, array cannot have dynamic size">;
6997 def err_placement_new_non_placement_delete : Error<
6998   "'new' expression with placement arguments refers to non-placement "
6999   "'operator delete'">;
7000 def err_array_size_not_integral : Error<
7001   "array size expression must have integral or %select{|unscoped }0"
7002   "enumeration type, not %1">;
7003 def err_array_size_incomplete_type : Error<
7004   "array size expression has incomplete class type %0">;
7005 def err_array_size_explicit_conversion : Error<
7006   "array size expression of type %0 requires explicit conversion to type %1">;
7007 def note_array_size_conversion : Note<
7008   "conversion to %select{integral|enumeration}0 type %1 declared here">;
7009 def err_array_size_ambiguous_conversion : Error<
7010   "ambiguous conversion of array size expression of type %0 to an integral or "
7011   "enumeration type">;
7012 def ext_array_size_conversion : Extension<
7013   "implicit conversion from array size expression of type %0 to "
7014   "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7015   InGroup<CXX11>;
7016 def warn_cxx98_compat_array_size_conversion : Warning<
7017   "implicit conversion from array size expression of type %0 to "
7018   "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7019   InGroup<CXX98CompatPedantic>, DefaultIgnore;
7020 def err_address_space_qualified_new : Error<
7021   "'new' cannot allocate objects of type %0 in address space '%1'">;
7022 def err_address_space_qualified_delete : Error<
7023   "'delete' cannot delete objects of type %0 in address space '%1'">;
7024
7025 def err_default_init_const : Error<
7026   "default initialization of an object of const type %0"
7027   "%select{| without a user-provided default constructor}1">;
7028 def ext_default_init_const : ExtWarn<
7029   "default initialization of an object of const type %0"
7030   "%select{| without a user-provided default constructor}1 "
7031   "is a Microsoft extension">,
7032   InGroup<MicrosoftConstInit>;
7033 def err_delete_operand : Error<"cannot delete expression of type %0">;
7034 def ext_delete_void_ptr_operand : ExtWarn<
7035   "cannot delete expression with pointer-to-'void' type %0">,
7036   InGroup<DeleteIncomplete>;
7037 def err_ambiguous_delete_operand : Error<
7038   "ambiguous conversion of delete expression of type %0 to a pointer">;
7039 def warn_delete_incomplete : Warning<
7040   "deleting pointer to incomplete type %0 may cause undefined behavior">,
7041   InGroup<DeleteIncomplete>;
7042 def err_delete_incomplete_class_type : Error<
7043   "deleting incomplete class type %0; no conversions to pointer type">;
7044 def err_delete_explicit_conversion : Error<
7045   "converting delete expression from type %0 to type %1 invokes an explicit "
7046   "conversion function">;
7047 def note_delete_conversion : Note<"conversion to pointer type %0">;
7048 def warn_delete_array_type : Warning<
7049   "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7050 def warn_mismatched_delete_new : Warning<
7051   "'delete%select{|[]}0' applied to a pointer that was allocated with "
7052   "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7053   InGroup<DiagGroup<"mismatched-new-delete">>;
7054 def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7055 def err_no_suitable_delete_member_function_found : Error<
7056   "no suitable member %0 in %1">;
7057 def err_ambiguous_suitable_delete_member_function_found : Error<
7058   "multiple suitable %0 functions in %1">;
7059 def warn_ambiguous_suitable_delete_function_found : Warning<
7060   "multiple suitable %0 functions for %1; no 'operator delete' function "
7061   "will be invoked if initialization throws an exception">,
7062   InGroup<DiagGroup<"ambiguous-delete">>;
7063 def note_member_declared_here : Note<
7064   "member %0 declared here">;
7065 def note_member_first_declared_here : Note<
7066   "member %0 first declared here">;
7067 def warn_bitwise_negation_bool : Warning<
7068   "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7069   "did you mean logical negation?">,
7070   InGroup<DiagGroup<"bool-operation">>;
7071 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7072 def warn_increment_bool : Warning<
7073   "incrementing expression of type bool is deprecated and "
7074   "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7075 def ext_increment_bool : ExtWarn<
7076   "ISO C++17 does not allow incrementing expression of type bool">,
7077   DefaultError, InGroup<IncrementBool>;
7078 def err_increment_decrement_enum : Error<
7079   "cannot %select{decrement|increment}0 expression of enum type %1">;
7080
7081 def warn_deprecated_increment_decrement_volatile : Warning<
7082   "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7083   "is deprecated">, InGroup<DeprecatedVolatile>;
7084 def warn_deprecated_simple_assign_volatile : Warning<
7085   "use of result of assignment to object of volatile-qualified type %0 "
7086   "is deprecated">, InGroup<DeprecatedVolatile>;
7087 def warn_deprecated_compound_assign_volatile : Warning<
7088   "compound assignment to object of volatile-qualified type %0 is deprecated">,
7089   InGroup<DeprecatedVolatile>;
7090 def warn_deprecated_volatile_return : Warning<
7091   "volatile-qualified return type %0 is deprecated">,
7092   InGroup<DeprecatedVolatile>;
7093 def warn_deprecated_volatile_param : Warning<
7094   "volatile-qualified parameter type %0 is deprecated">,
7095   InGroup<DeprecatedVolatile>;
7096 def warn_deprecated_volatile_structured_binding : Warning<
7097   "volatile qualifier in structured binding declaration is deprecated">,
7098   InGroup<DeprecatedVolatile>;
7099
7100 def err_catch_incomplete_ptr : Error<
7101   "cannot catch pointer to incomplete type %0">;
7102 def err_catch_incomplete_ref : Error<
7103   "cannot catch reference to incomplete type %0">;
7104 def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7105 def err_catch_sizeless : Error<
7106   "cannot catch %select{|reference to }0sizeless type %1">;
7107 def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7108 def err_catch_variably_modified : Error<
7109   "cannot catch variably modified type %0">;
7110 def err_qualified_catch_declarator : Error<
7111   "exception declarator cannot be qualified">;
7112 def err_early_catch_all : Error<"catch-all handler must come last">;
7113 def err_bad_memptr_rhs : Error<
7114   "right hand operand to %0 has non-pointer-to-member type %1">;
7115 def err_bad_memptr_lhs : Error<
7116   "left hand operand to %0 must be a %select{|pointer to }1class "
7117   "compatible with the right hand operand, but is %2">;
7118 def err_memptr_incomplete : Error<
7119   "member pointer has incomplete base type %0">;
7120 def warn_exception_caught_by_earlier_handler : Warning<
7121   "exception of type %0 will be caught by earlier handler">,
7122   InGroup<Exceptions>;
7123 def note_previous_exception_handler : Note<"for type %0">;
7124 def err_exceptions_disabled : Error<
7125   "cannot use '%0' with exceptions disabled">;
7126 def err_objc_exceptions_disabled : Error<
7127   "cannot use '%0' with Objective-C exceptions disabled">;
7128 def warn_throw_in_noexcept_func : Warning<
7129   "%0 has a non-throwing exception specification but can still throw">,
7130   InGroup<Exceptions>;
7131 def note_throw_in_dtor : Note<
7132   "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7133   "non-throwing}1 exception specification">;
7134 def note_throw_in_function : Note<"function declared non-throwing here">;
7135 def err_seh_try_outside_functions : Error<
7136   "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7137 def err_mixing_cxx_try_seh_try : Error<
7138   "cannot use C++ 'try' in the same function as SEH '__try'">;
7139 def err_seh_try_unsupported : Error<
7140   "SEH '__try' is not supported on this target">;
7141 def note_conflicting_try_here : Note<
7142   "conflicting %0 here">;
7143 def warn_jump_out_of_seh_finally : Warning<
7144   "jump out of __finally block has undefined behavior">,
7145   InGroup<DiagGroup<"jump-seh-finally">>;
7146 def warn_non_virtual_dtor : Warning<
7147   "%0 has virtual functions but non-virtual destructor">,
7148   InGroup<NonVirtualDtor>, DefaultIgnore;
7149 def warn_delete_non_virtual_dtor : Warning<
7150   "%select{delete|destructor}0 called on non-final %1 that has "
7151   "virtual functions but non-virtual destructor">,
7152   InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7153 def note_delete_non_virtual : Note<
7154   "qualify call to silence this warning">;
7155 def warn_delete_abstract_non_virtual_dtor : Warning<
7156   "%select{delete|destructor}0 called on %1 that is abstract but has "
7157   "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7158 def warn_overloaded_virtual : Warning<
7159   "%q0 hides overloaded virtual %select{function|functions}1">,
7160   InGroup<OverloadedVirtual>, DefaultIgnore;
7161 def note_hidden_overloaded_virtual_declared_here : Note<
7162   "hidden overloaded virtual function %q0 declared here"
7163   "%select{|: different classes%diff{ ($ vs $)|}2,3"
7164   "|: different number of parameters (%2 vs %3)"
7165   "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7166   "|: different return type%diff{ ($ vs $)|}2,3"
7167   "|: different qualifiers (%2 vs %3)"
7168   "|: different exception specifications}1">;
7169 def warn_using_directive_in_header : Warning<
7170   "using namespace directive in global context in header">,
7171   InGroup<HeaderHygiene>, DefaultIgnore;
7172 def warn_overaligned_type : Warning<
7173   "type %0 requires %1 bytes of alignment and the default allocator only "
7174   "guarantees %2 bytes">,
7175   InGroup<OveralignedType>, DefaultIgnore;
7176 def err_aligned_allocation_unavailable : Error<
7177   "aligned %select{allocation|deallocation}0 function of type '%1' is only "
7178   "available on %2 %3 or newer">;
7179 def note_silence_aligned_allocation_unavailable : Note<
7180   "if you supply your own aligned allocation functions, use "
7181   "-faligned-allocation to silence this diagnostic">;
7182
7183 def err_conditional_void_nonvoid : Error<
7184   "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7185   "is of type %0">;
7186 def err_conditional_ambiguous : Error<
7187   "conditional expression is ambiguous; "
7188   "%diff{$ can be converted to $ and vice versa|"
7189   "types can be convert to each other}0,1">;
7190 def err_conditional_ambiguous_ovl : Error<
7191   "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7192   "can be converted to several common types">;
7193 def err_conditional_vector_size : Error<
7194   "vector condition type %0 and result type %1 do not have the same number "
7195   "of elements">;
7196 def err_conditional_vector_element_size : Error<
7197   "vector condition type %0 and result type %1 do not have elements of the "
7198   "same size">;
7199 def err_conditional_vector_has_void : Error<
7200   "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7201 def err_conditional_vector_operand_type
7202     : Error<"%select{enumeration|extended vector}0 type %1 is not allowed in a "
7203             "vector conditional">;
7204 def err_conditional_vector_mismatched_vectors
7205     : Error<"vector operands to the vector conditional must be the same type "
7206             "%diff{($ and $)|}0,1}">;
7207
7208 def err_throw_incomplete : Error<
7209   "cannot throw object of incomplete type %0">;
7210 def err_throw_incomplete_ptr : Error<
7211   "cannot throw pointer to object of incomplete type %0">;
7212 def err_throw_sizeless : Error<
7213   "cannot throw object of sizeless type %0">;
7214 def warn_throw_underaligned_obj : Warning<
7215   "underaligned exception object thrown">,
7216   InGroup<UnderalignedExceptionObject>;
7217 def note_throw_underaligned_obj : Note<
7218   "required alignment of type %0 (%1 bytes) is larger than the supported "
7219   "alignment of C++ exception objects on this target (%2 bytes)">;
7220 def err_return_in_constructor_handler : Error<
7221   "return in the catch of a function try block of a constructor is illegal">;
7222 def warn_cdtor_function_try_handler_mem_expr : Warning<
7223   "cannot refer to a non-static member from the handler of a "
7224   "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7225
7226 let CategoryName = "Lambda Issue" in {
7227   def err_capture_more_than_once : Error<
7228     "%0 can appear only once in a capture list">;
7229   def err_reference_capture_with_reference_default : Error<
7230     "'&' cannot precede a capture when the capture default is '&'">;
7231   def err_copy_capture_with_copy_default : Error<
7232     "'&' must precede a capture when the capture default is '='">;
7233   def err_capture_does_not_name_variable : Error<
7234     "%0 in capture list does not name a variable">;
7235   def err_capture_non_automatic_variable : Error<
7236     "%0 cannot be captured because it does not have automatic storage "
7237     "duration">;
7238   def err_this_capture : Error<
7239     "'this' cannot be %select{implicitly |}0captured in this context">;
7240   def err_lambda_capture_anonymous_var : Error<
7241     "unnamed variable cannot be implicitly captured in a lambda expression">;
7242   def err_lambda_capture_flexarray_type : Error<
7243     "variable %0 with flexible array member cannot be captured in "
7244     "a lambda expression">;
7245   def err_lambda_impcap : Error<
7246     "variable %0 cannot be implicitly captured in a lambda with no "
7247     "capture-default specified">;
7248   def note_lambda_decl : Note<"lambda expression begins here">;
7249   def err_lambda_unevaluated_operand : Error<
7250     "lambda expression in an unevaluated operand">;
7251   def err_lambda_in_constant_expression : Error<
7252     "a lambda expression may not appear inside of a constant expression">;
7253   def err_lambda_in_invalid_context : Error<
7254     "a lambda expression cannot appear in this context">;
7255   def err_lambda_return_init_list : Error<
7256     "cannot deduce lambda return type from initializer list">;
7257   def err_lambda_capture_default_arg : Error<
7258     "lambda expression in default argument cannot capture any entity">;
7259   def err_lambda_incomplete_result : Error<
7260     "incomplete result type %0 in lambda expression">;
7261   def err_noreturn_lambda_has_return_expr : Error<
7262     "lambda declared 'noreturn' should not return">;
7263   def warn_maybe_falloff_nonvoid_lambda : Warning<
7264     "non-void lambda does not return a value in all control paths">,
7265     InGroup<ReturnType>;
7266   def warn_falloff_nonvoid_lambda : Warning<
7267     "non-void lambda does not return a value">,
7268     InGroup<ReturnType>;
7269   def err_access_lambda_capture : Error<
7270     // The ERRORs represent other special members that aren't constructors, in
7271     // hopes that someone will bother noticing and reporting if they appear
7272     "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7273     "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7274     AccessControl;
7275   def note_lambda_to_block_conv : Note<
7276     "implicit capture of lambda object due to conversion to block pointer "
7277     "here">;
7278   def note_var_explicitly_captured_here : Note<"variable %0 is"
7279     "%select{| explicitly}1 captured here">;
7280
7281   // C++14 lambda init-captures.
7282   def warn_cxx11_compat_init_capture : Warning<
7283     "initialized lambda captures are incompatible with C++ standards "
7284     "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7285   def ext_init_capture : ExtWarn<
7286     "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7287   def err_init_capture_no_expression : Error<
7288     "initializer missing for lambda capture %0">;
7289   def err_init_capture_multiple_expressions : Error<
7290     "initializer for lambda capture %0 contains multiple expressions">;
7291   def err_init_capture_paren_braces : Error<
7292     "cannot deduce type for lambda capture %1 from "
7293     "%select{parenthesized|nested}0 initializer list">;
7294   def err_init_capture_deduction_failure : Error<
7295     "cannot deduce type for lambda capture %0 from initializer of type %2">;
7296   def err_init_capture_deduction_failure_from_init_list : Error<
7297     "cannot deduce type for lambda capture %0 from initializer list">;
7298   def warn_cxx17_compat_init_capture_pack : Warning<
7299     "initialized lambda capture packs are incompatible with C++ standards "
7300     "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7301   def ext_init_capture_pack : ExtWarn<
7302     "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7303
7304   // C++14 generic lambdas.
7305   def warn_cxx11_compat_generic_lambda : Warning<
7306     "generic lambdas are incompatible with C++11">,
7307     InGroup<CXXPre14Compat>, DefaultIgnore;
7308
7309   // C++17 '*this' captures.
7310   def warn_cxx14_compat_star_this_lambda_capture : Warning<
7311     "by value capture of '*this' is incompatible with C++ standards before C++17">,
7312      InGroup<CXXPre17Compat>, DefaultIgnore;
7313   def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7314     "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7315
7316   // C++17 parameter shadows capture
7317   def err_parameter_shadow_capture : Error<
7318     "a lambda parameter cannot shadow an explicitly captured entity">;
7319
7320   // C++20 [=, this] captures.
7321   def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7322     "explicit capture of 'this' with a capture default of '=' is incompatible "
7323     "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7324   def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7325     "explicit capture of 'this' with a capture default of '=' "
7326     "is a C++20 extension">, InGroup<CXX20>;
7327   def warn_deprecated_this_capture : Warning<
7328     "implicit capture of 'this' with a capture default of '=' is deprecated">,
7329     InGroup<DeprecatedThisCapture>, DefaultIgnore;
7330   def note_deprecated_this_capture : Note<
7331     "add an explicit capture of 'this' to capture '*this' by reference">;
7332
7333   // C++20 default constructible / assignable lambdas.
7334   def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7335     "%select{default construction|assignment}0 of lambda is incompatible with "
7336     "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7337 }
7338
7339 def err_return_in_captured_stmt : Error<
7340   "cannot return from %0">;
7341 def err_capture_block_variable : Error<
7342   "__block variable %0 cannot be captured in a "
7343   "%select{lambda expression|captured statement}1">;
7344
7345 def err_operator_arrow_circular : Error<
7346   "circular pointer delegation detected">;
7347 def err_operator_arrow_depth_exceeded : Error<
7348   "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7349   "'operator->' calls">;
7350 def note_operator_arrow_here : Note<
7351   "'operator->' declared here produces an object of type %0">;
7352 def note_operator_arrows_suppressed : Note<
7353   "(skipping %0 'operator->'%s0 in backtrace)">;
7354 def note_operator_arrow_depth : Note<
7355   "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7356
7357 def err_pseudo_dtor_base_not_scalar : Error<
7358   "object expression of non-scalar type %0 cannot be used in a "
7359   "pseudo-destructor expression">;
7360 def ext_pseudo_dtor_on_void : ExtWarn<
7361   "pseudo-destructors on type void are a Microsoft extension">,
7362   InGroup<MicrosoftVoidPseudoDtor>;
7363 def err_pseudo_dtor_type_mismatch : Error<
7364   "the type of object expression "
7365   "%diff{($) does not match the type being destroyed ($)|"
7366   "does not match the type being destroyed}0,1 "
7367   "in pseudo-destructor expression">;
7368 def err_pseudo_dtor_call_with_args : Error<
7369   "call to pseudo-destructor cannot have any arguments">;
7370 def err_dtor_expr_without_call : Error<
7371   "reference to %select{destructor|pseudo-destructor}0 must be called"
7372   "%select{|; did you mean to call it with no arguments?}1">;
7373 def err_pseudo_dtor_destructor_non_type : Error<
7374   "%0 does not refer to a type name in pseudo-destructor expression; expected "
7375   "the name of type %1">;
7376 def err_invalid_use_of_function_type : Error<
7377   "a function type is not allowed here">;
7378 def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7379 def err_typecheck_bool_condition : Error<
7380   "value of type %0 is not contextually convertible to 'bool'">;
7381 def err_typecheck_ambiguous_condition : Error<
7382   "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7383 def err_typecheck_nonviable_condition : Error<
7384   "no viable conversion%select{%diff{ from $ to $|}1,2|"
7385   "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7386 def err_typecheck_nonviable_condition_incomplete : Error<
7387   "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7388 def err_typecheck_deleted_function : Error<
7389   "conversion function %diff{from $ to $|between types}0,1 "
7390   "invokes a deleted function">;
7391
7392 def err_expected_class_or_namespace : Error<"%0 is not a class"
7393   "%select{ or namespace|, namespace, or enumeration}1">;
7394 def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7395   "because namespace %1 does not enclose namespace %2">;
7396 def err_invalid_declarator_global_scope : Error<
7397   "definition or redeclaration of %0 cannot name the global scope">;
7398 def err_invalid_declarator_in_function : Error<
7399   "definition or redeclaration of %0 not allowed inside a function">;
7400 def err_invalid_declarator_in_block : Error<
7401   "definition or redeclaration of %0 not allowed inside a block">;
7402 def err_not_tag_in_scope : Error<
7403   "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7404
7405 def err_no_typeid_with_fno_rtti : Error<
7406   "use of typeid requires -frtti">;
7407 def err_no_dynamic_cast_with_fno_rtti : Error<
7408   "use of dynamic_cast requires -frtti">;
7409
7410 def err_cannot_form_pointer_to_member_of_reference_type : Error<
7411   "cannot form a pointer-to-member to member %0 of reference type %1">;
7412 def err_incomplete_object_call : Error<
7413   "incomplete type in call to object of type %0">;
7414
7415 def warn_condition_is_assignment : Warning<"using the result of an "
7416   "assignment as a condition without parentheses">,
7417   InGroup<Parentheses>;
7418 // Completely identical except off by default.
7419 def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7420   "of an assignment as a condition without parentheses">,
7421   InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7422 def note_condition_assign_to_comparison : Note<
7423   "use '==' to turn this assignment into an equality comparison">;
7424 def note_condition_or_assign_to_comparison : Note<
7425   "use '!=' to turn this compound assignment into an inequality comparison">;
7426 def note_condition_assign_silence : Note<
7427   "place parentheses around the assignment to silence this warning">;
7428
7429 def warn_equality_with_extra_parens : Warning<"equality comparison with "
7430   "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7431 def note_equality_comparison_to_assign : Note<
7432   "use '=' to turn this equality comparison into an assignment">;
7433 def note_equality_comparison_silence : Note<
7434   "remove extraneous parentheses around the comparison to silence this warning">;
7435
7436 // assignment related diagnostics (also for argument passing, returning, etc).
7437 // In most of these diagnostics the %2 is a value from the
7438 // Sema::AssignmentAction enumeration
7439 def err_typecheck_convert_incompatible : Error<
7440   "%select{%diff{assigning to $ from incompatible type $|"
7441   "assigning to type from incompatible type}0,1"
7442   "|%diff{passing $ to parameter of incompatible type $|"
7443   "passing type to parameter of incompatible type}0,1"
7444   "|%diff{returning $ from a function with incompatible result type $|"
7445   "returning type from a function with incompatible result type}0,1"
7446   "|%diff{converting $ to incompatible type $|"
7447   "converting type to incompatible type}0,1"
7448   "|%diff{initializing $ with an expression of incompatible type $|"
7449   "initializing type with an expression of incompatible type}0,1"
7450   "|%diff{sending $ to parameter of incompatible type $|"
7451   "sending type to parameter of incompatible type}0,1"
7452   "|%diff{casting $ to incompatible type $|"
7453   "casting type to incompatible type}0,1}2"
7454   "%select{|; dereference with *|"
7455   "; take the address with &|"
7456   "; remove *|"
7457   "; remove &}3"
7458   "%select{|: different classes%diff{ ($ vs $)|}5,6"
7459   "|: different number of parameters (%5 vs %6)"
7460   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7461   "|: different return type%diff{ ($ vs $)|}5,6"
7462   "|: different qualifiers (%5 vs %6)"
7463   "|: different exception specifications}4">;
7464 def err_typecheck_missing_return_type_incompatible : Error<
7465   "%diff{return type $ must match previous return type $|"
7466   "return type must match previous return type}0,1 when %select{block "
7467   "literal|lambda expression}2 has unspecified explicit return type">;
7468
7469 def note_incomplete_class_and_qualified_id : Note<
7470   "conformance of forward class %0 to protocol %1 can not be confirmed">;
7471 def warn_incompatible_qualified_id : Warning<
7472   "%select{%diff{assigning to $ from incompatible type $|"
7473   "assigning to type from incompatible type}0,1"
7474   "|%diff{passing $ to parameter of incompatible type $|"
7475   "passing type to parameter of incompatible type}0,1"
7476   "|%diff{returning $ from a function with incompatible result type $|"
7477   "returning type from a function with incompatible result type}0,1"
7478   "|%diff{converting $ to incompatible type $|"
7479   "converting type to incompatible type}0,1"
7480   "|%diff{initializing $ with an expression of incompatible type $|"
7481   "initializing type with an expression of incompatible type}0,1"
7482   "|%diff{sending $ to parameter of incompatible type $|"
7483   "sending type to parameter of incompatible type}0,1"
7484   "|%diff{casting $ to incompatible type $|"
7485   "casting type to incompatible type}0,1}2">;
7486 def err_incompatible_qualified_id : Error<
7487   "%select{%diff{assigning to $ from incompatible type $|"
7488   "assigning to type from incompatible type}0,1"
7489   "|%diff{passing $ to parameter of incompatible type $|"
7490   "passing type to parameter of incompatible type}0,1"
7491   "|%diff{returning $ from a function with incompatible result type $|"
7492   "returning type from a function with incompatible result type}0,1"
7493   "|%diff{converting $ to incompatible type $|"
7494   "converting type to incompatible type}0,1"
7495   "|%diff{initializing $ with an expression of incompatible type $|"
7496   "initializing type with an expression of incompatible type}0,1"
7497   "|%diff{sending $ to parameter of incompatible type $|"
7498   "sending type to parameter of incompatible type}0,1"
7499   "|%diff{casting $ to incompatible type $|"
7500   "casting type to incompatible type}0,1}2">;
7501 def ext_typecheck_convert_pointer_int : ExtWarn<
7502   "incompatible pointer to integer conversion "
7503   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7504   "|%diff{passing $ to parameter of type $|"
7505   "passing to parameter of different type}0,1"
7506   "|%diff{returning $ from a function with result type $|"
7507   "returning from function with different return type}0,1"
7508   "|%diff{converting $ to type $|converting between types}0,1"
7509   "|%diff{initializing $ with an expression of type $|"
7510   "initializing with expression of different type}0,1"
7511   "|%diff{sending $ to parameter of type $|"
7512   "sending to parameter of different type}0,1"
7513   "|%diff{casting $ to type $|casting between types}0,1}2"
7514   "%select{|; dereference with *|"
7515   "; take the address with &|"
7516   "; remove *|"
7517   "; remove &}3">,
7518   InGroup<IntConversion>;
7519 def err_typecheck_convert_pointer_int : Error<
7520   "incompatible pointer to integer conversion "
7521   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7522   "|%diff{passing $ to parameter of type $|"
7523   "passing to parameter of different type}0,1"
7524   "|%diff{returning $ from a function with result type $|"
7525   "returning from function with different return type}0,1"
7526   "|%diff{converting $ to type $|converting between types}0,1"
7527   "|%diff{initializing $ with an expression of type $|"
7528   "initializing with expression of different type}0,1"
7529   "|%diff{sending $ to parameter of type $|"
7530   "sending to parameter of different type}0,1"
7531   "|%diff{casting $ to type $|casting between types}0,1}2"
7532   "%select{|; dereference with *|"
7533   "; take the address with &|"
7534   "; remove *|"
7535   "; remove &}3">;
7536 def ext_typecheck_convert_int_pointer : ExtWarn<
7537   "incompatible integer to pointer conversion "
7538   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7539   "|%diff{passing $ to parameter of type $|"
7540   "passing to parameter of different type}0,1"
7541   "|%diff{returning $ from a function with result type $|"
7542   "returning from function with different return type}0,1"
7543   "|%diff{converting $ to type $|converting between types}0,1"
7544   "|%diff{initializing $ with an expression of type $|"
7545   "initializing with expression of different type}0,1"
7546   "|%diff{sending $ to parameter of type $|"
7547   "sending to parameter of different type}0,1"
7548   "|%diff{casting $ to type $|casting between types}0,1}2"
7549   "%select{|; dereference with *|"
7550   "; take the address with &|"
7551   "; remove *|"
7552   "; remove &}3">,
7553   InGroup<IntConversion>, SFINAEFailure;
7554 def err_typecheck_convert_int_pointer : Error<
7555   "incompatible integer to pointer conversion "
7556   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7557   "|%diff{passing $ to parameter of type $|"
7558   "passing to parameter of different type}0,1"
7559   "|%diff{returning $ from a function with result type $|"
7560   "returning from function with different return type}0,1"
7561   "|%diff{converting $ to type $|converting between types}0,1"
7562   "|%diff{initializing $ with an expression of type $|"
7563   "initializing with expression of different type}0,1"
7564   "|%diff{sending $ to parameter of type $|"
7565   "sending to parameter of different type}0,1"
7566   "|%diff{casting $ to type $|casting between types}0,1}2"
7567   "%select{|; dereference with *|"
7568   "; take the address with &|"
7569   "; remove *|"
7570   "; remove &}3">;
7571 def ext_typecheck_convert_pointer_void_func : Extension<
7572   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7573   "|%diff{passing $ to parameter of type $|"
7574   "passing to parameter of different type}0,1"
7575   "|%diff{returning $ from a function with result type $|"
7576   "returning from function with different return type}0,1"
7577   "|%diff{converting $ to type $|converting between types}0,1"
7578   "|%diff{initializing $ with an expression of type $|"
7579   "initializing with expression of different type}0,1"
7580   "|%diff{sending $ to parameter of type $|"
7581   "sending to parameter of different type}0,1"
7582   "|%diff{casting $ to type $|casting between types}0,1}2"
7583   " converts between void pointer and function pointer">;
7584 def err_typecheck_convert_pointer_void_func : Error<
7585   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7586   "|%diff{passing $ to parameter of type $|"
7587   "passing to parameter of different type}0,1"
7588   "|%diff{returning $ from a function with result type $|"
7589   "returning from function with different return type}0,1"
7590   "|%diff{converting $ to type $|converting between types}0,1"
7591   "|%diff{initializing $ with an expression of type $|"
7592   "initializing with expression of different type}0,1"
7593   "|%diff{sending $ to parameter of type $|"
7594   "sending to parameter of different type}0,1"
7595   "|%diff{casting $ to type $|casting between types}0,1}2"
7596   " converts between void pointer and function pointer">;
7597 def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
7598   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7599   "|%diff{passing $ to parameter of type $|"
7600   "passing to parameter of different type}0,1"
7601   "|%diff{returning $ from a function with result type $|"
7602   "returning from function with different return type}0,1"
7603   "|%diff{converting $ to type $|converting between types}0,1"
7604   "|%diff{initializing $ with an expression of type $|"
7605   "initializing with expression of different type}0,1"
7606   "|%diff{sending $ to parameter of type $|"
7607   "sending to parameter of different type}0,1"
7608   "|%diff{casting $ to type $|casting between types}0,1}2"
7609   " converts between pointers to integer types with different sign">,
7610   InGroup<DiagGroup<"pointer-sign">>;
7611 def err_typecheck_convert_incompatible_pointer_sign : Error<
7612   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7613   "|%diff{passing $ to parameter of type $|"
7614   "passing to parameter of different type}0,1"
7615   "|%diff{returning $ from a function with result type $|"
7616   "returning from function with different return type}0,1"
7617   "|%diff{converting $ to type $|converting between types}0,1"
7618   "|%diff{initializing $ with an expression of type $|"
7619   "initializing with expression of different type}0,1"
7620   "|%diff{sending $ to parameter of type $|"
7621   "sending to parameter of different type}0,1"
7622   "|%diff{casting $ to type $|casting between types}0,1}2"
7623   " converts between pointers to integer types with different sign">;
7624 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
7625   "incompatible pointer types "
7626   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7627   "|%diff{passing $ to parameter of type $|"
7628   "passing to parameter of different type}0,1"
7629   "|%diff{returning $ from a function with result type $|"
7630   "returning from function with different return type}0,1"
7631   "|%diff{converting $ to type $|converting between types}0,1"
7632   "|%diff{initializing $ with an expression of type $|"
7633   "initializing with expression of different type}0,1"
7634   "|%diff{sending $ to parameter of type $|"
7635   "sending to parameter of different type}0,1"
7636   "|%diff{casting $ to type $|casting between types}0,1}2"
7637   "%select{|; dereference with *|"
7638   "; take the address with &|"
7639   "; remove *|"
7640   "; remove &}3">,
7641   InGroup<IncompatiblePointerTypes>;
7642 def err_typecheck_convert_incompatible_pointer : Error<
7643   "incompatible pointer types "
7644   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7645   "|%diff{passing $ to parameter of type $|"
7646   "passing to parameter of different type}0,1"
7647   "|%diff{returning $ from a function with result type $|"
7648   "returning from function with different return type}0,1"
7649   "|%diff{converting $ to type $|converting between types}0,1"
7650   "|%diff{initializing $ with an expression of type $|"
7651   "initializing with expression of different type}0,1"
7652   "|%diff{sending $ to parameter of type $|"
7653   "sending to parameter of different type}0,1"
7654   "|%diff{casting $ to type $|casting between types}0,1}2"
7655   "%select{|; dereference with *|"
7656   "; take the address with &|"
7657   "; remove *|"
7658   "; remove &}3">;
7659 def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
7660   "incompatible function pointer types "
7661   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7662   "|%diff{passing $ to parameter of type $|"
7663   "passing to parameter of different type}0,1"
7664   "|%diff{returning $ from a function with result type $|"
7665   "returning from function with different return type}0,1"
7666   "|%diff{converting $ to type $|converting between types}0,1"
7667   "|%diff{initializing $ with an expression of type $|"
7668   "initializing with expression of different type}0,1"
7669   "|%diff{sending $ to parameter of type $|"
7670   "sending to parameter of different type}0,1"
7671   "|%diff{casting $ to type $|casting between types}0,1}2"
7672   "%select{|; dereference with *|"
7673   "; take the address with &|"
7674   "; remove *|"
7675   "; remove &}3">,
7676   InGroup<IncompatibleFunctionPointerTypes>;
7677 def err_typecheck_convert_incompatible_function_pointer : Error<
7678   "incompatible function pointer types "
7679   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7680   "|%diff{passing $ to parameter of type $|"
7681   "passing to parameter of different type}0,1"
7682   "|%diff{returning $ from a function with result type $|"
7683   "returning from function with different return type}0,1"
7684   "|%diff{converting $ to type $|converting between types}0,1"
7685   "|%diff{initializing $ with an expression of type $|"
7686   "initializing with expression of different type}0,1"
7687   "|%diff{sending $ to parameter of type $|"
7688   "sending to parameter of different type}0,1"
7689   "|%diff{casting $ to type $|casting between types}0,1}2"
7690   "%select{|; dereference with *|"
7691   "; take the address with &|"
7692   "; remove *|"
7693   "; remove &}3">;
7694 def ext_typecheck_convert_discards_qualifiers : ExtWarn<
7695   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7696   "|%diff{passing $ to parameter of type $|"
7697   "passing to parameter of different type}0,1"
7698   "|%diff{returning $ from a function with result type $|"
7699   "returning from function with different return type}0,1"
7700   "|%diff{converting $ to type $|converting between types}0,1"
7701   "|%diff{initializing $ with an expression of type $|"
7702   "initializing with expression of different type}0,1"
7703   "|%diff{sending $ to parameter of type $|"
7704   "sending to parameter of different type}0,1"
7705   "|%diff{casting $ to type $|casting between types}0,1}2"
7706   " discards qualifiers">,
7707   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7708 def err_typecheck_convert_discards_qualifiers : Error<
7709   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7710   "|%diff{passing $ to parameter of type $|"
7711   "passing to parameter of different type}0,1"
7712   "|%diff{returning $ from a function with result type $|"
7713   "returning from function with different return type}0,1"
7714   "|%diff{converting $ to type $|converting between types}0,1"
7715   "|%diff{initializing $ with an expression of type $|"
7716   "initializing with expression of different type}0,1"
7717   "|%diff{sending $ to parameter of type $|"
7718   "sending to parameter of different type}0,1"
7719   "|%diff{casting $ to type $|casting between types}0,1}2"
7720   " discards qualifiers">;
7721 def ext_nested_pointer_qualifier_mismatch : ExtWarn<
7722   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7723   "|%diff{passing $ to parameter of type $|"
7724   "passing to parameter of different type}0,1"
7725   "|%diff{returning $ from a function with result type $|"
7726   "returning from function with different return type}0,1"
7727   "|%diff{converting $ to type $|converting between types}0,1"
7728   "|%diff{initializing $ with an expression of type $|"
7729   "initializing with expression of different type}0,1"
7730   "|%diff{sending $ to parameter of type $|"
7731   "sending to parameter of different type}0,1"
7732   "|%diff{casting $ to type $|casting between types}0,1}2"
7733   " discards qualifiers in nested pointer types">,
7734   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7735 def err_nested_pointer_qualifier_mismatch : Error<
7736   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7737   "|%diff{passing $ to parameter of type $|"
7738   "passing to parameter of different type}0,1"
7739   "|%diff{returning $ from a function with result type $|"
7740   "returning from function with different return type}0,1"
7741   "|%diff{converting $ to type $|converting between types}0,1"
7742   "|%diff{initializing $ with an expression of type $|"
7743   "initializing with expression of different type}0,1"
7744   "|%diff{sending $ to parameter of type $|"
7745   "sending to parameter of different type}0,1"
7746   "|%diff{casting $ to type $|casting between types}0,1}2"
7747   " discards qualifiers in nested pointer types">;
7748 def warn_incompatible_vectors : Warning<
7749   "incompatible vector types "
7750   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7751   "|%diff{passing $ to parameter of type $|"
7752   "passing to parameter of different type}0,1"
7753   "|%diff{returning $ from a function with result type $|"
7754   "returning from function with different return type}0,1"
7755   "|%diff{converting $ to type $|converting between types}0,1"
7756   "|%diff{initializing $ with an expression of type $|"
7757   "initializing with expression of different type}0,1"
7758   "|%diff{sending $ to parameter of type $|"
7759   "sending to parameter of different type}0,1"
7760   "|%diff{casting $ to type $|casting between types}0,1}2">,
7761   InGroup<VectorConversion>, DefaultIgnore;
7762 def err_incompatible_vectors : Error<
7763   "incompatible vector types "
7764   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7765   "|%diff{passing $ to parameter of type $|"
7766   "passing to parameter of different type}0,1"
7767   "|%diff{returning $ from a function with result type $|"
7768   "returning from function with different return type}0,1"
7769   "|%diff{converting $ to type $|converting between types}0,1"
7770   "|%diff{initializing $ with an expression of type $|"
7771   "initializing with expression of different type}0,1"
7772   "|%diff{sending $ to parameter of type $|"
7773   "sending to parameter of different type}0,1"
7774   "|%diff{casting $ to type $|casting between types}0,1}2">;
7775 def err_int_to_block_pointer : Error<
7776   "invalid block pointer conversion "
7777   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7778   "|%diff{passing $ to parameter of type $|"
7779   "passing to parameter of different type}0,1"
7780   "|%diff{returning $ from a function with result type $|"
7781   "returning from function with different return type}0,1"
7782   "|%diff{converting $ to type $|converting between types}0,1"
7783   "|%diff{initializing $ with an expression of type $|"
7784   "initializing with expression of different type}0,1"
7785   "|%diff{sending $ to parameter of type $|"
7786   "sending to parameter of different type}0,1"
7787   "|%diff{casting $ to type $|casting between types}0,1}2">;
7788 def err_typecheck_convert_incompatible_block_pointer : Error<
7789   "incompatible block pointer types "
7790   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7791   "|%diff{passing $ to parameter of type $|"
7792   "passing to parameter of different type}0,1"
7793   "|%diff{returning $ from a function with result type $|"
7794   "returning from function with different return type}0,1"
7795   "|%diff{converting $ to type $|converting between types}0,1"
7796   "|%diff{initializing $ with an expression of type $|"
7797   "initializing with expression of different type}0,1"
7798   "|%diff{sending $ to parameter of type $|"
7799   "sending to parameter of different type}0,1"
7800   "|%diff{casting $ to type $|casting between types}0,1}2">;
7801 def err_typecheck_incompatible_address_space : Error<
7802   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7803   "|%diff{passing $ to parameter of type $|"
7804   "passing to parameter of different type}0,1"
7805   "|%diff{returning $ from a function with result type $|"
7806   "returning from function with different return type}0,1"
7807   "|%diff{converting $ to type $|converting between types}0,1"
7808   "|%diff{initializing $ with an expression of type $|"
7809   "initializing with expression of different type}0,1"
7810   "|%diff{sending $ to parameter of type $|"
7811   "sending to parameter of different type}0,1"
7812   "|%diff{casting $ to type $|casting between types}0,1}2"
7813   " changes address space of pointer">;
7814 def err_typecheck_incompatible_nested_address_space : Error<
7815   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7816   "|%diff{passing $ to parameter of type $|"
7817   "passing to parameter of different type}0,1"
7818   "|%diff{returning $ from a function with result type $|"
7819   "returning from function with different return type}0,1"
7820   "|%diff{converting $ to type $|converting between types}0,1"
7821   "|%diff{initializing $ with an expression of type $|"
7822   "initializing with expression of different type}0,1"
7823   "|%diff{sending $ to parameter of type $|"
7824   "sending to parameter of different type}0,1"
7825   "|%diff{casting $ to type $|casting between types}0,1}2"
7826   " changes address space of nested pointer">;
7827 def err_typecheck_incompatible_ownership : Error<
7828   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7829   "|%diff{passing $ to parameter of type $|"
7830   "passing to parameter of different type}0,1"
7831   "|%diff{returning $ from a function with result type $|"
7832   "returning from function with different return type}0,1"
7833   "|%diff{converting $ to type $|converting between types}0,1"
7834   "|%diff{initializing $ with an expression of type $|"
7835   "initializing with expression of different type}0,1"
7836   "|%diff{sending $ to parameter of type $|"
7837   "sending to parameter of different type}0,1"
7838   "|%diff{casting $ to type $|casting between types}0,1}2"
7839   " changes retain/release properties of pointer">;
7840 def err_typecheck_comparison_of_distinct_blocks : Error<
7841   "comparison of distinct block types%diff{ ($ and $)|}0,1">;
7842
7843 def err_typecheck_array_not_modifiable_lvalue : Error<
7844   "array type %0 is not assignable">;
7845 def err_typecheck_non_object_not_modifiable_lvalue : Error<
7846   "non-object type %0 is not assignable">;
7847 def err_typecheck_expression_not_modifiable_lvalue : Error<
7848   "expression is not assignable">;
7849 def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
7850   "incomplete type %0 is not assignable">;
7851 def err_typecheck_lvalue_casts_not_supported : Error<
7852   "assignment to cast is illegal, lvalue casts are not supported">;
7853
7854 def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
7855   "vector is not assignable (contains duplicate components)">;
7856 def err_block_decl_ref_not_modifiable_lvalue : Error<
7857   "variable is not assignable (missing __block type specifier)">;
7858 def err_lambda_decl_ref_not_modifiable_lvalue : Error<
7859   "cannot assign to a variable captured by copy in a non-mutable lambda">;
7860 def err_typecheck_call_not_function : Error<
7861   "called object type %0 is not a function or function pointer">;
7862 def err_call_incomplete_return : Error<
7863   "calling function with incomplete return type %0">;
7864 def err_call_function_incomplete_return : Error<
7865   "calling %0 with incomplete return type %1">;
7866 def err_call_incomplete_argument : Error<
7867   "argument type %0 is incomplete">;
7868 def err_typecheck_call_too_few_args : Error<
7869   "too few %select{|||execution configuration }0arguments to "
7870   "%select{function|block|method|kernel function}0 call, "
7871   "expected %1, have %2">;
7872 def err_typecheck_call_too_few_args_one : Error<
7873   "too few %select{|||execution configuration }0arguments to "
7874   "%select{function|block|method|kernel function}0 call, "
7875   "single argument %1 was not specified">;
7876 def err_typecheck_call_too_few_args_at_least : Error<
7877   "too few %select{|||execution configuration }0arguments to "
7878   "%select{function|block|method|kernel function}0 call, "
7879   "expected at least %1, have %2">;
7880 def err_typecheck_call_too_few_args_at_least_one : Error<
7881   "too few %select{|||execution configuration }0arguments to "
7882   "%select{function|block|method|kernel function}0 call, "
7883   "at least argument %1 must be specified">;
7884 def err_typecheck_call_too_few_args_suggest : Error<
7885   "too few %select{|||execution configuration }0arguments to "
7886   "%select{function|block|method|kernel function}0 call, "
7887   "expected %1, have %2; did you mean %3?">;
7888 def err_typecheck_call_too_few_args_at_least_suggest : Error<
7889   "too few %select{|||execution configuration }0arguments to "
7890   "%select{function|block|method|kernel function}0 call, "
7891   "expected at least %1, have %2; did you mean %3?">;
7892 def err_typecheck_call_too_many_args : Error<
7893   "too many %select{|||execution configuration }0arguments to "
7894   "%select{function|block|method|kernel function}0 call, "
7895   "expected %1, have %2">;
7896 def err_typecheck_call_too_many_args_one : Error<
7897   "too many %select{|||execution configuration }0arguments to "
7898   "%select{function|block|method|kernel function}0 call, "
7899   "expected single argument %1, have %2 arguments">;
7900 def err_typecheck_call_too_many_args_at_most : Error<
7901   "too many %select{|||execution configuration }0arguments to "
7902   "%select{function|block|method|kernel function}0 call, "
7903   "expected at most %1, have %2">;
7904 def err_typecheck_call_too_many_args_at_most_one : Error<
7905   "too many %select{|||execution configuration }0arguments to "
7906   "%select{function|block|method|kernel function}0 call, "
7907   "expected at most single argument %1, have %2 arguments">;
7908 def err_typecheck_call_too_many_args_suggest : Error<
7909   "too many %select{|||execution configuration }0arguments to "
7910   "%select{function|block|method|kernel function}0 call, "
7911   "expected %1, have %2; did you mean %3?">;
7912 def err_typecheck_call_too_many_args_at_most_suggest : Error<
7913   "too many %select{|||execution configuration }0arguments to "
7914   "%select{function|block|method|kernel function}0 call, "
7915   "expected at most %1, have %2; did you mean %3?">;
7916
7917 def err_arc_typecheck_convert_incompatible_pointer : Error<
7918   "incompatible pointer types passing retainable parameter of type %0"
7919   "to a CF function expecting %1 type">;
7920
7921 def err_builtin_fn_use : Error<"builtin functions must be directly called">;
7922
7923 def warn_call_wrong_number_of_arguments : Warning<
7924   "too %select{few|many}0 arguments in call to %1">;
7925 def err_atomic_builtin_must_be_pointer : Error<
7926   "address argument to atomic builtin must be a pointer (%0 invalid)">;
7927 def err_atomic_builtin_must_be_pointer_intptr : Error<
7928   "address argument to atomic builtin must be a pointer to integer or pointer"
7929   " (%0 invalid)">;
7930 def err_atomic_builtin_cannot_be_const : Error<
7931   "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
7932 def err_atomic_builtin_must_be_pointer_intfltptr : Error<
7933   "address argument to atomic builtin must be a pointer to integer,"
7934   " floating-point or pointer (%0 invalid)">;
7935 def err_atomic_builtin_pointer_size : Error<
7936   "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
7937   "type (%0 invalid)">;
7938 def err_atomic_exclusive_builtin_pointer_size : Error<
7939   "address argument to load or store exclusive builtin must be a pointer to"
7940   " 1,2,4 or 8 byte type (%0 invalid)">;
7941 def err_atomic_builtin_ext_int_size : Error<
7942   "Atomic memory operand must have a power-of-two size">;
7943 def err_atomic_builtin_ext_int_prohibit : Error<
7944   "argument to atomic builtin of type '_ExtInt' is not supported">;
7945 def err_atomic_op_needs_atomic : Error<
7946   "address argument to atomic operation must be a pointer to _Atomic "
7947   "type (%0 invalid)">;
7948 def err_atomic_op_needs_non_const_atomic : Error<
7949   "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
7950   "type (%1 invalid)">;
7951 def err_atomic_op_needs_non_const_pointer : Error<
7952   "address argument to atomic operation must be a pointer to non-const "
7953   "type (%0 invalid)">;
7954 def err_atomic_op_needs_trivial_copy : Error<
7955   "address argument to atomic operation must be a pointer to a "
7956   "trivially-copyable type (%0 invalid)">;
7957 def err_atomic_op_needs_atomic_int_or_ptr : Error<
7958   "address argument to atomic operation must be a pointer to %select{|atomic }0"
7959   "integer or pointer (%1 invalid)">;
7960 def err_atomic_op_needs_atomic_int : Error<
7961   "address argument to atomic operation must be a pointer to "
7962   "%select{|atomic }0integer (%1 invalid)">;
7963 def warn_atomic_op_has_invalid_memory_order : Warning<
7964   "memory order argument to atomic operation is invalid">,
7965   InGroup<DiagGroup<"atomic-memory-ordering">>;
7966 def err_atomic_op_has_invalid_synch_scope : Error<
7967   "synchronization scope argument to atomic operation is invalid">;
7968 def warn_atomic_implicit_seq_cst : Warning<
7969   "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
7970   InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
7971
7972 def err_overflow_builtin_must_be_int : Error<
7973   "operand argument to overflow builtin must be an integer (%0 invalid)">;
7974 def err_overflow_builtin_must_be_ptr_int : Error<
7975   "result argument to overflow builtin must be a pointer "
7976   "to a non-const integer (%0 invalid)">;
7977 def err_overflow_builtin_ext_int_max_size : Error<
7978   "__builtin_mul_overflow does not support signed _ExtInt operands of more "
7979   "than %0 bits">;
7980
7981 def err_atomic_load_store_uses_lib : Error<
7982   "atomic %select{load|store}0 requires runtime support that is not "
7983   "available for this target">;
7984
7985 def err_nontemporal_builtin_must_be_pointer : Error<
7986   "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
7987 def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
7988   "address argument to nontemporal builtin must be a pointer to integer, float, "
7989   "pointer, or a vector of such types (%0 invalid)">;
7990
7991 def err_deleted_function_use : Error<"attempt to use a deleted function">;
7992 def err_deleted_inherited_ctor_use : Error<
7993   "constructor inherited by %0 from base class %1 is implicitly deleted">;
7994
7995 def note_called_by : Note<"called by %0">;
7996 def err_kern_type_not_void_return : Error<
7997   "kernel function type %0 must have void return type">;
7998 def err_kern_is_nonstatic_method : Error<
7999   "kernel function %0 must be a free function or static member function">;
8000 def err_config_scalar_return : Error<
8001   "CUDA special function '%0' must have scalar return type">;
8002 def err_kern_call_not_global_function : Error<
8003   "kernel call to non-global function %0">;
8004 def err_global_call_not_config : Error<
8005   "call to global function %0 not configured">;
8006 def err_ref_bad_target : Error<
8007   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8008   "function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
8009 def err_ref_bad_target_global_initializer : Error<
8010   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8011   "function %1 in global initializer">;
8012 def err_capture_bad_target : Error<
8013   "capture host variable %0 by reference in device or host device lambda function">;
8014 def err_capture_bad_target_this_ptr : Error<
8015   "capture host side class data member by this pointer in device or host device lambda function">;
8016 def warn_kern_is_method : Extension<
8017   "kernel function %0 is a member function; this may not be accepted by nvcc">,
8018   InGroup<CudaCompat>;
8019 def warn_kern_is_inline : Warning<
8020   "ignored 'inline' attribute on kernel function %0">,
8021   InGroup<CudaCompat>;
8022 def err_variadic_device_fn : Error<
8023   "CUDA device code does not support variadic functions">;
8024 def err_va_arg_in_device : Error<
8025   "CUDA device code does not support va_arg">;
8026 def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8027 def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8028   "constexpr function %0 without __host__ or __device__ attributes cannot "
8029   "overload __device__ function with same signature.  Add a __host__ "
8030   "attribute, or build with -fno-cuda-host-device-constexpr.">;
8031 def note_cuda_conflicting_device_function_declared_here : Note<
8032   "conflicting __device__ function declared here">;
8033 def err_cuda_device_exceptions : Error<
8034   "cannot use '%0' in "
8035   "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8036 def err_dynamic_var_init : Error<
8037     "dynamic initialization is not supported for "
8038     "__device__, __constant__, and __shared__ variables.">;
8039 def err_shared_var_init : Error<
8040     "initialization is not supported for __shared__ variables.">;
8041 def err_device_static_local_var : Error<
8042     "within a %select{__device__|__global__|__host__|__host__ __device__}0 "
8043     "function, only __shared__ variables or const variables without device "
8044     "memory qualifier may be marked 'static'">;
8045 def err_cuda_vla : Error<
8046     "cannot use variable-length arrays in "
8047     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8048 def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8049 def err_cuda_host_shared : Error<
8050     "__shared__ local variables not allowed in "
8051     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8052 def err_cuda_nonglobal_constant : Error<"__constant__ variables must be global">;
8053 def err_cuda_ovl_target : Error<
8054   "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8055   "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8056 def note_cuda_ovl_candidate_target_mismatch : Note<
8057     "candidate template ignored: target attributes do not match">;
8058
8059 def err_cuda_device_builtin_surftex_cls_template : Error<
8060     "illegal device builtin %select{surface|texture}0 reference "
8061     "class template %1 declared here">;
8062 def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8063     "%0 needs to have exactly %1 template parameters">;
8064 def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8065     "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8066     "%select{a type|an integer or enum value}2">;
8067
8068 def err_cuda_device_builtin_surftex_ref_decl : Error<
8069     "illegal device builtin %select{surface|texture}0 reference "
8070     "type %1 declared here">;
8071 def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8072     "%0 needs to be instantiated from a class template with proper "
8073     "template arguments">;
8074
8075 def warn_non_pod_vararg_with_format_string : Warning<
8076   "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8077   "%select{function|block|method|constructor}2; expected type from format "
8078   "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8079 // The arguments to this diagnostic should match the warning above.
8080 def err_cannot_pass_objc_interface_to_vararg_format : Error<
8081   "cannot pass object with interface type %1 by value to variadic "
8082   "%select{function|block|method|constructor}2; expected type from format "
8083   "string was %3">;
8084 def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8085   "cannot pass non-trivial C object of type %0 by value to variadic "
8086   "%select{function|block|method|constructor}1">;
8087
8088
8089 def err_cannot_pass_objc_interface_to_vararg : Error<
8090   "cannot pass object with interface type %0 by value through variadic "
8091   "%select{function|block|method|constructor}1">;
8092 def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8093   "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8094   " %select{function|block|method|constructor}2; call will abort at runtime">,
8095   InGroup<NonPODVarargs>, DefaultError;
8096 def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8097   "passing object of trivial but non-POD type %0 through variadic"
8098   " %select{function|block|method|constructor}1 is incompatible with C++98">,
8099   InGroup<CXX98Compat>, DefaultIgnore;
8100 def warn_pass_class_arg_to_vararg : Warning<
8101   "passing object of class type %0 through variadic "
8102   "%select{function|block|method|constructor}1"
8103   "%select{|; did you mean to call '%3'?}2">,
8104   InGroup<ClassVarargs>, DefaultIgnore;
8105 def err_cannot_pass_to_vararg : Error<
8106   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8107   "%select{function|block|method|constructor}2">;
8108 def err_cannot_pass_to_vararg_format : Error<
8109   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8110   "%select{function|block|method|constructor}2; expected type from format "
8111   "string was %3">;
8112
8113 def err_typecheck_call_invalid_ordered_compare : Error<
8114   "ordered compare requires two args of floating point type"
8115   "%diff{ ($ and $)|}0,1">;
8116 def err_typecheck_call_invalid_unary_fp : Error<
8117   "floating point classification requires argument of floating point type "
8118   "(passed in %0)">;
8119 def err_typecheck_cond_expect_int_float : Error<
8120   "used type %0 where integer or floating point type is required">;
8121 def err_typecheck_cond_expect_scalar : Error<
8122   "used type %0 where arithmetic or pointer type is required">;
8123 def err_typecheck_cond_expect_nonfloat : Error<
8124   "used type %0 where floating point type is not allowed">;
8125 def ext_typecheck_cond_one_void : Extension<
8126   "C99 forbids conditional expressions with only one void side">;
8127 def err_typecheck_cast_to_incomplete : Error<
8128   "cast to incomplete type %0">;
8129 def ext_typecheck_cast_nonscalar : Extension<
8130   "C99 forbids casting nonscalar type %0 to the same type">;
8131 def ext_typecheck_cast_to_union : Extension<
8132   "cast to union type is a GNU extension">,
8133   InGroup<GNUUnionCast>;
8134 def err_typecheck_cast_to_union_no_type : Error<
8135   "cast to union type from type %0 not present in union">;
8136 def err_cast_pointer_from_non_pointer_int : Error<
8137   "operand of type %0 cannot be cast to a pointer type">;
8138 def warn_cast_pointer_from_sel : Warning<
8139   "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8140   InGroup<SelTypeCast>;
8141 def warn_function_def_in_objc_container : Warning<
8142   "function definition inside an Objective-C container is deprecated">,
8143   InGroup<FunctionDefInObjCContainer>;
8144
8145 def warn_cast_calling_conv : Warning<
8146   "cast between incompatible calling conventions '%0' and '%1'; "
8147   "calls through this pointer may abort at runtime">,
8148   InGroup<DiagGroup<"cast-calling-convention">>;
8149 def note_change_calling_conv_fixit : Note<
8150   "consider defining %0 with the '%1' calling convention">;
8151 def warn_bad_function_cast : Warning<
8152   "cast from function call of type %0 to non-matching type %1">,
8153   InGroup<BadFunctionCast>, DefaultIgnore;
8154 def err_cast_pointer_to_non_pointer_int : Error<
8155   "pointer cannot be cast to type %0">;
8156 def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8157 def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8158 def err_typecheck_expect_scalar_operand : Error<
8159   "operand of type %0 where arithmetic or pointer type is required">;
8160 def err_typecheck_cond_incompatible_operands : Error<
8161   "incompatible operand types%diff{ ($ and $)|}0,1">;
8162 def err_cast_selector_expr : Error<
8163   "cannot type cast @selector expression">;
8164 def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8165   "pointer type mismatch%diff{ ($ and $)|}0,1">,
8166   InGroup<DiagGroup<"pointer-type-mismatch">>;
8167 def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8168   "pointer/integer type mismatch in conditional expression"
8169   "%diff{ ($ and $)|}0,1">,
8170   InGroup<DiagGroup<"conditional-type-mismatch">>;
8171 def err_typecheck_choose_expr_requires_constant : Error<
8172   "'__builtin_choose_expr' requires a constant expression">;
8173 def warn_unused_expr : Warning<"expression result unused">,
8174   InGroup<UnusedValue>;
8175 def warn_unused_voidptr : Warning<
8176   "expression result unused; should this cast be to 'void'?">,
8177   InGroup<UnusedValue>;
8178 def warn_unused_property_expr : Warning<
8179  "property access result unused - getters should not be used for side effects">,
8180   InGroup<UnusedGetterReturnValue>;
8181 def warn_unused_container_subscript_expr : Warning<
8182  "container access result unused - container access should not be used for side effects">,
8183   InGroup<UnusedValue>;
8184 def warn_unused_call : Warning<
8185   "ignoring return value of function declared with %0 attribute">,
8186   InGroup<UnusedValue>;
8187 def warn_unused_constructor : Warning<
8188   "ignoring temporary created by a constructor declared with %0 attribute">,
8189   InGroup<UnusedValue>;
8190 def warn_unused_constructor_msg : Warning<
8191   "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8192   InGroup<UnusedValue>;
8193 def warn_side_effects_unevaluated_context : Warning<
8194   "expression with side effects has no effect in an unevaluated context">,
8195   InGroup<UnevaluatedExpression>;
8196 def warn_side_effects_typeid : Warning<
8197   "expression with side effects will be evaluated despite being used as an "
8198   "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8199 def warn_unused_result : Warning<
8200   "ignoring return value of function declared with %0 attribute">,
8201   InGroup<UnusedResult>;
8202 def warn_unused_result_msg : Warning<
8203   "ignoring return value of function declared with %0 attribute: %1">,
8204   InGroup<UnusedResult>;
8205 def warn_unused_volatile : Warning<
8206   "expression result unused; assign into a variable to force a volatile load">,
8207   InGroup<DiagGroup<"unused-volatile-lvalue">>;
8208
8209 def ext_cxx14_attr : Extension<
8210   "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
8211 def ext_cxx17_attr : Extension<
8212   "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
8213 def ext_cxx20_attr : Extension<
8214   "use of the %0 attribute is a C++20 extension">, InGroup<CXX20>;
8215
8216 def warn_unused_comparison : Warning<
8217   "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8218   InGroup<UnusedComparison>;
8219 def note_inequality_comparison_to_or_assign : Note<
8220   "use '|=' to turn this inequality comparison into an or-assignment">;
8221
8222 def err_incomplete_type_used_in_type_trait_expr : Error<
8223   "incomplete type %0 used in type trait expression">;
8224
8225 // C++20 constinit and require_constant_initialization attribute
8226 def warn_cxx20_compat_constinit : Warning<
8227   "'constinit' specifier is incompatible with C++ standards before C++20">,
8228   InGroup<CXX20Compat>, DefaultIgnore;
8229 def err_constinit_local_variable : Error<
8230   "local variable cannot be declared 'constinit'">;
8231 def err_require_constant_init_failed : Error<
8232   "variable does not have a constant initializer">;
8233 def note_declared_required_constant_init_here : Note<
8234   "required by %select{'require_constant_initialization' attribute|"
8235   "'constinit' specifier}0 here">;
8236 def ext_constinit_missing : ExtWarn<
8237   "'constinit' specifier missing on initializing declaration of %0">,
8238   InGroup<DiagGroup<"missing-constinit">>;
8239 def note_constinit_specified_here : Note<"variable declared constinit here">;
8240 def err_constinit_added_too_late : Error<
8241   "'constinit' specifier added after initialization of variable">;
8242 def warn_require_const_init_added_too_late : Warning<
8243   "'require_constant_initialization' attribute added after initialization "
8244   "of variable">, InGroup<IgnoredAttributes>;
8245 def note_constinit_missing_here : Note<
8246   "add the "
8247   "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8248   "to the initializing declaration here">;
8249
8250 def err_dimension_expr_not_constant_integer : Error<
8251   "dimension expression does not evaluate to a constant unsigned int">;
8252
8253 def err_typecheck_cond_incompatible_operands_null : Error<
8254   "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8255 def ext_empty_struct_union : Extension<
8256   "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8257 def ext_no_named_members_in_struct_union : Extension<
8258   "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8259 def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8260   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8261   InGroup<CXXCompat>, DefaultIgnore;
8262 def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8263   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8264   InGroup<ExternCCompat>;
8265 def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8266   "volatile qualifiers|const qualifier|volatile qualifier}2">,
8267   InGroup<CastQual>, DefaultIgnore;
8268 def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8269   "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8270 def warn_redefine_extname_not_applied : Warning<
8271   "#pragma redefine_extname is applicable to external C declarations only; "
8272   "not applied to %select{function|variable}0 %1">,
8273   InGroup<Pragmas>;
8274 } // End of general sema category.
8275
8276 // inline asm.
8277 let CategoryName = "Inline Assembly Issue" in {
8278   def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8279   def err_asm_invalid_output_constraint : Error<
8280     "invalid output constraint '%0' in asm">;
8281   def err_asm_invalid_lvalue_in_input : Error<
8282     "invalid lvalue in asm input for constraint '%0'">;
8283   def err_asm_invalid_input_constraint : Error<
8284     "invalid input constraint '%0' in asm">;
8285   def err_asm_tying_incompatible_types : Error<
8286     "unsupported inline asm: input with type "
8287     "%diff{$ matching output with type $|}0,1">;
8288   def err_asm_unexpected_constraint_alternatives : Error<
8289     "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8290   def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8291   def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8292   def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8293     "global register variables on this target">;
8294   def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8295     "match variable size">;
8296   def err_asm_bad_register_type : Error<"bad type for named register variable">;
8297   def err_asm_invalid_input_size : Error<
8298     "invalid input size for constraint '%0'">;
8299   def err_asm_invalid_output_size : Error<
8300     "invalid output size for constraint '%0'">;
8301   def err_invalid_asm_cast_lvalue : Error<
8302     "invalid use of a cast in a inline asm context requiring an l-value: "
8303     "remove the cast or build with -fheinous-gnu-extensions">;
8304   def err_invalid_asm_value_for_constraint
8305       : Error <"value '%0' out of range for constraint '%1'">;
8306   def err_asm_non_addr_value_in_memory_constraint : Error <
8307     "reference to a %select{bit-field|vector element|global register variable}0"
8308     " in asm %select{input|output}1 with a memory constraint '%2'">;
8309   def err_asm_input_duplicate_match : Error<
8310     "more than one input constraint matches the same output '%0'">;
8311
8312   def warn_asm_label_on_auto_decl : Warning<
8313     "ignored asm label '%0' on automatic variable">;
8314   def warn_invalid_asm_cast_lvalue : Warning<
8315     "invalid use of a cast in an inline asm context requiring an l-value: "
8316     "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8317     "for this in the future">;
8318   def warn_asm_mismatched_size_modifier : Warning<
8319     "value size does not match register size specified by the constraint "
8320     "and modifier">,
8321     InGroup<ASMOperandWidths>;
8322
8323   def note_asm_missing_constraint_modifier : Note<
8324     "use constraint modifier \"%0\"">;
8325   def note_asm_input_duplicate_first : Note<
8326     "constraint '%0' is already present here">;
8327  def error_duplicate_asm_operand_name : Error<
8328     "duplicate use of asm operand name \"%0\"">;
8329  def note_duplicate_asm_operand_name : Note<
8330     "asm operand name \"%0\" first referenced here">;
8331 }
8332
8333   def error_inoutput_conflict_with_clobber : Error<
8334     "asm-specifier for input or output variable conflicts with asm"
8335     " clobber list">;
8336
8337 let CategoryName = "Semantic Issue" in {
8338
8339 def err_invalid_conversion_between_vectors : Error<
8340   "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8341   "size">;
8342 def err_invalid_conversion_between_vector_and_integer : Error<
8343   "invalid conversion between vector type %0 and integer type %1 "
8344   "of different size">;
8345
8346 def err_opencl_function_pointer : Error<
8347   "pointers to functions are not allowed">;
8348
8349 def err_opencl_taking_address_capture : Error<
8350   "taking address of a capture is not allowed">;
8351
8352 def err_invalid_conversion_between_vector_and_scalar : Error<
8353   "invalid conversion between vector type %0 and scalar type %1">;
8354
8355 // C++ member initializers.
8356 def err_only_constructors_take_base_inits : Error<
8357   "only constructors take base initializers">;
8358
8359 def err_multiple_mem_initialization : Error <
8360   "multiple initializations given for non-static member %0">;
8361 def err_multiple_mem_union_initialization : Error <
8362   "initializing multiple members of union">;
8363 def err_multiple_base_initialization : Error <
8364   "multiple initializations given for base %0">;
8365
8366 def err_mem_init_not_member_or_class : Error<
8367   "member initializer %0 does not name a non-static data member or base "
8368   "class">;
8369
8370 def warn_initializer_out_of_order : Warning<
8371   "%select{field|base class}0 %1 will be initialized after "
8372   "%select{field|base}2 %3">,
8373   InGroup<ReorderCtor>, DefaultIgnore;
8374 def warn_abstract_vbase_init_ignored : Warning<
8375   "initializer for virtual base class %0 of abstract class %1 "
8376   "will never be used">,
8377   InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8378
8379 def err_base_init_does_not_name_class : Error<
8380   "constructor initializer %0 does not name a class">;
8381 def err_base_init_direct_and_virtual : Error<
8382   "base class initializer %0 names both a direct base class and an "
8383   "inherited virtual base class">;
8384 def err_not_direct_base_or_virtual : Error<
8385   "type %0 is not a direct or virtual base of %1">;
8386
8387 def err_in_class_initializer_non_const : Error<
8388   "non-const static data member must be initialized out of line">;
8389 def err_in_class_initializer_volatile : Error<
8390   "static const volatile data member must be initialized out of line">;
8391 def err_in_class_initializer_bad_type : Error<
8392   "static data member of type %0 must be initialized out of line">;
8393 def ext_in_class_initializer_float_type : ExtWarn<
8394   "in-class initializer for static data member of type %0 is a GNU extension">,
8395   InGroup<GNUStaticFloatInit>;
8396 def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8397   "in-class initializer for static data member of type %0 requires "
8398   "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8399 def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8400 def err_in_class_initializer_literal_type : Error<
8401   "in-class initializer for static data member of type %0 requires "
8402   "'constexpr' specifier">;
8403 def err_in_class_initializer_non_constant : Error<
8404   "in-class initializer for static data member is not a constant expression">;
8405 def err_in_class_initializer_not_yet_parsed : Error<
8406   "default member initializer for %1 needed within definition of enclosing "
8407   "class %0 outside of member functions">;
8408 def note_in_class_initializer_not_yet_parsed : Note<
8409   "default member initializer declared here">;
8410 def err_in_class_initializer_cycle
8411     : Error<"default member initializer for %0 uses itself">;
8412
8413 def ext_in_class_initializer_non_constant : Extension<
8414   "in-class initializer for static data member is not a constant expression; "
8415   "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8416
8417 def err_thread_dynamic_init : Error<
8418   "initializer for thread-local variable must be a constant expression">;
8419 def err_thread_nontrivial_dtor : Error<
8420   "type of thread-local variable has non-trivial destruction">;
8421 def note_use_thread_local : Note<
8422   "use 'thread_local' to allow this">;
8423
8424 // C++ anonymous unions and GNU anonymous structs/unions
8425 def ext_anonymous_union : Extension<
8426   "anonymous unions are a C11 extension">, InGroup<C11>;
8427 def ext_gnu_anonymous_struct : Extension<
8428   "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8429 def ext_c11_anonymous_struct : Extension<
8430   "anonymous structs are a C11 extension">, InGroup<C11>;
8431 def err_anonymous_union_not_static : Error<
8432   "anonymous unions at namespace or global scope must be declared 'static'">;
8433 def err_anonymous_union_with_storage_spec : Error<
8434   "anonymous union at class scope must not have a storage specifier">;
8435 def err_anonymous_struct_not_member : Error<
8436   "anonymous %select{structs|structs and classes}0 must be "
8437   "%select{struct or union|class}0 members">;
8438 def err_anonymous_record_member_redecl : Error<
8439   "member of anonymous %select{struct|union}0 redeclares %1">;
8440 def err_anonymous_record_with_type : Error<
8441   "types cannot be declared in an anonymous %select{struct|union}0">;
8442 def ext_anonymous_record_with_type : Extension<
8443   "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8444   "extension">, InGroup<MicrosoftAnonTag>;
8445 def ext_anonymous_record_with_anonymous_type : Extension<
8446   "anonymous types declared in an anonymous %select{struct|union}0 "
8447   "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8448 def err_anonymous_record_with_function : Error<
8449   "functions cannot be declared in an anonymous %select{struct|union}0">;
8450 def err_anonymous_record_with_static : Error<
8451   "static members cannot be declared in an anonymous %select{struct|union}0">;
8452 def err_anonymous_record_bad_member : Error<
8453   "anonymous %select{struct|union}0 can only contain non-static data members">;
8454 def err_anonymous_record_nonpublic_member : Error<
8455   "anonymous %select{struct|union}0 cannot contain a "
8456   "%select{private|protected}1 data member">;
8457 def ext_ms_anonymous_record : ExtWarn<
8458   "anonymous %select{structs|unions}0 are a Microsoft extension">,
8459   InGroup<MicrosoftAnonTag>;
8460
8461 // C++ local classes
8462 def err_reference_to_local_in_enclosing_context : Error<
8463   "reference to local %select{variable|binding}1 %0 declared in enclosing "
8464   "%select{%3|block literal|lambda expression|context}2">;
8465
8466 def err_static_data_member_not_allowed_in_local_class : Error<
8467   "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
8468
8469 // C++ derived classes
8470 def err_base_clause_on_union : Error<"unions cannot have base classes">;
8471 def err_base_must_be_class : Error<"base specifier must name a class">;
8472 def err_union_as_base_class : Error<"unions cannot be base classes">;
8473 def err_circular_inheritance : Error<
8474   "circular inheritance between %0 and %1">;
8475 def err_base_class_has_flexible_array_member : Error<
8476   "base class %0 has a flexible array member">;
8477 def err_incomplete_base_class : Error<"base class has incomplete type">;
8478 def err_duplicate_base_class : Error<
8479   "base class %0 specified more than once as a direct base class">;
8480 def warn_inaccessible_base_class : Warning<
8481   "direct base %0 is inaccessible due to ambiguity:%1">,
8482   InGroup<DiagGroup<"inaccessible-base">>;
8483 // FIXME: better way to display derivation?  Pass entire thing into diagclient?
8484 def err_ambiguous_derived_to_base_conv : Error<
8485   "ambiguous conversion from derived class %0 to base class %1:%2">;
8486 def err_ambiguous_memptr_conv : Error<
8487   "ambiguous conversion from pointer to member of %select{base|derived}0 "
8488   "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8489 def ext_ms_ambiguous_direct_base : ExtWarn<
8490   "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8491   InGroup<MicrosoftInaccessibleBase>;
8492
8493 def err_memptr_conv_via_virtual : Error<
8494   "conversion from pointer to member of class %0 to pointer to member "
8495   "of class %1 via virtual base %2 is not allowed">;
8496
8497 // C++ member name lookup
8498 def err_ambiguous_member_multiple_subobjects : Error<
8499   "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8500 def err_ambiguous_member_multiple_subobject_types : Error<
8501   "member %0 found in multiple base classes of different types">;
8502 def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8503 def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8504 def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8505 def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8506   "declaration in a different namespace">;
8507 def note_hidden_tag : Note<"type declaration hidden">;
8508 def note_hiding_object : Note<"declaration hides type">;
8509
8510 // C++ operator overloading
8511 def err_operator_overload_needs_class_or_enum : Error<
8512   "overloaded %0 must have at least one parameter of class "
8513   "or enumeration type">;
8514
8515 def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8516 def err_operator_overload_static : Error<
8517   "overloaded %0 cannot be a static member function">;
8518 def err_operator_overload_default_arg : Error<
8519   "parameter of overloaded %0 cannot have a default argument">;
8520 def err_operator_overload_must_be : Error<
8521   "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8522   "(has %1 parameter%s1)">;
8523
8524 def err_operator_overload_must_be_member : Error<
8525   "overloaded %0 must be a non-static member function">;
8526 def err_operator_overload_post_incdec_must_be_int : Error<
8527   "parameter of overloaded post-%select{increment|decrement}1 operator must "
8528   "have type 'int' (not %0)">;
8529
8530 // C++ allocation and deallocation functions.
8531 def err_operator_new_delete_declared_in_namespace : Error<
8532   "%0 cannot be declared inside a namespace">;
8533 def err_operator_new_delete_declared_static : Error<
8534   "%0 cannot be declared static in global scope">;
8535 def ext_operator_new_delete_declared_inline : ExtWarn<
8536   "replacement function %0 cannot be declared 'inline'">,
8537   InGroup<DiagGroup<"inline-new-delete">>;
8538 def err_operator_new_delete_invalid_result_type : Error<
8539   "%0 must return type %1">;
8540 def err_operator_new_delete_dependent_result_type : Error<
8541   "%0 cannot have a dependent return type; use %1 instead">;
8542 def err_operator_new_delete_too_few_parameters : Error<
8543   "%0 must have at least one parameter">;
8544 def err_operator_new_delete_template_too_few_parameters : Error<
8545   "%0 template must have at least two parameters">;
8546 def warn_operator_new_returns_null : Warning<
8547   "%0 should not return a null pointer unless it is declared 'throw()'"
8548   "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
8549
8550 def err_operator_new_dependent_param_type : Error<
8551   "%0 cannot take a dependent type as first parameter; "
8552   "use size_t (%1) instead">;
8553 def err_operator_new_param_type : Error<
8554   "%0 takes type size_t (%1) as first parameter">;
8555 def err_operator_new_default_arg: Error<
8556   "parameter of %0 cannot have a default argument">;
8557 def err_operator_delete_dependent_param_type : Error<
8558   "%0 cannot take a dependent type as first parameter; use %1 instead">;
8559 def err_operator_delete_param_type : Error<
8560   "first parameter of %0 must have type %1">;
8561 def err_destroying_operator_delete_not_usual : Error<
8562   "destroying operator delete can have only an optional size and optional "
8563   "alignment parameter">;
8564 def note_implicit_delete_this_in_destructor_here : Note<
8565   "while checking implicit 'delete this' for virtual destructor">;
8566 def err_builtin_operator_new_delete_not_usual : Error<
8567   "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
8568   "selects non-usual %select{allocation|deallocation}0 function">;
8569 def note_non_usual_function_declared_here : Note<
8570   "non-usual %0 declared here">;
8571
8572 // C++ literal operators
8573 def err_literal_operator_outside_namespace : Error<
8574   "literal operator %0 must be in a namespace or global scope">;
8575 def err_literal_operator_id_outside_namespace : Error<
8576   "non-namespace scope '%0' cannot have a literal operator member">;
8577 def err_literal_operator_default_argument : Error<
8578   "literal operator cannot have a default argument">;
8579 def err_literal_operator_bad_param_count : Error<
8580   "non-template literal operator must have one or two parameters">;
8581 def err_literal_operator_invalid_param : Error<
8582   "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
8583 def err_literal_operator_param : Error<
8584   "invalid literal operator parameter type %0, did you mean %1?">;
8585 def err_literal_operator_template_with_params : Error<
8586   "literal operator template cannot have any parameters">;
8587 def err_literal_operator_template : Error<
8588   "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
8589 def err_literal_operator_extern_c : Error<
8590   "literal operator must have C++ linkage">;
8591 def ext_string_literal_operator_template : ExtWarn<
8592   "string literal operator templates are a GNU extension">,
8593   InGroup<GNUStringLiteralOperatorTemplate>;
8594 def warn_user_literal_reserved : Warning<
8595   "user-defined literal suffixes not starting with '_' are reserved"
8596   "%select{; no literal will invoke this operator|}0">,
8597   InGroup<UserDefinedLiterals>;
8598
8599 // C++ conversion functions
8600 def err_conv_function_not_member : Error<
8601   "conversion function must be a non-static member function">;
8602 def err_conv_function_return_type : Error<
8603   "conversion function cannot have a return type">;
8604 def err_conv_function_with_params : Error<
8605   "conversion function cannot have any parameters">;
8606 def err_conv_function_variadic : Error<
8607   "conversion function cannot be variadic">;
8608 def err_conv_function_to_array : Error<
8609   "conversion function cannot convert to an array type">;
8610 def err_conv_function_to_function : Error<
8611   "conversion function cannot convert to a function type">;
8612 def err_conv_function_with_complex_decl : Error<
8613   "cannot specify any part of a return type in the "
8614   "declaration of a conversion function"
8615   "%select{"
8616   "; put the complete type after 'operator'|"
8617   "; use a typedef to declare a conversion to %1|"
8618   "; use an alias template to declare a conversion to %1|"
8619   "}0">;
8620 def err_conv_function_redeclared : Error<
8621   "conversion function cannot be redeclared">;
8622 def warn_conv_to_self_not_used : Warning<
8623   "conversion function converting %0 to itself will never be used">,
8624   InGroup<ClassConversion>;
8625 def warn_conv_to_base_not_used : Warning<
8626   "conversion function converting %0 to its base class %1 will never be used">,
8627   InGroup<ClassConversion>;
8628 def warn_conv_to_void_not_used : Warning<
8629   "conversion function converting %0 to %1 will never be used">,
8630   InGroup<ClassConversion>;
8631
8632 def warn_not_compound_assign : Warning<
8633   "use of unary operator that may be intended as compound assignment (%0=)">;
8634
8635 // C++11 explicit conversion operators
8636 def ext_explicit_conversion_functions : ExtWarn<
8637   "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
8638 def warn_cxx98_compat_explicit_conversion_functions : Warning<
8639   "explicit conversion functions are incompatible with C++98">,
8640   InGroup<CXX98Compat>, DefaultIgnore;
8641
8642 // C++11 defaulted functions
8643 def err_defaulted_special_member_params : Error<
8644   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8645   "have default arguments">;
8646 def err_defaulted_special_member_variadic : Error<
8647   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8648   "be variadic">;
8649 def err_defaulted_special_member_return_type : Error<
8650   "explicitly-defaulted %select{copy|move}0 assignment operator must "
8651   "return %1">;
8652 def err_defaulted_special_member_quals : Error<
8653   "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
8654   "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
8655 def err_defaulted_special_member_volatile_param : Error<
8656   "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
8657   "may not be volatile">;
8658 def err_defaulted_special_member_move_const_param : Error<
8659   "the parameter for an explicitly-defaulted move "
8660   "%select{constructor|assignment operator}0 may not be const">;
8661 def err_defaulted_special_member_copy_const_param : Error<
8662   "the parameter for this explicitly-defaulted copy "
8663   "%select{constructor|assignment operator}0 is const, but a member or base "
8664   "requires it to be non-const">;
8665 def err_defaulted_copy_assign_not_ref : Error<
8666   "the parameter for an explicitly-defaulted copy assignment operator must be an "
8667   "lvalue reference type">;
8668 def err_incorrect_defaulted_constexpr : Error<
8669   "defaulted definition of %sub{select_special_member_kind}0 "
8670   "is not constexpr">;
8671 def err_incorrect_defaulted_consteval : Error<
8672   "defaulted declaration of %sub{select_special_member_kind}0 "
8673   "cannot be consteval because implicit definition is not constexpr">;
8674 def warn_defaulted_method_deleted : Warning<
8675   "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
8676   "deleted">, InGroup<DefaultedFunctionDeleted>;
8677 def err_out_of_line_default_deletes : Error<
8678   "defaulting this %sub{select_special_member_kind}0 "
8679   "would delete it after its first declaration">;
8680 def note_deleted_type_mismatch : Note<
8681   "function is implicitly deleted because its declared type does not match "
8682   "the type of an implicit %sub{select_special_member_kind}0">;
8683 def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
8684   "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
8685   "different from the implicit type is incompatible with C++ standards before "
8686   "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8687 def warn_vbase_moved_multiple_times : Warning<
8688   "defaulted move assignment operator of %0 will move assign virtual base "
8689   "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
8690 def note_vbase_moved_here : Note<
8691   "%select{%1 is a virtual base class of base class %2 declared here|"
8692   "virtual base class %1 declared here}0">;
8693
8694 // C++20 defaulted comparisons
8695 // This corresponds to values of Sema::DefaultedComparisonKind.
8696 def select_defaulted_comparison_kind : TextSubstitution<
8697   "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
8698   "operator">;
8699 def ext_defaulted_comparison : ExtWarn<
8700   "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
8701 def warn_cxx17_compat_defaulted_comparison : Warning<
8702   "defaulted comparison operators are incompatible with C++ standards "
8703   "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8704 def err_defaulted_comparison_template : Error<
8705   "comparison operator template cannot be defaulted">;
8706 def err_defaulted_comparison_out_of_class : Error<
8707   "%sub{select_defaulted_comparison_kind}0 can only be defaulted in a class "
8708   "definition">;
8709 def err_defaulted_comparison_param : Error<
8710   "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
8711   "; found %1, expected %2%select{| or %4}3">;
8712 def err_defaulted_comparison_param_mismatch : Error<
8713   "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
8714   "must have the same type%diff{ (found $ vs $)|}1,2">;
8715 def err_defaulted_comparison_non_const : Error<
8716   "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
8717   "const-qualified">;
8718 def err_defaulted_comparison_return_type_not_bool : Error<
8719   "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8720   "must be 'bool', not %1">;
8721 def err_defaulted_comparison_deduced_return_type_not_auto : Error<
8722   "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8723   "must be 'auto', not %1">;
8724 def warn_defaulted_comparison_deleted : Warning<
8725   "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
8726   "deleted">, InGroup<DefaultedFunctionDeleted>;
8727 def err_non_first_default_compare_deletes : Error<
8728   "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
8729   "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
8730   "would delete it after its first declaration">;
8731 def note_defaulted_comparison_union : Note<
8732   "defaulted %0 is implicitly deleted because "
8733   "%2 is a %select{union-like class|union}1 with variant members">;
8734 def note_defaulted_comparison_reference_member : Note<
8735   "defaulted %0 is implicitly deleted because "
8736   "class %1 has a reference member">;
8737 def note_defaulted_comparison_ambiguous : Note<
8738   "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
8739   "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
8740 def note_defaulted_comparison_inaccessible : Note<
8741   "defaulted %0 is implicitly deleted because it would invoke a "
8742   "%select{private|protected}3 %4%select{ member of %6|"
8743   " member of %6 to compare member %2| to compare base class %2}1">;
8744 def note_defaulted_comparison_calls_deleted : Note<
8745   "defaulted %0 is implicitly deleted because it would invoke a deleted "
8746   "comparison function%select{| for member %2| for base class %2}1">;
8747 def note_defaulted_comparison_no_viable_function : Note<
8748   "defaulted %0 is implicitly deleted because there is no viable comparison "
8749   "function%select{| for member %2| for base class %2}1">;
8750 def note_defaulted_comparison_no_viable_function_synthesized : Note<
8751   "three-way comparison cannot be synthesized because there is no viable "
8752   "function for %select{'=='|'<'}0 comparison">;
8753 def note_defaulted_comparison_not_rewritten_callee : Note<
8754   "defaulted %0 is implicitly deleted because this non-rewritten comparison "
8755   "function would be the best match for the comparison">;
8756 def note_defaulted_comparison_cannot_deduce : Note<
8757   "return type of defaulted 'operator<=>' cannot be deduced because "
8758   "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
8759   "is not a standard comparison category type">;
8760 def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
8761   "return type of defaulted 'operator<=>' cannot be deduced because "
8762   "three-way comparison for %select{|member|base class}0 %1 "
8763   "has a deduced return type and is not yet defined">;
8764 def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
8765   "%select{|member|base class}0 %1 declared here">;
8766 def note_defaulted_comparison_cannot_deduce_callee : Note<
8767   "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
8768 def err_incorrect_defaulted_comparison_constexpr : Error<
8769   "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
8770   "three-way comparison operator}0 "
8771   "cannot be declared %select{constexpr|consteval}2 because "
8772   "%select{it|the corresponding implicit 'operator=='}0 "
8773   "invokes a non-constexpr comparison function">;
8774 def note_defaulted_comparison_not_constexpr : Note<
8775   "non-constexpr comparison function would be used to compare "
8776   "%select{|member %1|base class %1}0">;
8777 def note_defaulted_comparison_not_constexpr_here : Note<
8778   "non-constexpr comparison function declared here">;
8779 def note_in_declaration_of_implicit_equality_comparison : Note<
8780   "while declaring the corresponding implicit 'operator==' "
8781   "for this defaulted 'operator<=>'">;
8782
8783 def ext_implicit_exception_spec_mismatch : ExtWarn<
8784   "function previously declared with an %select{explicit|implicit}0 exception "
8785   "specification redeclared with an %select{implicit|explicit}0 exception "
8786   "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
8787
8788 def warn_ptr_arith_precedes_bounds : Warning<
8789   "the pointer decremented by %0 refers before the beginning of the array">,
8790   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8791 def warn_ptr_arith_exceeds_bounds : Warning<
8792   "the pointer incremented by %0 refers past the end of the array (that "
8793   "contains %1 element%s2)">,
8794   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8795 def warn_array_index_precedes_bounds : Warning<
8796   "array index %0 is before the beginning of the array">,
8797   InGroup<ArrayBounds>;
8798 def warn_array_index_exceeds_bounds : Warning<
8799   "array index %0 is past the end of the array (which contains %1 "
8800   "element%s2)">, InGroup<ArrayBounds>;
8801 def note_array_declared_here : Note<
8802   "array %0 declared here">;
8803
8804 def warn_printf_insufficient_data_args : Warning<
8805   "more '%%' conversions than data arguments">, InGroup<Format>;
8806 def warn_printf_data_arg_not_used : Warning<
8807   "data argument not used by format string">, InGroup<FormatExtraArgs>;
8808 def warn_format_invalid_conversion : Warning<
8809   "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
8810 def warn_printf_incomplete_specifier : Warning<
8811   "incomplete format specifier">, InGroup<Format>;
8812 def warn_missing_format_string : Warning<
8813   "format string missing">, InGroup<Format>;
8814 def warn_scanf_nonzero_width : Warning<
8815   "zero field width in scanf format string is unused">,
8816   InGroup<Format>;
8817 def warn_format_conversion_argument_type_mismatch : Warning<
8818   "format specifies type %0 but the argument has "
8819   "%select{type|underlying type}2 %1">,
8820   InGroup<Format>;
8821 def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
8822   warn_format_conversion_argument_type_mismatch.Text>,
8823   InGroup<FormatPedantic>;
8824 def warn_format_conversion_argument_type_mismatch_confusion : Warning<
8825   warn_format_conversion_argument_type_mismatch.Text>,
8826   InGroup<FormatTypeConfusion>, DefaultIgnore;
8827 def warn_format_argument_needs_cast : Warning<
8828   "%select{values of type|enum values with underlying type}2 '%0' should not "
8829   "be used as format arguments; add an explicit cast to %1 instead">,
8830   InGroup<Format>;
8831 def warn_format_argument_needs_cast_pedantic : Warning<
8832   warn_format_argument_needs_cast.Text>,
8833   InGroup<FormatPedantic>, DefaultIgnore;
8834 def warn_printf_positional_arg_exceeds_data_args : Warning <
8835   "data argument position '%0' exceeds the number of data arguments (%1)">,
8836   InGroup<Format>;
8837 def warn_format_zero_positional_specifier : Warning<
8838   "position arguments in format strings start counting at 1 (not 0)">,
8839   InGroup<Format>;
8840 def warn_format_invalid_positional_specifier : Warning<
8841   "invalid position specified for %select{field width|field precision}0">,
8842   InGroup<Format>;
8843 def warn_format_mix_positional_nonpositional_args : Warning<
8844   "cannot mix positional and non-positional arguments in format string">,
8845   InGroup<Format>;
8846 def warn_static_array_too_small : Warning<
8847   "array argument is too small; %select{contains %0 elements|is of size %0}2,"
8848   " callee requires at least %1">,
8849   InGroup<ArrayBounds>;
8850 def note_callee_static_array : Note<
8851   "callee declares array parameter as static here">;
8852 def warn_empty_format_string : Warning<
8853   "format string is empty">, InGroup<FormatZeroLength>;
8854 def warn_format_string_is_wide_literal : Warning<
8855   "format string should not be a wide string">, InGroup<Format>;
8856 def warn_printf_format_string_contains_null_char : Warning<
8857   "format string contains '\\0' within the string body">, InGroup<Format>;
8858 def warn_printf_format_string_not_null_terminated : Warning<
8859   "format string is not null-terminated">, InGroup<Format>;
8860 def warn_printf_asterisk_missing_arg : Warning<
8861   "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
8862   InGroup<Format>;
8863 def warn_printf_asterisk_wrong_type : Warning<
8864   "field %select{width|precision}0 should have type %1, but argument has type %2">,
8865   InGroup<Format>;
8866 def warn_printf_nonsensical_optional_amount: Warning<
8867   "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
8868   InGroup<Format>;
8869 def warn_printf_nonsensical_flag: Warning<
8870   "flag '%0' results in undefined behavior with '%1' conversion specifier">,
8871   InGroup<Format>;
8872 def warn_format_nonsensical_length: Warning<
8873   "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
8874   InGroup<Format>;
8875 def warn_format_non_standard_positional_arg: Warning<
8876   "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
8877 def warn_format_non_standard: Warning<
8878   "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
8879   InGroup<FormatNonStandard>, DefaultIgnore;
8880 def warn_format_non_standard_conversion_spec: Warning<
8881   "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
8882   InGroup<FormatNonStandard>, DefaultIgnore;
8883 def err_invalid_mask_type_size : Error<
8884   "mask type size must be between 1-byte and 8-bytes">;
8885 def warn_format_invalid_annotation : Warning<
8886   "using '%0' format specifier annotation outside of os_log()/os_trace()">,
8887   InGroup<Format>;
8888 def warn_format_P_no_precision : Warning<
8889   "using '%%P' format specifier without precision">,
8890   InGroup<Format>;
8891 def warn_printf_ignored_flag: Warning<
8892   "flag '%0' is ignored when flag '%1' is present">,
8893   InGroup<Format>;
8894 def warn_printf_empty_objc_flag: Warning<
8895   "missing object format flag">,
8896   InGroup<Format>;
8897 def warn_printf_ObjCflags_without_ObjCConversion: Warning<
8898   "object format flags cannot be used with '%0' conversion specifier">,
8899   InGroup<Format>;
8900 def warn_printf_invalid_objc_flag: Warning<
8901     "'%0' is not a valid object format flag">,
8902     InGroup<Format>;
8903 def warn_scanf_scanlist_incomplete : Warning<
8904   "no closing ']' for '%%[' in scanf format string">,
8905   InGroup<Format>;
8906 def warn_format_bool_as_character : Warning<
8907   "using '%0' format specifier, but argument has boolean value">,
8908   InGroup<Format>;
8909 def note_format_string_defined : Note<"format string is defined here">;
8910 def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
8911 def note_printf_c_str: Note<"did you mean to call the %0 method?">;
8912 def note_format_security_fixit: Note<
8913   "treat the string as an argument to avoid this">;
8914
8915 def warn_null_arg : Warning<
8916   "null passed to a callee that requires a non-null argument">,
8917   InGroup<NonNull>;
8918 def warn_null_ret : Warning<
8919   "null returned from %select{function|method}0 that requires a non-null return value">,
8920   InGroup<NonNull>;
8921
8922 def err_lifetimebound_no_object_param : Error<
8923   "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
8924   "function has no implicit object parameter">;
8925 def err_lifetimebound_ctor_dtor : Error<
8926   "'lifetimebound' attribute cannot be applied to a "
8927   "%select{constructor|destructor}0">;
8928
8929 // CHECK: returning address/reference of stack memory
8930 def warn_ret_stack_addr_ref : Warning<
8931   "%select{address of|reference to}0 stack memory associated with "
8932   "%select{local variable|parameter}2 %1 returned">,
8933   InGroup<ReturnStackAddress>;
8934 def warn_ret_local_temp_addr_ref : Warning<
8935   "returning %select{address of|reference to}0 local temporary object">,
8936   InGroup<ReturnStackAddress>;
8937 def warn_ret_addr_label : Warning<
8938   "returning address of label, which is local">,
8939   InGroup<ReturnStackAddress>;
8940 def err_ret_local_block : Error<
8941   "returning block that lives on the local stack">;
8942 def note_local_var_initializer : Note<
8943   "%select{via initialization of|binding reference}0 variable "
8944   "%select{%2 |}1here">;
8945 def note_init_with_default_member_initalizer : Note<
8946   "initializing field %0 with default member initializer">;
8947
8948 // Check for initializing a member variable with the address or a reference to
8949 // a constructor parameter.
8950 def warn_bind_ref_member_to_parameter : Warning<
8951   "binding reference member %0 to stack allocated "
8952   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
8953 def warn_init_ptr_member_to_parameter_addr : Warning<
8954   "initializing pointer member %0 with the stack address of "
8955   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
8956 def note_ref_or_ptr_member_declared_here : Note<
8957   "%select{reference|pointer}0 member declared here">;
8958
8959 def err_dangling_member : Error<
8960   "%select{reference|backing array for 'std::initializer_list'}2 "
8961   "%select{|subobject of }1member %0 "
8962   "%select{binds to|is}2 a temporary object "
8963   "whose lifetime would be shorter than the lifetime of "
8964   "the constructed object">;
8965 def warn_dangling_member : Warning<
8966   "%select{reference|backing array for 'std::initializer_list'}2 "
8967   "%select{|subobject of }1member %0 "
8968   "%select{binds to|is}2 a temporary object "
8969   "whose lifetime is shorter than the lifetime of the constructed object">,
8970   InGroup<DanglingField>;
8971 def warn_dangling_lifetime_pointer_member : Warning<
8972   "initializing pointer member %0 to point to a temporary object "
8973   "whose lifetime is shorter than the lifetime of the constructed object">,
8974   InGroup<DanglingGsl>;
8975 def note_lifetime_extending_member_declared_here : Note<
8976   "%select{%select{reference|'std::initializer_list'}0 member|"
8977   "member with %select{reference|'std::initializer_list'}0 subobject}1 "
8978   "declared here">;
8979 def warn_dangling_variable : Warning<
8980   "%select{temporary %select{whose address is used as value of|"
8981   "%select{|implicitly }2bound to}4 "
8982   "%select{%select{|reference }4member of local variable|"
8983   "local %select{variable|reference}4}1|"
8984   "array backing "
8985   "%select{initializer list subobject of local variable|"
8986   "local initializer list}1}0 "
8987   "%select{%3 |}2will be destroyed at the end of the full-expression">,
8988   InGroup<Dangling>;
8989 def warn_new_dangling_reference : Warning<
8990   "temporary bound to reference member of allocated object "
8991   "will be destroyed at the end of the full-expression">,
8992   InGroup<DanglingField>;
8993 def warn_dangling_lifetime_pointer : Warning<
8994   "object backing the pointer "
8995   "will be destroyed at the end of the full-expression">,
8996   InGroup<DanglingGsl>;
8997 def warn_new_dangling_initializer_list : Warning<
8998   "array backing "
8999   "%select{initializer list subobject of the allocated object|"
9000   "the allocated initializer list}0 "
9001   "will be destroyed at the end of the full-expression">,
9002   InGroup<DanglingInitializerList>;
9003 def warn_unsupported_lifetime_extension : Warning<
9004   "sorry, lifetime extension of "
9005   "%select{temporary|backing array of initializer list}0 created "
9006   "by aggregate initialization using default member initializer "
9007   "is not supported; lifetime of %select{temporary|backing array}0 "
9008   "will end at the end of the full-expression">, InGroup<Dangling>;
9009
9010 // For non-floating point, expressions of the form x == x or x != x
9011 // should result in a warning, since these always evaluate to a constant.
9012 // Array comparisons have similar warnings
9013 def warn_comparison_always : Warning<
9014   "%select{self-|array }0comparison always evaluates to "
9015   "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9016   InGroup<TautologicalCompare>;
9017 def warn_comparison_bitwise_always : Warning<
9018   "bitwise comparison always evaluates to %select{false|true}0">,
9019   InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9020 def warn_comparison_bitwise_or : Warning<
9021   "bitwise or with non-zero value always evaluates to true">,
9022   InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9023 def warn_tautological_overlap_comparison : Warning<
9024   "overlapping comparisons always evaluate to %select{false|true}0">,
9025   InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9026 def warn_depr_array_comparison : Warning<
9027   "comparison between two arrays is deprecated; "
9028   "to compare array addresses, use unary '+' to decay operands to pointers">,
9029   InGroup<DeprecatedArrayCompare>;
9030
9031 def warn_stringcompare : Warning<
9032   "result of comparison against %select{a string literal|@encode}0 is "
9033   "unspecified (use an explicit string comparison function instead)">,
9034   InGroup<StringCompare>;
9035
9036 def warn_identity_field_assign : Warning<
9037   "assigning %select{field|instance variable}0 to itself">,
9038   InGroup<SelfAssignmentField>;
9039
9040 // Type safety attributes
9041 def err_type_tag_for_datatype_not_ice : Error<
9042   "'type_tag_for_datatype' attribute requires the initializer to be "
9043   "an %select{integer|integral}0 constant expression">;
9044 def err_type_tag_for_datatype_too_large : Error<
9045   "'type_tag_for_datatype' attribute requires the initializer to be "
9046   "an %select{integer|integral}0 constant expression "
9047   "that can be represented by a 64 bit integer">;
9048 def err_tag_index_out_of_range : Error<
9049   "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9050 def warn_type_tag_for_datatype_wrong_kind : Warning<
9051   "this type tag was not designed to be used with this function">,
9052   InGroup<TypeSafety>;
9053 def warn_type_safety_type_mismatch : Warning<
9054   "argument type %0 doesn't match specified %1 type tag "
9055   "%select{that requires %3|}2">, InGroup<TypeSafety>;
9056 def warn_type_safety_null_pointer_required : Warning<
9057   "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9058
9059 // Generic selections.
9060 def err_assoc_type_incomplete : Error<
9061   "type %0 in generic association incomplete">;
9062 def err_assoc_type_nonobject : Error<
9063   "type %0 in generic association not an object type">;
9064 def err_assoc_type_variably_modified : Error<
9065   "type %0 in generic association is a variably modified type">;
9066 def err_assoc_compatible_types : Error<
9067   "type %0 in generic association compatible with previously specified type %1">;
9068 def note_compat_assoc : Note<
9069   "compatible type %0 specified here">;
9070 def err_generic_sel_no_match : Error<
9071   "controlling expression type %0 not compatible with any generic association type">;
9072 def err_generic_sel_multi_match : Error<
9073   "controlling expression type %0 compatible with %1 generic association types">;
9074
9075
9076 // Blocks
9077 def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9078   " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
9079 def err_block_returning_array_function : Error<
9080   "block cannot return %select{array|function}0 type %1">;
9081
9082 // Builtin annotation
9083 def err_builtin_annotation_first_arg : Error<
9084   "first argument to __builtin_annotation must be an integer">;
9085 def err_builtin_annotation_second_arg : Error<
9086   "second argument to __builtin_annotation must be a non-wide string constant">;
9087 def err_msvc_annotation_wide_str : Error<
9088   "arguments to __annotation must be wide string constants">;
9089
9090 // CFString checking
9091 def err_cfstring_literal_not_string_constant : Error<
9092   "CFString literal is not a string constant">;
9093 def warn_cfstring_truncated : Warning<
9094   "input conversion stopped due to an input byte that does not "
9095   "belong to the input codeset UTF-8">,
9096   InGroup<DiagGroup<"CFString-literal">>;
9097
9098 // os_log checking
9099 // TODO: separate diagnostic for os_trace()
9100 def err_os_log_format_not_string_constant : Error<
9101   "os_log() format argument is not a string constant">;
9102 def err_os_log_argument_too_big : Error<
9103   "os_log() argument %0 is too big (%1 bytes, max %2)">;
9104 def warn_os_log_format_narg : Error<
9105  "os_log() '%%n' format specifier is not allowed">, DefaultError;
9106
9107 // Statements.
9108 def err_continue_not_in_loop : Error<
9109   "'continue' statement not in loop statement">;
9110 def err_break_not_in_loop_or_switch : Error<
9111   "'break' statement not in loop or switch statement">;
9112 def warn_loop_ctrl_binds_to_inner : Warning<
9113   "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9114   InGroup<GccCompat>;
9115 def warn_break_binds_to_switch : Warning<
9116   "'break' is bound to loop, GCC binds it to switch">,
9117   InGroup<GccCompat>;
9118 def err_default_not_in_switch : Error<
9119   "'default' statement not in switch statement">;
9120 def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9121 def warn_bool_switch_condition : Warning<
9122   "switch condition has boolean value">, InGroup<SwitchBool>;
9123 def warn_case_value_overflow : Warning<
9124   "overflow converting case value to switch condition type (%0 to %1)">,
9125   InGroup<Switch>;
9126 def err_duplicate_case : Error<"duplicate case value '%0'">;
9127 def err_duplicate_case_differing_expr : Error<
9128   "duplicate case value: '%0' and '%1' both equal '%2'">;
9129 def warn_case_empty_range : Warning<"empty case range specified">;
9130 def warn_missing_case_for_condition :
9131   Warning<"no case matching constant switch condition '%0'">;
9132
9133 def warn_def_missing_case : Warning<"%plural{"
9134   "1:enumeration value %1 not explicitly handled in switch|"
9135   "2:enumeration values %1 and %2 not explicitly handled in switch|"
9136   "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9137   ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9138   InGroup<SwitchEnum>, DefaultIgnore;
9139
9140 def warn_missing_case : Warning<"%plural{"
9141   "1:enumeration value %1 not handled in switch|"
9142   "2:enumeration values %1 and %2 not handled in switch|"
9143   "3:enumeration values %1, %2, and %3 not handled in switch|"
9144   ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9145   InGroup<Switch>;
9146
9147 def warn_unannotated_fallthrough : Warning<
9148   "unannotated fall-through between switch labels">,
9149   InGroup<ImplicitFallthrough>, DefaultIgnore;
9150 def warn_unannotated_fallthrough_per_function : Warning<
9151   "unannotated fall-through between switch labels in partly-annotated "
9152   "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9153 def note_insert_fallthrough_fixit : Note<
9154   "insert '%0;' to silence this warning">;
9155 def note_insert_break_fixit : Note<
9156   "insert 'break;' to avoid fall-through">;
9157 def err_fallthrough_attr_wrong_target : Error<
9158   "%0 attribute is only allowed on empty statements">;
9159 def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9160 def err_fallthrough_attr_outside_switch : Error<
9161   "fallthrough annotation is outside switch statement">;
9162 def err_fallthrough_attr_invalid_placement : Error<
9163   "fallthrough annotation does not directly precede switch label">;
9164 def warn_fallthrough_attr_unreachable : Warning<
9165   "fallthrough annotation in unreachable code">,
9166   InGroup<ImplicitFallthrough>, DefaultIgnore;
9167
9168 def warn_unreachable_default : Warning<
9169   "default label in switch which covers all enumeration values">,
9170   InGroup<CoveredSwitchDefault>, DefaultIgnore;
9171 def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9172   InGroup<Switch>;
9173 def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9174   "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9175 def err_typecheck_statement_requires_scalar : Error<
9176   "statement requires expression of scalar type (%0 invalid)">;
9177 def err_typecheck_statement_requires_integer : Error<
9178   "statement requires expression of integer type (%0 invalid)">;
9179 def err_multiple_default_labels_defined : Error<
9180   "multiple default labels in one switch">;
9181 def err_switch_multiple_conversions : Error<
9182   "multiple conversions from switch condition type %0 to an integral or "
9183   "enumeration type">;
9184 def note_switch_conversion : Note<
9185   "conversion to %select{integral|enumeration}0 type %1">;
9186 def err_switch_explicit_conversion : Error<
9187   "switch condition type %0 requires explicit conversion to %1">;
9188 def err_switch_incomplete_class_type : Error<
9189   "switch condition has incomplete class type %0">;
9190
9191 def warn_empty_if_body : Warning<
9192   "if statement has empty body">, InGroup<EmptyBody>;
9193 def warn_empty_for_body : Warning<
9194   "for loop has empty body">, InGroup<EmptyBody>;
9195 def warn_empty_range_based_for_body : Warning<
9196   "range-based for loop has empty body">, InGroup<EmptyBody>;
9197 def warn_empty_while_body : Warning<
9198   "while loop has empty body">, InGroup<EmptyBody>;
9199 def warn_empty_switch_body : Warning<
9200   "switch statement has empty body">, InGroup<EmptyBody>;
9201 def note_empty_body_on_separate_line : Note<
9202   "put the semicolon on a separate line to silence this warning">;
9203
9204 def err_va_start_captured_stmt : Error<
9205   "'va_start' cannot be used in a captured statement">;
9206 def err_va_start_outside_function : Error<
9207   "'va_start' cannot be used outside a function">;
9208 def err_va_start_fixed_function : Error<
9209   "'va_start' used in function with fixed args">;
9210 def err_va_start_used_in_wrong_abi_function : Error<
9211   "'va_start' used in %select{System V|Win64}0 ABI function">;
9212 def err_ms_va_start_used_in_sysv_function : Error<
9213   "'__builtin_ms_va_start' used in System V ABI function">;
9214 def warn_second_arg_of_va_start_not_last_named_param : Warning<
9215   "second argument to 'va_start' is not the last named parameter">,
9216   InGroup<Varargs>;
9217 def warn_va_start_type_is_undefined : Warning<
9218   "passing %select{an object that undergoes default argument promotion|"
9219   "an object of reference type|a parameter declared with the 'register' "
9220   "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9221 def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9222   "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9223 def err_second_parameter_to_va_arg_incomplete: Error<
9224   "second argument to 'va_arg' is of incomplete type %0">;
9225 def err_second_parameter_to_va_arg_abstract: Error<
9226   "second argument to 'va_arg' is of abstract type %0">;
9227 def warn_second_parameter_to_va_arg_not_pod : Warning<
9228   "second argument to 'va_arg' is of non-POD type %0">,
9229   InGroup<NonPODVarargs>, DefaultError;
9230 def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9231   "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9232   InGroup<NonPODVarargs>, DefaultError;
9233 def warn_second_parameter_to_va_arg_never_compatible : Warning<
9234   "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9235   "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9236
9237 def warn_return_missing_expr : Warning<
9238   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9239   InGroup<ReturnType>;
9240 def ext_return_missing_expr : ExtWarn<
9241   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9242   InGroup<ReturnType>;
9243 def ext_return_has_expr : ExtWarn<
9244   "%select{void function|void method|constructor|destructor}1 %0 "
9245   "should not return a value">,
9246   DefaultError, InGroup<ReturnType>;
9247 def ext_return_has_void_expr : Extension<
9248   "void %select{function|method|block}1 %0 should not return void expression">;
9249 def err_return_init_list : Error<
9250   "%select{void function|void method|constructor|destructor}1 %0 "
9251   "must not return a value">;
9252 def err_ctor_dtor_returns_void : Error<
9253   "%select{constructor|destructor}1 %0 must not return void expression">;
9254 def warn_noreturn_function_has_return_expr : Warning<
9255   "function %0 declared 'noreturn' should not return">,
9256   InGroup<InvalidNoreturn>;
9257 def warn_falloff_noreturn_function : Warning<
9258   "function declared 'noreturn' should not return">,
9259   InGroup<InvalidNoreturn>;
9260 def err_noreturn_block_has_return_expr : Error<
9261   "block declared 'noreturn' should not return">;
9262 def err_noreturn_missing_on_first_decl : Error<
9263   "function declared '[[noreturn]]' after its first declaration">;
9264 def note_noreturn_missing_first_decl : Note<
9265   "declaration missing '[[noreturn]]' attribute is here">;
9266 def err_carries_dependency_missing_on_first_decl : Error<
9267   "%select{function|parameter}0 declared '[[carries_dependency]]' "
9268   "after its first declaration">;
9269 def note_carries_dependency_missing_first_decl : Note<
9270   "declaration missing '[[carries_dependency]]' attribute is here">;
9271 def err_carries_dependency_param_not_function_decl : Error<
9272   "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9273   "declaration or lambda">;
9274 def err_block_on_nonlocal : Error<
9275   "__block attribute not allowed, only allowed on local variables">;
9276 def err_block_on_vm : Error<
9277   "__block attribute not allowed on declaration with a variably modified type">;
9278 def err_sizeless_nonlocal : Error<
9279   "non-local variable with sizeless type %0">;
9280
9281 def err_vec_builtin_non_vector : Error<
9282  "first two arguments to %0 must be vectors">;
9283 def err_vec_builtin_incompatible_vector : Error<
9284   "first two arguments to %0 must have the same type">;
9285 def err_vsx_builtin_nonconstant_argument : Error<
9286   "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9287
9288 def err_shufflevector_nonconstant_argument : Error<
9289   "index for __builtin_shufflevector must be a constant integer">;
9290 def err_shufflevector_argument_too_large : Error<
9291   "index for __builtin_shufflevector must be less than the total number "
9292   "of vector elements">;
9293
9294 def err_convertvector_non_vector : Error<
9295   "first argument to __builtin_convertvector must be a vector">;
9296 def err_convertvector_non_vector_type : Error<
9297   "second argument to __builtin_convertvector must be a vector type">;
9298 def err_convertvector_incompatible_vector : Error<
9299   "first two arguments to __builtin_convertvector must have the same number of elements">;
9300
9301 def err_first_argument_to_cwsc_not_call : Error<
9302   "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9303 def err_first_argument_to_cwsc_block_call : Error<
9304   "first argument to __builtin_call_with_static_chain must not be a block call">;
9305 def err_first_argument_to_cwsc_builtin_call : Error<
9306   "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9307 def err_first_argument_to_cwsc_pdtor_call : Error<
9308   "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9309 def err_second_argument_to_cwsc_not_pointer : Error<
9310   "second argument to __builtin_call_with_static_chain must be of pointer type">;
9311
9312 def err_vector_incorrect_num_initializers : Error<
9313   "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9314 def err_altivec_empty_initializer : Error<"expected initializer">;
9315
9316 def err_invalid_neon_type_code : Error<
9317   "incompatible constant for this __builtin_neon function">;
9318 def err_argument_invalid_range : Error<
9319   "argument value %0 is outside the valid range [%1, %2]">;
9320 def warn_argument_invalid_range : Warning<
9321   "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9322   InGroup<DiagGroup<"argument-outside-range">>;
9323 def err_argument_not_multiple : Error<
9324   "argument should be a multiple of %0">;
9325 def err_argument_not_power_of_2 : Error<
9326   "argument should be a power of 2">;
9327 def err_argument_not_shifted_byte : Error<
9328   "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9329 def err_argument_not_shifted_byte_or_xxff : Error<
9330   "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9331 def err_rotation_argument_to_cadd
9332     : Error<"argument should be the value 90 or 270">;
9333 def err_rotation_argument_to_cmla
9334     : Error<"argument should be the value 0, 90, 180 or 270">;
9335 def warn_neon_vector_initializer_non_portable : Warning<
9336   "vector initializers are not compatible with NEON intrinsics in big endian "
9337   "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9338 def note_neon_vector_initializer_non_portable : Note<
9339   "consider using vld1_%0%1() to initialize a vector from memory, or "
9340   "vcreate_%0%1() to initialize from an integer constant">;
9341 def note_neon_vector_initializer_non_portable_q : Note<
9342   "consider using vld1q_%0%1() to initialize a vector from memory, or "
9343   "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9344   "constants">;
9345 def err_systemz_invalid_tabort_code : Error<
9346   "invalid transaction abort code">;
9347 def err_64_bit_builtin_32_bit_tgt : Error<
9348   "this builtin is only available on 64-bit targets">;
9349 def err_32_bit_builtin_64_bit_tgt : Error<
9350   "this builtin is only available on 32-bit targets">;
9351 def err_builtin_x64_aarch64_only : Error<
9352   "this builtin is only available on x86-64 and aarch64 targets">;
9353 def err_mips_builtin_requires_dsp : Error<
9354   "this builtin requires 'dsp' ASE, please use -mdsp">;
9355 def err_mips_builtin_requires_dspr2 : Error<
9356   "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9357 def err_mips_builtin_requires_msa : Error<
9358   "this builtin requires 'msa' ASE, please use -mmsa">;
9359 def err_ppc_builtin_only_on_pwr7 : Error<
9360   "this builtin is only valid on POWER7 or later CPUs">;
9361 def err_x86_builtin_invalid_rounding : Error<
9362   "invalid rounding argument">;
9363 def err_x86_builtin_invalid_scale : Error<
9364   "scale argument must be 1, 2, 4, or 8">;
9365 def err_x86_builtin_tile_arg_duplicate : Error<
9366   "tile arguments must refer to different tiles">;
9367
9368 def err_builtin_target_unsupported : Error<
9369   "builtin is not supported on this target">;
9370 def err_builtin_longjmp_unsupported : Error<
9371   "__builtin_longjmp is not supported for the current target">;
9372 def err_builtin_setjmp_unsupported : Error<
9373   "__builtin_setjmp is not supported for the current target">;
9374
9375 def err_builtin_longjmp_invalid_val : Error<
9376   "argument to __builtin_longjmp must be a constant 1">;
9377 def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9378
9379 def err_constant_integer_arg_type : Error<
9380   "argument to %0 must be a constant integer">;
9381
9382 def ext_mixed_decls_code : Extension<
9383   "ISO C90 forbids mixing declarations and code">,
9384   InGroup<DiagGroup<"declaration-after-statement">>;
9385
9386 def err_non_local_variable_decl_in_for : Error<
9387   "declaration of non-local variable in 'for' loop">;
9388 def err_non_variable_decl_in_for : Error<
9389   "non-variable declaration in 'for' loop">;
9390 def err_toomany_element_decls : Error<
9391   "only one element declaration is allowed">;
9392 def err_selector_element_not_lvalue : Error<
9393   "selector element is not a valid lvalue">;
9394 def err_selector_element_type : Error<
9395   "selector element type %0 is not a valid object">;
9396 def err_selector_element_const_type : Error<
9397   "selector element of type %0 cannot be a constant l-value expression">;
9398 def err_collection_expr_type : Error<
9399   "the type %0 is not a pointer to a fast-enumerable object">;
9400 def warn_collection_expr_type : Warning<
9401   "collection expression type %0 may not respond to %1">;
9402
9403 def err_invalid_conversion_between_ext_vectors : Error<
9404   "invalid conversion between ext-vector type %0 and %1">;
9405
9406 def warn_duplicate_attribute_exact : Warning<
9407   "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9408
9409 def warn_duplicate_attribute : Warning<
9410   "attribute %0 is already applied with different parameters">,
9411   InGroup<IgnoredAttributes>;
9412
9413 def warn_sync_fetch_and_nand_semantics_change : Warning<
9414   "the semantics of this intrinsic changed with GCC "
9415   "version 4.4 - the newer semantics are provided here">,
9416   InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9417
9418 // Type
9419 def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9420   InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9421 def warn_receiver_forward_class : Warning<
9422   "receiver %0 is a forward class and corresponding @interface may not exist">,
9423   InGroup<ForwardClassReceiver>;
9424 def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9425 def ext_missing_declspec : ExtWarn<
9426   "declaration specifier missing, defaulting to 'int'">;
9427 def ext_missing_type_specifier : ExtWarn<
9428   "type specifier missing, defaults to 'int'">,
9429   InGroup<ImplicitInt>;
9430 def err_decimal_unsupported : Error<
9431   "GNU decimal type extension not supported">;
9432 def err_missing_type_specifier : Error<
9433   "C++ requires a type specifier for all declarations">;
9434 def err_objc_array_of_interfaces : Error<
9435   "array of interface %0 is invalid (probably should be an array of pointers)">;
9436 def ext_c99_array_usage : Extension<
9437   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9438   "feature">, InGroup<C99>;
9439 def err_c99_array_usage_cxx : Error<
9440   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9441   "feature, not permitted in C++">;
9442 def err_type_unsupported : Error<
9443   "%0 is not supported on this target">;
9444 def err_nsconsumed_attribute_mismatch : Error<
9445   "overriding method has mismatched ns_consumed attribute on its"
9446   " parameter">;
9447 def err_nsreturns_retained_attribute_mismatch : Error<
9448   "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9449   " attributes">;
9450 def warn_nsconsumed_attribute_mismatch : Warning<
9451   err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9452 def warn_nsreturns_retained_attribute_mismatch : Warning<
9453   err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9454
9455 def note_getter_unavailable : Note<
9456   "or because setter is declared here, but no getter method %0 is found">;
9457 def err_invalid_protocol_qualifiers : Error<
9458   "invalid protocol qualifiers on non-ObjC type">;
9459 def warn_ivar_use_hidden : Warning<
9460   "local declaration of %0 hides instance variable">,
9461    InGroup<ShadowIvar>;
9462 def warn_direct_initialize_call : Warning<
9463   "explicit call to +initialize results in duplicate call to +initialize">,
9464    InGroup<ExplicitInitializeCall>;
9465 def warn_direct_super_initialize_call : Warning<
9466   "explicit call to [super initialize] should only be in implementation "
9467   "of +initialize">,
9468    InGroup<ExplicitInitializeCall>;
9469 def err_ivar_use_in_class_method : Error<
9470   "instance variable %0 accessed in class method">;
9471 def err_private_ivar_access : Error<"instance variable %0 is private">,
9472   AccessControl;
9473 def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9474   AccessControl;
9475 def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9476 def ext_typecheck_base_super : Warning<
9477   "method parameter type "
9478   "%diff{$ does not match super class method parameter type $|"
9479   "does not match super class method parameter type}0,1">,
9480    InGroup<SuperSubClassMismatch>, DefaultIgnore;
9481 def warn_missing_method_return_type : Warning<
9482   "method has no return type specified; defaults to 'id'">,
9483   InGroup<MissingMethodReturnType>, DefaultIgnore;
9484 def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9485   "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9486
9487 // Spell-checking diagnostics
9488 def err_unknown_typename : Error<
9489   "unknown type name %0">;
9490 def err_unknown_type_or_class_name_suggest : Error<
9491   "unknown %select{type|class}1 name %0; did you mean %2?">;
9492 def err_unknown_typename_suggest : Error<
9493   "unknown type name %0; did you mean %1?">;
9494 def err_unknown_nested_typename_suggest : Error<
9495   "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9496 def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9497 def err_undeclared_use_suggest : Error<
9498   "use of undeclared %0; did you mean %1?">;
9499 def err_undeclared_var_use_suggest : Error<
9500   "use of undeclared identifier %0; did you mean %1?">;
9501 def err_no_template : Error<"no template named %0">;
9502 def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
9503 def err_no_member_template : Error<"no template named %0 in %1">;
9504 def err_no_member_template_suggest : Error<
9505   "no template named %0 in %1; did you mean %select{|simply }2%3?">;
9506 def err_non_template_in_template_id : Error<
9507   "%0 does not name a template but is followed by template arguments">;
9508 def err_non_template_in_template_id_suggest : Error<
9509   "%0 does not name a template but is followed by template arguments; "
9510   "did you mean %1?">;
9511 def err_non_template_in_member_template_id_suggest : Error<
9512   "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
9513 def note_non_template_in_template_id_found : Note<
9514   "non-template declaration found by name lookup">;
9515 def err_mem_init_not_member_or_class_suggest : Error<
9516   "initializer %0 does not name a non-static data member or base "
9517   "class; did you mean the %select{base class|member}1 %2?">;
9518 def err_field_designator_unknown_suggest : Error<
9519   "field designator %0 does not refer to any field in type %1; did you mean "
9520   "%2?">;
9521 def err_typecheck_member_reference_ivar_suggest : Error<
9522   "%0 does not have a member named %1; did you mean %2?">;
9523 def err_property_not_found_suggest : Error<
9524   "property %0 not found on object of type %1; did you mean %2?">;
9525 def err_class_property_found : Error<
9526   "property %0 is a class property; did you mean to access it with class '%1'?">;
9527 def err_ivar_access_using_property_syntax_suggest : Error<
9528   "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
9529 def warn_property_access_suggest : Warning<
9530 "property %0 not found on object of type %1; did you mean to access property %2?">,
9531 InGroup<PropertyAccessDotSyntax>;
9532 def err_property_found_suggest : Error<
9533   "property %0 found on object of type %1; did you mean to access "
9534   "it with the \".\" operator?">;
9535 def err_undef_interface_suggest : Error<
9536   "cannot find interface declaration for %0; did you mean %1?">;
9537 def warn_undef_interface_suggest : Warning<
9538   "cannot find interface declaration for %0; did you mean %1?">;
9539 def err_undef_superclass_suggest : Error<
9540   "cannot find interface declaration for %0, superclass of %1; did you mean "
9541   "%2?">;
9542 def err_undeclared_protocol_suggest : Error<
9543   "cannot find protocol declaration for %0; did you mean %1?">;
9544 def note_base_class_specified_here : Note<
9545   "base class %0 specified here">;
9546 def err_using_directive_suggest : Error<
9547   "no namespace named %0; did you mean %1?">;
9548 def err_using_directive_member_suggest : Error<
9549   "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
9550 def note_namespace_defined_here : Note<"namespace %0 defined here">;
9551 def err_sizeof_pack_no_pack_name_suggest : Error<
9552   "%0 does not refer to the name of a parameter pack; did you mean %1?">;
9553 def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
9554
9555 def err_uncasted_use_of_unknown_any : Error<
9556   "%0 has unknown type; cast it to its declared type to use it">;
9557 def err_uncasted_call_of_unknown_any : Error<
9558   "%0 has unknown return type; cast the call to its declared return type">;
9559 def err_uncasted_send_to_unknown_any_method : Error<
9560   "no known method %select{%objcinstance1|%objcclass1}0; cast the "
9561   "message send to the method's return type">;
9562 def err_unsupported_unknown_any_decl : Error<
9563   "%0 has unknown type, which is not supported for this kind of declaration">;
9564 def err_unsupported_unknown_any_expr : Error<
9565   "unsupported expression with unknown type">;
9566 def err_unsupported_unknown_any_call : Error<
9567   "call to unsupported expression with unknown type">;
9568 def err_unknown_any_addrof : Error<
9569   "the address of a declaration with unknown type "
9570   "can only be cast to a pointer type">;
9571 def err_unknown_any_addrof_call : Error<
9572   "address-of operator cannot be applied to a call to a function with "
9573   "unknown return type">;
9574 def err_unknown_any_var_function_type : Error<
9575   "variable %0 with unknown type cannot be given a function type">;
9576 def err_unknown_any_function : Error<
9577   "function %0 with unknown type must be given a function type">;
9578
9579 def err_filter_expression_integral : Error<
9580   "filter expression has non-integral type %0">;
9581
9582 def err_non_asm_stmt_in_naked_function : Error<
9583   "non-ASM statement in naked function is not supported">;
9584 def err_asm_naked_this_ref : Error<
9585   "'this' pointer references not allowed in naked functions">;
9586 def err_asm_naked_parm_ref : Error<
9587   "parameter references not allowed in naked functions">;
9588
9589 // OpenCL warnings and errors.
9590 def err_invalid_astype_of_different_size : Error<
9591   "invalid reinterpretation: sizes of %0 and %1 must match">;
9592 def err_static_kernel : Error<
9593   "kernel functions cannot be declared static">;
9594 def err_method_kernel : Error<
9595   "kernel functions cannot be class members">;
9596 def err_template_kernel : Error<
9597   "kernel functions cannot be used in a template declaration, instantiation or specialization">;
9598 def err_opencl_ptrptr_kernel_param : Error<
9599   "kernel parameter cannot be declared as a pointer to a pointer">;
9600 def err_kernel_arg_address_space : Error<
9601   "pointer arguments to kernel functions must reside in '__global', "
9602   "'__constant' or '__local' address space">;
9603 def err_opencl_ext_vector_component_invalid_length : Error<
9604   "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
9605 def err_opencl_function_variable : Error<
9606   "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
9607 def err_opencl_addrspace_scope : Error<
9608   "variables in the %0 address space can only be declared in the outermost "
9609   "scope of a kernel function">;
9610 def err_static_function_scope : Error<
9611   "variables in function scope cannot be declared static">;
9612 def err_opencl_bitfields : Error<
9613   "bit-fields are not supported in OpenCL">;
9614 def err_opencl_vla : Error<
9615   "variable length arrays are not supported in OpenCL">;
9616 def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
9617     "scalar operand type has greater rank than the type of the vector "
9618     "element. (%0 and %1)">;
9619 def err_bad_kernel_param_type : Error<
9620   "%0 cannot be used as the type of a kernel parameter">;
9621 def err_opencl_implicit_function_decl : Error<
9622   "implicit declaration of function %0 is invalid in OpenCL">;
9623 def err_record_with_pointers_kernel_param : Error<
9624   "%select{struct|union}0 kernel parameters may not contain pointers">;
9625 def note_within_field_of_type : Note<
9626   "within field of type %0 declared here">;
9627 def note_illegal_field_declared_here : Note<
9628   "field of illegal %select{type|pointer type}0 %1 declared here">;
9629 def err_opencl_type_struct_or_union_field : Error<
9630   "the %0 type cannot be used to declare a structure or union field">;
9631 def err_event_t_addr_space_qual : Error<
9632   "the event_t type can only be used with __private address space qualifier">;
9633 def err_expected_kernel_void_return_type : Error<
9634   "kernel must have void return type">;
9635 def err_sampler_initializer_not_integer : Error<
9636   "sampler_t initialization requires 32-bit integer, not %0">;
9637 def warn_sampler_initializer_invalid_bits : Warning<
9638   "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
9639 def err_sampler_argument_required : Error<
9640   "sampler_t variable required - got %0">;
9641 def err_wrong_sampler_addressspace: Error<
9642   "sampler type cannot be used with the __local and __global address space qualifiers">;
9643 def err_opencl_nonconst_global_sampler : Error<
9644   "global sampler requires a const or constant address space qualifier">;
9645 def err_opencl_cast_non_zero_to_event_t : Error<
9646   "cannot cast non-zero value '%0' to 'event_t'">;
9647 def err_opencl_global_invalid_addr_space : Error<
9648   "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
9649 def err_missing_actual_pipe_type : Error<
9650   "missing actual type specifier for pipe">;
9651 def err_reference_pipe_type : Error <
9652   "pipes packet types cannot be of reference type">;
9653 def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
9654 def err_opencl_kernel_attr :
9655   Error<"attribute %0 can only be applied to an OpenCL kernel function">;
9656 def err_opencl_return_value_with_address_space : Error<
9657   "return value cannot be qualified with address space">;
9658 def err_opencl_constant_no_init : Error<
9659   "variable in constant address space must be initialized">;
9660 def err_opencl_atomic_init: Error<
9661   "atomic variable can be %select{assigned|initialized}0 to a variable only "
9662   "in global address space">;
9663 def err_opencl_implicit_vector_conversion : Error<
9664   "implicit conversions between vector types (%0 and %1) are not permitted">;
9665 def err_opencl_invalid_type_array : Error<
9666   "array of %0 type is invalid in OpenCL">;
9667 def err_opencl_ternary_with_block : Error<
9668   "block type cannot be used as expression in ternary expression in OpenCL">;
9669 def err_opencl_pointer_to_type : Error<
9670   "pointer to type %0 is invalid in OpenCL">;
9671 def err_opencl_type_can_only_be_used_as_function_parameter : Error <
9672   "type %0 can only be used as a function parameter in OpenCL">;
9673 def warn_opencl_attr_deprecated_ignored : Warning <
9674   "%0 attribute is deprecated and ignored in OpenCL version %1">,
9675   InGroup<IgnoredAttributes>;
9676 def err_opencl_variadic_function : Error<
9677   "invalid prototype, variadic arguments are not allowed in OpenCL">;
9678 def err_opencl_requires_extension : Error<
9679   "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
9680 def warn_opencl_generic_address_space_arg : Warning<
9681   "passing non-generic address space pointer to %0"
9682   " may cause dynamic conversion affecting performance">,
9683   InGroup<Conversion>, DefaultIgnore;
9684
9685 // OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
9686 def err_opencl_builtin_pipe_first_arg : Error<
9687   "first argument to %0 must be a pipe type">;
9688 def err_opencl_builtin_pipe_arg_num : Error<
9689   "invalid number of arguments to function: %0">;
9690 def err_opencl_builtin_pipe_invalid_arg : Error<
9691   "invalid argument type to function %0 (expecting %1 having %2)">;
9692 def err_opencl_builtin_pipe_invalid_access_modifier : Error<
9693   "invalid pipe access modifier (expecting %0)">;
9694
9695 // OpenCL access qualifier
9696 def err_opencl_invalid_access_qualifier : Error<
9697   "access qualifier can only be used for pipe and image type">;
9698 def err_opencl_invalid_read_write : Error<
9699   "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
9700 def err_opencl_multiple_access_qualifiers : Error<
9701   "multiple access qualifiers">;
9702 def note_opencl_typedef_access_qualifier : Note<
9703   "previously declared '%0' here">;
9704
9705 // OpenCL v2.0 s6.12.5 Blocks restrictions
9706 def err_opencl_block_storage_type : Error<
9707   "the __block storage type is not permitted">;
9708 def err_opencl_invalid_block_declaration : Error<
9709   "invalid block variable declaration - must be %select{const qualified|initialized}0">;
9710 def err_opencl_extern_block_declaration : Error<
9711   "invalid block variable declaration - using 'extern' storage class is disallowed">;
9712 def err_opencl_block_ref_block : Error<
9713   "cannot refer to a block inside block">;
9714
9715 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
9716 def err_opencl_builtin_to_addr_arg_num : Error<
9717   "invalid number of arguments to function: %0">;
9718 def err_opencl_builtin_to_addr_invalid_arg : Error<
9719   "invalid argument %0 to function: %1, expecting a generic pointer argument">;
9720
9721 // OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
9722 def err_opencl_enqueue_kernel_incorrect_args : Error<
9723   "illegal call to enqueue_kernel, incorrect argument types">;
9724 def err_opencl_enqueue_kernel_local_size_args : Error<
9725   "mismatch in number of block parameters and local size arguments passed">;
9726 def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
9727   "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
9728 def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
9729   "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
9730 def err_opencl_enqueue_kernel_blocks_no_args : Error<
9731   "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
9732
9733 def err_opencl_builtin_expected_type : Error<
9734   "illegal call to %0, expected %1 argument type">;
9735
9736 // OpenCL v2.2 s2.1.2.3 - Vector Component Access
9737 def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
9738   "vector component name '%0' is an OpenCL version 2.2 feature">,
9739   InGroup<OpenCLUnsupportedRGBA>;
9740
9741 def err_openclcxx_placement_new : Error<
9742   "use of placement new requires explicit declaration">;
9743
9744 // MIG routine annotations.
9745 def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
9746   "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
9747   InGroup<IgnoredAttributes>;
9748 } // end of sema category
9749
9750 let CategoryName = "OpenMP Issue" in {
9751 // OpenMP support.
9752 def err_omp_expected_var_arg : Error<
9753   "%0 is not a global variable, static local variable or static data member">;
9754 def err_omp_expected_var_arg_suggest : Error<
9755   "%0 is not a global variable, static local variable or static data member; "
9756   "did you mean %1">;
9757 def err_omp_global_var_arg : Error<
9758   "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
9759 def err_omp_ref_type_arg : Error<
9760   "arguments of '#pragma omp %0' cannot be of reference type %1">;
9761 def err_omp_region_not_file_context : Error<
9762   "directive must be at file or namespace scope">;
9763 def err_omp_var_scope : Error<
9764   "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
9765 def err_omp_var_used : Error<
9766   "'#pragma omp %0' must precede all references to variable %q1">;
9767 def err_omp_var_thread_local : Error<
9768   "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
9769 def err_omp_private_incomplete_type : Error<
9770   "a private variable with incomplete type %0">;
9771 def err_omp_firstprivate_incomplete_type : Error<
9772   "a firstprivate variable with incomplete type %0">;
9773 def err_omp_lastprivate_incomplete_type : Error<
9774   "a lastprivate variable with incomplete type %0">;
9775 def err_omp_reduction_incomplete_type : Error<
9776   "a reduction list item with incomplete type %0">;
9777 def err_omp_unexpected_clause_value : Error<
9778   "expected %0 in OpenMP clause '%1'">;
9779 def err_omp_expected_var_name_member_expr : Error<
9780   "expected variable name%select{| or data member of current class}0">;
9781 def err_omp_expected_var_name_member_expr_or_array_item : Error<
9782   "expected variable name%select{|, data member of current class}0, array element or array section">;
9783 def err_omp_expected_addressable_lvalue_or_array_item : Error<
9784   "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">;
9785 def err_omp_expected_named_var_member_or_array_expression: Error<
9786   "expected expression containing only member accesses and/or array sections based on named variables">;
9787 def err_omp_bit_fields_forbidden_in_clause : Error<
9788   "bit fields cannot be used to specify storage in a '%0' clause">;
9789 def err_array_section_does_not_specify_contiguous_storage : Error<
9790   "array section does not specify contiguous storage">;
9791 def err_omp_union_type_not_allowed : Error<
9792   "mapping of union members is not allowed">;
9793 def err_omp_expected_access_to_data_field : Error<
9794   "expected access to data field">;
9795 def err_omp_multiple_array_items_in_map_clause : Error<
9796   "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
9797 def err_omp_duplicate_map_type_modifier : Error<
9798   "same map type modifier has been specified more than once">;
9799 def err_omp_pointer_mapped_along_with_derived_section : Error<
9800   "pointer cannot be mapped along with a section derived from itself">;
9801 def err_omp_original_storage_is_shared_and_does_not_contain : Error<
9802   "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
9803 def err_omp_same_pointer_dereferenced : Error<
9804   "same pointer dereferenced in multiple different ways in map clause expressions">;
9805 def note_omp_task_predetermined_firstprivate_here : Note<
9806   "predetermined as a firstprivate in a task construct here">;
9807 def err_omp_threadprivate_incomplete_type : Error<
9808   "threadprivate variable with incomplete type %0">;
9809 def err_omp_no_dsa_for_variable : Error<
9810   "variable %0 must have explicitly specified data sharing attributes">;
9811 def err_omp_defaultmap_no_attr_for_variable : Error<
9812   "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
9813 def note_omp_default_dsa_none : Note<
9814   "explicit data sharing attribute requested here">;
9815 def note_omp_defaultmap_attr_none : Note<
9816   "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
9817 def err_omp_wrong_dsa : Error<
9818   "%0 variable cannot be %1">;
9819 def err_omp_variably_modified_type_not_supported : Error<
9820   "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
9821 def note_omp_explicit_dsa : Note<
9822   "defined as %0">;
9823 def note_omp_predetermined_dsa : Note<
9824   "%select{static data member is predetermined as shared|"
9825   "variable with static storage duration is predetermined as shared|"
9826   "loop iteration variable is predetermined as private|"
9827   "loop iteration variable is predetermined as linear|"
9828   "loop iteration variable is predetermined as lastprivate|"
9829   "constant variable is predetermined as shared|"
9830   "global variable is predetermined as shared|"
9831   "non-shared variable in a task construct is predetermined as firstprivate|"
9832   "variable with automatic storage duration is predetermined as private}0"
9833   "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
9834 def note_omp_implicit_dsa : Note<
9835   "implicitly determined as %0">;
9836 def err_omp_loop_var_dsa : Error<
9837   "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
9838 def err_omp_not_for : Error<
9839   "%select{statement after '#pragma omp %1' must be a for loop|"
9840   "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
9841 def note_omp_collapse_ordered_expr : Note<
9842   "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
9843 def err_omp_negative_expression_in_clause : Error<
9844   "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
9845 def err_omp_not_integral : Error<
9846   "expression must have integral or unscoped enumeration "
9847   "type, not %0">;
9848 def err_omp_threadprivate_in_target : Error<
9849   "threadprivate variables cannot be used in target constructs">;
9850 def err_omp_incomplete_type : Error<
9851   "expression has incomplete class type %0">;
9852 def err_omp_explicit_conversion : Error<
9853   "expression requires explicit conversion from %0 to %1">;
9854 def note_omp_conversion_here : Note<
9855   "conversion to %select{integral|enumeration}0 type %1 declared here">;
9856 def err_omp_ambiguous_conversion : Error<
9857   "ambiguous conversion from type %0 to an integral or unscoped "
9858   "enumeration type">;
9859 def err_omp_iterator_not_integral_or_pointer : Error<
9860   "expected integral or pointer type as the iterator-type, not %0">;
9861 def err_omp_iterator_step_not_integral : Error<
9862   "iterator step expression %0 is not the integral expression">;
9863 def err_omp_iterator_step_constant_zero : Error<
9864   "iterator step expression %0 evaluates to 0">;
9865 def err_omp_required_access : Error<
9866   "%0 variable must be %1">;
9867 def err_omp_const_variable : Error<
9868   "const-qualified variable cannot be %0">;
9869 def err_omp_const_not_mutable_variable : Error<
9870   "const-qualified variable without mutable fields cannot be %0">;
9871 def err_omp_const_list_item : Error<
9872   "const-qualified list item cannot be %0">;
9873 def err_omp_linear_incomplete_type : Error<
9874   "a linear variable with incomplete type %0">;
9875 def err_omp_linear_expected_int_or_ptr : Error<
9876   "argument of a linear clause should be of integral or pointer "
9877   "type, not %0">;
9878 def warn_omp_linear_step_zero : Warning<
9879   "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
9880   InGroup<OpenMPClauses>;
9881 def warn_omp_alignment_not_power_of_two : Warning<
9882   "aligned clause will be ignored because the requested alignment is not a power of 2">,
9883   InGroup<OpenMPClauses>;
9884 def err_omp_invalid_target_decl : Error<
9885   "%0 used in declare target directive is not a variable or a function name">;
9886 def err_omp_declare_target_multiple : Error<
9887   "%0 appears multiple times in clauses on the same declare target directive">;
9888 def err_omp_declare_target_to_and_link : Error<
9889   "%0 must not appear in both clauses 'to' and 'link'">;
9890 def warn_omp_not_in_target_context : Warning<
9891   "declaration is not declared in any declare target region">,
9892   InGroup<OpenMPTarget>;
9893 def err_omp_function_in_link_clause : Error<
9894   "function name is not allowed in 'link' clause">;
9895 def err_omp_aligned_expected_array_or_ptr : Error<
9896   "argument of aligned clause should be array"
9897   "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
9898   ", not %0">;
9899 def err_omp_used_in_clause_twice : Error<
9900   "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
9901 def err_omp_local_var_in_threadprivate_init : Error<
9902   "variable with local storage in initial value of threadprivate variable">;
9903 def err_omp_loop_not_canonical_init : Error<
9904   "initialization clause of OpenMP for loop is not in canonical form "
9905   "('var = init' or 'T var = init')">;
9906 def ext_omp_loop_not_canonical_init : ExtWarn<
9907   "initialization clause of OpenMP for loop is not in canonical form "
9908   "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
9909 def err_omp_loop_not_canonical_cond : Error<
9910   "condition of OpenMP for loop must be a relational comparison "
9911   "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
9912 def err_omp_loop_not_canonical_incr : Error<
9913   "increment clause of OpenMP for loop must perform simple addition "
9914   "or subtraction on loop variable %0">;
9915 def err_omp_loop_variable_type : Error<
9916   "variable must be of integer or %select{pointer|random access iterator}0 type">;
9917 def err_omp_loop_incr_not_compatible : Error<
9918   "increment expression must cause %0 to %select{decrease|increase}1 "
9919   "on each iteration of OpenMP for loop">;
9920 def note_omp_loop_cond_requres_compatible_incr : Note<
9921   "loop step is expected to be %select{negative|positive}0 due to this condition">;
9922 def err_omp_loop_diff_cxx : Error<
9923   "could not calculate number of iterations calling 'operator-' with "
9924   "upper and lower loop bounds">;
9925 def err_omp_loop_cannot_use_stmt : Error<
9926   "'%0' statement cannot be used in OpenMP for loop">;
9927 def err_omp_simd_region_cannot_use_stmt : Error<
9928   "'%0' statement cannot be used in OpenMP simd region">;
9929 def warn_omp_loop_64_bit_var : Warning<
9930   "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
9931   InGroup<OpenMPLoopForm>;
9932 def err_omp_unknown_reduction_identifier : Error<
9933   "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
9934   "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
9935 def err_omp_not_resolved_reduction_identifier : Error<
9936   "unable to resolve declare reduction construct for type %0">;
9937 def err_omp_reduction_ref_type_arg : Error<
9938   "argument of OpenMP clause '%0' must reference the same object in all threads">;
9939 def err_omp_clause_not_arithmetic_type_arg : Error<
9940   "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
9941 def err_omp_clause_floating_type_arg : Error<
9942   "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
9943 def err_omp_once_referenced : Error<
9944   "variable can appear only once in OpenMP '%0' clause">;
9945 def err_omp_once_referenced_in_target_update : Error<
9946   "variable can appear only once in OpenMP 'target update' construct">;
9947 def note_omp_referenced : Note<
9948   "previously referenced here">;
9949 def err_omp_reduction_in_task : Error<
9950   "reduction variables may not be accessed in an explicit task">;
9951 def err_omp_reduction_id_not_compatible : Error<
9952   "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
9953 def err_omp_reduction_identifier_mismatch : Error<
9954   "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
9955 def note_omp_previous_reduction_identifier : Note<
9956   "previously marked as task_reduction with different reduction operation">;
9957 def err_omp_prohibited_region : Error<
9958   "region cannot be%select{| closely}0 nested inside '%1' region"
9959   "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
9960   "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
9961   "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
9962   "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
9963   "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
9964 def err_omp_prohibited_region_simd : Error<
9965   "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
9966 def err_omp_prohibited_region_atomic : Error<
9967   "OpenMP constructs may not be nested inside an atomic region">;
9968 def err_omp_prohibited_region_critical_same_name : Error<
9969   "cannot nest 'critical' regions having the same name %0">;
9970 def note_omp_previous_critical_region : Note<
9971   "previous 'critical' region starts here">;
9972 def err_omp_several_directives_in_region : Error<
9973   "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
9974 def note_omp_previous_directive : Note<
9975   "previous '%0' directive used here">;
9976 def err_omp_sections_not_compound_stmt : Error<
9977   "the statement for '#pragma omp sections' must be a compound statement">;
9978 def err_omp_parallel_sections_not_compound_stmt : Error<
9979   "the statement for '#pragma omp parallel sections' must be a compound statement">;
9980 def err_omp_orphaned_section_directive : Error<
9981   "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
9982   " must be closely nested to a sections region%select{|, not a %1 region}0">;
9983 def err_omp_sections_substmt_not_section : Error<
9984   "statement in 'omp sections' directive must be enclosed into a section region">;
9985 def err_omp_parallel_sections_substmt_not_section : Error<
9986   "statement in 'omp parallel sections' directive must be enclosed into a section region">;
9987 def err_omp_parallel_reduction_in_task_firstprivate : Error<
9988   "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
9989 def err_omp_atomic_read_not_expression_statement : Error<
9990   "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
9991   " where v and x are both lvalue expressions with scalar type">;
9992 def note_omp_atomic_read_write: Note<
9993   "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
9994 def err_omp_atomic_write_not_expression_statement : Error<
9995   "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
9996   " where x is a lvalue expression with scalar type">;
9997 def err_omp_atomic_update_not_expression_statement : Error<
9998   "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',"
9999   " where x is an l-value expression with scalar type">;
10000 def err_omp_atomic_not_expression_statement : Error<
10001   "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',"
10002   " where x is an l-value expression with scalar type">;
10003 def note_omp_atomic_update: Note<
10004   "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10005   "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10006   "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10007 def err_omp_atomic_capture_not_expression_statement : Error<
10008   "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',"
10009   " where x and v are both l-value expressions with scalar type">;
10010 def err_omp_atomic_capture_not_compound_statement : Error<
10011   "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10012   " '{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;}',"
10013   " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10014   " where x is an l-value expression with scalar type">;
10015 def note_omp_atomic_capture: Note<
10016   "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10017 def err_omp_atomic_several_clauses : Error<
10018   "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
10019 def err_omp_several_mem_order_clauses : Error<
10020   "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10021 def err_omp_atomic_incompatible_mem_order_clause : Error<
10022   "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10023 def note_omp_previous_mem_order_clause : Note<
10024   "'%0' clause used here">;
10025 def err_omp_target_contains_not_only_teams : Error<
10026   "target construct with nested teams region contains statements outside of the teams construct">;
10027 def note_omp_nested_teams_construct_here : Note<
10028   "nested teams construct here">;
10029 def note_omp_nested_statement_here : Note<
10030   "%select{statement|directive}0 outside teams construct here">;
10031 def err_omp_single_copyprivate_with_nowait : Error<
10032   "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10033 def note_omp_nowait_clause_here : Note<
10034   "'nowait' clause is here">;
10035 def err_omp_single_decl_in_declare_simd_variant : Error<
10036   "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10037 def err_omp_function_expected : Error<
10038   "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10039 def err_omp_wrong_cancel_region : Error<
10040   "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10041 def err_omp_parent_cancel_region_nowait : Error<
10042   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10043 def err_omp_parent_cancel_region_ordered : Error<
10044   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10045 def 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">;
10046 def 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">;
10047 def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10048 def err_omp_mapper_wrong_type : Error<
10049   "mapper type must be of struct, union or class type">;
10050 def err_omp_declare_mapper_wrong_var : Error<
10051   "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10052 def err_omp_declare_mapper_redefinition : Error<
10053   "redefinition of user-defined mapper for type %0 with name %1">;
10054 def err_omp_invalid_mapper: Error<
10055   "cannot find a valid user-defined mapper for type %0 with name %1">;
10056 def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10057 def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10058 def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10059 def err_omp_typecheck_section_value : Error<
10060   "subscripted value is not an array or pointer">;
10061 def err_omp_typecheck_section_not_integer : Error<
10062   "array section %select{lower bound|length}0 is not an integer">;
10063 def err_omp_typecheck_shaping_not_integer : Error<
10064   "array shaping operation dimension is not an integer">;
10065 def err_omp_shaping_dimension_not_positive : Error<
10066   "array shaping dimension is evaluated to a non-positive value %0">;
10067 def err_omp_section_function_type : Error<
10068   "section of pointer to function type %0">;
10069 def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10070   InGroup<CharSubscript>, DefaultIgnore;
10071 def err_omp_section_incomplete_type : Error<
10072   "section of pointer to incomplete type %0">;
10073 def err_omp_section_not_subset_of_array : Error<
10074   "array section must be a subset of the original array">;
10075 def err_omp_section_length_negative : Error<
10076   "section length is evaluated to a negative value %0">;
10077 def err_omp_section_stride_non_positive : Error<
10078   "section stride is evaluated to a non-positive value %0">;
10079 def err_omp_section_length_undefined : Error<
10080   "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10081 def err_omp_wrong_linear_modifier : Error<
10082   "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10083 def err_omp_wrong_linear_modifier_non_reference : Error<
10084   "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10085 def err_omp_wrong_simdlen_safelen_values : Error<
10086   "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10087 def err_omp_wrong_if_directive_name_modifier : Error<
10088   "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10089 def err_omp_no_more_if_clause : Error<
10090   "no more 'if' clause is allowed">;
10091 def err_omp_unnamed_if_clause : Error<
10092   "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10093 def note_omp_previous_named_if_clause : Note<
10094   "previous clause with directive name modifier specified here">;
10095 def err_omp_ordered_directive_with_param : Error<
10096   "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10097 def err_omp_ordered_directive_without_param : Error<
10098   "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10099 def note_omp_ordered_param : Note<
10100   "'ordered' clause%select{| with specified parameter}0">;
10101 def err_omp_expected_base_var_name : Error<
10102   "expected variable name as a base of the array %select{subscript|section}0">;
10103 def err_omp_map_shared_storage : Error<
10104   "variable already marked as mapped in current construct">;
10105 def err_omp_invalid_map_type_for_directive : Error<
10106   "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10107 def err_omp_no_clause_for_directive : Error<
10108   "expected at least one %0 clause for '#pragma omp %1'">;
10109 def err_omp_threadprivate_in_clause : Error<
10110   "threadprivate variables are not allowed in '%0' clause">;
10111 def err_omp_wrong_ordered_loop_count : Error<
10112   "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10113 def note_collapse_loop_count : Note<
10114   "parameter of the 'collapse' clause">;
10115 def err_omp_clauses_mutually_exclusive : Error<
10116   "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10117 def note_omp_previous_clause : Note<
10118   "'%0' clause is specified here">;
10119 def err_omp_hint_clause_no_name : Error<
10120   "the name of the construct must be specified in presence of 'hint' clause">;
10121 def err_omp_critical_with_hint : Error<
10122   "constructs with the same name must have a 'hint' clause with the same value">;
10123 def note_omp_critical_hint_here : Note<
10124   "%select{|previous }0'hint' clause with value '%1'">;
10125 def note_omp_critical_no_hint : Note<
10126   "%select{|previous }0directive with no 'hint' clause specified">;
10127 def err_omp_depend_clause_thread_simd : Error<
10128   "'depend' clauses cannot be mixed with '%0' clause">;
10129 def err_omp_depend_sink_expected_loop_iteration : Error<
10130   "expected%select{| %1}0 loop iteration variable">;
10131 def err_omp_depend_sink_unexpected_expr : Error<
10132   "unexpected expression: number of expressions is larger than the number of associated loops">;
10133 def err_omp_depend_sink_expected_plus_minus : Error<
10134   "expected '+' or '-' operation">;
10135 def err_omp_depend_sink_source_not_allowed : Error<
10136   "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10137 def err_omp_depend_zero_length_array_section_not_allowed : Error<
10138   "zero-length array section is not allowed in 'depend' clause">;
10139 def err_omp_depend_sink_source_with_modifier : Error<
10140   "depend modifier cannot be used with 'sink' or 'source' depend type">;
10141 def err_omp_depend_modifier_not_iterator : Error<
10142   "expected iterator specification as depend modifier">;
10143 def err_omp_linear_ordered : Error<
10144   "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10145 def err_omp_unexpected_schedule_modifier : Error<
10146   "modifier '%0' cannot be used along with modifier '%1'">;
10147 def err_omp_schedule_nonmonotonic_static : Error<
10148   "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10149 def err_omp_simple_clause_incompatible_with_ordered : Error<
10150   "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10151 def err_omp_ordered_simd : Error<
10152   "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10153 def err_omp_variable_in_given_clause_and_dsa : Error<
10154   "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10155 def err_omp_param_or_this_in_clause : Error<
10156   "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10157 def err_omp_expected_uniform_param : Error<
10158   "expected a reference to a parameter specified in a 'uniform' clause">;
10159 def err_omp_expected_int_param : Error<
10160   "expected a reference to an integer-typed parameter">;
10161 def err_omp_at_least_one_motion_clause_required : Error<
10162   "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10163 def err_omp_usedeviceptr_not_a_pointer : Error<
10164   "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10165 def err_omp_argument_type_isdeviceptr : Error <
10166   "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10167 def warn_omp_nesting_simd : Warning<
10168   "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10169   InGroup<SourceUsesOpenMP>;
10170 def err_omp_orphaned_device_directive : Error<
10171   "orphaned 'omp %0' directives are prohibited"
10172   "; perhaps you forget to enclose the directive into a "
10173   "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10174 def err_omp_reduction_non_addressable_expression : Error<
10175   "expected addressable reduction item for the task-based directives">;
10176 def err_omp_reduction_with_nogroup : Error<
10177   "'reduction' clause cannot be used with 'nogroup' clause">;
10178 def err_omp_reduction_vla_unsupported : Error<
10179   "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10180 def err_omp_linear_distribute_var_non_loop_iteration : Error<
10181   "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10182 def warn_omp_non_trivial_type_mapped : Warning<
10183   "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10184   InGroup<OpenMPMapping>;
10185 def err_omp_requires_clause_redeclaration : Error <
10186   "Only one %0 clause can appear on a requires directive in a single translation unit">;
10187 def note_omp_requires_previous_clause : Note <
10188   "%0 clause previously used here">;
10189 def err_omp_directive_before_requires : Error <
10190   "'%0' region encountered before requires directive with '%1' clause">;
10191 def note_omp_requires_encountered_directive : Note <
10192   "'%0' previously encountered here">;
10193 def err_omp_invalid_scope : Error <
10194   "'#pragma omp %0' directive must appear only in file scope">;
10195 def note_omp_invalid_length_on_this_ptr_mapping : Note <
10196   "expected length on mapping of 'this' array section expression to be '1'">;
10197 def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10198   "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10199 def note_omp_invalid_subscript_on_this_ptr_map : Note <
10200   "expected 'this' subscript expression on map clause to be 'this[0]'">;
10201 def err_omp_invalid_map_this_expr : Error <
10202   "invalid 'this' expression on 'map' clause">;
10203 def err_omp_implied_type_not_found : Error<
10204   "'%0' type not found; include <omp.h>">;
10205 def err_omp_expected_omp_depend_t_lvalue : Error<
10206   "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10207 def err_omp_depobj_expected : Error<
10208   "expected depobj expression">;
10209 def err_omp_depobj_single_clause_expected : Error<
10210   "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10211 def err_omp_scan_single_clause_expected : Error<
10212   "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10213 def err_omp_inclusive_exclusive_not_reduction : Error<
10214   "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10215   "of the parent directive">;
10216 def err_omp_reduction_not_inclusive_exclusive : Error<
10217   "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10218   " 'exclusive' clause on an inner 'omp scan' directive">;
10219 def err_omp_wrong_inscan_reduction : Error<
10220   "'inscan' modifier can be used only in 'omp for', 'omp simd', 'omp for simd',"
10221   " 'omp parallel for', or 'omp parallel for simd' directive">;
10222 def err_omp_inscan_reduction_expected : Error<
10223   "expected 'reduction' clause with the 'inscan' modifier">;
10224 def note_omp_previous_inscan_reduction : Note<
10225   "'reduction' clause with 'inscan' modifier is used here">;
10226 def err_omp_expected_predefined_allocator : Error<
10227   "expected one of the predefined allocators for the variables with the static "
10228   "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
10229   "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
10230   "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
10231 def warn_omp_used_different_allocator : Warning<
10232   "allocate directive specifies %select{default|'%1'}0 allocator while "
10233   "previously used %select{default|'%3'}2">,
10234   InGroup<OpenMPClauses>;
10235 def note_omp_previous_allocator : Note<
10236   "previous allocator is specified here">;
10237 def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
10238   "inside of the target region; provide an 'allocator' clause or use 'requires'"
10239   " directive with the 'dynamic_allocators' clause">;
10240 def err_expected_allocator_expression : Error<"expected an allocator expression "
10241   "inside of the target region; provide an allocator expression or use 'requires'"
10242   " directive with the 'dynamic_allocators' clause">;
10243 def warn_omp_allocate_thread_on_task_target_directive : Warning<
10244   "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
10245   InGroup<OpenMPClauses>;
10246 def err_omp_expected_private_copy_for_allocate : Error<
10247   "the referenced item is not found in any private clause on the same directive">;
10248 def err_omp_stmt_depends_on_loop_counter : Error<
10249   "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
10250 def err_omp_invariant_or_linear_dependency : Error<
10251   "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
10252 def err_omp_wrong_dependency_iterator_type : Error<
10253   "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
10254 def err_device_unsupported_type : Error <
10255   "%0 requires %1 bit size %2 type support, but device '%3' does not support it">;
10256 def err_omp_lambda_capture_in_declare_target_not_to : Error<
10257   "variable captured in declare target region must appear in a to clause">;
10258 def err_omp_device_type_mismatch : Error<
10259   "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
10260 def err_omp_wrong_device_function_call : Error<
10261   "function with 'device_type(%0)' is not available on %select{device|host}1">;
10262 def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
10263 def warn_omp_declare_target_after_first_use : Warning<
10264   "declaration marked as declare target after first use, it may lead to incorrect results">,
10265   InGroup<OpenMPTarget>;
10266 def err_omp_declare_variant_incompat_attributes : Error<
10267   "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
10268 def warn_omp_declare_variant_score_not_constant
10269     : Warning<"score expressions in the OpenMP context selector need to be "
10270               "constant; %0 is not and will be ignored">,
10271       InGroup<SourceUsesOpenMP>;
10272 def err_omp_declare_variant_user_condition_not_constant
10273     : Error<"the user condition in the OpenMP context selector needs to be "
10274             "constant; %0 is not">;
10275 def warn_omp_declare_variant_after_used : Warning<
10276   "'#pragma omp declare variant' cannot be applied for function after first "
10277   "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
10278 def warn_omp_declare_variant_after_emitted : Warning<
10279   "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
10280   " the original function might be used">, InGroup<SourceUsesOpenMP>;
10281 def err_omp_declare_variant_doesnt_support : Error<
10282   "'#pragma omp declare variant' does not "
10283   "support %select{function templates|virtual functions|"
10284   "deduced return types|constructors|destructors|deleted functions|"
10285   "defaulted functions|constexpr functions|consteval function}0">;
10286 def err_omp_declare_variant_diff : Error<
10287   "function with '#pragma omp declare variant' has a different %select{calling convention"
10288   "|return type|constexpr specification|inline specification|storage class|"
10289   "linkage}0">;
10290 def err_omp_declare_variant_incompat_types : Error<
10291   "variant in '#pragma omp declare variant' with type %0 is incompatible with type %1"
10292   >;
10293 def warn_omp_declare_variant_marked_as_declare_variant : Warning<
10294   "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
10295   >, InGroup<SourceUsesOpenMP>;
10296 def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
10297 def err_omp_one_defaultmap_each_category: Error<
10298   "at most one defaultmap clause for each variable-category can appear on the directive">;
10299 def err_omp_lastprivate_conditional_non_scalar : Error<
10300   "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
10301   >;
10302 def err_omp_flush_order_clause_and_list : Error<
10303   "'flush' directive with memory order clause '%0' cannot have the list">;
10304 def note_omp_flush_order_clause_here : Note<
10305   "memory order clause '%0' is specified here">;
10306 def err_omp_non_lvalue_in_map_or_motion_clauses: Error<
10307   "expected addressable lvalue in '%0' clause">;
10308 def err_omp_var_expected : Error<
10309   "expected variable of the '%0' type%select{|, not %2}1">;
10310 def warn_nested_declare_variant
10311     : Warning<"nesting `omp begin/end declare variant` is not supported yet; "
10312               "nested context ignored">,
10313       InGroup<SourceUsesOpenMP>;
10314 def err_omp_non_pointer_type_array_shaping_base : Error<
10315   "expected expression with a pointer to a complete type as a base of an array "
10316   "shaping operation">;
10317 def err_omp_reduction_task_not_parallel_or_worksharing : Error<
10318   "'reduction' clause with 'task' modifier allowed only on non-simd parallel or"
10319   " worksharing constructs">;
10320 def err_omp_expected_array_alloctraits : Error<
10321   "expected constant sized array of 'omp_alloctrait_t' elements, not %0">;
10322 def err_omp_predefined_allocator_with_traits : Error<
10323   "predefined allocator cannot have traits specified">;
10324 def note_omp_predefined_allocator : Note<
10325   "predefined trait '%0' used here">;
10326 def err_omp_nonpredefined_allocator_without_traits : Error<
10327   "non-predefined allocator must have traits specified">;
10328 def err_omp_allocator_used_in_clauses : Error<
10329   "allocators used in 'uses_allocators' clause cannot appear in other "
10330   "data-sharing or data-mapping attribute clauses">;
10331 def err_omp_allocator_not_in_uses_allocators : Error<
10332   "allocator must be specified in the 'uses_allocators' clause">;
10333 } // end of OpenMP category
10334
10335 let CategoryName = "Related Result Type Issue" in {
10336 // Objective-C related result type compatibility
10337 def warn_related_result_type_compatibility_class : Warning<
10338   "method is expected to return an instance of its class type "
10339   "%diff{$, but is declared to return $|"
10340   ", but is declared to return different type}0,1">;
10341 def warn_related_result_type_compatibility_protocol : Warning<
10342   "protocol method is expected to return an instance of the implementing "
10343   "class, but is declared to return %0">;
10344 def note_related_result_type_family : Note<
10345   "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
10346   "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
10347   "self}1' method family%select{| and is expected to return an instance of its "
10348   "class type}0">;
10349 def note_related_result_type_overridden : Note<
10350   "overridden method returns an instance of its class type">;
10351 def note_related_result_type_inferred : Note<
10352   "%select{class|instance}0 method %1 is assumed to return an instance of "
10353   "its receiver type (%2)">;
10354 def note_related_result_type_explicit : Note<
10355   "%select{overridden|current}0 method is explicitly declared 'instancetype'"
10356   "%select{| and is expected to return an instance of its class type}0">;
10357 def err_invalid_type_for_program_scope_var : Error<
10358   "the %0 type cannot be used to declare a program scope variable">;
10359
10360 }
10361
10362 let CategoryName = "Modules Issue" in {
10363 def err_module_decl_in_module_map_module : Error<
10364   "'module' declaration found while building module from module map">;
10365 def err_module_decl_in_header_module : Error<
10366   "'module' declaration found while building header unit">;
10367 def err_module_interface_implementation_mismatch : Error<
10368   "missing 'export' specifier in module declaration while "
10369   "building module interface">;
10370 def err_current_module_name_mismatch : Error<
10371   "module name '%0' specified on command line does not match name of module">;
10372 def err_module_redefinition : Error<
10373   "redefinition of module '%0'">;
10374 def note_prev_module_definition : Note<"previously defined here">;
10375 def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
10376 def err_module_not_defined : Error<
10377   "definition of module '%0' is not available; use -fmodule-file= to specify "
10378   "path to precompiled module interface">;
10379 def err_module_redeclaration : Error<
10380   "translation unit contains multiple module declarations">;
10381 def note_prev_module_declaration : Note<"previous module declaration is here">;
10382 def err_module_declaration_missing : Error<
10383   "missing 'export module' declaration in module interface unit">;
10384 def err_module_declaration_missing_after_global_module_introducer : Error<
10385   "missing 'module' declaration at end of global module fragment "
10386   "introduced here">;
10387 def err_module_private_specialization : Error<
10388   "%select{template|partial|member}0 specialization cannot be "
10389   "declared __module_private__">;
10390 def err_module_private_local : Error<
10391   "%select{local variable|parameter|typedef}0 %1 cannot be declared "
10392   "__module_private__">;
10393 def err_module_private_local_class : Error<
10394   "local %select{struct|interface|union|class|enum}0 cannot be declared "
10395   "__module_private__">;
10396 def err_module_unimported_use : Error<
10397   "%select{declaration|definition|default argument|"
10398   "explicit specialization|partial specialization}0 of %1 must be imported "
10399   "from module '%2' before it is required">;
10400 def err_module_unimported_use_header : Error<
10401   "%select{missing '#include'|missing '#include %3'}2; "
10402   "%select{||default argument of |explicit specialization of |"
10403   "partial specialization of }0%1 must be "
10404   "%select{declared|defined|defined|declared|declared}0 "
10405   "before it is used">;
10406 def err_module_unimported_use_multiple : Error<
10407   "%select{declaration|definition|default argument|"
10408   "explicit specialization|partial specialization}0 of %1 must be imported "
10409   "from one of the following modules before it is required:%2">;
10410 def note_unreachable_entity : Note<
10411   "%select{declaration|definition|default argument declared|"
10412   "explicit specialization declared|partial specialization declared}0 here "
10413   "is not %select{visible|reachable|reachable|reachable|reachable|reachable}0">;
10414 def ext_module_import_in_extern_c : ExtWarn<
10415   "import of C++ module '%0' appears within extern \"C\" language linkage "
10416   "specification">, DefaultError,
10417   InGroup<DiagGroup<"module-import-in-extern-c">>;
10418 def err_module_import_not_at_top_level_fatal : Error<
10419   "import of module '%0' appears within %1">, DefaultFatal;
10420 def ext_module_import_not_at_top_level_noop : ExtWarn<
10421   "redundant #include of module '%0' appears within %1">, DefaultError,
10422   InGroup<DiagGroup<"modules-import-nested-redundant">>;
10423 def note_module_import_not_at_top_level : Note<"%0 begins here">;
10424 def err_module_self_import : Error<
10425   "import of module '%0' appears within same top-level module '%1'">;
10426 def err_module_import_in_implementation : Error<
10427   "@import of module '%0' in implementation of '%1'; use #import">;
10428
10429 // C++ Modules
10430 def err_module_decl_not_at_start : Error<
10431   "module declaration must occur at the start of the translation unit">;
10432 def note_global_module_introducer_missing : Note<
10433   "add 'module;' to the start of the file to introduce a "
10434   "global module fragment">;
10435 def err_export_within_anonymous_namespace : Error<
10436   "export declaration appears within anonymous namespace">;
10437 def note_anonymous_namespace : Note<"anonymous namespace begins here">;
10438 def ext_export_no_name_block : ExtWarn<
10439   "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
10440   "to appear in an export block">, InGroup<ExportUnnamed>;
10441 def ext_export_no_names : ExtWarn<
10442   "ISO C++20 does not permit a declaration that does not introduce any names "
10443   "to be exported">, InGroup<ExportUnnamed>;
10444 def note_export : Note<"export block begins here">;
10445 def err_export_no_name : Error<
10446   "%select{empty|static_assert|asm}0 declaration cannot be exported">;
10447 def ext_export_using_directive : ExtWarn<
10448   "ISO C++20 does not permit using directive to be exported">,
10449   InGroup<DiagGroup<"export-using-directive">>;
10450 def err_export_within_export : Error<
10451   "export declaration appears within another export declaration">;
10452 def err_export_internal : Error<
10453   "declaration of %0 with internal linkage cannot be exported">;
10454 def err_export_using_internal : Error<
10455   "using declaration referring to %0 with internal linkage cannot be exported">;
10456 def err_export_not_in_module_interface : Error<
10457   "export declaration can only be used within a module interface unit"
10458   "%select{ after the module declaration|}0">;
10459 def err_export_in_private_module_fragment : Error<
10460   "export declaration cannot be used in a private module fragment">;
10461 def note_private_module_fragment : Note<
10462   "private module fragment begins here">;
10463 def err_private_module_fragment_not_module : Error<
10464   "private module fragment declaration with no preceding module declaration">;
10465 def err_private_module_fragment_redefined : Error<
10466   "private module fragment redefined">;
10467 def err_private_module_fragment_not_module_interface : Error<
10468   "private module fragment in module implementation unit">;
10469 def note_not_module_interface_add_export : Note<
10470   "add 'export' here if this is intended to be a module interface unit">;
10471
10472 def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
10473   "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
10474   InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
10475 def note_equivalent_internal_linkage_decl : Note<
10476   "declared here%select{ in module '%1'|}0">;
10477
10478 def note_redefinition_modules_same_file : Note<
10479   "'%0' included multiple times, additional include site in header from module '%1'">;
10480 def note_redefinition_include_same_file : Note<
10481   "'%0' included multiple times, additional include site here">;
10482 }
10483
10484 let CategoryName = "Coroutines Issue" in {
10485 def err_return_in_coroutine : Error<
10486   "return statement not allowed in coroutine; did you mean 'co_return'?">;
10487 def note_declared_coroutine_here : Note<
10488   "function is a coroutine due to use of '%0' here">;
10489 def err_coroutine_objc_method : Error<
10490   "Objective-C methods as coroutines are not yet supported">;
10491 def err_coroutine_unevaluated_context : Error<
10492   "'%0' cannot be used in an unevaluated context">;
10493 def err_coroutine_within_handler : Error<
10494   "'%0' cannot be used in the handler of a try block">;
10495 def err_coroutine_outside_function : Error<
10496   "'%0' cannot be used outside a function">;
10497 def err_coroutine_invalid_func_context : Error<
10498   "'%1' cannot be used in %select{a constructor|a destructor"
10499   "|the 'main' function|a constexpr function"
10500   "|a function with a deduced return type|a varargs function"
10501   "|a consteval function}0">;
10502 def err_implied_coroutine_type_not_found : Error<
10503   "%0 type was not found; include <experimental/coroutine> before defining "
10504   "a coroutine">;
10505 def err_implicit_coroutine_std_nothrow_type_not_found : Error<
10506   "std::nothrow was not found; include <new> before defining a coroutine which "
10507   "uses get_return_object_on_allocation_failure()">;
10508 def err_malformed_std_nothrow : Error<
10509   "std::nothrow must be a valid variable declaration">;
10510 def err_malformed_std_coroutine_handle : Error<
10511   "std::experimental::coroutine_handle must be a class template">;
10512 def err_coroutine_handle_missing_member : Error<
10513   "std::experimental::coroutine_handle missing a member named '%0'">;
10514 def err_malformed_std_coroutine_traits : Error<
10515   "'std::experimental::coroutine_traits' must be a class template">;
10516 def err_implied_std_coroutine_traits_promise_type_not_found : Error<
10517   "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
10518 def err_implied_std_coroutine_traits_promise_type_not_class : Error<
10519   "this function cannot be a coroutine: %0 is not a class">;
10520 def err_coroutine_promise_type_incomplete : Error<
10521   "this function cannot be a coroutine: %0 is an incomplete type">;
10522 def err_coroutine_type_missing_specialization : Error<
10523   "this function cannot be a coroutine: missing definition of "
10524   "specialization %0">;
10525 def err_coroutine_promise_incompatible_return_functions : Error<
10526   "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
10527 def err_coroutine_promise_requires_return_function : Error<
10528   "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
10529 def note_coroutine_promise_implicit_await_transform_required_here : Note<
10530   "call to 'await_transform' implicitly required by 'co_await' here">;
10531 def note_coroutine_promise_suspend_implicitly_required : Note<
10532   "call to '%select{initial_suspend|final_suspend}0' implicitly "
10533   "required by the %select{initial suspend point|final suspend point}0">;
10534 def err_coroutine_promise_unhandled_exception_required : Error<
10535   "%0 is required to declare the member 'unhandled_exception()'">;
10536 def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
10537   "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
10538   InGroup<CoroutineMissingUnhandledException>;
10539 def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
10540   "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
10541 def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
10542   "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
10543 def err_coroutine_promise_new_requires_nothrow : Error<
10544   "%0 is required to have a non-throwing noexcept specification when the promise "
10545    "type declares 'get_return_object_on_allocation_failure()'">;
10546 def note_coroutine_promise_call_implicitly_required : Note<
10547   "call to %0 implicitly required by coroutine function here">;
10548 def err_await_suspend_invalid_return_type : Error<
10549   "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
10550 >;
10551 def note_await_ready_no_bool_conversion : Note<
10552   "return type of 'await_ready' is required to be contextually convertible to 'bool'"
10553 >;
10554 def warn_coroutine_handle_address_invalid_return_type : Warning <
10555   "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">,
10556   InGroup<Coroutine>;
10557 def err_coroutine_promise_final_suspend_requires_nothrow : Error<
10558   "the expression 'co_await __promise.final_suspend()' is required to be non-throwing"
10559 >;
10560 def note_coroutine_function_declare_noexcept : Note<
10561   "must be declared with 'noexcept'"
10562 >;
10563 } // end of coroutines issue category
10564
10565 let CategoryName = "Documentation Issue" in {
10566 def warn_not_a_doxygen_trailing_member_comment : Warning<
10567   "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
10568 } // end of documentation issue category
10569
10570 let CategoryName = "Nullability Issue" in {
10571
10572 def warn_mismatched_nullability_attr : Warning<
10573   "nullability specifier %0 conflicts with existing specifier %1">,
10574   InGroup<Nullability>;
10575
10576 def warn_nullability_declspec : Warning<
10577   "nullability specifier %0 cannot be applied "
10578   "to non-pointer type %1; did you mean to apply the specifier to the "
10579   "%select{pointer|block pointer|member pointer|function pointer|"
10580   "member function pointer}2?">,
10581   InGroup<NullabilityDeclSpec>,
10582   DefaultError;
10583
10584 def note_nullability_here : Note<"%0 specified here">;
10585
10586 def err_nullability_nonpointer : Error<
10587   "nullability specifier %0 cannot be applied to non-pointer type %1">;
10588
10589 def warn_nullability_lost : Warning<
10590   "implicit conversion from nullable pointer %0 to non-nullable pointer "
10591   "type %1">,
10592   InGroup<NullableToNonNullConversion>, DefaultIgnore;
10593 def warn_zero_as_null_pointer_constant : Warning<
10594   "zero as null pointer constant">,
10595   InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
10596
10597 def err_nullability_cs_multilevel : Error<
10598   "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
10599 def note_nullability_type_specifier : Note<
10600   "use nullability type specifier %0 to affect the innermost "
10601   "pointer type of %1">;
10602
10603 def warn_null_resettable_setter : Warning<
10604   "synthesized setter %0 for null_resettable property %1 does not handle nil">,
10605   InGroup<Nullability>;
10606
10607 def warn_nullability_missing : Warning<
10608   "%select{pointer|block pointer|member pointer}0 is missing a nullability "
10609   "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
10610   InGroup<NullabilityCompleteness>;
10611 def warn_nullability_missing_array : Warning<
10612   "array parameter is missing a nullability type specifier (_Nonnull, "
10613   "_Nullable, or _Null_unspecified)">,
10614   InGroup<NullabilityCompletenessOnArrays>;
10615 def note_nullability_fix_it : Note<
10616   "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
10617   "%select{pointer|block pointer|member pointer|array parameter}1 "
10618   "%select{should never be null|may be null|should not declare nullability}0">;
10619
10620 def warn_nullability_inferred_on_nested_type : Warning<
10621   "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
10622   "deprecated">,
10623   InGroup<NullabilityInferredOnNestedType>;
10624
10625 def err_objc_type_arg_explicit_nullability : Error<
10626   "type argument %0 cannot explicitly specify nullability">;
10627
10628 def err_objc_type_param_bound_explicit_nullability : Error<
10629   "type parameter %0 bound %1 cannot explicitly specify nullability">;
10630
10631 }
10632
10633 let CategoryName = "Generics Issue" in {
10634
10635 def err_objc_type_param_bound_nonobject : Error<
10636   "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
10637
10638 def err_objc_type_param_bound_missing_pointer : Error<
10639   "missing '*' in type bound %0 for type parameter %1">;
10640 def err_objc_type_param_bound_qualified : Error<
10641   "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
10642
10643 def err_objc_type_param_redecl : Error<
10644   "redeclaration of type parameter %0">;
10645
10646 def err_objc_type_param_arity_mismatch : Error<
10647   "%select{forward class declaration|class definition|category|extension}0 has "
10648   "too %select{few|many}1 type parameters (expected %2, have %3)">;
10649
10650 def err_objc_type_param_bound_conflict : Error<
10651   "type bound %0 for type parameter %1 conflicts with "
10652   "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
10653
10654 def err_objc_type_param_variance_conflict : Error<
10655   "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
10656   "%select{in|co|contra}2variant type parameter %3">;
10657
10658 def note_objc_type_param_here : Note<"type parameter %0 declared here">;
10659
10660 def err_objc_type_param_bound_missing : Error<
10661   "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
10662
10663 def err_objc_parameterized_category_nonclass : Error<
10664   "%select{extension|category}0 of non-parameterized class %1 cannot have type "
10665   "parameters">;
10666
10667 def err_objc_parameterized_forward_class : Error<
10668   "forward declaration of non-parameterized class %0 cannot have type "
10669   "parameters">;
10670
10671 def err_objc_parameterized_forward_class_first : Error<
10672   "class %0 previously declared with type parameters">;
10673
10674 def err_objc_type_arg_missing_star : Error<
10675   "type argument %0 must be a pointer (requires a '*')">;
10676 def err_objc_type_arg_qualified : Error<
10677   "type argument %0 cannot be qualified with '%1'">;
10678
10679 def err_objc_type_arg_missing : Error<
10680   "no type or protocol named %0">;
10681
10682 def err_objc_type_args_and_protocols : Error<
10683   "angle brackets contain both a %select{type|protocol}0 (%1) and a "
10684   "%select{protocol|type}0 (%2)">;
10685
10686 def err_objc_type_args_non_class : Error<
10687   "type arguments cannot be applied to non-class type %0">;
10688
10689 def err_objc_type_args_non_parameterized_class : Error<
10690   "type arguments cannot be applied to non-parameterized class %0">;
10691
10692 def err_objc_type_args_specialized_class : Error<
10693   "type arguments cannot be applied to already-specialized class type %0">;
10694
10695 def err_objc_type_args_wrong_arity : Error<
10696   "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
10697 }
10698
10699 def err_objc_type_arg_not_id_compatible : Error<
10700   "type argument %0 is neither an Objective-C object nor a block type">;
10701
10702 def err_objc_type_arg_does_not_match_bound : Error<
10703   "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
10704
10705 def warn_objc_redundant_qualified_class_type : Warning<
10706   "parameterized class %0 already conforms to the protocols listed; did you "
10707   "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
10708
10709 def warn_block_literal_attributes_on_omitted_return_type : Warning<
10710   "attribute %0 ignored, because it cannot be applied to omitted return type">,
10711   InGroup<IgnoredAttributes>;
10712
10713 def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
10714   "'%0' qualifier on omitted return type %1 has no effect">,
10715   InGroup<IgnoredQualifiers>;
10716
10717 def warn_shadow_field : Warning<
10718   "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
10719   "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
10720 def note_shadow_field : Note<"declared here">;
10721
10722 def err_multiversion_required_in_redecl : Error<
10723   "function declaration is missing %select{'target'|'cpu_specific' or "
10724   "'cpu_dispatch'}0 attribute in a multiversioned function">;
10725 def note_multiversioning_caused_here : Note<
10726   "function multiversioning caused by this declaration">;
10727 def err_multiversion_after_used : Error<
10728   "function declaration cannot become a multiversioned function after first "
10729   "usage">;
10730 def err_bad_multiversion_option : Error<
10731   "function multiversioning doesn't support %select{feature|architecture}0 "
10732   "'%1'">;
10733 def err_multiversion_duplicate : Error<
10734   "multiversioned function redeclarations require identical target attributes">;
10735 def err_multiversion_noproto : Error<
10736   "multiversioned function must have a prototype">;
10737 def err_multiversion_no_other_attrs : Error<
10738   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
10739   " with other attributes">;
10740 def err_multiversion_diff : Error<
10741   "multiversioned function declaration has a different %select{calling convention"
10742   "|return type|constexpr specification|inline specification|storage class|"
10743   "linkage}0">;
10744 def err_multiversion_doesnt_support : Error<
10745   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
10746   "yet support %select{function templates|virtual functions|"
10747   "deduced return types|constructors|destructors|deleted functions|"
10748   "defaulted functions|constexpr functions|consteval function}1">;
10749 def err_multiversion_not_allowed_on_main : Error<
10750   "'main' cannot be a multiversioned function">;
10751 def err_multiversion_not_supported : Error<
10752  "function multiversioning is not supported on the current target">;
10753 def err_multiversion_types_mixed : Error<
10754   "multiversioning attributes cannot be combined">;
10755 def err_cpu_dispatch_mismatch : Error<
10756  "'cpu_dispatch' function redeclared with different CPUs">;
10757 def err_cpu_specific_multiple_defs : Error<
10758  "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
10759 def warn_multiversion_duplicate_entries : Warning<
10760  "CPU list contains duplicate entries; attribute ignored">,
10761   InGroup<FunctionMultiVersioning>;
10762 def warn_dispatch_body_ignored : Warning<
10763   "body of cpu_dispatch function will be ignored">,
10764   InGroup<FunctionMultiVersioning>;
10765
10766 // three-way comparison operator diagnostics
10767 def err_implied_comparison_category_type_not_found : Error<
10768   "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
10769   "because type '%0' was not found; include <compare>">;
10770 def err_spaceship_argument_narrowing : Error<
10771   "argument to 'operator<=>' "
10772   "%select{cannot be narrowed from type %1 to %2|"
10773   "evaluates to %1, which cannot be narrowed to type %2}0">;
10774 def err_std_compare_type_not_supported : Error<
10775   "standard library implementation of %0 is not supported; "
10776    "%select{member '%2' does not have expected form|"
10777    "member '%2' is missing|"
10778    "the type is not trivially copyable|"
10779    "the type does not have the expected form}1">;
10780 def note_rewriting_operator_as_spaceship : Note<
10781   "while rewriting comparison as call to 'operator<=>' declared here">;
10782 def err_three_way_vector_comparison : Error<
10783   "three-way comparison between vectors is not supported">;
10784
10785 // Memory Tagging Extensions (MTE) diagnostics
10786 def err_memtag_arg_null_or_pointer : Error<
10787   "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
10788 def err_memtag_any2arg_pointer : Error<
10789   "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
10790 def err_memtag_arg_must_be_pointer : Error<
10791   "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
10792 def err_memtag_arg_must_be_integer : Error<
10793   "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
10794
10795 def warn_dereference_of_noderef_type : Warning<
10796   "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
10797 def warn_dereference_of_noderef_type_no_decl : Warning<
10798   "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
10799 def warn_noderef_on_non_pointer_or_array : Warning<
10800   "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
10801 def warn_noderef_to_dereferenceable_pointer : Warning<
10802   "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
10803
10804 def err_builtin_launder_invalid_arg : Error<
10805   "%select{non-pointer|function pointer|void pointer}0 argument to "
10806   "'__builtin_launder' is not allowed">;
10807
10808 def err_builtin_matrix_disabled: Error<
10809   "matrix types extension is disabled. Pass -fenable-matrix to enable it">;
10810 def err_matrix_index_not_integer: Error<
10811   "matrix %select{row|column}0 index is not an integer">;
10812 def err_matrix_index_outside_range: Error<
10813   "matrix %select{row|column}0 index is outside the allowed range [0, %1)">;
10814 def err_matrix_incomplete_index: Error<
10815   "single subscript expressions are not allowed for matrix values">;
10816 def err_matrix_separate_incomplete_index: Error<
10817   "matrix row and column subscripts cannot be separated by any expression">;
10818 def err_matrix_subscript_comma: Error<
10819   "comma expressions are not allowed as indices in matrix subscript expressions">;
10820 def err_builtin_matrix_arg: Error<"1st argument must be a matrix">;
10821 def err_builtin_matrix_scalar_unsigned_arg: Error<
10822   "%0 argument must be a constant unsigned integer expression">;
10823 def err_builtin_matrix_pointer_arg: Error<
10824   "%ordinal0 argument must be a pointer to a valid matrix element type">;
10825 def err_builtin_matrix_pointer_arg_mismatch: Error<
10826   "the pointee of the 2nd argument must match the element type of the 1st argument (%0 != %1)">;
10827 def err_builtin_matrix_store_to_const: Error<
10828   "cannot store matrix to read-only pointer">;
10829 def err_builtin_matrix_stride_too_small: Error<
10830   "stride must be greater or equal to the number of rows">;
10831 def err_builtin_matrix_invalid_dimension: Error<
10832   "%0 dimension is outside the allowed range [1, %1]">;
10833
10834 def warn_mismatched_import : Warning<
10835   "import %select{module|name}0 (%1) does not match the import %select{module|name}0 (%2) of the "
10836   "previous declaration">,
10837   InGroup<IgnoredAttributes>;
10838 def warn_import_on_definition : Warning<
10839   "import %select{module|name}0 cannot be applied to a function with a definition">,
10840   InGroup<IgnoredAttributes>;
10841
10842 def err_preserve_field_info_not_field : Error<
10843   "__builtin_preserve_field_info argument %0 not a field access">;
10844 def err_preserve_field_info_not_const: Error<
10845   "__builtin_preserve_field_info argument %0 not a constant">;
10846 def err_btf_type_id_not_const: Error<
10847   "__builtin_btf_type_id argument %0 not a constant">;
10848
10849 def err_bit_cast_non_trivially_copyable : Error<
10850   "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
10851 def err_bit_cast_type_size_mismatch : Error<
10852   "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
10853
10854 // SYCL-specific diagnostics
10855 def warn_sycl_kernel_num_of_template_params : Warning<
10856   "'sycl_kernel' attribute only applies to a function template with at least"
10857   " two template parameters">, InGroup<IgnoredAttributes>;
10858 def warn_sycl_kernel_invalid_template_param_type : Warning<
10859   "template parameter of a function template with the 'sycl_kernel' attribute"
10860   " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
10861 def warn_sycl_kernel_num_of_function_params : Warning<
10862   "function template with 'sycl_kernel' attribute must have a single parameter">,
10863   InGroup<IgnoredAttributes>;
10864 def warn_sycl_kernel_return_type : Warning<
10865   "function template with 'sycl_kernel' attribute must have a 'void' return type">,
10866   InGroup<IgnoredAttributes>;
10867
10868 def err_ext_int_bad_size : Error<"%select{signed|unsigned}0 _ExtInt must "
10869                                  "have a bit size of at least %select{2|1}0">;
10870 def err_ext_int_max_size : Error<"%select{signed|unsigned}0 _ExtInt of bit "
10871                                  "sizes greater than %1 not supported">;
10872
10873 // errors of expect.with.probability
10874 def err_probability_not_constant_float : Error<
10875    "probability argument to __builtin_expect_with_probability must be constant "
10876    "floating-point expression">;
10877 def err_probability_out_of_range : Error<
10878    "probability argument to __builtin_expect_with_probability is outside the "
10879    "range [0.0, 1.0]">;
10880 } // end of sema component.