]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/clang/include/clang/Basic/DiagnosticSemaKinds.td
Update to version 3.1.3
[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_init : Error<
175   "designator in initializer for scalar type %0">;
176 def warn_initializer_overrides : Warning<
177   "initializer %select{partially |}0overrides prior initialization of "
178   "this subobject">, InGroup<InitializerOverrides>;
179 def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
180   InGroup<InitializerOverrides>, SFINAEFailure;
181 def err_initializer_overrides_destructed : Error<
182   "initializer would partially override prior initialization of object of "
183   "type %1 with non-trivial destruction">;
184 def note_previous_initializer : Note<
185   "previous initialization %select{|with side effects }0is here"
186   "%select{| (side effects will not occur at run time)}0">;
187 def err_designator_into_flexible_array_member : Error<
188   "designator into flexible array member subobject">;
189 def note_flexible_array_member : Note<
190   "initialized flexible array member %0 is here">;
191 def ext_flexible_array_init : Extension<
192   "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
193
194 // C++20 designated initializers
195 def ext_cxx_designated_init : Extension<
196   "designated initializers are a C++20 extension">, InGroup<CXX20Designator>;
197 def warn_cxx17_compat_designated_init : Warning<
198   "designated initializers are incompatible with C++ standards before C++20">,
199   InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
200 def ext_designated_init_mixed : ExtWarn<
201   "mixture of designated and non-designated initializers in the same "
202   "initializer list is a C99 extension">, InGroup<C99Designator>;
203 def note_designated_init_mixed : Note<
204   "first non-designated initializer is here">;
205 def ext_designated_init_array : ExtWarn<
206   "array designators are a C99 extension">, InGroup<C99Designator>;
207 def ext_designated_init_nested : ExtWarn<
208   "nested designators are a C99 extension">, InGroup<C99Designator>;
209 def ext_designated_init_reordered : ExtWarn<
210   "ISO C++ requires field designators to be specified in declaration order; "
211   "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
212   SFINAEFailure;
213 def note_previous_field_init : Note<
214   "previous initialization for field %0 is here">;
215
216 // Declarations.
217 def ext_plain_complex : ExtWarn<
218   "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
219 def ext_imaginary_constant : Extension<
220   "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
221 def ext_integer_complex : Extension<
222   "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
223
224 def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
225   "'_Fract' or '_Accum', not '%0'">;
226 def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
227 def err_invalid_width_spec : Error<
228   "'%select{|short|long|long long}0 %1' is invalid">;
229 def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
230
231 def ext_auto_type_specifier : ExtWarn<
232   "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
233 def warn_auto_storage_class : Warning<
234   "'auto' storage class specifier is redundant and incompatible with C++11">,
235   InGroup<CXX11Compat>, DefaultIgnore;
236
237 def warn_deprecated_register : Warning<
238   "'register' storage class specifier is deprecated "
239   "and incompatible with C++17">, InGroup<DeprecatedRegister>;
240 def ext_register_storage_class : ExtWarn<
241   "ISO C++17 does not allow 'register' storage class specifier">,
242   DefaultError, InGroup<Register>;
243
244 def err_invalid_decl_spec_combination : Error<
245   "cannot combine with previous '%0' declaration specifier">;
246 def err_invalid_vector_decl_spec_combination : Error<
247   "cannot combine with previous '%0' declaration specifier. "
248   "'__vector' must be first">;
249 def err_invalid_pixel_decl_spec_combination : Error<
250   "'__pixel' must be preceded by '__vector'.  "
251   "'%0' declaration specifier not allowed here">;
252 def err_invalid_vector_bool_decl_spec : Error<
253   "cannot use '%0' with '__vector bool'">;
254 def err_invalid_vector_long_decl_spec : Error<
255   "cannot use 'long' with '__vector'">;
256 def err_invalid_vector_float_decl_spec : Error<
257   "cannot use 'float' with '__vector'">;
258 def err_invalid_vector_double_decl_spec : Error <
259   "use of 'double' with '__vector' requires VSX support to be enabled "
260   "(available on POWER7 or later)">;
261 def err_invalid_vector_long_long_decl_spec : Error <
262   "use of 'long long' with '__vector bool' requires VSX support (available on "
263   "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
264   "to be enabled">;
265 def err_invalid_vector_long_double_decl_spec : Error<
266   "cannot use 'long double' with '__vector'">;
267 def warn_vector_long_decl_spec_combination : Warning<
268   "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
269
270 def err_redeclaration_different_type : Error<
271   "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
272 def err_bad_variable_name : Error<
273   "%0 cannot be the name of a variable or data member">;
274 def err_bad_parameter_name : Error<
275   "%0 cannot be the name of a parameter">;
276 def err_bad_parameter_name_template_id : Error<
277   "parameter name cannot have template arguments">;
278 def err_parameter_name_omitted : Error<"parameter name omitted">;
279 def err_anyx86_interrupt_attribute : Error<
280   "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
281   "have %select{a 'void' return type|"
282   "only a pointer parameter optionally followed by an integer parameter|"
283   "a pointer as the first parameter|a %2 type as the second parameter}1">;
284 def err_anyx86_interrupt_called : Error<
285   "interrupt service routine cannot be called directly">;
286 def warn_arm_interrupt_calling_convention : Warning<
287    "call to function without interrupt attribute could clobber interruptee's VFP registers">,
288    InGroup<Extra>;
289 def warn_interrupt_attribute_invalid : Warning<
290    "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
291    "functions that have %select{no parameters|a 'void' return type}1">,
292    InGroup<IgnoredAttributes>;
293 def warn_riscv_repeated_interrupt_attribute : Warning<
294   "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
295 def note_riscv_repeated_interrupt_attribute : Note<
296   "repeated RISC-V 'interrupt' attribute is here">;
297 def warn_unused_parameter : Warning<"unused parameter %0">,
298   InGroup<UnusedParameter>, DefaultIgnore;
299 def warn_unused_variable : Warning<"unused variable %0">,
300   InGroup<UnusedVariable>, DefaultIgnore;
301 def warn_unused_local_typedef : Warning<
302   "unused %select{typedef|type alias}0 %1">,
303   InGroup<UnusedLocalTypedef>, DefaultIgnore;
304 def warn_unused_property_backing_ivar :
305   Warning<"ivar %0 which backs the property is not "
306   "referenced in this property's accessor">,
307   InGroup<UnusedPropertyIvar>, DefaultIgnore;
308 def warn_unused_const_variable : Warning<"unused variable %0">,
309   InGroup<UnusedConstVariable>, DefaultIgnore;
310 def warn_unused_exception_param : Warning<"unused exception parameter %0">,
311   InGroup<UnusedExceptionParameter>, DefaultIgnore;
312 def warn_decl_in_param_list : Warning<
313   "declaration of %0 will not be visible outside of this function">,
314   InGroup<Visibility>;
315 def warn_redefinition_in_param_list : Warning<
316   "redefinition of %0 will not be visible outside of this function">,
317   InGroup<Visibility>;
318 def warn_empty_parens_are_function_decl : Warning<
319   "empty parentheses interpreted as a function declaration">,
320   InGroup<VexingParse>;
321 def warn_parens_disambiguated_as_function_declaration : Warning<
322   "parentheses were disambiguated as a function declaration">,
323   InGroup<VexingParse>;
324 def warn_parens_disambiguated_as_variable_declaration : Warning<
325   "parentheses were disambiguated as redundant parentheses around declaration "
326   "of variable named %0">, InGroup<VexingParse>;
327 def warn_redundant_parens_around_declarator : Warning<
328   "redundant parentheses surrounding declarator">,
329   InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
330 def note_additional_parens_for_variable_declaration : Note<
331   "add a pair of parentheses to declare a variable">;
332 def note_raii_guard_add_name : Note<
333   "add a variable name to declare a %0 initialized with %1">;
334 def note_function_style_cast_add_parentheses : Note<
335   "add enclosing parentheses to perform a function-style cast">;
336 def note_remove_parens_for_variable_declaration : Note<
337   "remove parentheses to silence this warning">;
338 def note_empty_parens_function_call : Note<
339   "change this ',' to a ';' to call %0">;
340 def note_empty_parens_default_ctor : Note<
341   "remove parentheses to declare a variable">;
342 def note_empty_parens_zero_initialize : Note<
343   "replace parentheses with an initializer to declare a variable">;
344 def warn_unused_function : Warning<"unused function %0">,
345   InGroup<UnusedFunction>, DefaultIgnore;
346 def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
347   InGroup<UnusedTemplate>, DefaultIgnore;
348 def warn_unused_member_function : Warning<"unused member function %0">,
349   InGroup<UnusedMemberFunction>, DefaultIgnore;
350 def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
351   InGroup<UsedButMarkedUnused>, DefaultIgnore;
352 def warn_unneeded_internal_decl : Warning<
353   "%select{function|variable}0 %1 is not needed and will not be emitted">,
354   InGroup<UnneededInternalDecl>, DefaultIgnore;
355 def warn_unneeded_static_internal_decl : Warning<
356   "'static' function %0 declared in header file "
357   "should be declared 'static inline'">,
358   InGroup<UnneededInternalDecl>, DefaultIgnore;
359 def warn_unneeded_member_function : Warning<
360   "member function %0 is not needed and will not be emitted">,
361   InGroup<UnneededMemberFunction>, DefaultIgnore;
362 def warn_unused_private_field: Warning<"private field %0 is not used">,
363   InGroup<UnusedPrivateField>, DefaultIgnore;
364 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
365   "%select{used|required to be captured for this use}1">,
366   InGroup<UnusedLambdaCapture>, DefaultIgnore;
367
368 def warn_parameter_size: Warning<
369   "%0 is a large (%1 bytes) pass-by-value argument; "
370   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
371 def warn_return_value_size: Warning<
372   "return value of %0 is a large (%1 bytes) pass-by-value object; "
373   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
374 def warn_return_value_udt: Warning<
375   "%0 has C-linkage specified, but returns user-defined type %1 which is "
376   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
377 def warn_return_value_udt_incomplete: Warning<
378   "%0 has C-linkage specified, but returns incomplete type %1 which could be "
379   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
380 def warn_implicit_function_decl : Warning<
381   "implicit declaration of function %0">,
382   InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
383 def ext_implicit_function_decl : ExtWarn<
384   "implicit declaration of function %0 is invalid in C99">,
385   InGroup<ImplicitFunctionDeclare>;
386 def note_function_suggestion : Note<"did you mean %0?">;
387
388 def err_ellipsis_first_param : Error<
389   "ISO C requires a named parameter before '...'">;
390 def err_declarator_need_ident : Error<"declarator requires an identifier">;
391 def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
392 def err_language_linkage_spec_not_ascii : Error<
393   "string literal in language linkage specifier cannot have an "
394   "encoding-prefix">;
395 def ext_use_out_of_scope_declaration : ExtWarn<
396   "use of out-of-scope declaration of %0%select{| whose type is not "
397   "compatible with that of an implicit declaration}1">,
398   InGroup<DiagGroup<"out-of-scope-function">>;
399 def err_inline_non_function : Error<
400   "'inline' can only appear on functions%select{| and non-local variables}0">;
401 def err_noreturn_non_function : Error<
402   "'_Noreturn' can only appear on functions">;
403 def warn_qual_return_type : Warning<
404   "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
405   InGroup<IgnoredQualifiers>, DefaultIgnore;
406 def warn_deprecated_redundant_constexpr_static_def : Warning<
407   "out-of-line definition of constexpr static data member is redundant "
408   "in C++17 and is deprecated">,
409   InGroup<Deprecated>, DefaultIgnore;
410
411 def warn_decl_shadow :
412   Warning<"declaration shadows a %select{"
413           "local variable|"
414           "variable in %2|"
415           "static data member of %2|"
416           "field of %2|"
417           "typedef in %2|"
418           "type alias in %2}1">,
419   InGroup<Shadow>, DefaultIgnore;
420 def warn_decl_shadow_uncaptured_local :
421   Warning<warn_decl_shadow.Text>,
422   InGroup<ShadowUncapturedLocal>, DefaultIgnore;
423 def warn_ctor_parm_shadows_field:
424   Warning<"constructor parameter %0 shadows the field %1 of %2">,
425   InGroup<ShadowFieldInConstructor>, DefaultIgnore;
426 def warn_modifying_shadowing_decl :
427   Warning<"modifying constructor parameter %0 that shadows a "
428           "field of %1">,
429   InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
430
431 // C++ decomposition declarations
432 def err_decomp_decl_context : Error<
433   "decomposition declaration not permitted in this context">;
434 def warn_cxx14_compat_decomp_decl : Warning<
435   "decomposition declarations are incompatible with "
436   "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
437 def ext_decomp_decl : ExtWarn<
438   "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
439 def ext_decomp_decl_cond : ExtWarn<
440   "ISO C++17 does not permit structured binding declaration in a condition">,
441   InGroup<DiagGroup<"binding-in-condition">>;
442 def err_decomp_decl_spec : Error<
443   "decomposition declaration cannot be declared "
444   "%plural{1:'%1'|:with '%1' specifiers}0">;
445 def ext_decomp_decl_spec : ExtWarn<
446   "decomposition declaration declared "
447   "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
448   InGroup<CXX20>;
449 def warn_cxx17_compat_decomp_decl_spec : Warning<
450   "decomposition declaration declared "
451   "%plural{1:'%1'|:with '%1' specifiers}0 "
452   "is incompatible with C++ standards before C++20">,
453   InGroup<CXXPre20Compat>, DefaultIgnore;
454 def err_decomp_decl_type : Error<
455   "decomposition declaration cannot be declared with type %0; "
456   "declared type must be 'auto' or reference to 'auto'">;
457 def err_decomp_decl_parens : Error<
458   "decomposition declaration cannot be declared with parentheses">;
459 def err_decomp_decl_template : Error<
460   "decomposition declaration template not supported">;
461 def err_decomp_decl_not_alone : Error<
462   "decomposition declaration must be the only declaration in its group">;
463 def err_decomp_decl_requires_init : Error<
464   "decomposition declaration %0 requires an initializer">;
465 def err_decomp_decl_wrong_number_bindings : Error<
466   "type %0 decomposes into %2 elements, but %select{only |}3%1 "
467   "names were provided">;
468 def err_decomp_decl_unbindable_type : Error<
469   "cannot decompose %select{union|non-class, non-array}1 type %2">;
470 def err_decomp_decl_multiple_bases_with_members : Error<
471   "cannot decompose class type %1: "
472   "%select{its base classes %2 and|both it and its base class}0 %3 "
473   "have non-static data members">;
474 def err_decomp_decl_ambiguous_base : Error<
475   "cannot decompose members of ambiguous base class %1 of %0:%2">;
476 def err_decomp_decl_inaccessible_base : Error<
477   "cannot decompose members of inaccessible base class %1 of %0">,
478   AccessControl;
479 def err_decomp_decl_inaccessible_field : Error<
480   "cannot decompose %select{private|protected}0 member %1 of %3">,
481   AccessControl;
482 def err_decomp_decl_anon_union_member : Error<
483   "cannot decompose class type %0 because it has an anonymous "
484   "%select{struct|union}1 member">;
485 def err_decomp_decl_std_tuple_element_not_specialized : Error<
486   "cannot decompose this type; 'std::tuple_element<%0>::type' "
487   "does not name a type">;
488 def err_decomp_decl_std_tuple_size_not_constant : Error<
489   "cannot decompose this type; 'std::tuple_size<%0>::value' "
490   "is not a valid integral constant expression">;
491 def note_in_binding_decl_init : Note<
492   "in implicit initialization of binding declaration %0">;
493
494 def err_std_type_trait_not_class_template : Error<
495   "unsupported standard library implementation: "
496   "'std::%0' is not a class template">;
497
498 // C++ using declarations
499 def err_using_requires_qualname : Error<
500   "using declaration requires a qualified name">;
501 def err_using_typename_non_type : Error<
502   "'typename' keyword used on a non-type">;
503 def err_using_dependent_value_is_type : Error<
504   "dependent using declaration resolved to type without 'typename'">;
505 def err_using_decl_nested_name_specifier_is_not_class : Error<
506   "using declaration in class refers into '%0', which is not a class">;
507 def err_using_decl_nested_name_specifier_is_current_class : Error<
508   "using declaration refers to its own class">;
509 def err_using_decl_nested_name_specifier_is_not_base_class : Error<
510   "using declaration refers into '%0', which is not a base class of %1">;
511 def err_using_decl_constructor_not_in_direct_base : Error<
512   "%0 is not a direct base of %1, cannot inherit constructors">;
513 def err_using_decl_can_not_refer_to_class_member : Error<
514   "using declaration cannot refer to class member">;
515 def err_ambiguous_inherited_constructor : Error<
516   "constructor of %0 inherited from multiple base class subobjects">;
517 def note_ambiguous_inherited_constructor_using : Note<
518   "inherited from base class %0 here">;
519 def note_using_decl_class_member_workaround : Note<
520   "use %select{an alias declaration|a typedef declaration|a reference|"
521   "a const variable|a constexpr variable}0 instead">;
522 def err_using_decl_can_not_refer_to_namespace : Error<
523   "using declaration cannot refer to a namespace">;
524 def err_using_decl_can_not_refer_to_scoped_enum : Error<
525   "using declaration cannot refer to a scoped enumerator">;
526 def err_using_decl_constructor : Error<
527   "using declaration cannot refer to a constructor">;
528 def warn_cxx98_compat_using_decl_constructor : Warning<
529   "inheriting constructors are incompatible with C++98">,
530   InGroup<CXX98Compat>, DefaultIgnore;
531 def err_using_decl_destructor : Error<
532   "using declaration cannot refer to a destructor">;
533 def err_using_decl_template_id : Error<
534   "using declaration cannot refer to a template specialization">;
535 def note_using_decl_target : Note<"target of using declaration">;
536 def note_using_decl_conflict : Note<"conflicting declaration">;
537 def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
538 def err_using_decl_conflict : Error<
539   "target of using declaration conflicts with declaration already in scope">;
540 def err_using_decl_conflict_reverse : Error<
541   "declaration conflicts with target of using declaration already in scope">;
542 def note_using_decl : Note<"%select{|previous }0using declaration">;
543 def err_using_decl_redeclaration_expansion : Error<
544   "using declaration pack expansion at block scope produces multiple values">;
545
546 def warn_access_decl_deprecated : Warning<
547   "access declarations are deprecated; use using declarations instead">,
548   InGroup<Deprecated>;
549 def err_access_decl : Error<
550   "ISO C++11 does not allow access declarations; "
551   "use using declarations instead">;
552 def warn_deprecated_copy_operation : Warning<
553   "definition of implicit copy %select{constructor|assignment operator}1 "
554   "for %0 is deprecated because it has a user-declared copy "
555   "%select{assignment operator|constructor}1">,
556   InGroup<DeprecatedCopy>, DefaultIgnore;
557 def warn_deprecated_copy_dtor_operation : Warning<
558   "definition of implicit copy %select{constructor|assignment operator}1 "
559   "for %0 is deprecated because it has a user-declared destructor">,
560   InGroup<DeprecatedCopyDtor>, DefaultIgnore;
561 def warn_cxx17_compat_exception_spec_in_signature : Warning<
562   "mangled name of %0 will change in C++17 due to non-throwing exception "
563   "specification in function signature">, InGroup<CXX17CompatMangling>;
564
565 def warn_global_constructor : Warning<
566   "declaration requires a global constructor">,
567   InGroup<GlobalConstructors>, DefaultIgnore;
568 def warn_global_destructor : Warning<
569   "declaration requires a global destructor">,
570    InGroup<GlobalConstructors>, DefaultIgnore;
571 def warn_exit_time_destructor : Warning<
572   "declaration requires an exit-time destructor">,
573   InGroup<ExitTimeDestructors>, DefaultIgnore;
574
575 def err_invalid_thread : Error<
576   "'%0' is only allowed on variable declarations">;
577 def err_thread_non_global : Error<
578   "'%0' variables must have global storage">;
579 def err_thread_unsupported : Error<
580   "thread-local storage is not supported for the current target">;
581
582 // FIXME: Combine fallout warnings to just one warning.
583 def warn_maybe_falloff_nonvoid_function : Warning<
584   "non-void function does not return a value in all control paths">,
585   InGroup<ReturnType>;
586 def warn_falloff_nonvoid_function : Warning<
587   "non-void function does not return a value">,
588   InGroup<ReturnType>;
589 def err_maybe_falloff_nonvoid_block : Error<
590   "non-void block does not return a value in all control paths">;
591 def err_falloff_nonvoid_block : Error<
592   "non-void block does not return a value">;
593 def warn_maybe_falloff_nonvoid_coroutine : Warning<
594   "non-void coroutine does not return a value in all control paths">,
595   InGroup<ReturnType>;
596 def warn_falloff_nonvoid_coroutine : Warning<
597   "non-void coroutine does not return a value">,
598   InGroup<ReturnType>;
599 def warn_suggest_noreturn_function : Warning<
600   "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
601   InGroup<MissingNoreturn>, DefaultIgnore;
602 def warn_suggest_noreturn_block : Warning<
603   "block could be declared with attribute 'noreturn'">,
604   InGroup<MissingNoreturn>, DefaultIgnore;
605
606 // Unreachable code.
607 def warn_unreachable : Warning<
608   "code will never be executed">,
609   InGroup<UnreachableCode>, DefaultIgnore;
610 def warn_unreachable_break : Warning<
611   "'break' will never be executed">,
612   InGroup<UnreachableCodeBreak>, DefaultIgnore;
613 def warn_unreachable_return : Warning<
614   "'return' will never be executed">,
615   InGroup<UnreachableCodeReturn>, DefaultIgnore;
616 def warn_unreachable_loop_increment : Warning<
617   "loop will run at most once (loop increment never executed)">,
618   InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
619 def note_unreachable_silence : Note<
620   "silence by adding parentheses to mark code as explicitly dead">;
621
622 /// Built-in functions.
623 def ext_implicit_lib_function_decl : ExtWarn<
624   "implicitly declaring library function '%0' with type %1">,
625   InGroup<ImplicitFunctionDeclare>;
626 def note_include_header_or_declare : Note<
627   "include the header <%0> or explicitly provide a declaration for '%1'">;
628 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
629 def warn_implicit_decl_no_jmp_buf
630     : Warning<"declaration of built-in function '%0' requires the declaration"
631     " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
632       InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
633 def warn_implicit_decl_requires_sysheader : Warning<
634   "declaration of built-in function '%1' requires inclusion of the header <%0>">,
635   InGroup<BuiltinRequiresHeader>;
636 def warn_redecl_library_builtin : Warning<
637   "incompatible redeclaration of library function %0">,
638   InGroup<DiagGroup<"incompatible-library-redeclaration">>;
639 def err_builtin_definition : Error<"definition of builtin function %0">;
640 def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
641 def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
642 def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
643 def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
644 def err_invalid_cpu_specific_dispatch_value : Error<
645 "invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
646 def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
647   InGroup<ImplicitFunctionDeclare>, DefaultError;
648 def warn_cstruct_memaccess : Warning<
649   "%select{destination for|source of|first operand of|second operand of}0 this "
650   "%1 call is a pointer to record %2 that is not trivial to "
651   "%select{primitive-default-initialize|primitive-copy}3">,
652   InGroup<NonTrivialMemaccess>;
653 def note_nontrivial_field : Note<
654   "field is non-trivial to %select{copy|default-initialize}0">;
655 def err_non_trivial_c_union_in_invalid_context : Error<
656   "cannot %select{"
657   "use type %1 for a function/method parameter|"
658   "use type %1 for function/method return|"
659   "default-initialize an object of type %1|"
660   "declare an automatic variable of type %1|"
661   "copy-initialize an object of type %1|"
662   "assign to a variable of type %1|"
663   "construct an automatic compound literal of type %1|"
664   "capture a variable of type %1|"
665   "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
666   "}3 "
667   "since it %select{contains|is}2 a union that is non-trivial to "
668   "%select{default-initialize|destruct|copy}0">;
669 def note_non_trivial_c_union : Note<
670   "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
671   "non-trivial to %select{default-initialize|destruct|copy}1">;
672 def warn_dyn_class_memaccess : Warning<
673   "%select{destination for|source of|first operand of|second operand of}0 this "
674   "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
675   "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
676   InGroup<DynamicClassMemaccess>;
677 def note_bad_memaccess_silence : Note<
678   "explicitly cast the pointer to silence this warning">;
679 def warn_sizeof_pointer_expr_memaccess : Warning<
680   "'%0' call operates on objects of type %1 while the size is based on a "
681   "different type %2">,
682   InGroup<SizeofPointerMemaccess>;
683 def warn_sizeof_pointer_expr_memaccess_note : Note<
684   "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
685   "it by the number of elements)|remove the addressof in the argument to "
686   "'sizeof' (and multiply it by the number of elements)|provide an explicit "
687   "length}0?">;
688 def warn_sizeof_pointer_type_memaccess : Warning<
689   "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
690   "%select{destination|source}2; expected %3 or an explicit length">,
691   InGroup<SizeofPointerMemaccess>;
692 def warn_strlcpycat_wrong_size : Warning<
693   "size argument in %0 call appears to be size of the source; "
694   "expected the size of the destination">,
695   InGroup<DiagGroup<"strlcpy-strlcat-size">>;
696 def note_strlcpycat_wrong_size : Note<
697   "change size argument to be the size of the destination">;
698 def warn_memsize_comparison : Warning<
699   "size argument in %0 call is a comparison">,
700   InGroup<DiagGroup<"memsize-comparison">>;
701 def note_memsize_comparison_paren : Note<
702   "did you mean to compare the result of %0 instead?">;
703 def note_memsize_comparison_cast_silence : Note<
704   "explicitly cast the argument to size_t to silence this warning">;
705 def warn_suspicious_sizeof_memset : Warning<
706   "%select{'size' argument to memset is '0'|"
707   "setting buffer to a 'sizeof' expression}0"
708   "; did you mean to transpose the last two arguments?">,
709   InGroup<MemsetTransposedArgs>;
710 def note_suspicious_sizeof_memset_silence : Note<
711   "%select{parenthesize the third argument|"
712   "cast the second argument to 'int'}0 to silence">;
713 def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
714   InGroup<SuspiciousBzero>;
715 def note_suspicious_bzero_size_silence : Note<
716   "parenthesize the second argument to silence">;
717
718 def warn_strncat_large_size : Warning<
719   "the value of the size argument in 'strncat' is too large, might lead to a "
720   "buffer overflow">, InGroup<StrncatSize>;
721 def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
722   "to be size of the source">, InGroup<StrncatSize>;
723 def warn_strncat_wrong_size : Warning<
724   "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
725 def note_strncat_wrong_size : Note<
726   "change the argument to be the free space in the destination buffer minus "
727   "the terminating null byte">;
728
729 def warn_assume_side_effects : Warning<
730   "the argument to %0 has side effects that will be discarded">,
731   InGroup<DiagGroup<"assume">>;
732
733 def warn_builtin_chk_overflow : Warning<
734   "'%0' will always overflow; destination buffer has size %1,"
735   " but size argument is %2">,
736   InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
737
738 def warn_fortify_source_overflow
739   : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
740 def warn_fortify_source_size_mismatch : Warning<
741   "'%0' size argument is too large; destination buffer has size %1,"
742   " but size argument is %2">, InGroup<FortifySource>;
743
744 /// main()
745 // static main() is not an error in C, just in C++.
746 def warn_static_main : Warning<"'main' should not be declared static">,
747     InGroup<Main>;
748 def err_static_main : Error<"'main' is not allowed to be declared static">;
749 def err_inline_main : Error<"'main' is not allowed to be declared inline">;
750 def ext_variadic_main : ExtWarn<
751   "'main' is not allowed to be declared variadic">, InGroup<Main>;
752 def ext_noreturn_main : ExtWarn<
753   "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
754 def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
755 def err_constexpr_main : Error<
756   "'main' is not allowed to be declared %select{constexpr|consteval}0">;
757 def err_deleted_main : Error<"'main' is not allowed to be deleted">;
758 def err_mainlike_template_decl : Error<"%0 cannot be a template">;
759 def err_main_returns_nonint : Error<"'main' must return 'int'">;
760 def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
761     InGroup<MainReturnType>;
762 def note_main_change_return_type : Note<"change return type to 'int'">;
763 def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
764     "must be 0, 2, or 3">;
765 def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
766     InGroup<Main>;
767 def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
768     "parameter of 'main' (%select{argument count|argument array|environment|"
769     "platform-specific data}0) must be of type %1">;
770 def warn_main_returns_bool_literal : Warning<"bool literal returned from "
771     "'main'">, InGroup<Main>;
772 def err_main_global_variable :
773     Error<"main cannot be declared as global variable">;
774 def warn_main_redefined : Warning<"variable named 'main' with external linkage "
775     "has undefined behavior">, InGroup<Main>;
776 def ext_main_used : Extension<
777   "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
778
779 /// parser diagnostics
780 def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
781   InGroup<MissingDeclarations>;
782 def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
783   InGroup<MissingDeclarations>;
784 def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
785 def err_typedef_changes_linkage : Error<"unsupported: typedef changes linkage"
786   " of anonymous type, but linkage was already computed">;
787 def note_typedef_changes_linkage : Note<"use a tag name here to establish "
788   "linkage prior to definition">;
789 def err_statically_allocated_object : Error<
790   "interface type cannot be statically allocated">;
791 def err_object_cannot_be_passed_returned_by_value : Error<
792   "interface type %1 cannot be %select{returned|passed}0 by value"
793   "; did you forget * in %1?">;
794 def err_parameters_retval_cannot_have_fp16_type : Error<
795   "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
796 def err_opencl_half_load_store : Error<
797   "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
798   "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
799 def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
800 def err_opencl_half_declaration : Error<
801   "declaring variable of type %0 is not allowed">;
802 def err_opencl_half_param : Error<
803   "declaring function parameter of type %0 is not allowed; did you forget * ?">;
804 def err_opencl_invalid_return : Error<
805   "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
806 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
807 def warn_pragma_options_align_reset_failed : Warning<
808   "#pragma options align=reset failed: %0">,
809   InGroup<IgnoredPragmas>;
810 def err_pragma_options_align_mac68k_target_unsupported : Error<
811   "mac68k alignment pragma is not supported on this target">;
812 def warn_pragma_pack_invalid_alignment : Warning<
813   "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
814   InGroup<IgnoredPragmas>;
815 def warn_pragma_pack_non_default_at_include : Warning<
816   "non-default #pragma pack value changes the alignment of struct or union "
817   "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
818   DefaultIgnore;
819 def warn_pragma_pack_modified_after_include : Warning<
820   "the current #pragma pack alignment value is modified in the included "
821   "file">, InGroup<PragmaPack>;
822 def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
823   "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
824 def note_pragma_pack_here : Note<
825   "previous '#pragma pack' directive that modifies alignment is here">;
826 def note_pragma_pack_pop_instead_reset : Note<
827   "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
828 // Follow the Microsoft implementation.
829 def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
830 def warn_pragma_pack_pop_identifier_and_alignment : Warning<
831   "specifying both a name and alignment to 'pop' is undefined">;
832 def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
833   InGroup<IgnoredPragmas>;
834 def warn_cxx_ms_struct :
835   Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
836           "with base classes or virtual functions">,
837   DefaultError, InGroup<IncompatibleMSStruct>;
838 def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
839 def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
840 def err_invalid_super_scope : Error<"invalid use of '__super', "
841   "this keyword can only be used inside class or member function scope">;
842 def err_super_in_lambda_unsupported : Error<
843   "use of '__super' inside a lambda is unsupported">;
844
845 def warn_pragma_unused_undeclared_var : Warning<
846   "undeclared variable %0 used as an argument for '#pragma unused'">,
847   InGroup<IgnoredPragmas>;
848 def warn_atl_uuid_deprecated : Warning<
849   "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
850   InGroup<DeprecatedDeclarations>;
851 def warn_pragma_unused_expected_var_arg : Warning<
852   "only variables can be arguments to '#pragma unused'">,
853   InGroup<IgnoredPragmas>;
854 def err_pragma_push_visibility_mismatch : Error<
855   "#pragma visibility push with no matching #pragma visibility pop">;
856 def note_surrounding_namespace_ends_here : Note<
857   "surrounding namespace with visibility attribute ends here">;
858 def err_pragma_pop_visibility_mismatch : Error<
859   "#pragma visibility pop with no matching #pragma visibility push">;
860 def note_surrounding_namespace_starts_here : Note<
861   "surrounding namespace with visibility attribute starts here">;
862 def err_pragma_loop_invalid_argument_type : Error<
863   "invalid argument of type %0; expected an integer type">;
864 def err_pragma_loop_invalid_argument_value : Error<
865   "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
866 def err_pragma_loop_compatibility : Error<
867   "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
868 def err_pragma_loop_precedes_nonloop : Error<
869   "expected a for, while, or do-while loop to follow '%0'">;
870
871 def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
872   "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
873   "those declarations">;
874 def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
875   "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
876 def err_pragma_attribute_invalid_matchers : Error<
877   "attribute %0 can't be applied to %1">;
878 def err_pragma_attribute_stack_mismatch : Error<
879   "'#pragma clang attribute %select{%1.|}0pop' with no matching"
880   " '#pragma clang attribute %select{%1.|}0push'">;
881 def warn_pragma_attribute_unused : Warning<
882   "unused attribute %0 in '#pragma clang attribute push' region">,
883   InGroup<PragmaClangAttribute>;
884 def note_pragma_attribute_region_ends_here : Note<
885   "'#pragma clang attribute push' regions ends here">;
886 def err_pragma_attribute_no_pop_eof : Error<"unterminated "
887   "'#pragma clang attribute push' at end of file">;
888 def note_pragma_attribute_applied_decl_here : Note<
889   "when applied to this declaration">;
890 def err_pragma_attr_attr_no_push : Error<
891   "'#pragma clang attribute' attribute with no matching "
892   "'#pragma clang attribute push'">;
893
894 /// Objective-C parser diagnostics
895 def err_duplicate_class_def : Error<
896   "duplicate interface definition for class %0">;
897 def err_undef_superclass : Error<
898   "cannot find interface declaration for %0, superclass of %1">;
899 def err_forward_superclass : Error<
900   "attempting to use the forward class %0 as superclass of %1">;
901 def err_no_nsconstant_string_class : Error<
902   "cannot find interface declaration for %0">;
903 def err_recursive_superclass : Error<
904   "trying to recursively use %0 as superclass of %1">;
905 def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
906 def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
907 def warn_duplicate_protocol_def : Warning<
908   "duplicate protocol definition of %0 is ignored">,
909   InGroup<DiagGroup<"duplicate-protocol">>;
910 def err_protocol_has_circular_dependency : Error<
911   "protocol has circular dependency">;
912 def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
913 def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
914 def err_atprotocol_protocol : Error<
915   "@protocol is using a forward protocol declaration of %0">;
916 def warn_readonly_property : Warning<
917   "attribute 'readonly' of property %0 restricts attribute "
918   "'readwrite' of property inherited from %1">,
919   InGroup<PropertyAttr>;
920
921 def warn_property_attribute : Warning<
922   "'%1' attribute on property %0 does not match the property inherited from %2">,
923   InGroup<PropertyAttr>;
924 def warn_property_types_are_incompatible : Warning<
925   "property type %0 is incompatible with type %1 inherited from %2">,
926   InGroup<DiagGroup<"incompatible-property-type">>;
927 def warn_protocol_property_mismatch : Warning<
928   "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
929   "getter %1|with setter %1}0 was selected for synthesis">,
930   InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
931 def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
932 def err_undef_interface : Error<"cannot find interface declaration for %0">;
933 def err_category_forward_interface : Error<
934   "cannot define %select{category|class extension}0 for undefined class %1">;
935 def err_class_extension_after_impl : Error<
936   "cannot declare class extension for %0 after class implementation">;
937 def note_implementation_declared : Note<
938   "class implementation is declared here">;
939 def note_while_in_implementation : Note<
940   "detected while default synthesizing properties in class implementation">;
941 def note_class_declared : Note<
942   "class is declared here">;
943 def note_receiver_class_declared : Note<
944   "receiver is instance of class declared here">;
945 def note_receiver_expr_here : Note<
946   "receiver expression is here">;
947 def note_receiver_is_id : Note<
948   "receiver is treated with 'id' type for purpose of method lookup">;
949 def note_suppressed_class_declare : Note<
950   "class with specified objc_requires_property_definitions attribute is declared here">;
951 def err_objc_root_class_subclass : Error<
952   "objc_root_class attribute may only be specified on a root class declaration">;
953 def err_restricted_superclass_mismatch : Error<
954   "cannot subclass a class that was declared with the "
955   "'objc_subclassing_restricted' attribute">;
956 def err_class_stub_subclassing_mismatch : Error<
957   "'objc_class_stub' attribute cannot be specified on a class that does not "
958   "have the 'objc_subclassing_restricted' attribute">;
959 def err_implementation_of_class_stub : Error<
960   "cannot declare implementation of a class declared with the "
961   "'objc_class_stub' attribute">;
962 def warn_objc_root_class_missing : Warning<
963   "class %0 defined without specifying a base class">,
964   InGroup<ObjCRootClass>;
965 def err_objc_runtime_visible_category : Error<
966   "cannot implement a category for class %0 that is only visible via the "
967   "Objective-C runtime">;
968 def err_objc_runtime_visible_subclass : Error<
969   "cannot implement subclass %0 of a superclass %1 that is only visible via the "
970   "Objective-C runtime">;
971 def note_objc_needs_superclass : Note<
972   "add a super class to fix this problem">;
973 def err_conflicting_super_class : Error<"conflicting super class name %0">;
974 def err_dup_implementation_class : Error<"reimplementation of class %0">;
975 def err_dup_implementation_category : Error<
976   "reimplementation of category %1 for class %0">;
977 def err_conflicting_ivar_type : Error<
978   "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
979 def err_duplicate_ivar_declaration : Error<
980   "instance variable is already declared">;
981 def warn_on_superclass_use : Warning<
982   "class implementation may not have super class">;
983 def err_conflicting_ivar_bitwidth : Error<
984   "instance variable %0 has conflicting bit-field width">;
985 def err_conflicting_ivar_name : Error<
986   "conflicting instance variable names: %0 vs %1">;
987 def err_inconsistent_ivar_count : Error<
988   "inconsistent number of instance variables specified">;
989 def warn_undef_method_impl : Warning<"method definition for %0 not found">,
990   InGroup<DiagGroup<"incomplete-implementation">>;
991 def warn_objc_boxing_invalid_utf8_string : Warning<
992   "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
993   InGroup<ObjCBoxing>;
994
995 def err_objc_direct_on_protocol : Error<
996   "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
997   "declared in an Objective-C protocol">;
998 def err_objc_direct_duplicate_decl : Error<
999   "%select{|direct }0method declaration conflicts "
1000   "with previous %select{|direct }1declaration of method %2">;
1001 def err_objc_direct_impl_decl_mismatch : Error<
1002   "direct method was declared in %select{the primary interface|an extension|a category}0 "
1003   "but is implemented in %select{the primary interface|a category|a different category}1">;
1004 def err_objc_direct_missing_on_decl : Error<
1005   "direct method implementation was previously declared not direct">;
1006 def err_objc_direct_on_override : Error<
1007   "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1008 def err_objc_override_direct_method : Error<
1009   "cannot override a method that is declared direct by a superclass">;
1010 def warn_objc_direct_ignored : Warning<
1011   "%0 attribute isn't implemented by this Objective-C runtime">,
1012   InGroup<IgnoredAttributes>;
1013 def warn_objc_direct_property_ignored : Warning<
1014   "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1015   InGroup<IgnoredAttributes>;
1016
1017 def warn_conflicting_overriding_ret_types : Warning<
1018   "conflicting return type in "
1019   "declaration of %0%diff{: $ vs $|}1,2">,
1020   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1021
1022 def warn_conflicting_ret_types : Warning<
1023   "conflicting return type in "
1024   "implementation of %0%diff{: $ vs $|}1,2">,
1025   InGroup<MismatchedReturnTypes>;
1026
1027 def warn_conflicting_overriding_ret_type_modifiers : Warning<
1028   "conflicting distributed object modifiers on return type "
1029   "in declaration of %0">,
1030   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1031
1032 def warn_conflicting_ret_type_modifiers : Warning<
1033   "conflicting distributed object modifiers on return type "
1034   "in implementation of %0">,
1035   InGroup<DistributedObjectModifiers>;
1036
1037 def warn_non_covariant_overriding_ret_types : Warning<
1038   "conflicting return type in "
1039   "declaration of %0: %1 vs %2">,
1040   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1041
1042 def warn_non_covariant_ret_types : Warning<
1043   "conflicting return type in "
1044   "implementation of %0: %1 vs %2">,
1045   InGroup<MethodSignatures>, DefaultIgnore;
1046
1047 def warn_conflicting_overriding_param_types : Warning<
1048   "conflicting parameter types in "
1049   "declaration of %0%diff{: $ vs $|}1,2">,
1050   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1051
1052 def warn_conflicting_param_types : Warning<
1053   "conflicting parameter types in "
1054   "implementation of %0%diff{: $ vs $|}1,2">,
1055   InGroup<MismatchedParameterTypes>;
1056
1057 def warn_conflicting_param_modifiers : Warning<
1058   "conflicting distributed object modifiers on parameter type "
1059   "in implementation of %0">,
1060   InGroup<DistributedObjectModifiers>;
1061
1062 def warn_conflicting_overriding_param_modifiers : Warning<
1063   "conflicting distributed object modifiers on parameter type "
1064   "in declaration of %0">,
1065   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1066
1067 def warn_non_contravariant_overriding_param_types : Warning<
1068   "conflicting parameter types in "
1069   "declaration of %0: %1 vs %2">,
1070   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1071
1072 def warn_non_contravariant_param_types : Warning<
1073   "conflicting parameter types in "
1074   "implementation of %0: %1 vs %2">,
1075   InGroup<MethodSignatures>, DefaultIgnore;
1076
1077 def warn_conflicting_overriding_variadic :Warning<
1078   "conflicting variadic declaration of method and its "
1079   "implementation">,
1080   InGroup<OverridingMethodMismatch>, DefaultIgnore;
1081
1082 def warn_conflicting_variadic :Warning<
1083   "conflicting variadic declaration of method and its "
1084   "implementation">;
1085
1086 def warn_category_method_impl_match:Warning<
1087   "category is implementing a method which will also be implemented"
1088   " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1089
1090 def warn_implements_nscopying : Warning<
1091 "default assign attribute on property %0 which implements "
1092 "NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1093
1094 def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1095   InGroup<ObjCMultipleMethodNames>;
1096 def warn_strict_multiple_method_decl : Warning<
1097   "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1098 def warn_accessor_property_type_mismatch : Warning<
1099   "type of property %0 does not match type of accessor %1">;
1100 def note_conv_function_declared_at : Note<"type conversion function declared here">;
1101 def note_method_declared_at : Note<"method %0 declared here">;
1102 def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1103 def note_property_attribute : Note<"property %0 is declared "
1104   "%select{deprecated|unavailable|partial}1 here">;
1105 def err_setter_type_void : Error<"type of setter must be void">;
1106 def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1107 def warn_duplicate_method_decl :
1108   Warning<"multiple declarations of method %0 found and ignored">,
1109   InGroup<MethodDuplicate>, DefaultIgnore;
1110 def warn_objc_cdirective_format_string :
1111   Warning<"using %0 directive in %select{NSString|CFString}1 "
1112           "which is being passed as a formatting argument to the formatting "
1113           "%select{method|CFfunction}2">,
1114   InGroup<ObjCCStringFormat>, DefaultIgnore;
1115 def err_objc_var_decl_inclass :
1116     Error<"cannot declare variable inside @interface or @protocol">;
1117 def err_missing_method_context : Error<
1118   "missing context for method declaration">;
1119 def err_objc_property_attr_mutually_exclusive : Error<
1120   "property attributes '%0' and '%1' are mutually exclusive">;
1121 def err_objc_property_requires_object : Error<
1122   "property with '%0' attribute must be of object type">;
1123 def warn_objc_property_assign_on_object : Warning<
1124   "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1125   InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1126 def warn_objc_property_no_assignment_attribute : Warning<
1127   "no 'assign', 'retain', or 'copy' attribute is specified - "
1128   "'assign' is assumed">,
1129   InGroup<ObjCPropertyNoAttribute>;
1130 def warn_objc_isa_use : Warning<
1131   "direct access to Objective-C's isa is deprecated in favor of "
1132   "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1133 def warn_objc_isa_assign : Warning<
1134   "assignment to Objective-C's isa is deprecated in favor of "
1135   "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1136 def warn_objc_pointer_masking : Warning<
1137   "bitmasking for introspection of Objective-C object pointers is strongly "
1138   "discouraged">,
1139   InGroup<ObjCPointerIntrospect>;
1140 def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1141   InGroup<ObjCPointerIntrospectPerformSelector>;
1142 def warn_objc_property_default_assign_on_object : Warning<
1143   "default property attribute 'assign' not appropriate for object">,
1144   InGroup<ObjCPropertyNoAttribute>;
1145 def warn_property_attr_mismatch : Warning<
1146   "property attribute in class extension does not match the primary class">,
1147   InGroup<PropertyAttr>;
1148 def warn_property_implicitly_mismatched : Warning <
1149   "primary property declaration is implicitly strong while redeclaration "
1150   "in class extension is weak">,
1151   InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1152 def warn_objc_property_copy_missing_on_block : Warning<
1153     "'copy' attribute must be specified for the block property "
1154     "when -fobjc-gc-only is specified">;
1155 def warn_objc_property_retain_of_block : Warning<
1156     "retain'ed block property does not copy the block "
1157     "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1158 def warn_objc_readonly_property_has_setter : Warning<
1159     "setter cannot be specified for a readonly property">,
1160     InGroup<ObjCReadonlyPropertyHasSetter>;
1161 def warn_atomic_property_rule : Warning<
1162   "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1163   "with a user defined %select{getter|setter}2">,
1164   InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1165 def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1166   "synthesized, or both be user defined,or the property must be nonatomic">;
1167 def err_atomic_property_nontrivial_assign_op : Error<
1168   "atomic property of reference type %0 cannot have non-trivial assignment"
1169   " operator">;
1170 def warn_cocoa_naming_owned_rule : Warning<
1171   "property follows Cocoa naming"
1172   " convention for returning 'owned' objects">,
1173   InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1174 def err_cocoa_naming_owned_rule : Error<
1175   "property follows Cocoa naming"
1176   " convention for returning 'owned' objects">;
1177 def note_cocoa_naming_declare_family : Note<
1178   "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1179   "object">;
1180 def warn_auto_synthesizing_protocol_property :Warning<
1181   "auto property synthesis will not synthesize property %0"
1182   " declared in protocol %1">,
1183   InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1184 def note_add_synthesize_directive : Note<
1185   "add a '@synthesize' directive">;
1186 def warn_no_autosynthesis_shared_ivar_property : Warning <
1187   "auto property synthesis will not synthesize property "
1188   "%0 because it cannot share an ivar with another synthesized property">,
1189   InGroup<ObjCNoPropertyAutoSynthesis>;
1190 def warn_no_autosynthesis_property : Warning<
1191   "auto property synthesis will not synthesize property "
1192   "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1193   "via another property">,
1194   InGroup<ObjCNoPropertyAutoSynthesis>;
1195 def warn_autosynthesis_property_in_superclass : Warning<
1196   "auto property synthesis will not synthesize property "
1197   "%0; it will be implemented by its superclass, use @dynamic to "
1198   "acknowledge intention">,
1199   InGroup<ObjCNoPropertyAutoSynthesis>;
1200 def warn_autosynthesis_property_ivar_match :Warning<
1201   "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1202   "%2, not existing instance variable %3">,
1203   InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1204 def warn_missing_explicit_synthesis : Warning <
1205   "auto property synthesis is synthesizing property not explicitly synthesized">,
1206   InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1207 def warn_property_getter_owning_mismatch : Warning<
1208   "property declared as returning non-retained objects"
1209   "; getter returning retained objects">;
1210 def warn_property_redecl_getter_mismatch : Warning<
1211   "getter name mismatch between property redeclaration (%1) and its original "
1212   "declaration (%0)">, InGroup<PropertyAttr>;
1213 def err_property_setter_ambiguous_use : Error<
1214   "synthesized properties %0 and %1 both claim setter %2 -"
1215   " use of this setter will cause unexpected behavior">;
1216 def warn_default_atomic_custom_getter_setter : Warning<
1217   "atomic by default property %0 has a user defined %select{getter|setter}1 "
1218   "(property should be marked 'atomic' if this is intended)">,
1219   InGroup<CustomAtomic>, DefaultIgnore;
1220 def err_use_continuation_class : Error<
1221   "illegal redeclaration of property in class extension %0"
1222   " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1223 def err_type_mismatch_continuation_class : Error<
1224   "type of property %0 in class extension does not match "
1225   "property type in primary class">;
1226 def err_use_continuation_class_redeclaration_readwrite : Error<
1227   "illegal redeclaration of 'readwrite' property in class extension %0"
1228   " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1229   "'readonly' public property?)">;
1230 def err_continuation_class : Error<"class extension has no primary class">;
1231 def err_property_type : Error<"property cannot have array or function type %0">;
1232 def err_missing_property_context : Error<
1233   "missing context for property implementation declaration">;
1234 def err_bad_property_decl : Error<
1235   "property implementation must have its declaration in interface %0 or one of "
1236   "its extensions">;
1237 def err_category_property : Error<
1238   "property declared in category %0 cannot be implemented in "
1239   "class implementation">;
1240 def note_property_declare : Note<
1241   "property declared here">;
1242 def note_protocol_property_declare : Note<
1243   "it could also be property "
1244   "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1245   "%1|with setter %1}0 declared here">;
1246 def note_property_synthesize : Note<
1247   "property synthesized here">;
1248 def err_synthesize_category_decl : Error<
1249   "@synthesize not allowed in a category's implementation">;
1250 def err_synthesize_on_class_property : Error<
1251   "@synthesize not allowed on a class property %0">;
1252 def err_missing_property_interface : Error<
1253   "property implementation in a category with no category declaration">;
1254 def err_bad_category_property_decl : Error<
1255   "property implementation must have its declaration in the category %0">;
1256 def err_bad_property_context : Error<
1257   "property implementation must be in a class or category implementation">;
1258 def err_missing_property_ivar_decl : Error<
1259   "synthesized property %0 must either be named the same as a compatible"
1260   " instance variable or must explicitly name an instance variable">;
1261 def err_arc_perform_selector_retains : Error<
1262   "performSelector names a selector which retains the object">;
1263 def warn_arc_perform_selector_leaks : Warning<
1264   "performSelector may cause a leak because its selector is unknown">,
1265   InGroup<DiagGroup<"arc-performSelector-leaks">>;
1266 def warn_dealloc_in_category : Warning<
1267 "-dealloc is being overridden in a category">,
1268 InGroup<DeallocInCategory>;
1269 def err_gc_weak_property_strong_type : Error<
1270   "weak attribute declared on a __strong type property in GC mode">;
1271 def warn_arc_repeated_use_of_weak : Warning <
1272   "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1273   "accessed multiple times in this %select{function|method|block|lambda}2 "
1274   "but may be unpredictably set to nil; assign to a strong variable to keep "
1275   "the object alive">,
1276   InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1277 def warn_implicitly_retains_self : Warning <
1278   "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1279   "this is intended behavior">,
1280   InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1281 def warn_arc_possible_repeated_use_of_weak : Warning <
1282   "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1283   "be accessed multiple times in this %select{function|method|block|lambda}2 "
1284   "and may be unpredictably set to nil; assign to a strong variable to keep "
1285   "the object alive">,
1286   InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1287 def note_arc_weak_also_accessed_here : Note<
1288   "also accessed here">;
1289 def err_incomplete_synthesized_property : Error<
1290   "cannot synthesize property %0 with incomplete type %1">;
1291
1292 def err_property_ivar_type : Error<
1293   "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1294 def err_property_accessor_type : Error<
1295   "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1296 def err_ivar_in_superclass_use : Error<
1297   "property %0 attempting to use instance variable %1 declared in super class %2">;
1298 def err_weak_property : Error<
1299   "existing instance variable %1 for __weak property %0 must be __weak">;
1300 def err_strong_property : Error<
1301   "existing instance variable %1 for strong property %0 may not be __weak">;
1302 def err_dynamic_property_ivar_decl : Error<
1303   "dynamic property cannot have instance variable specification">;
1304 def err_duplicate_ivar_use : Error<
1305   "synthesized properties %0 and %1 both claim instance variable %2">;
1306 def err_property_implemented : Error<"property %0 is already implemented">;
1307 def warn_objc_missing_super_call : Warning<
1308   "method possibly missing a [super %0] call">,
1309   InGroup<ObjCMissingSuperCalls>;
1310 def err_dealloc_bad_result_type : Error<
1311   "dealloc return type must be correctly specified as 'void' under ARC, "
1312   "instead of %0">;
1313 def warn_undeclared_selector : Warning<
1314   "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1315 def warn_undeclared_selector_with_typo : Warning<
1316   "undeclared selector %0; did you mean %1?">,
1317   InGroup<UndeclaredSelector>, DefaultIgnore;
1318 def warn_implicit_atomic_property : Warning<
1319   "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1320 def note_auto_readonly_iboutlet_fixup_suggest : Note<
1321   "property should be changed to be readwrite">;
1322 def warn_auto_readonly_iboutlet_property : Warning<
1323   "readonly IBOutlet property %0 when auto-synthesized may "
1324   "not work correctly with 'nib' loader">,
1325   InGroup<DiagGroup<"readonly-iboutlet-property">>;
1326 def warn_auto_implicit_atomic_property : Warning<
1327   "property is assumed atomic when auto-synthesizing the property">,
1328   InGroup<ImplicitAtomic>, DefaultIgnore;
1329 def warn_unimplemented_selector:  Warning<
1330   "no method with selector %0 is implemented in this translation unit">,
1331   InGroup<Selector>, DefaultIgnore;
1332 def warn_unimplemented_protocol_method : Warning<
1333   "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1334 def warn_multiple_selectors: Warning<
1335   "several methods with selector %0 of mismatched types are found "
1336   "for the @selector expression">,
1337   InGroup<SelectorTypeMismatch>, DefaultIgnore;
1338 def err_direct_selector_expression: Error<
1339   "@selector expression formed with direct selector %0">;
1340
1341 def err_objc_kindof_nonobject : Error<
1342   "'__kindof' specifier cannot be applied to non-object type %0">;
1343 def err_objc_kindof_wrong_position : Error<
1344   "'__kindof' type specifier must precede the declarator">;
1345
1346 def err_objc_method_unsupported_param_ret_type : Error<
1347   "%0 %select{parameter|return}1 type is unsupported; "
1348   "support for vector types for this target is introduced in %2">;
1349
1350 def warn_messaging_unqualified_id : Warning<
1351   "messaging unqualified id">, DefaultIgnore,
1352   InGroup<DiagGroup<"objc-messaging-id">>;
1353 def err_messaging_unqualified_id_with_direct_method : Error<
1354   "messaging unqualified id with a method that is possibly direct">;
1355 def err_messaging_super_with_direct_method : Error<
1356   "messaging super with a direct method">;
1357 def err_messaging_class_with_direct_method : Error<
1358   "messaging a Class with a method that is possibly direct">;
1359
1360 // C++ declarations
1361 def err_static_assert_expression_is_not_constant : Error<
1362   "static_assert expression is not an integral constant expression">;
1363 def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1364 def err_static_assert_requirement_failed : Error<
1365   "static_assert failed due to requirement '%0'%select{ %2|}1">;
1366
1367 def ext_inline_variable : ExtWarn<
1368   "inline variables are a C++17 extension">, InGroup<CXX17>;
1369 def warn_cxx14_compat_inline_variable : Warning<
1370   "inline variables are incompatible with C++ standards before C++17">,
1371   DefaultIgnore, InGroup<CXXPre17Compat>;
1372
1373 def warn_inline_namespace_reopened_noninline : Warning<
1374   "inline namespace reopened as a non-inline namespace">;
1375 def err_inline_namespace_mismatch : Error<
1376   "non-inline namespace cannot be reopened as inline">;
1377
1378 def err_unexpected_friend : Error<
1379   "friends can only be classes or functions">;
1380 def ext_enum_friend : ExtWarn<
1381   "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1382 def warn_cxx98_compat_enum_friend : Warning<
1383   "befriending enumeration type %0 is incompatible with C++98">,
1384   InGroup<CXX98Compat>, DefaultIgnore;
1385 def ext_nonclass_type_friend : ExtWarn<
1386   "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1387 def warn_cxx98_compat_nonclass_type_friend : Warning<
1388   "non-class friend type %0 is incompatible with C++98">,
1389   InGroup<CXX98Compat>, DefaultIgnore;
1390 def err_friend_is_member : Error<
1391   "friends cannot be members of the declaring class">;
1392 def warn_cxx98_compat_friend_is_member : Warning<
1393   "friend declaration naming a member of the declaring class is incompatible "
1394   "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1395 def ext_unelaborated_friend_type : ExtWarn<
1396   "unelaborated friend declaration is a C++11 extension; specify "
1397   "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1398   InGroup<CXX11>;
1399 def warn_cxx98_compat_unelaborated_friend_type : Warning<
1400   "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1401   "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1402 def err_qualified_friend_no_match : Error<
1403   "friend declaration of %0 does not match any declaration in %1">;
1404 def err_introducing_special_friend : Error<
1405   "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1406   " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1407   "as a friend">;
1408 def err_tagless_friend_type_template : Error<
1409   "friend type templates must use an elaborated type">;
1410 def err_no_matching_local_friend : Error<
1411   "no matching function found in local scope">;
1412 def err_no_matching_local_friend_suggest : Error<
1413   "no matching function %0 found in local scope; did you mean %3?">;
1414 def err_partial_specialization_friend : Error<
1415   "partial specialization cannot be declared as a friend">;
1416 def err_qualified_friend_def : Error<
1417   "friend function definition cannot be qualified with '%0'">;
1418 def err_friend_def_in_local_class : Error<
1419   "friend function cannot be defined in a local class">;
1420 def err_friend_not_first_in_declaration : Error<
1421   "'friend' must appear first in a non-function declaration">;
1422 def err_using_decl_friend : Error<
1423   "cannot befriend target of using declaration">;
1424 def warn_template_qualified_friend_unsupported : Warning<
1425   "dependent nested name specifier '%0' for friend class declaration is "
1426   "not supported; turning off access control for %1">,
1427   InGroup<UnsupportedFriend>;
1428 def warn_template_qualified_friend_ignored : Warning<
1429   "dependent nested name specifier '%0' for friend template declaration is "
1430   "not supported; ignoring this friend declaration">,
1431   InGroup<UnsupportedFriend>;
1432 def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1433   "unqualified friend declaration referring to type outside of the nearest "
1434   "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1435   InGroup<MicrosoftUnqualifiedFriend>;
1436 def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1437
1438 def err_invalid_base_in_interface : Error<
1439   "interface type cannot inherit from "
1440   "%select{struct|non-public interface|class}0 %1">;
1441
1442 def err_abstract_type_in_decl : Error<
1443   "%select{return|parameter|variable|field|instance variable|"
1444   "synthesized instance variable}0 type %1 is an abstract class">;
1445 def err_allocation_of_abstract_type : Error<
1446   "allocating an object of abstract class type %0">;
1447 def err_throw_abstract_type : Error<
1448   "cannot throw an object of abstract type %0">;
1449 def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1450 def err_capture_of_abstract_type : Error<
1451   "by-copy capture of value of abstract type %0">;
1452 def err_capture_of_incomplete_type : Error<
1453   "by-copy capture of variable %0 with incomplete type %1">;
1454 def err_capture_default_non_local : Error<
1455   "non-local lambda expression cannot have a capture-default">;
1456
1457 def err_multiple_final_overriders : Error<
1458   "virtual function %q0 has more than one final overrider in %1">;
1459 def note_final_overrider : Note<"final overrider of %q0 in %1">;
1460
1461 def err_type_defined_in_type_specifier : Error<
1462   "%0 cannot be defined in a type specifier">;
1463 def err_type_defined_in_result_type : Error<
1464   "%0 cannot be defined in the result type of a function">;
1465 def err_type_defined_in_param_type : Error<
1466   "%0 cannot be defined in a parameter type">;
1467 def err_type_defined_in_alias_template : Error<
1468   "%0 cannot be defined in a type alias template">;
1469 def err_type_defined_in_condition : Error<
1470   "%0 cannot be defined in a condition">;
1471 def err_type_defined_in_enum : Error<
1472   "%0 cannot be defined in an enumeration">;
1473
1474 def note_pure_virtual_function : Note<
1475   "unimplemented pure virtual method %0 in %1">;
1476
1477 def note_pure_qualified_call_kext : Note<
1478   "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1479
1480 def err_deleted_decl_not_first : Error<
1481   "deleted definition must be first declaration">;
1482
1483 def err_deleted_override : Error<
1484   "deleted function %0 cannot override a non-deleted function">;
1485
1486 def err_non_deleted_override : Error<
1487   "non-deleted function %0 cannot override a deleted function">;
1488
1489 def warn_weak_vtable : Warning<
1490   "%0 has no out-of-line virtual method definitions; its vtable will be "
1491   "emitted in every translation unit">,
1492   InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1493 def warn_weak_template_vtable : Warning<
1494   "explicit template instantiation %0 will emit a vtable in every "
1495   "translation unit">,
1496   InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1497
1498 def ext_using_undefined_std : ExtWarn<
1499   "using directive refers to implicitly-defined namespace 'std'">;
1500
1501 // C++ exception specifications
1502 def err_exception_spec_in_typedef : Error<
1503   "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1504 def err_distant_exception_spec : Error<
1505   "exception specifications are not allowed beyond a single level "
1506   "of indirection">;
1507 def err_incomplete_in_exception_spec : Error<
1508   "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1509   "in exception specification">;
1510 def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1511   InGroup<MicrosoftExceptionSpec>;
1512 def err_rref_in_exception_spec : Error<
1513   "rvalue reference type %0 is not allowed in exception specification">;
1514 def err_mismatched_exception_spec : Error<
1515   "exception specification in declaration does not match previous declaration">;
1516 def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1517   InGroup<MicrosoftExceptionSpec>;
1518 def err_override_exception_spec : Error<
1519   "exception specification of overriding function is more lax than "
1520   "base version">;
1521 def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1522   InGroup<MicrosoftExceptionSpec>;
1523 def err_incompatible_exception_specs : Error<
1524   "target exception specification is not superset of source">;
1525 def warn_incompatible_exception_specs : Warning<
1526   err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1527 def err_deep_exception_specs_differ : Error<
1528   "exception specifications of %select{return|argument}0 types differ">;
1529 def warn_deep_exception_specs_differ : Warning<
1530   err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1531 def err_missing_exception_specification : Error<
1532   "%0 is missing exception specification '%1'">;
1533 def ext_missing_exception_specification : ExtWarn<
1534   err_missing_exception_specification.Text>,
1535   InGroup<DiagGroup<"missing-exception-spec">>;
1536 def ext_ms_missing_exception_specification : ExtWarn<
1537   err_missing_exception_specification.Text>,
1538   InGroup<MicrosoftExceptionSpec>;
1539 def err_noexcept_needs_constant_expression : Error<
1540   "argument to noexcept specifier must be a constant expression">;
1541 def err_exception_spec_not_parsed : Error<
1542   "exception specification is not available until end of class definition">;
1543 def err_exception_spec_cycle : Error<
1544   "exception specification of %0 uses itself">;
1545 def err_exception_spec_incomplete_type : Error<
1546   "exception specification needed for member of incomplete class %0">;
1547
1548 // C++ access checking
1549 def err_class_redeclared_with_different_access : Error<
1550   "%0 redeclared with '%1' access">;
1551 def err_access : Error<
1552   "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1553 def ext_ms_using_declaration_inaccessible : ExtWarn<
1554   "using declaration referring to inaccessible member '%0' (which refers "
1555   "to accessible member '%1') is a Microsoft compatibility extension">,
1556     AccessControl, InGroup<MicrosoftUsingDecl>;
1557 def err_access_ctor : Error<
1558   "calling a %select{private|protected}0 constructor of class %2">,
1559   AccessControl;
1560 def ext_rvalue_to_reference_access_ctor : Extension<
1561   "C++98 requires an accessible copy constructor for class %2 when binding "
1562   "a reference to a temporary; was %select{private|protected}0">,
1563   AccessControl, InGroup<BindToTemporaryCopy>;
1564 def err_access_base_ctor : Error<
1565   // The ERRORs represent other special members that aren't constructors, in
1566   // hopes that someone will bother noticing and reporting if they appear
1567   "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1568   "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1569   "|*ERROR*|}2constructor">, AccessControl;
1570 def err_access_field_ctor : Error<
1571   // The ERRORs represent other special members that aren't constructors, in
1572   // hopes that someone will bother noticing and reporting if they appear
1573   "field of type %0 has %select{private|protected}2 "
1574   "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1575   AccessControl;
1576 def err_access_friend_function : Error<
1577   "friend function %1 is a %select{private|protected}0 member of %3">,
1578   AccessControl;
1579
1580 def err_access_dtor : Error<
1581   "calling a %select{private|protected}1 destructor of class %0">,
1582   AccessControl;
1583 def err_access_dtor_base :
1584     Error<"base class %0 has %select{private|protected}1 destructor">,
1585     AccessControl;
1586 def err_access_dtor_vbase :
1587     Error<"inherited virtual base class %1 has "
1588     "%select{private|protected}2 destructor">,
1589     AccessControl;
1590 def err_access_dtor_temp :
1591     Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1592     AccessControl;
1593 def err_access_dtor_exception :
1594     Error<"exception object of type %0 has %select{private|protected}1 "
1595           "destructor">, AccessControl;
1596 def err_access_dtor_field :
1597     Error<"field of type %1 has %select{private|protected}2 destructor">,
1598     AccessControl;
1599 def err_access_dtor_var :
1600     Error<"variable of type %1 has %select{private|protected}2 destructor">,
1601     AccessControl;
1602 def err_access_dtor_ivar :
1603     Error<"instance variable of type %0 has %select{private|protected}1 "
1604           "destructor">,
1605     AccessControl;
1606 def note_previous_access_declaration : Note<
1607   "previously declared '%1' here">;
1608 def note_access_natural : Note<
1609   "%select{|implicitly }1declared %select{private|protected}0 here">;
1610 def note_access_constrained_by_path : Note<
1611   "constrained by %select{|implicitly }1%select{private|protected}0"
1612   " inheritance here">;
1613 def note_access_protected_restricted_noobject : Note<
1614   "must name member using the type of the current context %0">;
1615 def note_access_protected_restricted_ctordtor : Note<
1616   "protected %select{constructor|destructor}0 can only be used to "
1617   "%select{construct|destroy}0 a base class subobject">;
1618 def note_access_protected_restricted_object : Note<
1619   "can only access this member on an object of type %0">;
1620 def warn_cxx98_compat_sfinae_access_control : Warning<
1621   "substitution failure due to access control is incompatible with C++98">,
1622   InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1623
1624 // C++ name lookup
1625 def err_incomplete_nested_name_spec : Error<
1626   "incomplete type %0 named in nested name specifier">;
1627 def err_dependent_nested_name_spec : Error<
1628   "nested name specifier for a declaration cannot depend on a template "
1629   "parameter">;
1630 def err_nested_name_member_ref_lookup_ambiguous : Error<
1631   "lookup of %0 in member access expression is ambiguous">;
1632 def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1633   "lookup of %0 in member access expression is ambiguous; using member of %1">,
1634   InGroup<AmbigMemberTemplate>;
1635 def note_ambig_member_ref_object_type : Note<
1636   "lookup in the object type %0 refers here">;
1637 def note_ambig_member_ref_scope : Note<
1638   "lookup from the current scope refers here">;
1639 def err_qualified_member_nonclass : Error<
1640   "qualified member access refers to a member in %0">;
1641 def err_incomplete_member_access : Error<
1642   "member access into incomplete type %0">;
1643 def err_incomplete_type : Error<
1644   "incomplete type %0 where a complete type is required">;
1645 def warn_cxx98_compat_enum_nested_name_spec : Warning<
1646   "enumeration type in nested name specifier is incompatible with C++98">,
1647   InGroup<CXX98Compat>, DefaultIgnore;
1648 def err_nested_name_spec_is_not_class : Error<
1649   "%0 cannot appear before '::' because it is not a class"
1650   "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1651 def ext_nested_name_spec_is_enum : ExtWarn<
1652   "use of enumeration in a nested name specifier is a C++11 extension">,
1653   InGroup<CXX11>;
1654 def err_out_of_line_qualified_id_type_names_constructor : Error<
1655   "qualified reference to %0 is a constructor name rather than a "
1656   "%select{template name|type}1 in this context">;
1657 def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1658   "ISO C++ specifies that "
1659   "qualified reference to %0 is a constructor name rather than a "
1660   "%select{template name|type}1 in this context, despite preceding "
1661   "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1662   InGroup<DiagGroup<"injected-class-name">>;
1663
1664 // C++ class members
1665 def err_storageclass_invalid_for_member : Error<
1666   "storage class specified for a member declaration">;
1667 def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1668 def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1669 def ext_mutable_reference : ExtWarn<
1670   "'mutable' on a reference type is a Microsoft extension">,
1671   InGroup<MicrosoftMutableReference>;
1672 def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1673 def err_mutable_nonmember : Error<
1674   "'mutable' can only be applied to member variables">;
1675 def err_virtual_in_union : Error<
1676   "unions cannot have virtual functions">;
1677 def err_virtual_non_function : Error<
1678   "'virtual' can only appear on non-static member functions">;
1679 def err_virtual_out_of_class : Error<
1680   "'virtual' can only be specified inside the class definition">;
1681 def err_virtual_member_function_template : Error<
1682   "'virtual' cannot be specified on member function templates">;
1683 def err_static_overrides_virtual : Error<
1684   "'static' member function %0 overrides a virtual function in a base class">;
1685 def err_explicit_non_function : Error<
1686   "'explicit' can only appear on non-static member functions">;
1687 def err_explicit_out_of_class : Error<
1688   "'explicit' can only be specified inside the class definition">;
1689 def err_explicit_non_ctor_or_conv_function : Error<
1690   "'explicit' can only be applied to a constructor or conversion function">;
1691 def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1692 def err_static_out_of_line : Error<
1693   "'static' can only be specified inside the class definition">;
1694 def ext_static_out_of_line : ExtWarn<
1695   err_static_out_of_line.Text>,
1696   InGroup<MicrosoftTemplate>;
1697 def err_storage_class_for_static_member : Error<
1698   "static data member definition cannot specify a storage class">;
1699 def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1700 def err_not_integral_type_bitfield : Error<
1701   "bit-field %0 has non-integral type %1">;
1702 def err_not_integral_type_anon_bitfield : Error<
1703   "anonymous bit-field has non-integral type %0">;
1704 def err_anon_bitfield_qualifiers : Error<
1705   "anonymous bit-field cannot have qualifiers">;
1706 def err_member_function_initialization : Error<
1707   "initializer on function does not look like a pure-specifier">;
1708 def err_non_virtual_pure : Error<
1709   "%0 is not virtual and cannot be declared pure">;
1710 def ext_pure_function_definition : ExtWarn<
1711   "function definition with pure-specifier is a Microsoft extension">,
1712   InGroup<MicrosoftPureDefinition>;
1713 def err_qualified_member_of_unrelated : Error<
1714   "%q0 is not a member of class %1">;
1715
1716 def err_member_function_call_bad_cvr : Error<
1717   "'this' argument to member function %0 has type %1, but function is not marked "
1718   "%select{const|restrict|const or restrict|volatile|const or volatile|"
1719   "volatile or restrict|const, volatile, or restrict}2">;
1720 def err_member_function_call_bad_ref : Error<
1721   "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1722   "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1723 def err_member_function_call_bad_type : Error<
1724   "cannot initialize object parameter of type %0 with an expression "
1725   "of type %1">;
1726
1727 def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1728   "call to pure virtual member function %0 has undefined behavior; "
1729   "overrides of %0 in subclasses are not available in the "
1730   "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1731
1732 def select_special_member_kind : TextSubstitution<
1733   "%select{default constructor|copy constructor|move constructor|"
1734   "copy assignment operator|move assignment operator|destructor}0">;
1735
1736 def note_member_declared_at : Note<"member is declared here">;
1737 def note_ivar_decl : Note<"instance variable is declared here">;
1738 def note_bitfield_decl : Note<"bit-field is declared here">;
1739 def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1740 def note_member_synthesized_at : Note<
1741   "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1742   "first required here">;
1743 def note_comparison_synthesized_at : Note<
1744   "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1745   "first required here">;
1746 def err_missing_default_ctor : Error<
1747   "%select{constructor for %1 must explicitly initialize the|"
1748   "implicit default constructor for %1 must explicitly initialize the|"
1749   "cannot use constructor inherited from base class %4;}0 "
1750   "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1751   "does not have a default constructor">;
1752 def note_due_to_dllexported_class : Note<
1753   "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1754
1755 def err_illegal_union_or_anon_struct_member : Error<
1756   "%select{anonymous struct|union}0 member %1 has a non-trivial "
1757   "%sub{select_special_member_kind}2">;
1758 def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1759   "%select{anonymous struct|union}0 member %1 with a non-trivial "
1760   "%sub{select_special_member_kind}2 is incompatible with C++98">,
1761   InGroup<CXX98Compat>, DefaultIgnore;
1762
1763 def note_nontrivial_virtual_dtor : Note<
1764   "destructor for %0 is not trivial because it is virtual">;
1765 def note_nontrivial_has_virtual : Note<
1766   "because type %0 has a virtual %select{member function|base class}1">;
1767 def note_nontrivial_no_def_ctor : Note<
1768   "because %select{base class of |field of |}0type %1 has no "
1769   "default constructor">;
1770 def note_user_declared_ctor : Note<
1771   "implicit default constructor suppressed by user-declared constructor">;
1772 def note_nontrivial_no_copy : Note<
1773   "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1774   "assignment operator|<<ERROR>>}2 can be used to "
1775   "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1776   "%select{base class|field|an object}0 of type %3">;
1777 def note_nontrivial_user_provided : Note<
1778   "because %select{base class of |field of |}0type %1 has a user-provided "
1779   "%sub{select_special_member_kind}2">;
1780 def note_nontrivial_in_class_init : Note<
1781   "because field %0 has an initializer">;
1782 def note_nontrivial_param_type : Note<
1783   "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1784 def note_nontrivial_default_arg : Note<"because it has a default argument">;
1785 def note_nontrivial_variadic : Note<"because it is a variadic function">;
1786 def note_nontrivial_subobject : Note<
1787   "because the function selected to %select{construct|copy|move|copy|move|"
1788   "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1789 def note_nontrivial_objc_ownership : Note<
1790   "because type %0 has a member with %select{no|no|__strong|__weak|"
1791   "__autoreleasing}1 ownership">;
1792
1793 def err_static_data_member_not_allowed_in_anon_struct : Error<
1794   "static data member %0 not allowed in anonymous struct">;
1795 def ext_static_data_member_in_union : ExtWarn<
1796   "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1797 def warn_cxx98_compat_static_data_member_in_union : Warning<
1798   "static data member %0 in union is incompatible with C++98">,
1799   InGroup<CXX98Compat>, DefaultIgnore;
1800 def ext_union_member_of_reference_type : ExtWarn<
1801   "union member %0 has reference type %1, which is a Microsoft extension">,
1802   InGroup<MicrosoftUnionMemberReference>;
1803 def err_union_member_of_reference_type : Error<
1804   "union member %0 has reference type %1">;
1805 def ext_anonymous_struct_union_qualified : Extension<
1806   "anonymous %select{struct|union}0 cannot be '%1'">;
1807 def err_different_return_type_for_overriding_virtual_function : Error<
1808   "virtual function %0 has a different return type "
1809   "%diff{($) than the function it overrides (which has return type $)|"
1810   "than the function it overrides}1,2">;
1811 def note_overridden_virtual_function : Note<
1812   "overridden virtual function is here">;
1813 def err_conflicting_overriding_cc_attributes : Error<
1814   "virtual function %0 has different calling convention attributes "
1815   "%diff{($) than the function it overrides (which has calling convention $)|"
1816   "than the function it overrides}1,2">;
1817 def warn_overriding_method_missing_noescape : Warning<
1818   "parameter of overriding method should be annotated with "
1819   "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1820 def note_overridden_marked_noescape : Note<
1821   "parameter of overridden method is annotated with __attribute__((noescape))">;
1822 def note_cat_conform_to_noescape_prot : Note<
1823   "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1824
1825 def err_covariant_return_inaccessible_base : Error<
1826   "invalid covariant return for virtual function: %1 is a "
1827   "%select{private|protected}2 base class of %0">, AccessControl;
1828 def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1829   "return type of virtual function %3 is not covariant with the return type of "
1830   "the function it overrides (ambiguous conversion from derived class "
1831   "%0 to base class %1:%2)">;
1832 def err_covariant_return_not_derived : Error<
1833   "return type of virtual function %0 is not covariant with the return type of "
1834   "the function it overrides (%1 is not derived from %2)">;
1835 def err_covariant_return_incomplete : Error<
1836   "return type of virtual function %0 is not covariant with the return type of "
1837   "the function it overrides (%1 is incomplete)">;
1838 def err_covariant_return_type_different_qualifications : Error<
1839   "return type of virtual function %0 is not covariant with the return type of "
1840   "the function it overrides (%1 has different qualifiers than %2)">;
1841 def err_covariant_return_type_class_type_more_qualified : Error<
1842   "return type of virtual function %0 is not covariant with the return type of "
1843   "the function it overrides (class type %1 is more qualified than class "
1844   "type %2">;
1845
1846 // C++ implicit special member functions
1847 def note_in_declaration_of_implicit_special_member : Note<
1848   "while declaring the implicit %sub{select_special_member_kind}1"
1849   " for %0">;
1850
1851 // C++ constructors
1852 def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1853 def err_invalid_qualified_constructor : Error<
1854   "'%0' qualifier is not allowed on a constructor">;
1855 def err_ref_qualifier_constructor : Error<
1856   "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1857
1858 def err_constructor_return_type : Error<
1859   "constructor cannot have a return type">;
1860 def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1861 def err_constructor_byvalue_arg : Error<
1862   "copy constructor must pass its first argument by reference">;
1863 def warn_no_constructor_for_refconst : Warning<
1864   "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1865   "constructor to initialize its non-modifiable members">;
1866 def note_refconst_member_not_initialized : Note<
1867   "%select{const|reference}0 member %1 will never be initialized">;
1868 def ext_ms_explicit_constructor_call : ExtWarn<
1869   "explicit constructor calls are a Microsoft extension">,
1870   InGroup<MicrosoftExplicitConstructorCall>;
1871
1872 // C++ destructors
1873 def err_destructor_not_member : Error<
1874   "destructor must be a non-static member function">;
1875 def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1876 def err_invalid_qualified_destructor : Error<
1877   "'%0' qualifier is not allowed on a destructor">;
1878 def err_ref_qualifier_destructor : Error<
1879   "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1880 def err_destructor_return_type : Error<"destructor cannot have a return type">;
1881 def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1882 def err_destructor_with_params : Error<"destructor cannot have any parameters">;
1883 def err_destructor_variadic : Error<"destructor cannot be variadic">;
1884 def err_destructor_typedef_name : Error<
1885   "destructor cannot be declared using a %select{typedef|type alias}1 %0 of the class name">;
1886 def err_destructor_name : Error<
1887   "expected the class name after '~' to name the enclosing class">;
1888 def err_destructor_class_name : Error<
1889   "expected the class name after '~' to name a destructor">;
1890 def err_ident_in_dtor_not_a_type : Error<
1891   "identifier %0 in object destruction expression does not name a type">;
1892 def err_destructor_expr_type_mismatch : Error<
1893   "destructor type %0 in object destruction expression does not match the "
1894   "type %1 of the object being destroyed">;
1895 def note_destructor_type_here : Note<
1896   "type %0 is declared here">;
1897
1898 def err_destroy_attr_on_non_static_var : Error<
1899   "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
1900   " variable with static or thread storage duration">;
1901
1902 def err_destructor_template : Error<
1903   "destructor cannot be declared as a template">;
1904
1905 // C++ initialization
1906 def err_init_conversion_failed : Error<
1907   "cannot initialize %select{a variable|a parameter|return object|"
1908   "statement expression result|an "
1909   "exception object|a member subobject|an array element|a new value|a value|a "
1910   "base class|a constructor delegation|a vector element|a block element|a "
1911   "block element|a complex element|a lambda capture|a compound literal "
1912   "initializer|a related result|a parameter of CF audited function}0 "
1913   "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
1914   "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
1915   "%select{|: different classes%diff{ ($ vs $)|}5,6"
1916   "|: different number of parameters (%5 vs %6)"
1917   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
1918   "|: different return type%diff{ ($ vs $)|}5,6"
1919   "|: different qualifiers (%5 vs %6)"
1920   "|: different exception specifications}4">;
1921
1922 def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
1923   "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
1924 def err_lvalue_reference_bind_to_initlist : Error<
1925   "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
1926   "initializer list temporary">;
1927 def err_lvalue_reference_bind_to_temporary : Error<
1928   "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
1929   "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
1930 def err_lvalue_reference_bind_to_unrelated : Error<
1931   "%select{non-const|volatile}0 lvalue reference "
1932   "%diff{to type $ cannot bind to a value of unrelated type $|"
1933   "cannot bind to a value of unrelated type}1,2">;
1934 def err_reference_bind_drops_quals : Error<
1935   "binding reference %diff{of type $ to value of type $|to value}0,1 "
1936   "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
1937   "not permitted due to incompatible qualifiers}2">;
1938 def err_reference_bind_failed : Error<
1939   "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
1940   "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
1941   "incompatible type}0,3">;
1942 def err_reference_bind_temporary_addrspace : Error<
1943   "reference of type %0 cannot bind to a temporary object because of "
1944   "address space mismatch">;
1945 def err_reference_bind_init_list : Error<
1946   "reference to type %0 cannot bind to an initializer list">;
1947 def err_init_list_bad_dest_type : Error<
1948   "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
1949   "list">;
1950 def warn_cxx2a_compat_aggregate_init_with_ctors : Warning<
1951   "aggregate initialization of type %0 with user-declared constructors "
1952   "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
1953
1954 def err_reference_bind_to_bitfield : Error<
1955   "%select{non-const|volatile}0 reference cannot bind to "
1956   "bit-field%select{| %1}2">;
1957 def err_reference_bind_to_vector_element : Error<
1958   "%select{non-const|volatile}0 reference cannot bind to vector element">;
1959 def err_reference_var_requires_init : Error<
1960   "declaration of reference variable %0 requires an initializer">;
1961 def err_reference_without_init : Error<
1962   "reference to type %0 requires an initializer">;
1963 def note_value_initialization_here : Note<
1964   "in value-initialization of type %0 here">;
1965 def err_reference_has_multiple_inits : Error<
1966   "reference cannot be initialized with multiple values">;
1967 def err_init_non_aggr_init_list : Error<
1968   "initialization of non-aggregate type %0 with an initializer list">;
1969 def err_init_reference_member_uninitialized : Error<
1970   "reference member of type %0 uninitialized">;
1971 def note_uninit_reference_member : Note<
1972   "uninitialized reference member is here">;
1973 def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
1974   InGroup<Uninitialized>;
1975 def warn_base_class_is_uninit : Warning<
1976   "base class %0 is uninitialized when used here to access %q1">,
1977   InGroup<Uninitialized>;
1978 def warn_reference_field_is_uninit : Warning<
1979   "reference %0 is not yet bound to a value when used here">,
1980   InGroup<Uninitialized>;
1981 def note_uninit_in_this_constructor : Note<
1982   "during field initialization in %select{this|the implicit default}0 "
1983   "constructor">;
1984 def warn_static_self_reference_in_init : Warning<
1985   "static variable %0 is suspiciously used within its own initialization">,
1986   InGroup<UninitializedStaticSelfInit>;
1987 def warn_uninit_self_reference_in_init : Warning<
1988   "variable %0 is uninitialized when used within its own initialization">,
1989   InGroup<Uninitialized>;
1990 def warn_uninit_self_reference_in_reference_init : Warning<
1991   "reference %0 is not yet bound to a value when used within its own"
1992   " initialization">,
1993   InGroup<Uninitialized>;
1994 def warn_uninit_var : Warning<
1995   "variable %0 is uninitialized when %select{used here|captured by block}1">,
1996   InGroup<Uninitialized>, DefaultIgnore;
1997 def warn_sometimes_uninit_var : Warning<
1998   "variable %0 is %select{used|captured}1 uninitialized whenever "
1999   "%select{'%3' condition is %select{true|false}4|"
2000   "'%3' loop %select{is entered|exits because its condition is false}4|"
2001   "'%3' loop %select{condition is true|exits because its condition is false}4|"
2002   "switch %3 is taken|"
2003   "its declaration is reached|"
2004   "%3 is called}2">,
2005   InGroup<UninitializedSometimes>, DefaultIgnore;
2006 def warn_maybe_uninit_var : Warning<
2007   "variable %0 may be uninitialized when "
2008   "%select{used here|captured by block}1">,
2009   InGroup<UninitializedMaybe>, DefaultIgnore;
2010 def note_var_declared_here : Note<"variable %0 is declared here">;
2011 def note_uninit_var_use : Note<
2012   "%select{uninitialized use occurs|variable is captured by block}0 here">;
2013 def warn_uninit_byref_blockvar_captured_by_block : Warning<
2014   "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2015   "block">, InGroup<Uninitialized>, DefaultIgnore;
2016 def note_block_var_fixit_add_initialization : Note<
2017   "did you mean to use __block %0?">;
2018 def note_in_omitted_aggregate_initializer : Note<
2019   "in implicit initialization of %select{"
2020   "array element %1 with omitted initializer|"
2021   "field %1 with omitted initializer|"
2022   "trailing array elements in runtime-sized array new}0">;
2023 def note_in_reference_temporary_list_initializer : Note<
2024   "in initialization of temporary of type %0 created to "
2025   "list-initialize this reference">;
2026 def note_var_fixit_add_initialization : Note<
2027   "initialize the variable %0 to silence this warning">;
2028 def note_uninit_fixit_remove_cond : Note<
2029   "remove the %select{'%1' if its condition|condition if it}0 "
2030   "is always %select{false|true}2">;
2031 def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2032 def err_list_init_in_parens : Error<
2033   "cannot initialize %select{non-class|reference}0 type %1 with a "
2034   "parenthesized initializer list">;
2035
2036 def warn_unsequenced_mod_mod : Warning<
2037   "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2038 def warn_unsequenced_mod_use : Warning<
2039   "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2040
2041 def select_initialized_entity_kind : TextSubstitution<
2042   "%select{copying variable|copying parameter|"
2043   "returning object|initializing statement expression result|"
2044   "throwing object|copying member subobject|copying array element|"
2045   "allocating object|copying temporary|initializing base subobject|"
2046   "initializing vector element|capturing value}0">;
2047
2048 def err_temp_copy_no_viable : Error<
2049   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2050 def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2051   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2052   "C++98 requires a copy constructor when binding a reference to a temporary">,
2053   InGroup<BindToTemporaryCopy>;
2054 def err_temp_copy_ambiguous : Error<
2055   "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2056   "of type %1">;
2057 def err_temp_copy_deleted : Error<
2058   "%sub{select_initialized_entity_kind}0 of type %1 "
2059   "invokes deleted constructor">;
2060 def err_temp_copy_incomplete : Error<
2061   "copying a temporary object of incomplete type %0">;
2062 def warn_cxx98_compat_temp_copy : Warning<
2063   "%sub{select_initialized_entity_kind}1 "
2064   "of type %2 when binding a reference to a temporary would %select{invoke "
2065   "an inaccessible constructor|find no viable constructor|find ambiguous "
2066   "constructors|invoke a deleted constructor}0 in C++98">,
2067   InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2068 def err_selected_explicit_constructor : Error<
2069   "chosen constructor is explicit in copy-initialization">;
2070 def note_explicit_ctor_deduction_guide_here : Note<
2071   "explicit %select{constructor|deduction guide}0 declared here">;
2072
2073 // C++11 decltype
2074 def err_decltype_in_declarator : Error<
2075     "'decltype' cannot be used to name a declaration">;
2076
2077 // C++11 auto
2078 def warn_cxx98_compat_auto_type_specifier : Warning<
2079   "'auto' type specifier is incompatible with C++98">,
2080   InGroup<CXX98Compat>, DefaultIgnore;
2081 def err_auto_variable_cannot_appear_in_own_initializer : Error<
2082   "variable %0 declared with deduced type %1 "
2083   "cannot appear in its own initializer">;
2084 def err_binding_cannot_appear_in_own_initializer : Error<
2085   "binding %0 cannot appear in the initializer of its own "
2086   "decomposition declaration">;
2087 def err_illegal_decl_array_of_auto : Error<
2088   "'%0' declared as array of %1">;
2089 def err_new_array_of_auto : Error<
2090   "cannot allocate array of 'auto'">;
2091 def err_auto_not_allowed : Error<
2092   "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2093   "use of "
2094   "%select{class template|function template|variable template|alias template|"
2095   "template template parameter|concept|template}2 %3 requires template "
2096   "arguments; argument deduction}0 not allowed "
2097   "%select{in function prototype"
2098   "|in non-static struct member|in struct member"
2099   "|in non-static union member|in union member"
2100   "|in non-static class member|in interface member"
2101   "|in exception declaration|in template parameter until C++17|in block literal"
2102   "|in template argument|in typedef|in type alias|in function return type"
2103   "|in conversion function type|here|in lambda parameter"
2104   "|in type allocated by 'new'|in K&R-style function parameter"
2105   "|in template parameter|in friend declaration|in function prototype that is "
2106   "not a function declaration|in requires expression parameter}1">;
2107 def err_dependent_deduced_tst : Error<
2108   "typename specifier refers to "
2109   "%select{class template|function template|variable template|alias template|"
2110   "template template parameter|template}0 member in %1; "
2111   "argument deduction not allowed here">;
2112 def err_deduced_tst : Error<
2113   "typename specifier refers to "
2114   "%select{class template|function template|variable template|alias template|"
2115   "template template parameter|template}0; argument deduction not allowed "
2116   "here">;
2117 def err_auto_not_allowed_var_inst : Error<
2118   "'auto' variable template instantiation is not allowed">;
2119 def err_auto_var_requires_init : Error<
2120   "declaration of variable %0 with deduced type %1 requires an initializer">;
2121 def err_auto_new_requires_ctor_arg : Error<
2122   "new expression for type %0 requires a constructor argument">;
2123 def ext_auto_new_list_init : Extension<
2124   "ISO C++ standards before C++17 do not allow new expression for "
2125   "type %0 to use list-initialization">, InGroup<CXX17>;
2126 def err_auto_var_init_no_expression : Error<
2127   "initializer for variable %0 with type %1 is empty">;
2128 def err_auto_var_init_multiple_expressions : Error<
2129   "initializer for variable %0 with type %1 contains multiple expressions">;
2130 def err_auto_var_init_paren_braces : Error<
2131   "cannot deduce type for variable %1 with type %2 from "
2132   "%select{parenthesized|nested}0 initializer list">;
2133 def err_auto_new_ctor_multiple_expressions : Error<
2134   "new expression for type %0 contains multiple constructor arguments">;
2135 def err_auto_missing_trailing_return : Error<
2136   "'auto' return without trailing return type; deduced return types are a "
2137   "C++14 extension">;
2138 def err_deduced_return_type : Error<
2139   "deduced return types are a C++14 extension">;
2140 def err_trailing_return_without_auto : Error<
2141   "function with trailing return type must specify return type 'auto', not %0">;
2142 def err_trailing_return_in_parens : Error<
2143   "trailing return type may not be nested within parentheses">;
2144 def err_auto_var_deduction_failure : Error<
2145   "variable %0 with type %1 has incompatible initializer of type %2">;
2146 def err_auto_var_deduction_failure_from_init_list : Error<
2147   "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2148 def err_auto_new_deduction_failure : Error<
2149   "new expression for type %0 has incompatible constructor argument of type %1">;
2150 def err_auto_inconsistent_deduction : Error<
2151   "deduced conflicting types %diff{($ vs $) |}0,1"
2152   "for initializer list element type">;
2153 def err_auto_different_deductions : Error<
2154   "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2155   "deduced as %1 in declaration of %2 and "
2156   "deduced as %3 in declaration of %4">;
2157 def err_auto_non_deduced_not_alone : Error<
2158   "%select{function with deduced return type|"
2159   "declaration with trailing return type}0 "
2160   "must be the only declaration in its group">;
2161 def err_implied_std_initializer_list_not_found : Error<
2162   "cannot deduce type of initializer list because std::initializer_list was "
2163   "not found; include <initializer_list>">;
2164 def err_malformed_std_initializer_list : Error<
2165   "std::initializer_list must be a class template with a single type parameter">;
2166 def err_auto_init_list_from_c : Error<
2167   "cannot use __auto_type with initializer list in C">;
2168 def err_auto_bitfield : Error<
2169   "cannot pass bit-field as __auto_type initializer in C">;
2170
2171 // C++1y decltype(auto) type
2172 def err_decltype_auto_invalid : Error<
2173   "'decltype(auto)' not allowed here">;
2174 def err_decltype_auto_cannot_be_combined : Error<
2175   "'decltype(auto)' cannot be combined with other type specifiers">;
2176 def err_decltype_auto_function_declarator_not_declaration : Error<
2177   "'decltype(auto)' can only be used as a return type "
2178   "in a function declaration">;
2179 def err_decltype_auto_compound_type : Error<
2180   "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2181 def err_decltype_auto_initializer_list : Error<
2182   "cannot deduce 'decltype(auto)' from initializer list">;
2183
2184 // C++17 deduced class template specialization types
2185 def err_deduced_class_template_compound_type : Error<
2186   "cannot %select{form pointer to|form reference to|form array of|"
2187   "form function returning|use parentheses when declaring variable with}0 "
2188   "deduced class template specialization type">;
2189 def err_deduced_non_class_template_specialization_type : Error<
2190   "%select{<error>|function template|variable template|alias template|"
2191   "template template parameter|concept|template}0 %1 requires template "
2192   "arguments; argument deduction only allowed for class templates">;
2193 def err_deduced_class_template_ctor_ambiguous : Error<
2194   "ambiguous deduction for template arguments of %0">;
2195 def err_deduced_class_template_ctor_no_viable : Error<
2196   "no viable constructor or deduction guide for deduction of "
2197   "template arguments of %0">;
2198 def err_deduced_class_template_incomplete : Error<
2199   "template %0 has no definition and no %select{|viable }1deduction guides "
2200   "for deduction of template arguments">;
2201 def err_deduced_class_template_deleted : Error<
2202   "class template argument deduction for %0 selected a deleted constructor">;
2203 def err_deduced_class_template_explicit : Error<
2204   "class template argument deduction for %0 selected an explicit "
2205   "%select{constructor|deduction guide}1 for copy-list-initialization">;
2206 def err_deduction_guide_no_trailing_return_type : Error<
2207   "deduction guide declaration without trailing return type">;
2208 def err_deduction_guide_bad_trailing_return_type : Error<
2209   "deduced type %1 of deduction guide is not %select{|written as }2"
2210   "a specialization of template %0">;
2211 def err_deduction_guide_with_complex_decl : Error<
2212   "cannot specify any part of a return type in the "
2213   "declaration of a deduction guide">;
2214 def err_deduction_guide_invalid_specifier : Error<
2215   "deduction guide cannot be declared '%0'">;
2216 def err_deduction_guide_name_not_class_template : Error<
2217   "cannot specify deduction guide for "
2218   "%select{<error>|function template|variable template|alias template|"
2219   "template template parameter|concept|dependent template name}0 %1">;
2220 def err_deduction_guide_wrong_scope : Error<
2221   "deduction guide must be declared in the same scope as template %q0">;
2222 def err_deduction_guide_defines_function : Error<
2223   "deduction guide cannot have a function definition">;
2224 def err_deduction_guide_redeclared : Error<
2225   "redeclaration of deduction guide">;
2226 def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2227   "%select{explicitly instantiated|explicitly specialized}0">;
2228 def err_deduction_guide_template_not_deducible : Error<
2229   "deduction guide template contains "
2230   "%select{a template parameter|template parameters}0 that cannot be "
2231   "deduced">;
2232 def err_deduction_guide_wrong_access : Error<
2233   "deduction guide has different access from the corresponding "
2234   "member template">;
2235 def note_deduction_guide_template_access : Note<
2236   "member template declared %0 here">;
2237 def note_deduction_guide_access : Note<
2238   "deduction guide declared %0 by intervening access specifier">;
2239 def warn_cxx14_compat_class_template_argument_deduction : Warning<
2240   "class template argument deduction is incompatible with C++ standards "
2241   "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2242   InGroup<CXXPre17Compat>, DefaultIgnore;
2243 def warn_ctad_maybe_unsupported : Warning<
2244   "%0 may not intend to support class template argument deduction">,
2245   InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2246 def note_suppress_ctad_maybe_unsupported : Note<
2247   "add a deduction guide to suppress this warning">;
2248
2249
2250 // C++14 deduced return types
2251 def err_auto_fn_deduction_failure : Error<
2252   "cannot deduce return type %0 from returned value of type %1">;
2253 def err_auto_fn_different_deductions : Error<
2254   "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2255   "deduced as %2 in earlier return statement">;
2256 def err_auto_fn_used_before_defined : Error<
2257   "function %0 with deduced return type cannot be used before it is defined">;
2258 def err_auto_fn_no_return_but_not_auto : Error<
2259   "cannot deduce return type %0 for function with no return statements">;
2260 def err_auto_fn_return_void_but_not_auto : Error<
2261   "cannot deduce return type %0 from omitted return expression">;
2262 def err_auto_fn_return_init_list : Error<
2263   "cannot deduce return type from initializer list">;
2264 def err_auto_fn_virtual : Error<
2265   "function with deduced return type cannot be virtual">;
2266 def warn_cxx11_compat_deduced_return_type : Warning<
2267   "return type deduction is incompatible with C++ standards before C++14">,
2268   InGroup<CXXPre14Compat>, DefaultIgnore;
2269
2270 // C++11 override control
2271 def override_keyword_only_allowed_on_virtual_member_functions : Error<
2272   "only virtual member functions can be marked '%0'">;
2273 def override_keyword_hides_virtual_member_function : Error<
2274   "non-virtual member function marked '%0' hides virtual member "
2275   "%select{function|functions}1">;
2276 def err_function_marked_override_not_overriding : Error<
2277   "%0 marked 'override' but does not override any member functions">;
2278 def warn_destructor_marked_not_override_overriding : Warning <
2279   "%0 overrides a destructor but is not marked 'override'">,
2280   InGroup<CXX11WarnOverrideDestructor>, DefaultIgnore;
2281 def warn_function_marked_not_override_overriding : Warning <
2282   "%0 overrides a member function but is not marked 'override'">,
2283   InGroup<CXX11WarnOverrideMethod>;
2284 def err_class_marked_final_used_as_base : Error<
2285   "base %0 is marked '%select{final|sealed}1'">;
2286 def warn_abstract_final_class : Warning<
2287   "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2288 def warn_final_dtor_non_final_class : Warning<
2289   "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2290   InGroup<FinalDtorNonFinalClass>;
2291 def note_final_dtor_non_final_class_silence : Note<
2292   "mark %0 as '%select{final|sealed}1' to silence this warning">;
2293
2294 // C++11 attributes
2295 def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2296
2297 // C++11 final
2298 def err_final_function_overridden : Error<
2299   "declaration of %0 overrides a '%select{final|sealed}1' function">;
2300
2301 // C++11 scoped enumerations
2302 def err_enum_invalid_underlying : Error<
2303   "non-integral type %0 is an invalid underlying type">;
2304 def err_enumerator_too_large : Error<
2305   "enumerator value is not representable in the underlying type %0">;
2306 def ext_enumerator_too_large : Extension<
2307   "enumerator value is not representable in the underlying type %0">,
2308   InGroup<MicrosoftEnumValue>;
2309 def err_enumerator_wrapped : Error<
2310   "enumerator value %0 is not representable in the underlying type %1">;
2311 def err_enum_redeclare_type_mismatch : Error<
2312   "enumeration redeclared with different underlying type %0 (was %1)">;
2313 def err_enum_redeclare_fixed_mismatch : Error<
2314   "enumeration previously declared with %select{non|}0fixed underlying type">;
2315 def err_enum_redeclare_scoped_mismatch : Error<
2316   "enumeration previously declared as %select{un|}0scoped">;
2317 def err_enum_class_reference : Error<
2318   "reference to %select{|scoped }0enumeration must use 'enum' "
2319   "not 'enum class'">;
2320 def err_only_enums_have_underlying_types : Error<
2321   "only enumeration types have underlying types">;
2322 def err_underlying_type_of_incomplete_enum : Error<
2323   "cannot determine underlying type of incomplete enumeration type %0">;
2324
2325 // C++11 delegating constructors
2326 def err_delegating_ctor : Error<
2327   "delegating constructors are permitted only in C++11">;
2328 def warn_cxx98_compat_delegating_ctor : Warning<
2329   "delegating constructors are incompatible with C++98">,
2330   InGroup<CXX98Compat>, DefaultIgnore;
2331 def err_delegating_initializer_alone : Error<
2332   "an initializer for a delegating constructor must appear alone">;
2333 def warn_delegating_ctor_cycle : Warning<
2334   "constructor for %0 creates a delegation cycle">, DefaultError,
2335   InGroup<DelegatingCtorCycles>;
2336 def note_it_delegates_to : Note<"it delegates to">;
2337 def note_which_delegates_to : Note<"which delegates to">;
2338
2339 // C++11 range-based for loop
2340 def err_for_range_decl_must_be_var : Error<
2341   "for range declaration must declare a variable">;
2342 def err_for_range_storage_class : Error<
2343   "loop variable %0 may not be declared %select{'extern'|'static'|"
2344   "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
2345 def err_type_defined_in_for_range : Error<
2346   "types may not be defined in a for range declaration">;
2347 def err_for_range_deduction_failure : Error<
2348   "cannot use type %0 as a range">;
2349 def err_for_range_incomplete_type : Error<
2350   "cannot use incomplete type %0 as a range">;
2351 def err_for_range_iter_deduction_failure : Error<
2352   "cannot use type %0 as an iterator">;
2353 def ext_for_range_begin_end_types_differ : ExtWarn<
2354   "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2355   InGroup<CXX17>;
2356 def warn_for_range_begin_end_types_differ : Warning<
2357   "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2358   "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2359 def note_in_for_range: Note<
2360   "when looking up '%select{begin|end}0' function for range expression "
2361   "of type %1">;
2362 def err_for_range_invalid: Error<
2363   "invalid range expression of type %0; no viable '%select{begin|end}1' "
2364   "function available">;
2365 def note_for_range_member_begin_end_ignored : Note<
2366   "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2367 def err_range_on_array_parameter : Error<
2368   "cannot build range expression with array function parameter %0 since "
2369   "parameter with array type %1 is treated as pointer type %2">;
2370 def err_for_range_dereference : Error<
2371   "invalid range expression of type %0; did you mean to dereference it "
2372   "with '*'?">;
2373 def note_for_range_invalid_iterator : Note <
2374   "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2375 def note_for_range_begin_end : Note<
2376   "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2377 def warn_for_range_const_reference_copy : Warning<
2378   "loop variable %0 "
2379   "%diff{has type $ but is initialized with type $"
2380   "| is initialized with a value of a different type}1,2 resulting in a copy">,
2381   InGroup<RangeLoopConstruct>, DefaultIgnore;
2382 def note_use_type_or_non_reference : Note<
2383   "use non-reference type %0 to keep the copy or type %1 to prevent copying">;
2384 def warn_for_range_variable_always_copy : Warning<
2385   "loop variable %0 is always a copy because the range of type %1 does not "
2386   "return a reference">,
2387   InGroup<RangeLoopBindReference>, DefaultIgnore;
2388 def note_use_non_reference_type : Note<"use non-reference type %0">;
2389 def warn_for_range_copy : Warning<
2390   "loop variable %0 of type %1 creates a copy from type %2">,
2391   InGroup<RangeLoopConstruct>, DefaultIgnore;
2392 def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2393 def err_objc_for_range_init_stmt : Error<
2394   "initialization statement is not supported when iterating over Objective-C "
2395   "collection">;
2396
2397 // C++11 constexpr
2398 def warn_cxx98_compat_constexpr : Warning<
2399   "'constexpr' specifier is incompatible with C++98">,
2400   InGroup<CXX98Compat>, DefaultIgnore;
2401 // FIXME: Maybe this should also go in -Wc++14-compat?
2402 def warn_cxx14_compat_constexpr_not_const : Warning<
2403   "'constexpr' non-static member function will not be implicitly 'const' "
2404   "in C++14; add 'const' to avoid a change in behavior">,
2405   InGroup<DiagGroup<"constexpr-not-const">>;
2406 def err_invalid_constexpr : Error<
2407   "%select{function parameter|typedef}0 "
2408   "cannot be %sub{select_constexpr_spec_kind}1">;
2409 def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2410   "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2411 def err_constexpr_tag : Error<
2412   "%select{class|struct|interface|union|enum}0 "
2413   "cannot be marked %sub{select_constexpr_spec_kind}1">;
2414 def err_constexpr_dtor : Error<
2415   "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2416 def err_constexpr_dtor_subobject : Error<
2417   "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2418   "%select{data member %2|base class %3}1 does not have a "
2419   "constexpr destructor">;
2420 def note_constexpr_dtor_subobject : Note<
2421   "%select{data member %1|base class %2}0 declared here">;
2422 def err_constexpr_wrong_decl_kind : Error<
2423   "%sub{select_constexpr_spec_kind}0 can only be used "
2424   "in %select{|variable and function|function|variable}0 declarations">;
2425 def err_invalid_constexpr_var_decl : Error<
2426   "constexpr variable declaration must be a definition">;
2427 def err_constexpr_static_mem_var_requires_init : Error<
2428   "declaration of constexpr static data member %0 requires an initializer">;
2429 def err_constexpr_var_non_literal : Error<
2430   "constexpr variable cannot have non-literal type %0">;
2431 def err_constexpr_var_requires_const_init : Error<
2432   "constexpr variable %0 must be initialized by a constant expression">;
2433 def err_constexpr_var_requires_const_destruction : Error<
2434   "constexpr variable %0 must have constant destruction">;
2435 def err_constexpr_redecl_mismatch : Error<
2436   "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2437   " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2438 def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2439 def warn_cxx17_compat_constexpr_virtual : Warning<
2440   "virtual constexpr functions are incompatible with "
2441   "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2442 def err_constexpr_virtual_base : Error<
2443   "constexpr %select{member function|constructor}0 not allowed in "
2444   "%select{struct|interface|class}1 with virtual base "
2445   "%plural{1:class|:classes}2">;
2446 def note_non_literal_incomplete : Note<
2447   "incomplete type %0 is not a literal type">;
2448 def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2449   "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2450 def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2451 def err_constexpr_non_literal_return : Error<
2452   "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2453 def err_constexpr_non_literal_param : Error<
2454   "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2455   "not a literal type">;
2456 def err_constexpr_body_invalid_stmt : Error<
2457   "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2458 def ext_constexpr_body_invalid_stmt : ExtWarn<
2459   "use of this statement in a constexpr %select{function|constructor}0 "
2460   "is a C++14 extension">, InGroup<CXX14>;
2461 def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2462   "use of this statement in a constexpr %select{function|constructor}0 "
2463   "is incompatible with C++ standards before C++14">,
2464   InGroup<CXXPre14Compat>, DefaultIgnore;
2465 def ext_constexpr_body_invalid_stmt_cxx2a : ExtWarn<
2466   "use of this statement in a constexpr %select{function|constructor}0 "
2467   "is a C++20 extension">, InGroup<CXX20>;
2468 def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2469   "use of this statement in a constexpr %select{function|constructor}0 "
2470   "is incompatible with C++ standards before C++20">,
2471   InGroup<CXXPre20Compat>, DefaultIgnore;
2472 def ext_constexpr_type_definition : ExtWarn<
2473   "type definition in a constexpr %select{function|constructor}0 "
2474   "is a C++14 extension">, InGroup<CXX14>;
2475 def warn_cxx11_compat_constexpr_type_definition : Warning<
2476   "type definition in a constexpr %select{function|constructor}0 "
2477   "is incompatible with C++ standards before C++14">,
2478   InGroup<CXXPre14Compat>, DefaultIgnore;
2479 def err_constexpr_vla : Error<
2480   "variably-modified type %0 cannot be used in a constexpr "
2481   "%select{function|constructor}1">;
2482 def ext_constexpr_local_var : ExtWarn<
2483   "variable declaration in a constexpr %select{function|constructor}0 "
2484   "is a C++14 extension">, InGroup<CXX14>;
2485 def warn_cxx11_compat_constexpr_local_var : Warning<
2486   "variable declaration in a constexpr %select{function|constructor}0 "
2487   "is incompatible with C++ standards before C++14">,
2488   InGroup<CXXPre14Compat>, DefaultIgnore;
2489 def err_constexpr_local_var_static : Error<
2490   "%select{static|thread_local}1 variable not permitted in a constexpr "
2491   "%select{function|constructor}0">;
2492 def err_constexpr_local_var_non_literal_type : Error<
2493   "variable of non-literal type %1 cannot be defined in a constexpr "
2494   "%select{function|constructor}0">;
2495 def ext_constexpr_local_var_no_init : ExtWarn<
2496   "uninitialized variable in a constexpr %select{function|constructor}0 "
2497   "is a C++20 extension">, InGroup<CXX20>;
2498 def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2499   "uninitialized variable in a constexpr %select{function|constructor}0 "
2500   "is incompatible with C++ standards before C++20">,
2501   InGroup<CXXPre20Compat>, DefaultIgnore;
2502 def ext_constexpr_function_never_constant_expr : ExtWarn<
2503   "constexpr %select{function|constructor}0 never produces a "
2504   "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2505 def err_attr_cond_never_constant_expr : Error<
2506   "%0 attribute expression never produces a constant expression">;
2507 def err_diagnose_if_invalid_diagnostic_type : Error<
2508   "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2509   "instead">;
2510 def err_constexpr_body_no_return : Error<
2511   "no return statement in %select{constexpr|consteval}0 function">;
2512 def err_constexpr_return_missing_expr : Error<
2513   "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2514 def warn_cxx11_compat_constexpr_body_no_return : Warning<
2515   "constexpr function with no return statements is incompatible with C++ "
2516   "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2517 def ext_constexpr_body_multiple_return : ExtWarn<
2518   "multiple return statements in constexpr function is a C++14 extension">,
2519   InGroup<CXX14>;
2520 def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2521   "multiple return statements in constexpr function "
2522   "is incompatible with C++ standards before C++14">,
2523   InGroup<CXXPre14Compat>, DefaultIgnore;
2524 def note_constexpr_body_previous_return : Note<
2525   "previous return statement is here">;
2526
2527 // C++20 function try blocks in constexpr
2528 def ext_constexpr_function_try_block_cxx2a : ExtWarn<
2529   "function try block in constexpr %select{function|constructor}0 is "
2530   "a C++20 extension">, InGroup<CXX20>;
2531 def warn_cxx17_compat_constexpr_function_try_block : Warning<
2532   "function try block in constexpr %select{function|constructor}0 is "
2533   "incompatible with C++ standards before C++20">,
2534   InGroup<CXXPre20Compat>, DefaultIgnore;
2535
2536 def ext_constexpr_union_ctor_no_init : ExtWarn<
2537   "constexpr union constructor that does not initialize any member "
2538   "is a C++20 extension">, InGroup<CXX20>;
2539 def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2540   "constexpr union constructor that does not initialize any member "
2541   "is incompatible with C++ standards before C++20">,
2542   InGroup<CXXPre20Compat>, DefaultIgnore;
2543 def ext_constexpr_ctor_missing_init : ExtWarn<
2544   "constexpr constructor that does not initialize all members "
2545   "is a C++20 extension">, InGroup<CXX20>;
2546 def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2547   "constexpr constructor that does not initialize all members "
2548   "is incompatible with C++ standards before C++20">,
2549   InGroup<CXXPre20Compat>, DefaultIgnore;
2550 def note_constexpr_ctor_missing_init : Note<
2551   "member not initialized by constructor">;
2552 def note_non_literal_no_constexpr_ctors : Note<
2553   "%0 is not literal because it is not an aggregate and has no constexpr "
2554   "constructors other than copy or move constructors">;
2555 def note_non_literal_base_class : Note<
2556   "%0 is not literal because it has base class %1 of non-literal type">;
2557 def note_non_literal_field : Note<
2558   "%0 is not literal because it has data member %1 of "
2559   "%select{non-literal|volatile}3 type %2">;
2560 def note_non_literal_user_provided_dtor : Note<
2561   "%0 is not literal because it has a user-provided destructor">;
2562 def note_non_literal_nontrivial_dtor : Note<
2563   "%0 is not literal because it has a non-trivial destructor">;
2564 def note_non_literal_non_constexpr_dtor : Note<
2565   "%0 is not literal because its destructor is not constexpr">;
2566 def note_non_literal_lambda : Note<
2567   "lambda closure types are non-literal types before C++17">;
2568 def warn_private_extern : Warning<
2569   "use of __private_extern__ on a declaration may not produce external symbol "
2570   "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2571 def note_private_extern : Note<
2572   "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2573
2574 // C++ Concepts
2575 def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2576   "concept declarations may only appear in global or namespace scope">;
2577 def err_concept_no_parameters : Error<
2578   "concept template parameter list must have at least one parameter; explicit "
2579   "specialization of concepts is not allowed">;
2580 def err_concept_extra_headers : Error<
2581   "extraneous template parameter list in concept definition">;
2582 def err_concept_no_associated_constraints : Error<
2583   "concept cannot have associated constraints">;
2584 def err_concept_not_implemented : Error<
2585   "sorry, unimplemented concepts feature %0 used">;
2586 def err_non_constant_constraint_expression : Error<
2587   "substitution into constraint expression resulted in a non-constant "
2588   "expression">;
2589 def err_non_bool_atomic_constraint : Error<
2590   "atomic constraint must be of type 'bool' (found %0)">;
2591 def err_template_arg_list_constraints_not_satisfied : Error<
2592   "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2593   "template template parameter|template}0 %1%2">;
2594 def note_constraints_not_satisfied : Note<
2595   "constraints not satisfied">;
2596 def note_substituted_constraint_expr_is_ill_formed : Note<
2597   "because substituted constraint expression is ill-formed%0">;
2598 def note_atomic_constraint_evaluated_to_false : Note<
2599   "%select{and|because}0 '%1' evaluated to false">;
2600 def note_concept_specialization_constraint_evaluated_to_false : Note<
2601   "%select{and|because}0 '%1' evaluated to false">;
2602 def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2603   "%select{and|because}0 %1 does not satisfy %2">;
2604 def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2605   "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2606 def err_constrained_virtual_method : Error<
2607   "virtual function cannot have a requires clause">;
2608 def err_trailing_requires_clause_on_deduction_guide : Error<
2609   "deduction guide cannot have a requires clause">;
2610 def err_reference_to_function_with_unsatisfied_constraints : Error<
2611   "invalid reference to function %0: constraints not satisfied">;
2612 def note_requires_expr_ill_formed_expr : Note<
2613   "expression is invalid: %0">;
2614 def note_requires_expr_no_implicit_conversion : Note<
2615   "no implicit conversion exists between expression type %0 and expected type "
2616   "%1">;
2617 def err_requires_expr_local_parameter_default_argument : Error<
2618   "default arguments not allowed for parameters of a requires expression">;
2619 def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2620   "constraint variable %0 cannot be used in an evaluated context">;
2621 def note_expr_requirement_expr_substitution_error : Note<
2622   "%select{and|because}0 '%1' would be invalid: %2">;
2623 def note_expr_requirement_expr_unknown_substitution_error : Note<
2624   "%select{and|because}0 '%1' would be invalid">;
2625 def note_expr_requirement_noexcept_not_met : Note<
2626   "%select{and|because}0 '%1' may throw an exception">;
2627 def note_expr_requirement_type_requirement_substitution_error : Note<
2628   "%select{and|because}0 '%1' would be invalid: %2">;
2629 def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2630   "%select{and|because}0 '%1' would be invalid">;
2631 def note_expr_requirement_constraints_not_satisfied : Note<
2632   "%select{and|because}0 type constraint '%1' was not satisfied:">;
2633 def note_expr_requirement_constraints_not_satisfied_simple : Note<
2634   "%select{and|because}0 %1 does not satisfy %2:">;
2635 def note_type_requirement_substitution_error : Note<
2636   "%select{and|because}0 '%1' would be invalid: %2">;
2637 def note_type_requirement_unknown_substitution_error : Note<
2638   "%select{and|because}0 '%1' would be invalid">;
2639 def err_type_requirement_non_type_template : Error<
2640   "'%0' refers to a %select{class template|function template|"
2641   "variable template|alias template|template template parameter|template}1, "
2642   "not a type template">;
2643 def err_type_requirement_no_such_type : Error<
2644   "'%0' does not name a type">;
2645 def note_nested_requirement_substitution_error : Note<
2646   "%select{and|because}0 '%1' would be invalid: %2">;
2647 def note_nested_requirement_unknown_substitution_error : Note<
2648   "%select{and|because}0 '%1' would be invalid">;
2649 def note_ambiguous_atomic_constraints : Note<
2650   "similar constraint expressions not considered equivalent; constraint "
2651   "expressions cannot be considered equivalent unless they originate from the "
2652   "same concept">;
2653 def note_ambiguous_atomic_constraints_similar_expression : Note<
2654   "similar constraint expression here">;
2655 def err_unsupported_placeholder_constraint : Error<
2656   "constrained placeholder types other than simple 'auto' on non-type template "
2657   "parameters not supported yet">;
2658
2659 def err_template_different_requires_clause : Error<
2660   "requires clause differs in template redeclaration">;
2661 def err_template_different_type_constraint : Error<
2662   "type constraint differs in template redeclaration">;
2663 def err_template_template_parameter_not_at_least_as_constrained : Error<
2664   "template template argument %0 is more constrained than template template "
2665   "parameter %1">;
2666
2667 def err_type_constraint_non_type_concept : Error<
2668   "concept named in type constraint is not a type concept">;
2669 def err_type_constraint_missing_arguments : Error<
2670   "%0 requires more than 1 template argument; provide the remaining arguments "
2671   "explicitly to use it here">;
2672 def err_placeholder_constraints_not_satisfied : Error<
2673   "deduced type %0 does not satisfy %1">;
2674
2675 // C++11 char16_t/char32_t
2676 def warn_cxx98_compat_unicode_type : Warning<
2677   "'%0' type specifier is incompatible with C++98">,
2678   InGroup<CXX98Compat>, DefaultIgnore;
2679 def warn_cxx17_compat_unicode_type : Warning<
2680   "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2681   InGroup<CXXPre20Compat>, DefaultIgnore;
2682
2683 // __make_integer_seq
2684 def err_integer_sequence_negative_length : Error<
2685   "integer sequences must have non-negative sequence length">;
2686 def err_integer_sequence_integral_element_type : Error<
2687   "integer sequences must have integral element type">;
2688
2689 // __type_pack_element
2690 def err_type_pack_element_out_of_bounds : Error<
2691   "a parameter pack may not be accessed at an out of bounds index">;
2692
2693 // Objective-C++
2694 def err_objc_decls_may_only_appear_in_global_scope : Error<
2695   "Objective-C declarations may only appear in global scope">;
2696 def warn_auto_var_is_id : Warning<
2697   "'auto' deduced as 'id' in declaration of %0">,
2698   InGroup<DiagGroup<"auto-var-id">>;
2699
2700 // Attributes
2701 def err_nsobject_attribute : Error<
2702   "'NSObject' attribute is for pointer types only">;
2703 def err_attributes_are_not_compatible : Error<
2704   "%0 and %1 attributes are not compatible">;
2705 def err_attribute_invalid_argument : Error<
2706   "%select{a reference type|an array type|a non-vector or "
2707   "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2708 def err_attribute_wrong_number_arguments : Error<
2709   "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2710   ":requires exactly %1 arguments}1">;
2711 def err_attribute_too_many_arguments : Error<
2712   "%0 attribute takes no more than %1 argument%s1">;
2713 def err_attribute_too_few_arguments : Error<
2714   "%0 attribute takes at least %1 argument%s1">;
2715 def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2716 def err_attribute_bad_neon_vector_size : Error<
2717   "Neon vector size must be 64 or 128 bits">;
2718 def err_attribute_requires_positive_integer : Error<
2719   "%0 attribute requires a %select{positive|non-negative}1 "
2720   "integral compile time constant expression">;
2721 def err_attribute_requires_opencl_version : Error<
2722   "%0 attribute requires OpenCL version %1%select{| or above}2">;
2723 def err_invalid_branch_protection_spec : Error<
2724   "invalid or misplaced branch protection specification '%0'">;
2725 def warn_unsupported_target_attribute
2726     : Warning<"%select{unsupported|duplicate}0%select{| architecture}1 '%2' in"
2727               " the 'target' attribute string; 'target' attribute ignored">,
2728       InGroup<IgnoredAttributes>;
2729 def err_attribute_unsupported
2730     : Error<"%0 attribute is not supported for this target">;
2731 // The err_*_attribute_argument_not_int are separate because they're used by
2732 // VerifyIntegerConstantExpression.
2733 def err_aligned_attribute_argument_not_int : Error<
2734   "'aligned' attribute requires integer constant">;
2735 def err_align_value_attribute_argument_not_int : Error<
2736   "'align_value' attribute requires integer constant">;
2737 def err_alignas_attribute_wrong_decl_type : Error<
2738   "%0 attribute cannot be applied to a %select{function parameter|"
2739   "variable with 'register' storage class|'catch' variable|bit-field}1">;
2740 def err_alignas_missing_on_definition : Error<
2741   "%0 must be specified on definition if it is specified on any declaration">;
2742 def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2743 def err_alignas_mismatch : Error<
2744   "redeclaration has different alignment requirement (%1 vs %0)">;
2745 def err_alignas_underaligned : Error<
2746   "requested alignment is less than minimum alignment of %1 for type %0">;
2747 def err_attribute_argument_n_type : Error<
2748   "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2749   "constant|a string|an identifier}2">;
2750 def err_attribute_argument_type : Error<
2751   "%0 attribute requires %select{int or bool|an integer "
2752   "constant|a string|an identifier}1">;
2753 def err_attribute_argument_out_of_range : Error<
2754   "%0 attribute requires integer constant between %1 and %2 inclusive">;
2755 def err_init_priority_object_attr : Error<
2756   "can only use 'init_priority' attribute on file-scope definitions "
2757   "of objects of class type">;
2758 def err_attribute_argument_out_of_bounds : Error<
2759   "%0 attribute parameter %1 is out of bounds">;
2760 def err_attribute_only_once_per_parameter : Error<
2761   "%0 attribute can only be applied once per parameter">;
2762 def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2763 def note_previous_uuid : Note<"previous uuid specified here">;
2764 def warn_attribute_pointers_only : Warning<
2765   "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2766   InGroup<IgnoredAttributes>;
2767 def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2768 def err_attribute_integers_only : Error<
2769   "%0 attribute argument may only refer to a function parameter of integer "
2770   "type">;
2771 def warn_attribute_return_pointers_only : Warning<
2772   "%0 attribute only applies to return values that are pointers">,
2773   InGroup<IgnoredAttributes>;
2774 def warn_attribute_return_pointers_refs_only : Warning<
2775   "%0 attribute only applies to return values that are pointers or references">,
2776   InGroup<IgnoredAttributes>;
2777 def warn_attribute_pointer_or_reference_only : Warning<
2778   "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2779   InGroup<IgnoredAttributes>;
2780 def err_attribute_no_member_pointers : Error<
2781   "%0 attribute cannot be used with pointers to members">;
2782 def err_attribute_invalid_implicit_this_argument : Error<
2783   "%0 attribute is invalid for the implicit this argument">;
2784 def err_ownership_type : Error<
2785   "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2786 def err_ownership_returns_index_mismatch : Error<
2787   "'ownership_returns' attribute index does not match; here it is %0">;
2788 def note_ownership_returns_index_mismatch : Note<
2789   "declared with index %0 here">;
2790 def err_format_strftime_third_parameter : Error<
2791   "strftime format attribute requires 3rd parameter to be 0">;
2792 def err_format_attribute_requires_variadic : Error<
2793   "format attribute requires variadic function">;
2794 def err_format_attribute_not : Error<"format argument not %0">;
2795 def err_format_attribute_result_not : Error<"function does not return %0">;
2796 def err_format_attribute_implicit_this_format_string : Error<
2797   "format attribute cannot specify the implicit this argument as the format "
2798   "string">;
2799 def err_callback_attribute_no_callee : Error<
2800   "'callback' attribute specifies no callback callee">;
2801 def err_callback_attribute_invalid_callee : Error<
2802   "'callback' attribute specifies invalid callback callee">;
2803 def err_callback_attribute_multiple : Error<
2804   "multiple 'callback' attributes specified">;
2805 def err_callback_attribute_argument_unknown : Error<
2806   "'callback' attribute argument %0 is not a known function parameter">;
2807 def err_callback_callee_no_function_type : Error<
2808   "'callback' attribute callee does not have function type">;
2809 def err_callback_callee_is_variadic : Error<
2810   "'callback' attribute callee may not be variadic">;
2811 def err_callback_implicit_this_not_available : Error<
2812   "'callback' argument at position %0 references unavailable implicit 'this'">;
2813 def err_init_method_bad_return_type : Error<
2814   "init methods must return an object pointer type, not %0">;
2815 def err_attribute_invalid_size : Error<
2816   "vector size not an integral multiple of component size">;
2817 def err_attribute_zero_size : Error<"zero vector size">;
2818 def err_attribute_size_too_large : Error<"vector size too large">;
2819 def err_typecheck_vector_not_convertable_implict_truncation : Error<
2820    "cannot convert between %select{scalar|vector}0 type %1 and vector type"
2821    " %2 as implicit conversion would cause truncation">;
2822 def err_typecheck_vector_not_convertable : Error<
2823   "cannot convert between vector values of different size (%0 and %1)">;
2824 def err_typecheck_vector_not_convertable_non_scalar : Error<
2825   "cannot convert between vector and non-scalar values (%0 and %1)">;
2826 def err_typecheck_vector_lengths_not_equal : Error<
2827   "vector operands do not have the same number of elements (%0 and %1)">;
2828 def warn_typecheck_vector_element_sizes_not_equal : Warning<
2829   "vector operands do not have the same elements sizes (%0 and %1)">,
2830   InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
2831 def err_ext_vector_component_exceeds_length : Error<
2832   "vector component access exceeds type %0">;
2833 def err_ext_vector_component_name_illegal : Error<
2834   "illegal vector component name '%0'">;
2835 def err_attribute_address_space_negative : Error<
2836   "address space is negative">;
2837 def err_attribute_address_space_too_high : Error<
2838   "address space is larger than the maximum supported (%0)">;
2839 def err_attribute_address_multiple_qualifiers : Error<
2840   "multiple address spaces specified for type">;
2841 def warn_attribute_address_multiple_identical_qualifiers : Warning<
2842   "multiple identical address spaces specified for type">,
2843   InGroup<DuplicateDeclSpecifier>;
2844 def err_attribute_address_function_type : Error<
2845   "function type may not be qualified with an address space">;
2846 def err_as_qualified_auto_decl : Error<
2847   "automatic variable qualified with an%select{| invalid}0 address space">;
2848 def err_arg_with_address_space : Error<
2849   "parameter may not be qualified with an address space">;
2850 def err_field_with_address_space : Error<
2851   "field may not be qualified with an address space">;
2852 def err_compound_literal_with_address_space : Error<
2853   "compound literal in function scope may not be qualified with an address space">;
2854 def err_address_space_mismatch_templ_inst : Error<
2855   "conflicting address space qualifiers are provided between types %0 and %1">;
2856 def err_attr_objc_ownership_redundant : Error<
2857   "the type %0 is already explicitly ownership-qualified">;
2858 def err_invalid_nsnumber_type : Error<
2859   "%0 is not a valid literal type for NSNumber">;
2860 def err_objc_illegal_boxed_expression_type : Error<
2861   "illegal type %0 used in a boxed expression">;
2862 def err_objc_non_trivially_copyable_boxed_expression_type : Error<
2863   "non-trivially copyable type %0 cannot be used in a boxed expression">;
2864 def err_objc_incomplete_boxed_expression_type : Error<
2865   "incomplete type %0 used in a boxed expression">;
2866 def err_undeclared_objc_literal_class : Error<
2867   "definition of class %0 must be available to use Objective-C "
2868   "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
2869   "string literals}1">;
2870 def err_undeclared_boxing_method : Error<
2871   "declaration of %0 is missing in %1 class">;
2872 def err_objc_literal_method_sig : Error<
2873   "literal construction method %0 has incompatible signature">;
2874 def note_objc_literal_method_param : Note<
2875   "%select{first|second|third}0 parameter has unexpected type %1 "
2876   "(should be %2)">;
2877 def note_objc_literal_method_return : Note<
2878   "method returns unexpected type %0 (should be an object type)">;
2879 def err_invalid_collection_element : Error<
2880   "collection element of type %0 is not an Objective-C object">;
2881 def err_box_literal_collection : Error<
2882   "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
2883   "in a collection">;
2884 def warn_objc_literal_comparison : Warning<
2885   "direct comparison of %select{an array literal|a dictionary literal|"
2886   "a numeric literal|a boxed expression|}0 has undefined behavior">,
2887   InGroup<ObjCLiteralComparison>;
2888 def err_missing_atsign_prefix : Error<
2889   "string literal must be prefixed by '@' ">;
2890 def warn_objc_string_literal_comparison : Warning<
2891   "direct comparison of a string literal has undefined behavior">,
2892   InGroup<ObjCStringComparison>;
2893 def warn_concatenated_nsarray_literal : Warning<
2894   "concatenated NSString literal for an NSArray expression - "
2895   "possibly missing a comma">,
2896   InGroup<ObjCStringConcatenation>;
2897 def note_objc_literal_comparison_isequal : Note<
2898   "use 'isEqual:' instead">;
2899 def warn_objc_collection_literal_element : Warning<
2900   "object of type %0 is not compatible with "
2901   "%select{array element type|dictionary key type|dictionary value type}1 %2">,
2902   InGroup<ObjCLiteralConversion>;
2903 def err_swift_param_attr_not_swiftcall : Error<
2904   "'%0' parameter can only be used with swiftcall calling convention">;
2905 def err_swift_indirect_result_not_first : Error<
2906   "'swift_indirect_result' parameters must be first parameters of function">;
2907 def err_swift_error_result_not_after_swift_context : Error<
2908   "'swift_error_result' parameter must follow 'swift_context' parameter">;
2909 def err_swift_abi_parameter_wrong_type : Error<
2910   "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
2911   "type here is %2">;
2912
2913 def err_attribute_argument_invalid : Error<
2914   "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
2915   "min must not be greater than max}1">;
2916 def err_attribute_argument_is_zero : Error<
2917   "%0 attribute must be greater than 0">;
2918 def warn_attribute_argument_n_negative : Warning<
2919   "%0 attribute parameter %1 is negative and will be ignored">,
2920   InGroup<CudaCompat>;
2921 def err_property_function_in_objc_container : Error<
2922   "use of Objective-C property in function nested in Objective-C "
2923   "container not supported, move function outside its container">;
2924
2925 let CategoryName = "Cocoa API Issue" in {
2926 def warn_objc_redundant_literal_use : Warning<
2927   "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
2928 }
2929
2930 def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
2931   "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
2932
2933 def err_tls_var_aligned_over_maximum : Error<
2934   "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
2935   "alignment (%2) for a thread-local variable on this target">;
2936
2937 def err_only_annotate_after_access_spec : Error<
2938   "access specifier can only have annotation attributes">;
2939
2940 def err_attribute_section_invalid_for_target : Error<
2941   "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
2942 def warn_attribute_section_drectve : Warning<
2943   "#pragma %0(\".drectve\") has undefined behavior, "
2944   "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
2945 def warn_mismatched_section : Warning<
2946   "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
2947 def warn_attribute_section_on_redeclaration : Warning<
2948   "section attribute is specified on redeclared variable">, InGroup<Section>;
2949 def err_mismatched_code_seg_base : Error<
2950   "derived class must specify the same code segment as its base classes">;
2951 def err_mismatched_code_seg_override : Error<
2952   "overriding virtual function must specify the same code segment as its overridden function">;
2953 def err_conflicting_codeseg_attribute : Error<
2954   "conflicting code segment specifiers">;
2955 def warn_duplicate_codeseg_attribute : Warning<
2956   "duplicate code segment specifiers">, InGroup<Section>;
2957
2958 def err_anonymous_property: Error<
2959   "anonymous property is not supported">;
2960 def err_property_is_variably_modified : Error<
2961   "property %0 has a variably modified type">;
2962 def err_no_accessor_for_property : Error<
2963   "no %select{getter|setter}0 defined for property %1">;
2964 def err_cannot_find_suitable_accessor : Error<
2965   "cannot find suitable %select{getter|setter}0 for property %1">;
2966
2967 def warn_alloca : Warning<
2968   "use of function %0 is discouraged; there is no way to check for failure but "
2969   "failure may still occur, resulting in a possibly exploitable security vulnerability">,
2970   InGroup<DiagGroup<"alloca">>, DefaultIgnore;
2971
2972 def warn_alloca_align_alignof : Warning<
2973   "second argument to __builtin_alloca_with_align is supposed to be in bits">,
2974   InGroup<DiagGroup<"alloca-with-align-alignof">>;
2975
2976 def err_alignment_too_small : Error<
2977   "requested alignment must be %0 or greater">;
2978 def err_alignment_too_big : Error<
2979   "requested alignment must be %0 or smaller">;
2980 def err_alignment_not_power_of_two : Error<
2981   "requested alignment is not a power of 2">;
2982 def err_alignment_dependent_typedef_name : Error<
2983   "requested alignment is dependent but declaration is not dependent">;
2984
2985 def warn_alignment_builtin_useless : Warning<
2986   "%select{aligning a value|the result of checking whether a value is aligned}0"
2987   " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
2988 def err_attribute_aligned_too_great : Error<
2989   "requested alignment must be %0 bytes or smaller">;
2990 def warn_assume_aligned_too_great
2991     : Warning<"requested alignment must be %0 bytes or smaller; maximum "
2992               "alignment assumed">,
2993       InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
2994 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
2995   "%q0 redeclared without %1 attribute: previous %1 ignored">,
2996   InGroup<MicrosoftInconsistentDllImport>;
2997 def warn_redeclaration_without_import_attribute : Warning<
2998   "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
2999   InGroup<MicrosoftInconsistentDllImport>;
3000 def warn_dllimport_dropped_from_inline_function : Warning<
3001   "%q0 redeclared inline; %1 attribute ignored">,
3002   InGroup<IgnoredAttributes>;
3003 def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3004   InGroup<IgnoredAttributes>;
3005 def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3006   " exception specification; attribute ignored">,
3007   InGroup<IgnoredAttributes>;
3008 def warn_attribute_ignored_on_inline :
3009   Warning<"%0 attribute ignored on inline function">,
3010   InGroup<IgnoredAttributes>;
3011 def warn_nocf_check_attribute_ignored :
3012   Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3013   InGroup<IgnoredAttributes>;
3014 def warn_attribute_after_definition_ignored : Warning<
3015   "attribute %0 after definition is ignored">,
3016    InGroup<IgnoredAttributes>;
3017 def warn_cxx11_gnu_attribute_on_type : Warning<
3018   "attribute %0 ignored, because it cannot be applied to a type">,
3019   InGroup<IgnoredAttributes>;
3020 def warn_unhandled_ms_attribute_ignored : Warning<
3021   "__declspec attribute %0 is not supported">,
3022   InGroup<IgnoredAttributes>;
3023 def err_decl_attribute_invalid_on_stmt : Error<
3024   "%0 attribute cannot be applied to a statement">;
3025 def err_stmt_attribute_invalid_on_decl : Error<
3026   "%0 attribute cannot be applied to a declaration">;
3027 def warn_declspec_attribute_ignored : Warning<
3028   "attribute %0 is ignored, place it after "
3029   "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3030   "type declaration">, InGroup<IgnoredAttributes>;
3031 def warn_attribute_precede_definition : Warning<
3032   "attribute declaration must precede definition">,
3033   InGroup<IgnoredAttributes>;
3034 def warn_attribute_void_function_method : Warning<
3035   "attribute %0 cannot be applied to "
3036   "%select{functions|Objective-C method}1 without return value">,
3037   InGroup<IgnoredAttributes>;
3038 def warn_attribute_weak_on_field : Warning<
3039   "__weak attribute cannot be specified on a field declaration">,
3040   InGroup<IgnoredAttributes>;
3041 def warn_gc_attribute_weak_on_local : Warning<
3042   "Objective-C GC does not allow weak variables on the stack">,
3043   InGroup<IgnoredAttributes>;
3044 def warn_nsobject_attribute : Warning<
3045   "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3046   InGroup<NSobjectAttribute>;
3047 def warn_independentclass_attribute : Warning<
3048   "'objc_independent_class' attribute may be put on a typedef only; "
3049   "attribute is ignored">,
3050   InGroup<IndependentClassAttribute>;
3051 def warn_ptr_independentclass_attribute : Warning<
3052   "'objc_independent_class' attribute may be put on Objective-C object "
3053   "pointer type only; attribute is ignored">,
3054   InGroup<IndependentClassAttribute>;
3055 def warn_attribute_weak_on_local : Warning<
3056   "__weak attribute cannot be specified on an automatic variable when ARC "
3057   "is not enabled">,
3058   InGroup<IgnoredAttributes>;
3059 def warn_weak_identifier_undeclared : Warning<
3060   "weak identifier %0 never declared">;
3061 def err_attribute_weak_static : Error<
3062   "weak declaration cannot have internal linkage">;
3063 def err_attribute_selectany_non_extern_data : Error<
3064   "'selectany' can only be applied to data items with external linkage">;
3065 def err_declspec_thread_on_thread_variable : Error<
3066   "'__declspec(thread)' applied to variable that already has a "
3067   "thread-local storage specifier">;
3068 def err_attribute_dll_not_extern : Error<
3069   "%q0 must have external linkage when declared %q1">;
3070 def err_attribute_dll_thread_local : Error<
3071   "%q0 cannot be thread local when declared %q1">;
3072 def err_attribute_dll_lambda : Error<
3073   "lambda cannot be declared %0">;
3074 def warn_attribute_invalid_on_definition : Warning<
3075   "'%0' attribute cannot be specified on a definition">,
3076   InGroup<IgnoredAttributes>;
3077 def err_attribute_dll_redeclaration : Error<
3078   "redeclaration of %q0 cannot add %q1 attribute">;
3079 def warn_attribute_dll_redeclaration : Warning<
3080   "redeclaration of %q0 should not add %q1 attribute">,
3081   InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3082 def err_attribute_dllimport_function_definition : Error<
3083   "dllimport cannot be applied to non-inline function definition">;
3084 def err_attribute_dll_deleted : Error<
3085   "attribute %q0 cannot be applied to a deleted function">;
3086 def err_attribute_dllimport_data_definition : Error<
3087   "definition of dllimport data">;
3088 def err_attribute_dllimport_static_field_definition : Error<
3089   "definition of dllimport static field not allowed">;
3090 def warn_attribute_dllimport_static_field_definition : Warning<
3091   "definition of dllimport static field">,
3092   InGroup<DiagGroup<"dllimport-static-field-def">>;
3093 def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3094   "explicit instantiation declaration should not be 'dllexport'">,
3095   InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
3096 def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3097   "'dllexport' attribute ignored on explicit instantiation definition">,
3098   InGroup<IgnoredAttributes>;
3099 def warn_invalid_initializer_from_system_header : Warning<
3100   "invalid constructor form class in system header, should not be explicit">,
3101   InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3102 def note_used_in_initialization_here : Note<"used in initialization here">;
3103 def err_attribute_dll_member_of_dll_class : Error<
3104   "attribute %q0 cannot be applied to member of %q1 class">;
3105 def warn_attribute_dll_instantiated_base_class : Warning<
3106   "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3107   "base class template without dll attribute is not supported">,
3108   InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3109 def err_attribute_dll_ambiguous_default_ctor : Error<
3110   "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3111 def err_attribute_weakref_not_static : Error<
3112   "weakref declaration must have internal linkage">;
3113 def err_attribute_weakref_not_global_context : Error<
3114   "weakref declaration of %0 must be in a global context">;
3115 def err_attribute_weakref_without_alias : Error<
3116   "weakref declaration of %0 must also have an alias attribute">;
3117 def err_alias_not_supported_on_darwin : Error <
3118   "aliases are not supported on darwin">;
3119 def warn_attribute_wrong_decl_type_str : Warning<
3120   "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3121 def err_attribute_wrong_decl_type_str : Error<
3122   warn_attribute_wrong_decl_type_str.Text>;
3123 def warn_attribute_wrong_decl_type : Warning<
3124   "%0 attribute only applies to %select{"
3125   "functions"
3126   "|unions"
3127   "|variables and functions"
3128   "|functions and methods"
3129   "|functions, methods and blocks"
3130   "|functions, methods, and parameters"
3131   "|variables"
3132   "|variables and fields"
3133   "|variables, data members and tag types"
3134   "|types and namespaces"
3135   "|variables, functions and classes"
3136   "|kernel functions"
3137   "|non-K&R-style functions}1">,
3138   InGroup<IgnoredAttributes>;
3139 def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3140 def warn_type_attribute_wrong_type : Warning<
3141   "'%0' only applies to %select{function|pointer|"
3142   "Objective-C object or block pointer}1 types; type here is %2">,
3143   InGroup<IgnoredAttributes>;
3144 def warn_incomplete_encoded_type : Warning<
3145   "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3146   InGroup<DiagGroup<"encode-type">>;
3147 def warn_gnu_inline_attribute_requires_inline : Warning<
3148   "'gnu_inline' attribute requires function to be marked 'inline',"
3149   " attribute ignored">,
3150   InGroup<IgnoredAttributes>;
3151 def warn_gnu_inline_cplusplus_without_extern : Warning<
3152   "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3153   " available, this changed in Clang 10">,
3154   InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3155 def err_attribute_vecreturn_only_vector_member : Error<
3156   "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3157 def err_attribute_vecreturn_only_pod_record : Error<
3158   "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3159 def err_cconv_change : Error<
3160   "function declared '%0' here was previously declared "
3161   "%select{'%2'|without calling convention}1">;
3162 def warn_cconv_unsupported : Warning<
3163   "%0 calling convention is not supported %select{"
3164   // Use CallingConventionIgnoredReason Enum to specify these.
3165   "for this target"
3166   "|on variadic function"
3167   "|on constructor/destructor"
3168   "|on builtin function"
3169   "}1">,
3170   InGroup<IgnoredAttributes>;
3171 def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3172 def err_cconv_knr : Error<
3173   "function with no prototype cannot use the %0 calling convention">;
3174 def warn_cconv_knr : Warning<
3175   err_cconv_knr.Text>,
3176   InGroup<DiagGroup<"missing-prototype-for-cc">>;
3177 def err_cconv_varargs : Error<
3178   "variadic function cannot use %0 calling convention">;
3179 def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3180   "attribute was previously declared "
3181   "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3182 def err_function_attribute_mismatch : Error<
3183   "function declared with %0 attribute "
3184   "was previously declared without the %0 attribute">;
3185 def err_objc_precise_lifetime_bad_type : Error<
3186   "objc_precise_lifetime only applies to retainable types; type here is %0">;
3187 def warn_objc_precise_lifetime_meaningless : Error<
3188   "objc_precise_lifetime is not meaningful for "
3189   "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3190 def err_invalid_pcs : Error<"invalid PCS type">;
3191 def warn_attribute_not_on_decl : Warning<
3192   "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3193 def err_base_specifier_attribute : Error<
3194   "%0 attribute cannot be applied to a base specifier">;
3195 def err_invalid_attribute_on_virtual_function : Error<
3196   "%0 attribute cannot be applied to virtual functions">;
3197 def warn_declspec_allocator_nonpointer : Warning<
3198   "ignoring __declspec(allocator) because the function return type %0 is not "
3199   "a pointer or reference type">, InGroup<IgnoredAttributes>;
3200 def err_cconv_incomplete_param_type : Error<
3201   "parameter %0 must have a complete type to use function %1 with the %2 "
3202   "calling convention">;
3203 def err_attribute_output_parameter : Error<
3204   "attribute only applies to output parameters">;
3205
3206 def ext_cannot_use_trivial_abi : ExtWarn<
3207   "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3208
3209 // Availability attribute
3210 def warn_availability_unknown_platform : Warning<
3211   "unknown platform %0 in availability macro">, InGroup<Availability>;
3212 def warn_availability_version_ordering : Warning<
3213   "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3214   "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3215   "attribute ignored">, InGroup<Availability>;
3216 def warn_mismatched_availability: Warning<
3217   "availability does not match previous declaration">, InGroup<Availability>;
3218 def warn_mismatched_availability_override : Warning<
3219   "%select{|overriding }4method %select{introduced after|"
3220   "deprecated before|obsoleted before}0 "
3221   "%select{the protocol method it implements|overridden method}4 "
3222   "on %1 (%2 vs. %3)">, InGroup<Availability>;
3223 def warn_mismatched_availability_override_unavail : Warning<
3224   "%select{|overriding }1method cannot be unavailable on %0 when "
3225   "%select{the protocol method it implements|its overridden method}1 is "
3226   "available">,
3227   InGroup<Availability>;
3228 def warn_availability_on_static_initializer : Warning<
3229   "ignoring availability attribute %select{on '+load' method|"
3230   "with constructor attribute|with destructor attribute}0">,
3231   InGroup<Availability>;
3232 def note_overridden_method : Note<
3233   "overridden method is here">;
3234 def warn_availability_swift_unavailable_deprecated_only : Warning<
3235   "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3236   InGroup<Availability>;
3237 def note_protocol_method : Note<
3238   "protocol method is here">;
3239
3240 def warn_unguarded_availability :
3241   Warning<"%0 is only available on %1 %2 or newer">,
3242   InGroup<UnguardedAvailability>, DefaultIgnore;
3243 def warn_unguarded_availability_new :
3244   Warning<warn_unguarded_availability.Text>,
3245   InGroup<UnguardedAvailabilityNew>;
3246 def note_decl_unguarded_availability_silence : Note<
3247   "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3248 def note_unguarded_available_silence : Note<
3249   "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3250   " this warning">;
3251 def warn_at_available_unchecked_use : Warning<
3252   "%select{@available|__builtin_available}0 does not guard availability here; "
3253   "use if (%select{@available|__builtin_available}0) instead">,
3254   InGroup<DiagGroup<"unsupported-availability-guard">>;
3255
3256 // Thread Safety Attributes
3257 def warn_invalid_capability_name : Warning<
3258   "invalid capability name '%0'; capability name must be 'mutex' or 'role'">,
3259   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3260 def warn_thread_attribute_ignored : Warning<
3261   "ignoring %0 attribute because its argument is invalid">,
3262   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3263 def warn_thread_attribute_not_on_non_static_member : Warning<
3264   "%0 attribute without capability arguments can only be applied to non-static "
3265   "methods of a class">,
3266   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3267 def warn_thread_attribute_not_on_capability_member : Warning<
3268   "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3269   "annotated with 'capability' or 'scoped_lockable' attribute">,
3270   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3271 def warn_thread_attribute_argument_not_lockable : Warning<
3272   "%0 attribute requires arguments whose type is annotated "
3273   "with 'capability' attribute; type here is %1">,
3274   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3275 def warn_thread_attribute_decl_not_lockable : Warning<
3276   "%0 attribute can only be applied in a context annotated "
3277   "with 'capability(\"mutex\")' attribute">,
3278   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3279 def warn_thread_attribute_decl_not_pointer : Warning<
3280   "%0 only applies to pointer types; type here is %1">,
3281   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3282 def err_attribute_argument_out_of_bounds_extra_info : Error<
3283   "%0 attribute parameter %1 is out of bounds: "
3284   "%plural{0:no parameters to index into|"
3285   "1:can only be 1, since there is one parameter|"
3286   ":must be between 1 and %2}2">;
3287
3288 // Thread Safety Analysis
3289 def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3290   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3291 def warn_unlock_kind_mismatch : Warning<
3292   "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3293   "%select{shared|exclusive}3 access">,
3294   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3295 def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3296   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3297 def warn_no_unlock : Warning<
3298   "%0 '%1' is still held at the end of function">,
3299   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3300 def warn_expecting_locked : Warning<
3301   "expecting %0 '%1' to be held at the end of function">,
3302   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3303 // FIXME: improve the error message about locks not in scope
3304 def warn_lock_some_predecessors : Warning<
3305   "%0 '%1' is not held on every path through here">,
3306   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3307 def warn_expecting_lock_held_on_loop : Warning<
3308   "expecting %0 '%1' to be held at start of each loop">,
3309   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3310 def note_locked_here : Note<"%0 acquired here">;
3311 def warn_lock_exclusive_and_shared : Warning<
3312   "%0 '%1' is acquired exclusively and shared in the same scope">,
3313   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3314 def note_lock_exclusive_and_shared : Note<
3315   "the other acquisition of %0 '%1' is here">;
3316 def warn_variable_requires_any_lock : Warning<
3317   "%select{reading|writing}1 variable %0 requires holding "
3318   "%select{any mutex|any mutex exclusively}1">,
3319   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3320 def warn_var_deref_requires_any_lock : Warning<
3321   "%select{reading|writing}1 the value pointed to by %0 requires holding "
3322   "%select{any mutex|any mutex exclusively}1">,
3323   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3324 def warn_fun_excludes_mutex : Warning<
3325   "cannot call function '%1' while %0 '%2' is held">,
3326   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3327 def warn_cannot_resolve_lock : Warning<
3328   "cannot resolve lock expression">,
3329   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3330 def warn_acquired_before : Warning<
3331   "%0 '%1' must be acquired before '%2'">,
3332   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3333 def warn_acquired_before_after_cycle : Warning<
3334   "Cycle in acquired_before/after dependencies, starting with '%0'">,
3335   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3336
3337
3338 // Thread safety warnings negative capabilities
3339 def warn_acquire_requires_negative_cap : Warning<
3340   "acquiring %0 '%1' requires negative capability '%2'">,
3341   InGroup<ThreadSafetyNegative>, DefaultIgnore;
3342
3343 // Thread safety warnings on pass by reference
3344 def warn_guarded_pass_by_reference : Warning<
3345   "passing variable %1 by reference requires holding %0 "
3346   "%select{'%2'|'%2' exclusively}3">,
3347   InGroup<ThreadSafetyReference>, DefaultIgnore;
3348 def warn_pt_guarded_pass_by_reference : Warning<
3349   "passing the value that %1 points to by reference requires holding %0 "
3350   "%select{'%2'|'%2' exclusively}3">,
3351   InGroup<ThreadSafetyReference>, DefaultIgnore;
3352
3353 // Imprecise thread safety warnings
3354 def warn_variable_requires_lock : Warning<
3355   "%select{reading|writing}3 variable %1 requires holding %0 "
3356   "%select{'%2'|'%2' exclusively}3">,
3357   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3358 def warn_var_deref_requires_lock : Warning<
3359   "%select{reading|writing}3 the value pointed to by %1 requires "
3360   "holding %0 %select{'%2'|'%2' exclusively}3">,
3361   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3362 def warn_fun_requires_lock : Warning<
3363   "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3364   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3365
3366 // Precise thread safety warnings
3367 def warn_variable_requires_lock_precise :
3368   Warning<warn_variable_requires_lock.Text>,
3369   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3370 def warn_var_deref_requires_lock_precise :
3371   Warning<warn_var_deref_requires_lock.Text>,
3372   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3373 def warn_fun_requires_lock_precise :
3374   Warning<warn_fun_requires_lock.Text>,
3375   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3376 def note_found_mutex_near_match : Note<"found near match '%0'">;
3377
3378 // Verbose thread safety warnings
3379 def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3380   InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3381 def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3382 def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3383
3384 // Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3385 def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3386   InGroup<ThreadSafetyBeta>, DefaultIgnore;
3387
3388 // Consumed warnings
3389 def warn_use_in_invalid_state : Warning<
3390   "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3391   "state">, InGroup<Consumed>, DefaultIgnore;
3392 def warn_use_of_temp_in_invalid_state : Warning<
3393   "invalid invocation of method '%0' on a temporary object while it is in the "
3394   "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3395 def warn_attr_on_unconsumable_class : Warning<
3396   "consumed analysis attribute is attached to member of class '%0' which isn't "
3397   "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3398 def warn_return_typestate_for_unconsumable_type : Warning<
3399   "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3400   DefaultIgnore;
3401 def warn_return_typestate_mismatch : Warning<
3402   "return value not in expected state; expected '%0', observed '%1'">,
3403   InGroup<Consumed>, DefaultIgnore;
3404 def warn_loop_state_mismatch : Warning<
3405   "state of variable '%0' must match at the entry and exit of loop">,
3406   InGroup<Consumed>, DefaultIgnore;
3407 def warn_param_return_typestate_mismatch : Warning<
3408   "parameter '%0' not in expected state when the function returns: expected "
3409   "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3410 def warn_param_typestate_mismatch : Warning<
3411   "argument not in expected state; expected '%0', observed '%1'">,
3412   InGroup<Consumed>, DefaultIgnore;
3413
3414 // no_sanitize attribute
3415 def warn_unknown_sanitizer_ignored : Warning<
3416   "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3417
3418 def warn_impcast_vector_scalar : Warning<
3419   "implicit conversion turns vector to scalar: %0 to %1">,
3420   InGroup<Conversion>, DefaultIgnore;
3421 def warn_impcast_complex_scalar : Warning<
3422   "implicit conversion discards imaginary component: %0 to %1">,
3423   InGroup<Conversion>, DefaultIgnore;
3424 def err_impcast_complex_scalar : Error<
3425   "implicit conversion from %0 to %1 is not permitted in C++">;
3426 def warn_impcast_float_precision : Warning<
3427   "implicit conversion loses floating-point precision: %0 to %1">,
3428   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3429 def warn_impcast_float_result_precision : Warning<
3430   "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3431   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3432 def warn_impcast_double_promotion : Warning<
3433   "implicit conversion increases floating-point precision: %0 to %1">,
3434   InGroup<DoublePromotion>, DefaultIgnore;
3435 def warn_impcast_integer_sign : Warning<
3436   "implicit conversion changes signedness: %0 to %1">,
3437   InGroup<SignConversion>, DefaultIgnore;
3438 def warn_impcast_integer_sign_conditional : Warning<
3439   "operand of ? changes signedness: %0 to %1">,
3440   InGroup<SignConversion>, DefaultIgnore;
3441 def warn_impcast_integer_precision : Warning<
3442   "implicit conversion loses integer precision: %0 to %1">,
3443   InGroup<ImplicitIntConversion>, DefaultIgnore;
3444 def warn_impcast_high_order_zero_bits : Warning<
3445   "higher order bits are zeroes after implicit conversion">,
3446   InGroup<ImplicitIntConversion>, DefaultIgnore;
3447 def warn_impcast_nonnegative_result : Warning<
3448   "the resulting value is always non-negative after implicit conversion">,
3449   InGroup<SignConversion>, DefaultIgnore;
3450 def warn_impcast_integer_64_32 : Warning<
3451   "implicit conversion loses integer precision: %0 to %1">,
3452   InGroup<Shorten64To32>, DefaultIgnore;
3453 def warn_impcast_integer_precision_constant : Warning<
3454   "implicit conversion from %2 to %3 changes value from %0 to %1">,
3455   InGroup<ConstantConversion>;
3456 def warn_impcast_bitfield_precision_constant : Warning<
3457   "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3458   InGroup<BitFieldConstantConversion>;
3459 def warn_impcast_constant_value_to_objc_bool : Warning<
3460   "implicit conversion from constant value %0 to 'BOOL'; "
3461   "the only well defined values for 'BOOL' are YES and NO">,
3462   InGroup<ObjCBoolConstantConversion>;
3463
3464 def warn_impcast_fixed_point_range : Warning<
3465   "implicit conversion from %0 cannot fit within the range of values for %1">,
3466   InGroup<ImplicitFixedPointConversion>;
3467
3468 def warn_impcast_literal_float_to_integer : Warning<
3469   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3470   InGroup<LiteralConversion>;
3471 def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3472   "implicit conversion of out of range value from %0 to %1 is undefined">,
3473   InGroup<LiteralConversion>;
3474 def warn_impcast_float_integer : Warning<
3475   "implicit conversion turns floating-point number into integer: %0 to %1">,
3476   InGroup<FloatConversion>, DefaultIgnore;
3477 def warn_impcast_float_to_objc_signed_char_bool : Warning<
3478   "implicit conversion from floating-point type %0 to 'BOOL'">,
3479   InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3480 def warn_impcast_int_to_objc_signed_char_bool : Warning<
3481   "implicit conversion from integral type %0 to 'BOOL'">,
3482   InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3483
3484 // Implicit int -> float conversion precision loss warnings.
3485 def warn_impcast_integer_float_precision : Warning<
3486   "implicit conversion from %0 to %1 may lose precision">,
3487   InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3488 def warn_impcast_integer_float_precision_constant : Warning<
3489   "implicit conversion from %2 to %3 changes value from %0 to %1">,
3490   InGroup<ImplicitIntFloatConversion>;
3491
3492 def warn_impcast_float_to_integer : Warning<
3493   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3494   InGroup<FloatOverflowConversion>, DefaultIgnore;
3495 def warn_impcast_float_to_integer_out_of_range : Warning<
3496   "implicit conversion of out of range value from %0 to %1 is undefined">,
3497   InGroup<FloatOverflowConversion>, DefaultIgnore;
3498 def warn_impcast_float_to_integer_zero : Warning<
3499   "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3500   InGroup<FloatZeroConversion>, DefaultIgnore;
3501
3502 def warn_impcast_string_literal_to_bool : Warning<
3503   "implicit conversion turns string literal into bool: %0 to %1">,
3504   InGroup<StringConversion>, DefaultIgnore;
3505 def warn_impcast_different_enum_types : Warning<
3506   "implicit conversion from enumeration type %0 to different enumeration type "
3507   "%1">, InGroup<EnumConversion>;
3508 def warn_impcast_bool_to_null_pointer : Warning<
3509     "initialization of pointer of type %0 to null from a constant boolean "
3510     "expression">, InGroup<BoolConversion>;
3511 def warn_non_literal_null_pointer : Warning<
3512     "expression which evaluates to zero treated as a null pointer constant of "
3513     "type %0">, InGroup<NonLiteralNullConversion>;
3514 def warn_pointer_compare : Warning<
3515     "comparing a pointer to a null character constant; did you mean "
3516     "to compare to %select{NULL|(void *)0}0?">,
3517     InGroup<DiagGroup<"pointer-compare">>;
3518 def warn_impcast_null_pointer_to_integer : Warning<
3519     "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3520     InGroup<NullConversion>;
3521 def warn_impcast_floating_point_to_bool : Warning<
3522     "implicit conversion turns floating-point number into bool: %0 to %1">,
3523     InGroup<ImplicitConversionFloatingPointToBool>;
3524 def ext_ms_impcast_fn_obj : ExtWarn<
3525   "implicit conversion between pointer-to-function and pointer-to-object is a "
3526   "Microsoft extension">, InGroup<MicrosoftCast>;
3527
3528 def warn_impcast_pointer_to_bool : Warning<
3529     "address of%select{| function| array}0 '%1' will always evaluate to "
3530     "'true'">,
3531     InGroup<PointerBoolConversion>;
3532 def warn_cast_nonnull_to_bool : Warning<
3533     "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3534     "'true' on first encounter">,
3535     InGroup<PointerBoolConversion>;
3536 def warn_this_bool_conversion : Warning<
3537   "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3538   "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3539 def warn_address_of_reference_bool_conversion : Warning<
3540   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3541   "code; pointer may be assumed to always convert to true">,
3542   InGroup<UndefinedBoolConversion>;
3543
3544 def warn_xor_used_as_pow : Warning<
3545   "result of '%0' is %1; did you mean exponentiation?">,
3546   InGroup<XorUsedAsPow>;
3547 def warn_xor_used_as_pow_base_extra : Warning<
3548   "result of '%0' is %1; did you mean '%2' (%3)?">,
3549   InGroup<XorUsedAsPow>;
3550 def warn_xor_used_as_pow_base : Warning<
3551   "result of '%0' is %1; did you mean '%2'?">,
3552   InGroup<XorUsedAsPow>;
3553 def note_xor_used_as_pow_silence : Note<
3554   "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3555
3556 def warn_null_pointer_compare : Warning<
3557     "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3558     "equal to a null pointer is always %select{true|false}2">,
3559     InGroup<TautologicalPointerCompare>;
3560 def warn_nonnull_expr_compare : Warning<
3561     "comparison of nonnull %select{function call|parameter}0 '%1' "
3562     "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3563     "encounter">,
3564     InGroup<TautologicalPointerCompare>;
3565 def warn_this_null_compare : Warning<
3566   "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3567   "assumed to always evaluate to %select{true|false}0">,
3568   InGroup<TautologicalUndefinedCompare>;
3569 def warn_address_of_reference_null_compare : Warning<
3570   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3571   "code; comparison may be assumed to always evaluate to "
3572   "%select{true|false}0">,
3573   InGroup<TautologicalUndefinedCompare>;
3574 def note_reference_is_return_value : Note<"%0 returns a reference">;
3575
3576 def note_pointer_declared_here : Note<
3577   "pointer %0 declared here">;
3578 def warn_division_sizeof_ptr : Warning<
3579   "'%0' will return the size of the pointer, not the array itself">,
3580   InGroup<DiagGroup<"sizeof-pointer-div">>;
3581 def warn_division_sizeof_array : Warning<
3582   "expression does not compute the number of elements in this array; element "
3583   "type is %0, not %1">,
3584   InGroup<DiagGroup<"sizeof-array-div">>;
3585
3586 def note_function_warning_silence : Note<
3587     "prefix with the address-of operator to silence this warning">;
3588 def note_function_to_function_call : Note<
3589     "suffix with parentheses to turn this into a function call">;
3590 def warn_impcast_objective_c_literal_to_bool : Warning<
3591     "implicit boolean conversion of Objective-C object literal always "
3592     "evaluates to true">,
3593     InGroup<ObjCLiteralConversion>;
3594
3595 def warn_cast_align : Warning<
3596   "cast from %0 to %1 increases required alignment from %2 to %3">,
3597   InGroup<CastAlign>, DefaultIgnore;
3598 def warn_old_style_cast : Warning<
3599   "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3600
3601 // Separate between casts to void* and non-void* pointers.
3602 // Some APIs use (abuse) void* for something like a user context,
3603 // and often that value is an integer even if it isn't a pointer itself.
3604 // Having a separate warning flag allows users to control the warning
3605 // for their workflow.
3606 def warn_int_to_pointer_cast : Warning<
3607   "cast to %1 from smaller integer type %0">,
3608   InGroup<IntToPointerCast>;
3609 def warn_int_to_void_pointer_cast : Warning<
3610   "cast to %1 from smaller integer type %0">,
3611   InGroup<IntToVoidPointerCast>;
3612
3613 def warn_attribute_ignored_for_field_of_type : Warning<
3614   "%0 attribute ignored for field of type %1">,
3615   InGroup<IgnoredAttributes>;
3616 def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3617   "enums in the Microsoft ABI are signed integers by default; consider giving "
3618   "the enum %0 an unsigned underlying type to make this code portable">,
3619   InGroup<SignedEnumBitfield>, DefaultIgnore;
3620 def warn_attribute_packed_for_bitfield : Warning<
3621   "'packed' attribute was ignored on bit-fields with single-byte alignment "
3622   "in older versions of GCC and Clang">,
3623   InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3624 def warn_transparent_union_attribute_field_size_align : Warning<
3625   "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3626   "%select{alignment|size}0 of the first field in transparent union; "
3627   "transparent_union attribute ignored">,
3628   InGroup<IgnoredAttributes>;
3629 def note_transparent_union_first_field_size_align : Note<
3630   "%select{alignment|size}0 of first field is %1 bits">;
3631 def warn_transparent_union_attribute_not_definition : Warning<
3632   "transparent_union attribute can only be applied to a union definition; "
3633   "attribute ignored">,
3634   InGroup<IgnoredAttributes>;
3635 def warn_transparent_union_attribute_floating : Warning<
3636   "first field of a transparent union cannot have %select{floating point|"
3637   "vector}0 type %1; transparent_union attribute ignored">,
3638   InGroup<IgnoredAttributes>;
3639 def warn_transparent_union_attribute_zero_fields : Warning<
3640   "transparent union definition must contain at least one field; "
3641   "transparent_union attribute ignored">,
3642   InGroup<IgnoredAttributes>;
3643 def warn_attribute_type_not_supported : Warning<
3644   "%0 attribute argument not supported: %1">,
3645   InGroup<IgnoredAttributes>;
3646 def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3647   InGroup<IgnoredAttributes>;
3648 def warn_attribute_protected_visibility :
3649   Warning<"target does not support 'protected' visibility; using 'default'">,
3650   InGroup<DiagGroup<"unsupported-visibility">>;
3651 def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3652 def note_previous_attribute : Note<"previous attribute is here">;
3653 def note_conflicting_attribute : Note<"conflicting attribute is here">;
3654 def note_attribute : Note<"attribute is here">;
3655 def err_mismatched_ms_inheritance : Error<
3656   "inheritance model does not match %select{definition|previous declaration}0">;
3657 def warn_ignored_ms_inheritance : Warning<
3658   "inheritance model ignored on %select{primary template|partial specialization}0">,
3659   InGroup<IgnoredAttributes>;
3660 def note_previous_ms_inheritance : Note<
3661   "previous inheritance model specified here">;
3662 def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3663 def err_mode_not_primitive : Error<
3664   "mode attribute only supported for integer and floating-point types">;
3665 def err_mode_wrong_type : Error<
3666   "type of machine mode does not match type of base type">;
3667 def warn_vector_mode_deprecated : Warning<
3668   "specifying vector types with the 'mode' attribute is deprecated; "
3669   "use the 'vector_size' attribute instead">,
3670   InGroup<DeprecatedAttributes>;
3671 def err_complex_mode_vector_type : Error<
3672   "type of machine mode does not support base vector types">;
3673 def err_enum_mode_vector_type : Error<
3674   "mode %0 is not supported for enumeration types">;
3675 def warn_attribute_nonnull_no_pointers : Warning<
3676   "'nonnull' attribute applied to function with no pointer arguments">,
3677   InGroup<IgnoredAttributes>;
3678 def warn_attribute_nonnull_parm_no_args : Warning<
3679   "'nonnull' attribute when used on parameters takes no arguments">,
3680   InGroup<IgnoredAttributes>;
3681 def note_declared_nonnull : Note<
3682   "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3683 def warn_attribute_sentinel_named_arguments : Warning<
3684   "'sentinel' attribute requires named arguments">,
3685   InGroup<IgnoredAttributes>;
3686 def warn_attribute_sentinel_not_variadic : Warning<
3687   "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3688   InGroup<IgnoredAttributes>;
3689 def err_attribute_sentinel_less_than_zero : Error<
3690   "'sentinel' parameter 1 less than zero">;
3691 def err_attribute_sentinel_not_zero_or_one : Error<
3692   "'sentinel' parameter 2 not 0 or 1">;
3693 def warn_cleanup_ext : Warning<
3694   "GCC does not allow the 'cleanup' attribute argument to be anything other "
3695   "than a simple identifier">,
3696   InGroup<GccCompat>;
3697 def err_attribute_cleanup_arg_not_function : Error<
3698   "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3699 def err_attribute_cleanup_func_must_take_one_arg : Error<
3700   "'cleanup' function %0 must take 1 parameter">;
3701 def err_attribute_cleanup_func_arg_incompatible_type : Error<
3702   "'cleanup' function %0 parameter has "
3703   "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3704 def err_attribute_regparm_wrong_platform : Error<
3705   "'regparm' is not valid on this platform">;
3706 def err_attribute_regparm_invalid_number : Error<
3707   "'regparm' parameter must be between 0 and %0 inclusive">;
3708 def err_attribute_not_supported_in_lang : Error<
3709   "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3710 def err_attribute_not_supported_on_arch
3711     : Error<"%0 attribute is not supported on '%1'">;
3712 def warn_gcc_ignores_type_attr : Warning<
3713   "GCC does not allow the %0 attribute to be written on a type">,
3714   InGroup<GccCompat>;
3715
3716 // Clang-Specific Attributes
3717 def warn_attribute_iboutlet : Warning<
3718   "%0 attribute can only be applied to instance variables or properties">,
3719   InGroup<IgnoredAttributes>;
3720 def err_iboutletcollection_type : Error<
3721   "invalid type %0 as argument of iboutletcollection attribute">;
3722 def err_iboutletcollection_builtintype : Error<
3723   "type argument of iboutletcollection attribute cannot be a builtin type">;
3724 def warn_iboutlet_object_type : Warning<
3725   "%select{instance variable|property}2 with %0 attribute must "
3726   "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3727 def warn_iboutletcollection_property_assign : Warning<
3728   "IBOutletCollection properties should be copy/strong and not assign">,
3729   InGroup<ObjCInvalidIBOutletProperty>;
3730
3731 def err_attribute_overloadable_mismatch : Error<
3732   "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
3733 def note_attribute_overloadable_prev_overload : Note<
3734   "previous %select{unmarked |}0overload of function is here">;
3735 def err_attribute_overloadable_no_prototype : Error<
3736   "'overloadable' function %0 must have a prototype">;
3737 def err_attribute_overloadable_multiple_unmarked_overloads : Error<
3738   "at most one overload for a given name may lack the 'overloadable' "
3739   "attribute">;
3740 def warn_attribute_no_builtin_invalid_builtin_name : Warning<
3741   "'%0' is not a valid builtin name for %1">,
3742   InGroup<DiagGroup<"invalid-no-builtin-names">>;
3743 def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
3744   "empty %0 cannot be composed with named ones">;
3745 def err_attribute_no_builtin_on_non_definition : Error<
3746   "%0 attribute is permitted on definitions only">;
3747 def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
3748   "%0 attribute has no effect on defaulted or deleted functions">;
3749 def warn_ns_attribute_wrong_return_type : Warning<
3750   "%0 attribute only applies to %select{functions|methods|properties}1 that "
3751   "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
3752   InGroup<IgnoredAttributes>;
3753 def err_ns_attribute_wrong_parameter_type : Error<
3754   "%0 attribute only applies to "
3755   "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
3756 def warn_ns_attribute_wrong_parameter_type : Warning<
3757   "%0 attribute only applies to "
3758   "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
3759   InGroup<IgnoredAttributes>;
3760 def warn_objc_requires_super_protocol : Warning<
3761   "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
3762   InGroup<DiagGroup<"requires-super-attribute">>;
3763 def note_protocol_decl : Note<
3764   "protocol is declared here">;
3765 def note_protocol_decl_undefined : Note<
3766   "protocol %0 has no definition">;
3767
3768 // objc_designated_initializer attribute diagnostics.
3769 def warn_objc_designated_init_missing_super_call : Warning<
3770   "designated initializer missing a 'super' call to a designated initializer of the super class">,
3771   InGroup<ObjCDesignatedInit>;
3772 def note_objc_designated_init_marked_here : Note<
3773   "method marked as designated initializer of the class here">;
3774 def warn_objc_designated_init_non_super_designated_init_call : Warning<
3775   "designated initializer should only invoke a designated initializer on 'super'">,
3776   InGroup<ObjCDesignatedInit>;
3777 def warn_objc_designated_init_non_designated_init_call : Warning<
3778   "designated initializer invoked a non-designated initializer">,
3779   InGroup<ObjCDesignatedInit>;
3780 def warn_objc_secondary_init_super_init_call : Warning<
3781   "convenience initializer should not invoke an initializer on 'super'">,
3782   InGroup<ObjCDesignatedInit>;
3783 def warn_objc_secondary_init_missing_init_call : Warning<
3784   "convenience initializer missing a 'self' call to another initializer">,
3785   InGroup<ObjCDesignatedInit>;
3786 def warn_objc_implementation_missing_designated_init_override : Warning<
3787   "method override for the designated initializer of the superclass %objcinstance0 not found">,
3788   InGroup<ObjCDesignatedInit>;
3789 def err_designated_init_attr_non_init : Error<
3790   "'objc_designated_initializer' attribute only applies to init methods "
3791   "of interface or class extension declarations">;
3792
3793 // objc_bridge attribute diagnostics.
3794 def err_objc_attr_not_id : Error<
3795   "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
3796 def err_objc_attr_typedef_not_id : Error<
3797   "parameter of %0 attribute must be 'id' when used on a typedef">;
3798 def err_objc_attr_typedef_not_void_pointer : Error<
3799   "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
3800 def err_objc_cf_bridged_not_interface : Error<
3801   "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
3802 def err_objc_ns_bridged_invalid_cfobject : Error<
3803   "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
3804 def warn_objc_invalid_bridge : Warning<
3805   "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
3806 def warn_objc_invalid_bridge_to_cf : Warning<
3807   "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
3808
3809 // objc_bridge_related attribute diagnostics.
3810 def err_objc_bridged_related_invalid_class : Error<
3811   "could not find Objective-C class %0 to convert %1 to %2">;
3812 def err_objc_bridged_related_invalid_class_name : Error<
3813   "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
3814 def err_objc_bridged_related_known_method : Error<
3815  "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
3816  "method for this conversion">;
3817
3818 def err_objc_attr_protocol_requires_definition : Error<
3819   "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
3820
3821 def warn_ignored_objc_externally_retained : Warning<
3822   "'objc_externally_retained' can only be applied to local variables "
3823   "%select{of retainable type|with strong ownership}0">,
3824   InGroup<IgnoredAttributes>;
3825
3826 // Function Parameter Semantic Analysis.
3827 def err_param_with_void_type : Error<"argument may not have 'void' type">;
3828 def err_void_only_param : Error<
3829   "'void' must be the first and only parameter if specified">;
3830 def err_void_param_qualified : Error<
3831   "'void' as parameter must not have type qualifiers">;
3832 def err_ident_list_in_fn_declaration : Error<
3833   "a parameter list without types is only allowed in a function definition">;
3834 def ext_param_not_declared : Extension<
3835   "parameter %0 was not declared, defaulting to type 'int'">;
3836 def err_param_default_argument : Error<
3837   "C does not support default arguments">;
3838 def err_param_default_argument_redefinition : Error<
3839   "redefinition of default argument">;
3840 def ext_param_default_argument_redefinition : ExtWarn<
3841   err_param_default_argument_redefinition.Text>,
3842   InGroup<MicrosoftDefaultArgRedefinition>;
3843 def err_param_default_argument_missing : Error<
3844   "missing default argument on parameter">;
3845 def err_param_default_argument_missing_name : Error<
3846   "missing default argument on parameter %0">;
3847 def err_param_default_argument_references_param : Error<
3848   "default argument references parameter %0">;
3849 def err_param_default_argument_references_local : Error<
3850   "default argument references local variable %0 of enclosing function">;
3851 def err_param_default_argument_references_this : Error<
3852   "default argument references 'this'">;
3853 def err_param_default_argument_nonfunc : Error<
3854   "default arguments can only be specified for parameters in a function "
3855   "declaration">;
3856 def err_param_default_argument_template_redecl : Error<
3857   "default arguments cannot be added to a function template that has already "
3858   "been declared">;
3859 def err_param_default_argument_member_template_redecl : Error<
3860   "default arguments cannot be added to an out-of-line definition of a member "
3861   "of a %select{class template|class template partial specialization|nested "
3862   "class in a template}0">;
3863 def err_param_default_argument_on_parameter_pack : Error<
3864   "parameter pack cannot have a default argument">;
3865 def err_uninitialized_member_for_assign : Error<
3866   "cannot define the implicit copy assignment operator for %0, because "
3867   "non-static %select{reference|const}1 member %2 cannot use copy "
3868   "assignment operator">;
3869 def err_uninitialized_member_in_ctor : Error<
3870   "%select{constructor for %1|"
3871   "implicit default constructor for %1|"
3872   "cannot use constructor inherited from %1:}0 must explicitly "
3873   "initialize the %select{reference|const}2 member %3">;
3874 def err_default_arg_makes_ctor_special : Error<
3875   "addition of default argument on redeclaration makes this constructor a "
3876   "%select{default|copy|move}0 constructor">;
3877
3878 def err_use_of_default_argument_to_function_declared_later : Error<
3879   "use of default argument to function %0 that is declared later in class %1">;
3880 def note_default_argument_declared_here : Note<
3881   "default argument declared here">;
3882 def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
3883
3884 def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
3885   "%diff{promoted type $ of K&R function parameter is not compatible with the "
3886   "parameter type $|promoted type of K&R function parameter is not compatible "
3887   "with parameter type}0,1 declared in a previous prototype">,
3888   InGroup<KNRPromotedParameter>;
3889
3890
3891 // C++ Overloading Semantic Analysis.
3892 def err_ovl_diff_return_type : Error<
3893   "functions that differ only in their return type cannot be overloaded">;
3894 def err_ovl_static_nonstatic_member : Error<
3895   "static and non-static member functions with the same parameter types "
3896   "cannot be overloaded">;
3897
3898 def err_ovl_no_viable_function_in_call : Error<
3899   "no matching function for call to %0">;
3900 def err_ovl_no_viable_member_function_in_call : Error<
3901   "no matching member function for call to %0">;
3902 def err_ovl_ambiguous_call : Error<
3903   "call to %0 is ambiguous">;
3904 def err_ovl_deleted_call : Error<"call to deleted function %0">;
3905 def err_ovl_ambiguous_member_call : Error<
3906   "call to member function %0 is ambiguous">;
3907 def err_ovl_deleted_member_call : Error<
3908   "call to deleted member function %0">;
3909 def note_ovl_too_many_candidates : Note<
3910     "remaining %0 candidate%s0 omitted; "
3911     "pass -fshow-overloads=all to show them">;
3912
3913 def select_ovl_candidate_kind : TextSubstitution<
3914   "%select{function|function|function (with reversed parameter order)|"
3915     "constructor|"
3916     "constructor (the implicit default constructor)|"
3917     "constructor (the implicit copy constructor)|"
3918     "constructor (the implicit move constructor)|"
3919     "function (the implicit copy assignment operator)|"
3920     "function (the implicit move assignment operator)|"
3921     "function (the implicit 'operator==' for this 'operator<=>)'|"
3922     "inherited constructor}0%select{| template| %2}1">;
3923
3924 def note_ovl_candidate : Note<
3925     "candidate %sub{select_ovl_candidate_kind}0,1,3"
3926     "%select{| has different class%diff{ (expected $ but has $)|}5,6"
3927     "| has different number of parameters (expected %5 but has %6)"
3928     "| has type mismatch at %ordinal5 parameter"
3929     "%diff{ (expected $ but has $)|}6,7"
3930     "| has different return type%diff{ ($ expected but has $)|}5,6"
3931     "| has different qualifiers (expected %5 but found %6)"
3932     "| has different exception specification}4">;
3933
3934 def note_ovl_candidate_explicit : Note<
3935     "explicit %select{constructor|conversion function|deduction guide}0 "
3936     "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
3937 def note_ovl_candidate_inherited_constructor : Note<
3938     "constructor from base class %0 inherited here">;
3939 def note_ovl_candidate_inherited_constructor_slice : Note<
3940     "candidate %select{constructor|template}0 ignored: "
3941     "inherited constructor cannot be used to %select{copy|move}1 object">;
3942 def note_ovl_candidate_illegal_constructor : Note<
3943     "candidate %select{constructor|template}0 ignored: "
3944     "instantiation %select{takes|would take}0 its own class type by value">;
3945 def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
3946     "candidate constructor ignored: cannot be used to construct an object "
3947     "in address space %0">;
3948 def note_ovl_candidate_bad_deduction : Note<
3949     "candidate template ignored: failed template argument deduction">;
3950 def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
3951     "couldn't infer template argument %0">;
3952 def note_ovl_candidate_incomplete_deduction_pack : Note<
3953     "candidate template ignored: "
3954     "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
3955     "expanded parameter in deduced argument pack %2">;
3956 def note_ovl_candidate_inconsistent_deduction : Note<
3957     "candidate template ignored: deduced %select{conflicting types|"
3958     "conflicting values|conflicting templates|packs of different lengths}0 "
3959     "for parameter %1%diff{ ($ vs. $)|}2,3">;
3960 def note_ovl_candidate_inconsistent_deduction_types : Note<
3961     "candidate template ignored: deduced values %diff{"
3962     "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
3963     "%1 and %3 of conflicting types for parameter %0}2,4">;
3964 def note_ovl_candidate_explicit_arg_mismatch_named : Note<
3965     "candidate template ignored: invalid explicitly-specified argument "
3966     "for template parameter %0">;
3967 def note_ovl_candidate_unsatisfied_constraints : Note<
3968     "candidate template ignored: constraints not satisfied%0">;
3969 def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
3970     "candidate template ignored: invalid explicitly-specified argument "
3971     "for %ordinal0 template parameter">;
3972 def note_ovl_candidate_instantiation_depth : Note<
3973     "candidate template ignored: substitution exceeded maximum template "
3974     "instantiation depth">;
3975 def note_ovl_candidate_underqualified : Note<
3976     "candidate template ignored: cannot deduce a type for %0 that would "
3977     "make %2 equal %1">;
3978 def note_ovl_candidate_substitution_failure : Note<
3979     "candidate template ignored: substitution failure%0%1">;
3980 def note_ovl_candidate_disabled_by_enable_if : Note<
3981     "candidate template ignored: disabled by %0%1">;
3982 def note_ovl_candidate_disabled_by_requirement : Note<
3983     "candidate template ignored: requirement '%0' was not satisfied%1">;
3984 def note_ovl_candidate_has_pass_object_size_params: Note<
3985     "candidate address cannot be taken because parameter %0 has "
3986     "pass_object_size attribute">;
3987 def err_diagnose_if_succeeded : Error<"%0">;
3988 def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
3989     ShowInSystemHeader;
3990 def note_ovl_candidate_disabled_by_function_cond_attr : Note<
3991     "candidate disabled: %0">;
3992 def note_ovl_candidate_disabled_by_extension : Note<
3993     "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
3994 def err_addrof_function_disabled_by_enable_if_attr : Error<
3995     "cannot take address of function %0 because it has one or more "
3996     "non-tautological enable_if conditions">;
3997 def err_addrof_function_constraints_not_satisfied : Error<
3998     "cannot take address of function %0 because its constraints are not "
3999     "satisfied">;
4000 def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4001     "candidate function made ineligible by enable_if">;
4002 def note_ovl_candidate_deduced_mismatch : Note<
4003     "candidate template ignored: deduced type "
4004     "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4005     "adjusted type $ of %select{|element of }4argument"
4006     "|of %select{|element of }4%ordinal0 parameter does not match "
4007     "adjusted type of %select{|element of }4argument}1,2%3">;
4008 def note_ovl_candidate_non_deduced_mismatch : Note<
4009     "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4010 // This note is needed because the above note would sometimes print two
4011 // different types with the same name.  Remove this note when the above note
4012 // can handle that case properly.
4013 def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4014     "candidate template ignored: could not match %q0 against %q1">;
4015
4016 // Note that we don't treat templates differently for this diagnostic.
4017 def note_ovl_candidate_arity : Note<"candidate "
4018     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4019     "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4020     "%plural{1:was|:were}5 provided">;
4021
4022 def note_ovl_candidate_arity_one : Note<"candidate "
4023     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4024     "%select{requires at least|allows at most single|requires single}3 "
4025     "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4026
4027 def note_ovl_candidate_deleted : Note<
4028     "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4029     "%select{explicitly made unavailable|explicitly deleted|"
4030     "implicitly deleted}3">;
4031
4032 // Giving the index of the bad argument really clutters this message, and
4033 // it's relatively unimportant because 1) it's generally obvious which
4034 // argument(s) are of the given object type and 2) the fix is usually
4035 // to complete the type, which doesn't involve changes to the call line
4036 // anyway.  If people complain, we can change it.
4037 def note_ovl_candidate_bad_conv_incomplete : Note<
4038     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4039     "cannot convert argument of incomplete type "
4040     "%diff{$ to $|to parameter type}3,4 for "
4041     "%select{%ordinal6 argument|object argument}5"
4042     "%select{|; dereference the argument with *|"
4043     "; take the address of the argument with &|"
4044     "; remove *|"
4045     "; remove &}7">;
4046 def note_ovl_candidate_bad_list_argument : Note<
4047     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4048     "cannot convert initializer list argument to %4">;
4049 def note_ovl_candidate_bad_overload : Note<
4050     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4051     "no overload of %4 matching %3 for %ordinal5 argument">;
4052 def note_ovl_candidate_bad_conv : Note<
4053     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4054     "no known conversion "
4055     "%diff{from $ to $|from argument type to parameter type}3,4 for "
4056     "%select{%ordinal6 argument|object argument}5"
4057     "%select{|; dereference the argument with *|"
4058     "; take the address of the argument with &|"
4059     "; remove *|"
4060     "; remove &}7">;
4061 def note_ovl_candidate_bad_arc_conv : Note<
4062     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4063     "cannot implicitly convert argument "
4064     "%diff{of type $ to $|type to parameter type}3,4 for "
4065     "%select{%ordinal6 argument|object argument}5 under ARC">;
4066 def note_ovl_candidate_bad_lvalue : Note<
4067     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4068     "expects an l-value for "
4069     "%select{%ordinal4 argument|object argument}3">;
4070 def note_ovl_candidate_bad_addrspace : Note<
4071     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4072     "cannot %select{pass pointer to|bind reference in}5 %3 "
4073     "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4074     "argument">;
4075 def note_ovl_candidate_bad_addrspace_this : Note<
4076     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4077     "'this' object is in %3, but method expects object in %4">;
4078 def note_ovl_candidate_bad_gc : Note<
4079     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4080     "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4081     "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4082 def note_ovl_candidate_bad_ownership : Note<
4083     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4084     "%select{%ordinal7|'this'}6 argument (%3) has "
4085     "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4086     " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4087     "__autoreleasing}5 ownership">;
4088 def note_ovl_candidate_bad_cvr_this : Note<
4089     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4090     "'this' argument has type %3, but method is not marked "
4091     "%select{const|restrict|const or restrict|volatile|const or volatile|"
4092     "volatile or restrict|const, volatile, or restrict}4">;
4093 def note_ovl_candidate_bad_cvr : Note<
4094     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4095     "%ordinal5 argument (%3) would lose "
4096     "%select{const|restrict|const and restrict|volatile|const and volatile|"
4097     "volatile and restrict|const, volatile, and restrict}4 qualifier"
4098     "%select{||s||s|s|s}4">;
4099 def note_ovl_candidate_bad_unaligned : Note<
4100     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4101     "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4102 def note_ovl_candidate_bad_base_to_derived_conv : Note<
4103     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4104     "cannot %select{convert from|convert from|bind}3 "
4105     "%select{base class pointer|superclass|base class object of type}3 %4 to "
4106     "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4107     "%ordinal6 argument">;
4108 def note_ovl_candidate_bad_target : Note<
4109     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4110     "call to "
4111     "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4112     " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4113 def note_ovl_candidate_constraints_not_satisfied : Note<
4114     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4115     "not satisfied">;
4116 def note_implicit_member_target_infer_collision : Note<
4117     "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4118     "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4119     "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4120
4121 def note_ambiguous_type_conversion: Note<
4122     "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4123 def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4124 def err_ovl_no_viable_function_in_init : Error<
4125   "no matching constructor for initialization of %0">;
4126 def err_ovl_no_conversion_in_cast : Error<
4127   "cannot convert %1 to %2 without a conversion operator">;
4128 def err_ovl_no_viable_conversion_in_cast : Error<
4129   "no matching conversion for %select{|static_cast|reinterpret_cast|"
4130   "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
4131 def err_ovl_ambiguous_conversion_in_cast : Error<
4132   "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4133   "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
4134 def err_ovl_deleted_conversion_in_cast : Error<
4135   "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4136   "functional-style cast}0 from %1 to %2 uses deleted function">;
4137 def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4138 def err_ref_init_ambiguous : Error<
4139   "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4140 def err_ovl_deleted_init : Error<
4141   "call to deleted constructor of %0">;
4142 def err_ovl_deleted_special_init : Error<
4143   "call to implicitly-deleted %select{default constructor|copy constructor|"
4144   "move constructor|copy assignment operator|move assignment operator|"
4145   "destructor|function}0 of %1">;
4146 def err_ovl_ambiguous_oper_unary : Error<
4147   "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4148 def err_ovl_ambiguous_oper_binary : Error<
4149   "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4150 def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4151   "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4152   "and %2) to be ambiguous despite there being a unique best viable function">,
4153   InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4154 def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4155   "ambiguity is between a regular call to this operator and a call with the "
4156   "argument order reversed">;
4157 def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4158 def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4159 def err_ovl_deleted_oper : Error<
4160   "overload resolution selected deleted operator '%0'">;
4161 def err_ovl_deleted_special_oper : Error<
4162   "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4163   "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4164   "implicitly deleted">;
4165 def err_ovl_deleted_comparison : Error<
4166   "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4167 def err_ovl_rewrite_equalequal_not_bool : Error<
4168   "return type %0 of selected 'operator==' function for rewritten "
4169   "'%1' comparison is not 'bool'">;
4170 def err_ovl_no_viable_subscript :
4171     Error<"no viable overloaded operator[] for type %0">;
4172 def err_ovl_no_oper :
4173     Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4174 def err_ovl_unresolvable : Error<
4175   "reference to %select{overloaded|multiversioned}1 function could not be "
4176   "resolved; did you mean to call it%select{| with no arguments}0?">;
4177 def err_bound_member_function : Error<
4178   "reference to non-static member function must be called"
4179   "%select{|; did you mean to call it with no arguments?}0">;
4180 def note_possible_target_of_call : Note<"possible target for call">;
4181
4182 def err_ovl_no_viable_object_call : Error<
4183   "no matching function for call to object of type %0">;
4184 def err_ovl_ambiguous_object_call : Error<
4185   "call to object of type %0 is ambiguous">;
4186 def err_ovl_deleted_object_call : Error<
4187   "call to deleted function call operator in type %0">;
4188 def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4189 def err_member_call_without_object : Error<
4190   "call to non-static member function without an object argument">;
4191
4192 // C++ Address of Overloaded Function
4193 def err_addr_ovl_no_viable : Error<
4194   "address of overloaded function %0 does not match required type %1">;
4195 def err_addr_ovl_ambiguous : Error<
4196   "address of overloaded function %0 is ambiguous">;
4197 def err_addr_ovl_not_func_ptrref : Error<
4198   "address of overloaded function %0 cannot be converted to type %1">;
4199 def err_addr_ovl_no_qualifier : Error<
4200   "cannot form member pointer of type %0 without '&' and class name">;
4201
4202 // C++11 Literal Operators
4203 def err_ovl_no_viable_literal_operator : Error<
4204   "no matching literal operator for call to %0"
4205   "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4206   "%select{| or 'const char *'}4"
4207   "%select{|, and no matching literal operator template}5">;
4208
4209 // C++ Template Declarations
4210 def err_template_param_shadow : Error<
4211   "declaration of %0 shadows template parameter">;
4212 def ext_template_param_shadow : ExtWarn<
4213   err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4214 def note_template_param_here : Note<"template parameter is declared here">;
4215 def warn_template_export_unsupported : Warning<
4216   "exported templates are unsupported">;
4217 def err_template_outside_namespace_or_class_scope : Error<
4218   "templates can only be declared in namespace or class scope">;
4219 def err_template_inside_local_class : Error<
4220   "templates cannot be declared inside of a local class">;
4221 def err_template_linkage : Error<"templates must have C++ linkage">;
4222 def err_template_typedef : Error<"a typedef cannot be a template">;
4223 def err_template_unnamed_class : Error<
4224   "cannot declare a class template with no name">;
4225 def err_template_param_list_different_arity : Error<
4226   "%select{too few|too many}0 template parameters in template "
4227   "%select{|template parameter }1redeclaration">;
4228 def note_template_param_list_different_arity : Note<
4229   "%select{too few|too many}0 template parameters in template template "
4230   "argument">;
4231 def note_template_prev_declaration : Note<
4232   "previous template %select{declaration|template parameter}0 is here">;
4233 def err_template_param_different_kind : Error<
4234   "template parameter has a different kind in template "
4235   "%select{|template parameter }0redeclaration">;
4236 def note_template_param_different_kind : Note<
4237   "template parameter has a different kind in template argument">;
4238
4239 def err_invalid_decl_specifier_in_nontype_parm : Error<
4240   "invalid declaration specifier in template non-type parameter">;
4241
4242 def err_template_nontype_parm_different_type : Error<
4243   "template non-type parameter has a different type %0 in template "
4244   "%select{|template parameter }1redeclaration">;
4245
4246 def note_template_nontype_parm_different_type : Note<
4247   "template non-type parameter has a different type %0 in template argument">;
4248 def note_template_nontype_parm_prev_declaration : Note<
4249   "previous non-type template parameter with type %0 is here">;
4250 def err_template_nontype_parm_bad_type : Error<
4251   "a non-type template parameter cannot have type %0">;
4252 def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4253   "non-type template parameters declared with %0 are incompatible with C++ "
4254   "standards before C++17">,
4255   DefaultIgnore, InGroup<CXXPre17Compat>;
4256 def err_template_param_default_arg_redefinition : Error<
4257   "template parameter redefines default argument">;
4258 def note_template_param_prev_default_arg : Note<
4259   "previous default template argument defined here">;
4260 def err_template_param_default_arg_missing : Error<
4261   "template parameter missing a default argument">;
4262 def ext_template_parameter_default_in_function_template : ExtWarn<
4263   "default template arguments for a function template are a C++11 extension">,
4264   InGroup<CXX11>;
4265 def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4266   "default template arguments for a function template are incompatible with C++98">,
4267   InGroup<CXX98Compat>, DefaultIgnore;
4268 def err_template_parameter_default_template_member : Error<
4269   "cannot add a default template argument to the definition of a member of a "
4270   "class template">;
4271 def err_template_parameter_default_friend_template : Error<
4272   "default template argument not permitted on a friend template">;
4273 def err_template_template_parm_no_parms : Error<
4274   "template template parameter must have its own template parameters">;
4275
4276 def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4277   InGroup<CXX14>;
4278 def warn_cxx11_compat_variable_template : Warning<
4279   "variable templates are incompatible with C++ standards before C++14">,
4280   InGroup<CXXPre14Compat>, DefaultIgnore;
4281 def err_template_variable_noparams : Error<
4282   "extraneous 'template<>' in declaration of variable %0">;
4283 def err_template_member : Error<"member %0 declared as a template">;
4284 def err_template_member_noparams : Error<
4285   "extraneous 'template<>' in declaration of member %0">;
4286 def err_template_tag_noparams : Error<
4287   "extraneous 'template<>' in declaration of %0 %1">;
4288
4289 def warn_cxx17_compat_adl_only_template_id : Warning<
4290   "use of function template name with no prior function template "
4291   "declaration in function call with explicit template arguments "
4292   "is incompatible with C++ standards before C++20">,
4293   InGroup<CXXPre20Compat>, DefaultIgnore;
4294 def ext_adl_only_template_id : ExtWarn<
4295   "use of function template name with no prior declaration in function call "
4296   "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4297
4298 // C++ Template Argument Lists
4299 def err_template_missing_args : Error<
4300   "use of "
4301   "%select{class template|function template|variable template|alias template|"
4302   "template template parameter|concept|template}0 %1 requires template "
4303   "arguments">;
4304 def err_template_arg_list_different_arity : Error<
4305   "%select{too few|too many}0 template arguments for "
4306   "%select{class template|function template|variable template|alias template|"
4307   "template template parameter|concept|template}1 %2">;
4308 def note_template_decl_here : Note<"template is declared here">;
4309 def err_template_arg_must_be_type : Error<
4310   "template argument for template type parameter must be a type">;
4311 def err_template_arg_must_be_type_suggest : Error<
4312   "template argument for template type parameter must be a type; "
4313   "did you forget 'typename'?">;
4314 def ext_ms_template_type_arg_missing_typename : ExtWarn<
4315   "template argument for template type parameter must be a type; "
4316   "omitted 'typename' is a Microsoft extension">,
4317   InGroup<MicrosoftTemplate>;
4318 def err_template_arg_must_be_expr : Error<
4319   "template argument for non-type template parameter must be an expression">;
4320 def err_template_arg_nontype_ambig : Error<
4321   "template argument for non-type template parameter is treated as function type %0">;
4322 def err_template_arg_must_be_template : Error<
4323   "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4324 def ext_template_arg_local_type : ExtWarn<
4325   "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4326 def ext_template_arg_unnamed_type : ExtWarn<
4327   "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4328 def warn_cxx98_compat_template_arg_local_type : Warning<
4329   "local type %0 as template argument is incompatible with C++98">,
4330   InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4331 def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4332   "unnamed type as template argument is incompatible with C++98">,
4333   InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4334 def note_template_unnamed_type_here : Note<
4335   "unnamed type used in template argument was declared here">;
4336 def err_template_arg_overload_type : Error<
4337   "template argument is the type of an unresolved overloaded function">;
4338 def err_template_arg_not_valid_template : Error<
4339   "template argument does not refer to a class or alias template, or template "
4340   "template parameter">;
4341 def note_template_arg_refers_here_func : Note<
4342   "template argument refers to function template %0, here">;
4343 def err_template_arg_template_params_mismatch : Error<
4344   "template template argument has different template parameters than its "
4345   "corresponding template template parameter">;
4346 def err_template_arg_not_integral_or_enumeral : Error<
4347   "non-type template argument of type %0 must have an integral or enumeration"
4348   " type">;
4349 def err_template_arg_not_ice : Error<
4350   "non-type template argument of type %0 is not an integral constant "
4351   "expression">;
4352 def err_template_arg_not_address_constant : Error<
4353   "non-type template argument of type %0 is not a constant expression">;
4354 def warn_cxx98_compat_template_arg_null : Warning<
4355   "use of null pointer as non-type template argument is incompatible with "
4356   "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4357 def err_template_arg_untyped_null_constant : Error<
4358   "null non-type template argument must be cast to template parameter type %0">;
4359 def err_template_arg_wrongtype_null_constant : Error<
4360   "null non-type template argument of type %0 does not match template parameter "
4361   "of type %1">;
4362 def err_non_type_template_parm_type_deduction_failure : Error<
4363   "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4364 def err_deduced_non_type_template_arg_type_mismatch : Error<
4365   "deduced non-type template argument does not have the same type as the "
4366   "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4367 def err_non_type_template_arg_subobject : Error<
4368   "non-type template argument refers to subobject '%0'">;
4369 def err_non_type_template_arg_addr_label_diff : Error<
4370   "template argument / label address difference / what did you expect?">;
4371 def err_template_arg_not_convertible : Error<
4372   "non-type template argument of type %0 cannot be converted to a value "
4373   "of type %1">;
4374 def warn_template_arg_negative : Warning<
4375   "non-type template argument with value '%0' converted to '%1' for unsigned "
4376   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4377 def warn_template_arg_too_large : Warning<
4378   "non-type template argument value '%0' truncated to '%1' for "
4379   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4380 def err_template_arg_no_ref_bind : Error<
4381   "non-type template parameter of reference type "
4382   "%diff{$ cannot bind to template argument of type $"
4383   "|cannot bind to template of incompatible argument type}0,1">;
4384 def err_template_arg_ref_bind_ignores_quals : Error<
4385   "reference binding of non-type template parameter "
4386   "%diff{of type $ to template argument of type $|to template argument}0,1 "
4387   "ignores qualifiers">;
4388 def err_template_arg_not_decl_ref : Error<
4389   "non-type template argument does not refer to any declaration">;
4390 def err_template_arg_not_address_of : Error<
4391   "non-type template argument for template parameter of pointer type %0 must "
4392   "have its address taken">;
4393 def err_template_arg_address_of_non_pointer : Error<
4394   "address taken in non-type template argument for template parameter of "
4395   "reference type %0">;
4396 def err_template_arg_reference_var : Error<
4397   "non-type template argument of reference type %0 is not an object">;
4398 def err_template_arg_field : Error<
4399   "non-type template argument refers to non-static data member %0">;
4400 def err_template_arg_method : Error<
4401   "non-type template argument refers to non-static member function %0">;
4402 def err_template_arg_object_no_linkage : Error<
4403   "non-type template argument refers to %select{function|object}0 %1 that "
4404   "does not have linkage">;
4405 def warn_cxx98_compat_template_arg_object_internal : Warning<
4406   "non-type template argument referring to %select{function|object}0 %1 with "
4407   "internal linkage is incompatible with C++98">,
4408   InGroup<CXX98Compat>, DefaultIgnore;
4409 def ext_template_arg_object_internal : ExtWarn<
4410   "non-type template argument referring to %select{function|object}0 %1 with "
4411   "internal linkage is a C++11 extension">, InGroup<CXX11>;
4412 def err_template_arg_thread_local : Error<
4413   "non-type template argument refers to thread-local object">;
4414 def note_template_arg_internal_object : Note<
4415   "non-type template argument refers to %select{function|object}0 here">;
4416 def note_template_arg_refers_here : Note<
4417   "non-type template argument refers here">;
4418 def err_template_arg_not_object_or_func : Error<
4419   "non-type template argument does not refer to an object or function">;
4420 def err_template_arg_not_pointer_to_member_form : Error<
4421   "non-type template argument is not a pointer to member constant">;
4422 def err_template_arg_member_ptr_base_derived_not_supported : Error<
4423   "sorry, non-type template argument of pointer-to-member type %1 that refers "
4424   "to member %q0 of a different class is not supported yet">;
4425 def ext_template_arg_extra_parens : ExtWarn<
4426   "address non-type template argument cannot be surrounded by parentheses">;
4427 def warn_cxx98_compat_template_arg_extra_parens : Warning<
4428   "redundant parentheses surrounding address non-type template argument are "
4429   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4430 def err_pointer_to_member_type : Error<
4431   "invalid use of pointer to member type after %select{.*|->*}0">;
4432 def err_pointer_to_member_call_drops_quals : Error<
4433   "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4434 def err_pointer_to_member_oper_value_classify: Error<
4435   "pointer-to-member function type %0 can only be called on an "
4436   "%select{rvalue|lvalue}1">;
4437 def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4438   "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4439   InGroup<CXX20>, SFINAEFailure;
4440 def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4441   "invoking a pointer to a 'const &' member function on an rvalue is "
4442   "incompatible with C++ standards before C++20">,
4443   InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4444 def ext_ms_deref_template_argument: ExtWarn<
4445   "non-type template argument containing a dereference operation is a "
4446   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4447 def ext_ms_delayed_template_argument: ExtWarn<
4448   "using the undeclared type %0 as a default template argument is a "
4449   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4450 def err_template_arg_deduced_incomplete_pack : Error<
4451   "deduced incomplete pack %0 for template parameter %1">;
4452
4453 // C++ template specialization
4454 def err_template_spec_unknown_kind : Error<
4455   "can only provide an explicit specialization for a class template, function "
4456   "template, variable template, or a member function, static data member, "
4457   "%select{or member class|member class, or member enumeration}0 of a "
4458   "class template">;
4459 def note_specialized_entity : Note<
4460   "explicitly specialized declaration is here">;
4461 def note_explicit_specialization_declared_here : Note<
4462   "explicit specialization declared here">;
4463 def err_template_spec_decl_function_scope : Error<
4464   "explicit specialization of %0 in function scope">;
4465 def err_template_spec_decl_friend : Error<
4466   "cannot declare an explicit specialization in a friend">;
4467 def err_template_spec_redecl_out_of_scope : Error<
4468   "%select{class template|class template partial|variable template|"
4469   "variable template partial|function template|member "
4470   "function|static data member|member class|member enumeration}0 "
4471   "specialization of %1 not in %select{a namespace enclosing %2|"
4472   "class %2 or an enclosing namespace}3">;
4473 def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4474   "%select{class template|class template partial|variable template|"
4475   "variable template partial|function template|member "
4476   "function|static data member|member class|member enumeration}0 "
4477   "specialization of %1 not in %select{a namespace enclosing %2|"
4478   "class %2 or an enclosing namespace}3 "
4479   "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4480 def err_template_spec_redecl_global_scope : Error<
4481   "%select{class template|class template partial|variable template|"
4482   "variable template partial|function template|member "
4483   "function|static data member|member class|member enumeration}0 "
4484   "specialization of %1 must occur at global scope">;
4485 def err_spec_member_not_instantiated : Error<
4486   "specialization of member %q0 does not specialize an instantiated member">;
4487 def note_specialized_decl : Note<"attempt to specialize declaration here">;
4488 def err_specialization_after_instantiation : Error<
4489   "explicit specialization of %0 after instantiation">;
4490 def note_instantiation_required_here : Note<
4491   "%select{implicit|explicit}0 instantiation first required here">;
4492 def err_template_spec_friend : Error<
4493   "template specialization declaration cannot be a friend">;
4494 def err_template_spec_default_arg : Error<
4495   "default argument not permitted on an explicit "
4496   "%select{instantiation|specialization}0 of function %1">;
4497 def err_not_class_template_specialization : Error<
4498   "cannot specialize a %select{dependent template|template template "
4499   "parameter}0">;
4500 def ext_explicit_specialization_storage_class : ExtWarn<
4501   "explicit specialization cannot have a storage class">;
4502 def err_explicit_specialization_inconsistent_storage_class : Error<
4503   "explicit specialization has extraneous, inconsistent storage class "
4504   "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4505 def err_dependent_function_template_spec_no_match : Error<
4506   "no candidate function template was found for dependent"
4507   " friend function template specialization">;
4508 def note_dependent_function_template_spec_discard_reason : Note<
4509   "candidate ignored: %select{not a function template"
4510   "|not a member of the enclosing namespace;"
4511   " did you mean to explicitly qualify the specialization?}0">;
4512
4513 // C++ class template specializations and out-of-line definitions
4514 def err_template_spec_needs_header : Error<
4515   "template specialization requires 'template<>'">;
4516 def err_template_spec_needs_template_parameters : Error<
4517   "template specialization or definition requires a template parameter list "
4518   "corresponding to the nested type %0">;
4519 def err_template_param_list_matches_nontemplate : Error<
4520   "template parameter list matching the non-templated nested type %0 should "
4521   "be empty ('template<>')">;
4522 def err_alias_template_extra_headers : Error<
4523   "extraneous template parameter list in alias template declaration">;
4524 def err_template_spec_extra_headers : Error<
4525   "extraneous template parameter list in template specialization or "
4526   "out-of-line template definition">;
4527 def warn_template_spec_extra_headers : Warning<
4528   "extraneous template parameter list in template specialization">;
4529 def note_explicit_template_spec_does_not_need_header : Note<
4530   "'template<>' header not required for explicitly-specialized class %0 "
4531   "declared here">;
4532 def err_template_qualified_declarator_no_match : Error<
4533   "nested name specifier '%0' for declaration does not refer into a class, "
4534   "class template or class template partial specialization">;
4535 def err_specialize_member_of_template : Error<
4536   "cannot specialize %select{|(with 'template<>') }0a member of an "
4537   "unspecialized template">;
4538
4539 // C++ Class Template Partial Specialization
4540 def err_default_arg_in_partial_spec : Error<
4541     "default template argument in a class template partial specialization">;
4542 def err_dependent_non_type_arg_in_partial_spec : Error<
4543     "type of specialized non-type template argument depends on a template "
4544     "parameter of the partial specialization">;
4545 def note_dependent_non_type_default_arg_in_partial_spec : Note<
4546     "template parameter is used in default argument declared here">;
4547 def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4548     "non-type template argument specializes a template parameter with "
4549     "dependent type %0">;
4550 def err_partial_spec_args_match_primary_template : Error<
4551     "%select{class|variable}0 template partial specialization does not "
4552     "specialize any template argument; to %select{declare|define}1 the "
4553     "primary template, remove the template argument list">;
4554 def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4555     "%select{class|variable}0 template partial specialization is not "
4556     "more specialized than the primary template">, DefaultError,
4557     InGroup<DiagGroup<"invalid-partial-specialization">>;
4558 def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4559 def ext_partial_specs_not_deducible : ExtWarn<
4560     "%select{class|variable}0 template partial specialization contains "
4561     "%select{a template parameter|template parameters}1 that cannot be "
4562     "deduced; this partial specialization will never be used">,
4563     DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4564 def note_non_deducible_parameter : Note<
4565     "non-deducible template parameter %0">;
4566 def err_partial_spec_ordering_ambiguous : Error<
4567     "ambiguous partial specializations of %0">;
4568 def note_partial_spec_match : Note<"partial specialization matches %0">;
4569 def err_partial_spec_redeclared : Error<
4570   "class template partial specialization %0 cannot be redeclared">;
4571 def note_partial_specialization_declared_here : Note<
4572   "explicit specialization declared here">;
4573 def note_prev_partial_spec_here : Note<
4574   "previous declaration of class template partial specialization %0 is here">;
4575 def err_partial_spec_fully_specialized : Error<
4576   "partial specialization of %0 does not use any of its template parameters">;
4577
4578 // C++ Variable Template Partial Specialization
4579 def err_var_partial_spec_redeclared : Error<
4580   "variable template partial specialization %0 cannot be redefined">;
4581 def note_var_prev_partial_spec_here : Note<
4582   "previous declaration of variable template partial specialization is here">;
4583 def err_var_spec_no_template : Error<
4584   "no variable template matches%select{| partial}0 specialization">;
4585 def err_var_spec_no_template_but_method : Error<
4586   "no variable template matches specialization; "
4587   "did you mean to use %0 as function template instead?">;
4588
4589 // C++ Function template specializations
4590 def err_function_template_spec_no_match : Error<
4591     "no function template matches function template specialization %0">;
4592 def err_function_template_spec_ambiguous : Error<
4593     "function template specialization %0 ambiguously refers to more than one "
4594     "function template; explicitly specify%select{| additional}1 template "
4595     "arguments to identify a particular function template">;
4596 def note_function_template_spec_matched : Note<
4597     "function template %q0 matches specialization %1">;
4598 def err_function_template_partial_spec : Error<
4599     "function template partial specialization is not allowed">;
4600
4601 // C++ Template Instantiation
4602 def err_template_recursion_depth_exceeded : Error<
4603   "recursive template instantiation exceeded maximum depth of %0">,
4604   DefaultFatal, NoSFINAE;
4605 def note_template_recursion_depth : Note<
4606   "use -ftemplate-depth=N to increase recursive template instantiation depth">;
4607
4608 def err_template_instantiate_within_definition : Error<
4609   "%select{implicit|explicit}0 instantiation of template %1 within its"
4610   " own definition">;
4611 def err_template_instantiate_undefined : Error<
4612   "%select{implicit|explicit}0 instantiation of undefined template %1">;
4613 def err_implicit_instantiate_member_undefined : Error<
4614   "implicit instantiation of undefined member %0">;
4615 def note_template_class_instantiation_was_here : Note<
4616   "class template %0 was instantiated here">;
4617 def note_template_class_explicit_specialization_was_here : Note<
4618   "class template %0 was explicitly specialized here">;
4619 def note_template_class_instantiation_here : Note<
4620   "in instantiation of template class %q0 requested here">;
4621 def note_template_member_class_here : Note<
4622   "in instantiation of member class %q0 requested here">;
4623 def note_template_member_function_here : Note<
4624   "in instantiation of member function %q0 requested here">;
4625 def note_function_template_spec_here : Note<
4626   "in instantiation of function template specialization %q0 requested here">;
4627 def note_template_static_data_member_def_here : Note<
4628   "in instantiation of static data member %q0 requested here">;
4629 def note_template_variable_def_here : Note<
4630   "in instantiation of variable template specialization %q0 requested here">;
4631 def note_template_enum_def_here : Note<
4632   "in instantiation of enumeration %q0 requested here">;
4633 def note_template_nsdmi_here : Note<
4634   "in instantiation of default member initializer %q0 requested here">;
4635 def note_template_type_alias_instantiation_here : Note<
4636   "in instantiation of template type alias %0 requested here">;
4637 def note_template_exception_spec_instantiation_here : Note<
4638   "in instantiation of exception specification for %0 requested here">;
4639 def note_template_requirement_instantiation_here : Note<
4640   "in instantiation of requirement here">;
4641 def warn_var_template_missing : Warning<"instantiation of variable %q0 "
4642   "required here, but no definition is available">,
4643   InGroup<UndefinedVarTemplate>;
4644 def warn_func_template_missing : Warning<"instantiation of function %q0 "
4645   "required here, but no definition is available">,
4646   InGroup<UndefinedFuncTemplate>, DefaultIgnore;
4647 def note_forward_template_decl : Note<
4648   "forward declaration of template entity is here">;
4649 def note_inst_declaration_hint : Note<"add an explicit instantiation "
4650   "declaration to suppress this warning if %q0 is explicitly instantiated in "
4651   "another translation unit">;
4652 def note_evaluating_exception_spec_here : Note<
4653   "in evaluation of exception specification for %q0 needed here">;
4654
4655 def note_default_arg_instantiation_here : Note<
4656   "in instantiation of default argument for '%0' required here">;
4657 def note_default_function_arg_instantiation_here : Note<
4658   "in instantiation of default function argument expression "
4659   "for '%0' required here">;
4660 def note_explicit_template_arg_substitution_here : Note<
4661   "while substituting explicitly-specified template arguments into function "
4662   "template %0 %1">;
4663 def note_function_template_deduction_instantiation_here : Note<
4664   "while substituting deduced template arguments into function template %0 "
4665   "%1">;
4666 def note_deduced_template_arg_substitution_here : Note<
4667   "during template argument deduction for %select{class|variable}0 template "
4668   "%select{partial specialization |}1%2 %3">;
4669 def note_prior_template_arg_substitution : Note<
4670   "while substituting prior template arguments into %select{non-type|template}0"
4671   " template parameter%1 %2">;
4672 def note_template_default_arg_checking : Note<
4673   "while checking a default template argument used here">;
4674 def note_concept_specialization_here : Note<
4675   "while checking the satisfaction of concept '%0' requested here">;
4676 def note_nested_requirement_here : Note<
4677   "while checking the satisfaction of nested requirement requested here">;
4678 def note_checking_constraints_for_template_id_here : Note<
4679   "while checking constraint satisfaction for template '%0' required here">;
4680 def note_checking_constraints_for_var_spec_id_here : Note<
4681   "while checking constraint satisfaction for variable template "
4682   "partial specialization '%0' required here">;
4683 def note_checking_constraints_for_class_spec_id_here : Note<
4684   "while checking constraint satisfaction for class template partial "
4685   "specialization '%0' required here">;
4686 def note_checking_constraints_for_function_here : Note<
4687   "while checking constraint satisfaction for function '%0' required here">;
4688 def note_constraint_substitution_here : Note<
4689   "while substituting template arguments into constraint expression here">;
4690 def note_constraint_normalization_here : Note<
4691   "while calculating associated constraint of template '%0' here">;
4692 def note_parameter_mapping_substitution_here : Note<
4693   "while substituting into concept arguments here; substitution failures not "
4694   "allowed in concept arguments">;
4695 def note_instantiation_contexts_suppressed : Note<
4696   "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
4697   "see all)">;
4698
4699 def err_field_instantiates_to_function : Error<
4700   "data member instantiated with function type %0">;
4701 def err_variable_instantiates_to_function : Error<
4702   "%select{variable|static data member}0 instantiated with function type %1">;
4703 def err_nested_name_spec_non_tag : Error<
4704   "type %0 cannot be used prior to '::' because it has no members">;
4705
4706 def err_using_pack_expansion_empty : Error<
4707   "%select{|member}0 using declaration %1 instantiates to an empty pack">;
4708
4709 // C++ Explicit Instantiation
4710 def err_explicit_instantiation_duplicate : Error<
4711     "duplicate explicit instantiation of %0">;
4712 def ext_explicit_instantiation_duplicate : ExtWarn<
4713     "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
4714     InGroup<MicrosoftTemplate>;
4715 def note_previous_explicit_instantiation : Note<
4716     "previous explicit instantiation is here">;
4717 def warn_explicit_instantiation_after_specialization : Warning<
4718   "explicit instantiation of %0 that occurs after an explicit "
4719   "specialization has no effect">,
4720   InGroup<DiagGroup<"instantiation-after-specialization">>;
4721 def note_previous_template_specialization : Note<
4722     "previous template specialization is here">;
4723 def err_explicit_instantiation_nontemplate_type : Error<
4724     "explicit instantiation of non-templated type %0">;
4725 def note_nontemplate_decl_here : Note<
4726     "non-templated declaration is here">;
4727 def err_explicit_instantiation_in_class : Error<
4728   "explicit instantiation of %0 in class scope">;
4729 def err_explicit_instantiation_out_of_scope : Error<
4730   "explicit instantiation of %0 not in a namespace enclosing %1">;
4731 def err_explicit_instantiation_must_be_global : Error<
4732   "explicit instantiation of %0 must occur at global scope">;
4733 def warn_explicit_instantiation_out_of_scope_0x : Warning<
4734   "explicit instantiation of %0 not in a namespace enclosing %1">,
4735   InGroup<CXX11Compat>, DefaultIgnore;
4736 def warn_explicit_instantiation_must_be_global_0x : Warning<
4737   "explicit instantiation of %0 must occur at global scope">,
4738   InGroup<CXX11Compat>, DefaultIgnore;
4739
4740 def err_explicit_instantiation_requires_name : Error<
4741   "explicit instantiation declaration requires a name">;
4742 def err_explicit_instantiation_of_typedef : Error<
4743   "explicit instantiation of typedef %0">;
4744 def err_explicit_instantiation_storage_class : Error<
4745   "explicit instantiation cannot have a storage class">;
4746 def err_explicit_instantiation_internal_linkage : Error<
4747   "explicit instantiation declaration of %0 with internal linkage">;
4748 def err_explicit_instantiation_not_known : Error<
4749   "explicit instantiation of %0 does not refer to a function template, "
4750   "variable template, member function, member class, or static data member">;
4751 def note_explicit_instantiation_here : Note<
4752   "explicit instantiation refers here">;
4753 def err_explicit_instantiation_data_member_not_instantiated : Error<
4754   "explicit instantiation refers to static data member %q0 that is not an "
4755   "instantiation">;
4756 def err_explicit_instantiation_member_function_not_instantiated : Error<
4757   "explicit instantiation refers to member function %q0 that is not an "
4758   "instantiation">;
4759 def err_explicit_instantiation_ambiguous : Error<
4760   "partial ordering for explicit instantiation of %0 is ambiguous">;
4761 def note_explicit_instantiation_candidate : Note<
4762   "explicit instantiation candidate function %q0 template here %1">;
4763 def err_explicit_instantiation_inline : Error<
4764   "explicit instantiation cannot be 'inline'">;
4765 def warn_explicit_instantiation_inline_0x : Warning<
4766   "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
4767   DefaultIgnore;
4768 def err_explicit_instantiation_constexpr : Error<
4769   "explicit instantiation cannot be 'constexpr'">;
4770 def ext_explicit_instantiation_without_qualified_id : Extension<
4771   "qualifier in explicit instantiation of %q0 requires a template-id "
4772   "(a typedef is not permitted)">;
4773 def err_explicit_instantiation_without_template_id : Error<
4774   "explicit instantiation of %q0 must specify a template argument list">;
4775 def err_explicit_instantiation_unqualified_wrong_namespace : Error<
4776   "explicit instantiation of %q0 must occur in namespace %1">;
4777 def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
4778   "explicit instantiation of %q0 must occur in namespace %1">,
4779   InGroup<CXX11Compat>, DefaultIgnore;
4780 def err_explicit_instantiation_undefined_member : Error<
4781   "explicit instantiation of undefined %select{member class|member function|"
4782   "static data member}0 %1 of class template %2">;
4783 def err_explicit_instantiation_undefined_func_template : Error<
4784   "explicit instantiation of undefined function template %0">;
4785 def err_explicit_instantiation_undefined_var_template : Error<
4786   "explicit instantiation of undefined variable template %q0">;
4787 def err_explicit_instantiation_declaration_after_definition : Error<
4788   "explicit instantiation declaration (with 'extern') follows explicit "
4789   "instantiation definition (without 'extern')">;
4790 def note_explicit_instantiation_definition_here : Note<
4791   "explicit instantiation definition is here">;
4792 def err_invalid_var_template_spec_type : Error<"type %2 "
4793   "of %select{explicit instantiation|explicit specialization|"
4794   "partial specialization|redeclaration}0 of %1 does not match"
4795   " expected type %3">;
4796 def err_mismatched_exception_spec_explicit_instantiation : Error<
4797   "exception specification in explicit instantiation does not match "
4798   "instantiated one">;
4799 def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
4800   err_mismatched_exception_spec_explicit_instantiation.Text>,
4801   InGroup<MicrosoftExceptionSpec>;
4802
4803 // C++ typename-specifiers
4804 def err_typename_nested_not_found : Error<"no type named %0 in %1">;
4805 def err_typename_nested_not_found_enable_if : Error<
4806   "no type named 'type' in %0; 'enable_if' cannot be used to disable "
4807   "this declaration">;
4808 def err_typename_nested_not_found_requirement : Error<
4809   "failed requirement '%0'; 'enable_if' cannot be used to disable this "
4810   "declaration">;
4811 def err_typename_nested_not_type : Error<
4812     "typename specifier refers to non-type member %0 in %1">;
4813 def err_typename_not_type : Error<
4814     "typename specifier refers to non-type %0">;
4815 def note_typename_member_refers_here : Note<
4816     "referenced member %0 is declared here">;
4817 def note_typename_refers_here : Note<
4818     "referenced %0 is declared here">;
4819 def err_typename_missing : Error<
4820   "missing 'typename' prior to dependent type name '%0%1'">;
4821 def err_typename_missing_template : Error<
4822   "missing 'typename' prior to dependent type template name '%0%1'">;
4823 def ext_typename_missing : ExtWarn<
4824   "missing 'typename' prior to dependent type name '%0%1'">,
4825   InGroup<DiagGroup<"typename-missing">>;
4826 def ext_typename_outside_of_template : ExtWarn<
4827   "'typename' occurs outside of a template">, InGroup<CXX11>;
4828 def warn_cxx98_compat_typename_outside_of_template : Warning<
4829   "use of 'typename' outside of a template is incompatible with C++98">,
4830   InGroup<CXX98Compat>, DefaultIgnore;
4831 def err_typename_refers_to_using_value_decl : Error<
4832   "typename specifier refers to a dependent using declaration for a value "
4833   "%0 in %1">;
4834 def note_using_value_decl_missing_typename : Note<
4835   "add 'typename' to treat this using declaration as a type">;
4836
4837 def err_template_kw_refers_to_non_template : Error<
4838   "%0 following the 'template' keyword does not refer to a template">;
4839 def note_template_kw_refers_to_non_template : Note<
4840   "declared as a non-template here">;
4841 def err_template_kw_refers_to_class_template : Error<
4842   "'%0%1' instantiated to a class template, not a function template">;
4843 def note_referenced_class_template : Note<
4844   "class template declared here">;
4845 def err_template_kw_missing : Error<
4846   "missing 'template' keyword prior to dependent template name '%0%1'">;
4847 def ext_template_outside_of_template : ExtWarn<
4848   "'template' keyword outside of a template">, InGroup<CXX11>;
4849 def warn_cxx98_compat_template_outside_of_template : Warning<
4850   "use of 'template' keyword outside of a template is incompatible with C++98">,
4851   InGroup<CXX98Compat>, DefaultIgnore;
4852
4853 def err_non_type_template_in_nested_name_specifier : Error<
4854   "qualified name refers into a specialization of %select{function|variable}0 "
4855   "template %1">;
4856 def err_template_id_not_a_type : Error<
4857   "template name refers to non-type template %0">;
4858 def note_template_declared_here : Note<
4859   "%select{function template|class template|variable template"
4860   "|type alias template|template template parameter}0 "
4861   "%1 declared here">;
4862 def err_template_expansion_into_fixed_list : Error<
4863   "pack expansion used as argument for non-pack parameter of %select{alias "
4864   "template|concept}0">;
4865 def note_parameter_type : Note<
4866   "parameter of type %0 is declared here">;
4867
4868 // C++11 Variadic Templates
4869 def err_template_param_pack_default_arg : Error<
4870   "template parameter pack cannot have a default argument">;
4871 def err_template_param_pack_must_be_last_template_parameter : Error<
4872   "template parameter pack must be the last template parameter">;
4873
4874 def err_template_parameter_pack_non_pack : Error<
4875   "%select{template type|non-type template|template template}0 parameter"
4876   "%select{| pack}1 conflicts with previous %select{template type|"
4877   "non-type template|template template}0 parameter%select{ pack|}1">;
4878 def note_template_parameter_pack_non_pack : Note<
4879   "%select{template type|non-type template|template template}0 parameter"
4880   "%select{| pack}1 does not match %select{template type|non-type template"
4881   "|template template}0 parameter%select{ pack|}1 in template argument">;
4882 def note_template_parameter_pack_here : Note<
4883   "previous %select{template type|non-type template|template template}0 "
4884   "parameter%select{| pack}1 declared here">;
4885
4886 def err_unexpanded_parameter_pack : Error<
4887   "%select{expression|base type|declaration type|data member type|bit-field "
4888   "size|static assertion|fixed underlying type|enumerator value|"
4889   "using declaration|friend declaration|qualifier|initializer|default argument|"
4890   "non-type template parameter type|exception type|partial specialization|"
4891   "__if_exists name|__if_not_exists name|lambda|block|type constraint}0 "
4892   "contains%plural{0: an|:}1 unexpanded parameter pack"
4893   "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
4894
4895 def err_pack_expansion_without_parameter_packs : Error<
4896   "pack expansion does not contain any unexpanded parameter packs">;
4897 def err_pack_expansion_length_conflict : Error<
4898   "pack expansion contains parameter packs %0 and %1 that have different "
4899   "lengths (%2 vs. %3)">;
4900 def err_pack_expansion_length_conflict_multilevel : Error<
4901   "pack expansion contains parameter pack %0 that has a different "
4902   "length (%1 vs. %2) from outer parameter packs">;
4903 def err_pack_expansion_length_conflict_partial : Error<
4904   "pack expansion contains parameter pack %0 that has a different "
4905   "length (at least %1 vs. %2) from outer parameter packs">;
4906 def err_pack_expansion_member_init : Error<
4907   "pack expansion for initialization of member %0">;
4908
4909 def err_function_parameter_pack_without_parameter_packs : Error<
4910   "type %0 of function parameter pack does not contain any unexpanded "
4911   "parameter packs">;
4912 def err_ellipsis_in_declarator_not_parameter : Error<
4913   "only function and template parameters can be parameter packs">;
4914
4915 def err_sizeof_pack_no_pack_name : Error<
4916   "%0 does not refer to the name of a parameter pack">;
4917
4918 def err_fold_expression_packs_both_sides : Error<
4919   "binary fold expression has unexpanded parameter packs in both operands">;
4920 def err_fold_expression_empty : Error<
4921   "unary fold expression has empty expansion for operator '%0' "
4922   "with no fallback value">;
4923 def err_fold_expression_bad_operand : Error<
4924   "expression not permitted as operand of fold expression">;
4925
4926 def err_unexpected_typedef : Error<
4927   "unexpected type name %0: expected expression">;
4928 def err_unexpected_namespace : Error<
4929   "unexpected namespace name %0: expected expression">;
4930 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
4931 def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
4932   "use of undeclared identifier %0; "
4933   "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
4934   InGroup<MicrosoftTemplate>;
4935 def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
4936   "found via unqualified lookup into dependent bases of class templates is a "
4937   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4938 def note_dependent_var_use : Note<"must qualify identifier to find this "
4939     "declaration in dependent base class">;
4940 def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
4941     "visible in the template definition nor found by argument-dependent lookup">;
4942 def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
4943     "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
4944 def err_undeclared_use : Error<"use of undeclared %0">;
4945 def warn_deprecated : Warning<"%0 is deprecated">,
4946     InGroup<DeprecatedDeclarations>;
4947 def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
4948 def warn_property_method_deprecated :
4949     Warning<"property access is using %0 method which is deprecated">,
4950     InGroup<DeprecatedDeclarations>;
4951 def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
4952     InGroup<DeprecatedDeclarations>;
4953 def warn_deprecated_anonymous_namespace : Warning<
4954   "'deprecated' attribute on anonymous namespace ignored">,
4955   InGroup<IgnoredAttributes>;
4956 def warn_deprecated_fwdclass_message : Warning<
4957     "%0 may be deprecated because the receiver type is unknown">,
4958     InGroup<DeprecatedDeclarations>;
4959 def warn_deprecated_def : Warning<
4960   "implementing deprecated %select{method|class|category}0">,
4961   InGroup<DeprecatedImplementations>, DefaultIgnore;
4962 def warn_unavailable_def : Warning<
4963   "implementing unavailable method">,
4964   InGroup<DeprecatedImplementations>, DefaultIgnore;
4965 def err_unavailable : Error<"%0 is unavailable">;
4966 def err_property_method_unavailable :
4967     Error<"property access is using %0 method which is unavailable">;
4968 def err_unavailable_message : Error<"%0 is unavailable: %1">;
4969 def warn_unavailable_fwdclass_message : Warning<
4970     "%0 may be unavailable because the receiver type is unknown">,
4971     InGroup<UnavailableDeclarations>;
4972 def note_availability_specified_here : Note<
4973   "%0 has been explicitly marked "
4974   "%select{unavailable|deleted|deprecated}1 here">;
4975 def note_partial_availability_specified_here : Note<
4976   "%0 has been marked as being introduced in %1 %2 here, "
4977   "but the deployment target is %1 %3">;
4978 def note_implicitly_deleted : Note<
4979   "explicitly defaulted function was implicitly deleted here">;
4980 def warn_not_enough_argument : Warning<
4981   "not enough variable arguments in %0 declaration to fit a sentinel">,
4982   InGroup<Sentinel>;
4983 def warn_missing_sentinel : Warning <
4984   "missing sentinel in %select{function call|method dispatch|block call}0">,
4985   InGroup<Sentinel>;
4986 def note_sentinel_here : Note<
4987   "%select{function|method|block}0 has been explicitly marked sentinel here">;
4988 def warn_missing_prototype : Warning<
4989   "no previous prototype for function %0">,
4990   InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
4991 def note_declaration_not_a_prototype : Note<
4992   "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
4993   "to make it %select{a prototype for a zero-parameter function|one}0">;
4994 def warn_strict_prototypes : Warning<
4995   "this %select{function declaration is not|block declaration is not|"
4996   "old-style function definition is not preceded by}0 a prototype">,
4997   InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
4998 def warn_missing_variable_declarations : Warning<
4999   "no previous extern declaration for non-static variable %0">,
5000   InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5001 def note_static_for_internal_linkage : Note<
5002   "declare 'static' if the %select{variable|function}0 is not intended to be "
5003   "used outside of this translation unit">;
5004 def err_static_data_member_reinitialization :
5005   Error<"static data member %0 already has an initializer">;
5006 def err_redefinition : Error<"redefinition of %0">;
5007 def err_alias_after_tentative :
5008   Error<"alias definition of %0 after tentative definition">;
5009 def err_alias_is_definition :
5010   Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5011 def err_definition_of_implicitly_declared_member : Error<
5012   "definition of implicitly declared %select{default constructor|copy "
5013   "constructor|move constructor|copy assignment operator|move assignment "
5014   "operator|destructor|function}1">;
5015 def err_definition_of_explicitly_defaulted_member : Error<
5016   "definition of explicitly defaulted %select{default constructor|copy "
5017   "constructor|move constructor|copy assignment operator|move assignment "
5018   "operator|destructor|function}0">;
5019 def err_redefinition_extern_inline : Error<
5020   "redefinition of a 'extern inline' function %0 is not supported in "
5021   "%select{C99 mode|C++}1">;
5022 def warn_attr_abi_tag_namespace : Warning<
5023   "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5024   InGroup<IgnoredAttributes>;
5025 def err_abi_tag_on_redeclaration : Error<
5026   "cannot add 'abi_tag' attribute in a redeclaration">;
5027 def err_new_abi_tag_on_redeclaration : Error<
5028   "'abi_tag' %0 missing in original declaration">;
5029 def note_use_ifdef_guards : Note<
5030   "unguarded header; consider using #ifdef guards or #pragma once">;
5031
5032 def note_deleted_dtor_no_operator_delete : Note<
5033   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5034 def note_deleted_special_member_class_subobject : Note<
5035   "%select{default constructor of|copy constructor of|move constructor of|"
5036   "copy assignment operator of|move assignment operator of|destructor of|"
5037   "constructor inherited by}0 "
5038   "%1 is implicitly deleted because "
5039   "%select{base class %3|%select{||||variant }4field %3}2 "
5040   "%select{has "
5041   "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5042   "%select{%select{default constructor|copy constructor|move constructor|copy "
5043   "assignment operator|move assignment operator|destructor|"
5044   "%select{default|corresponding|default|default|default}4 constructor}0|"
5045   "destructor}5"
5046   "%select{||s||}4"
5047   "|is an ObjC pointer}6">;
5048 def note_deleted_default_ctor_uninit_field : Note<
5049   "%select{default constructor of|constructor inherited by}0 "
5050   "%1 is implicitly deleted because field %2 of "
5051   "%select{reference|const-qualified}4 type %3 would not be initialized">;
5052 def note_deleted_default_ctor_all_const : Note<
5053   "%select{default constructor of|constructor inherited by}0 "
5054   "%1 is implicitly deleted because all "
5055   "%select{data members|data members of an anonymous union member}2"
5056   " are const-qualified">;
5057 def note_deleted_copy_ctor_rvalue_reference : Note<
5058   "copy constructor of %0 is implicitly deleted because field %1 is of "
5059   "rvalue reference type %2">;
5060 def note_deleted_copy_user_declared_move : Note<
5061   "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5062   " %1 has a user-declared move %select{constructor|assignment operator}2">;
5063 def note_deleted_assign_field : Note<
5064   "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5065   "because field %2 is of %select{reference|const-qualified}4 type %3">;
5066
5067 // These should be errors.
5068 def warn_undefined_internal : Warning<
5069   "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5070   InGroup<DiagGroup<"undefined-internal">>;
5071 def err_undefined_internal_type : Error<
5072   "%select{function|variable}0 %q1 is used but not defined in this "
5073   "translation unit, and cannot be defined in any other translation unit "
5074   "because its type does not have linkage">;
5075 def ext_undefined_internal_type : Extension<
5076   "ISO C++ requires a definition in this translation unit for "
5077   "%select{function|variable}0 %q1 because its type does not have linkage">,
5078   InGroup<DiagGroup<"undefined-internal-type">>;
5079 def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5080   InGroup<DiagGroup<"undefined-inline">>;
5081 def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5082 def note_used_here : Note<"used here">;
5083
5084 def err_internal_linkage_redeclaration : Error<
5085   "'internal_linkage' attribute does not appear on the first declaration of %0">;
5086 def warn_internal_linkage_local_storage : Warning<
5087   "'internal_linkage' attribute on a non-static local variable is ignored">,
5088   InGroup<IgnoredAttributes>;
5089
5090 def ext_internal_in_extern_inline : ExtWarn<
5091   "static %select{function|variable}0 %1 is used in an inline function with "
5092   "external linkage">, InGroup<StaticInInline>;
5093 def ext_internal_in_extern_inline_quiet : Extension<
5094   "static %select{function|variable}0 %1 is used in an inline function with "
5095   "external linkage">, InGroup<StaticInInline>;
5096 def warn_static_local_in_extern_inline : Warning<
5097   "non-constant static local variable in inline function may be different "
5098   "in different files">, InGroup<StaticLocalInInline>;
5099 def note_convert_inline_to_static : Note<
5100   "use 'static' to give inline function %0 internal linkage">;
5101
5102 def ext_redefinition_of_typedef : ExtWarn<
5103   "redefinition of typedef %0 is a C11 feature">,
5104   InGroup<DiagGroup<"typedef-redefinition"> >;
5105 def err_redefinition_variably_modified_typedef : Error<
5106   "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5107
5108 def err_inline_decl_follows_def : Error<
5109   "inline declaration of %0 follows non-inline definition">;
5110 def err_inline_declaration_block_scope : Error<
5111   "inline declaration of %0 not allowed in block scope">;
5112 def err_static_non_static : Error<
5113   "static declaration of %0 follows non-static declaration">;
5114 def err_different_language_linkage : Error<
5115   "declaration of %0 has a different language linkage">;
5116 def ext_retained_language_linkage : Extension<
5117   "friend function %0 retaining previous language linkage is an extension">,
5118   InGroup<DiagGroup<"retained-language-linkage">>;
5119 def err_extern_c_global_conflict : Error<
5120   "declaration of %1 %select{with C language linkage|in global scope}0 "
5121   "conflicts with declaration %select{in global scope|with C language linkage}0">;
5122 def note_extern_c_global_conflict : Note<
5123   "declared %select{in global scope|with C language linkage}0 here">;
5124 def note_extern_c_begins_here : Note<
5125   "extern \"C\" language linkage specification begins here">;
5126 def warn_weak_import : Warning <
5127   "an already-declared variable is made a weak_import declaration %0">;
5128 def ext_static_non_static : Extension<
5129   "redeclaring non-static %0 as static is a Microsoft extension">,
5130   InGroup<MicrosoftRedeclareStatic>;
5131 def err_non_static_static : Error<
5132   "non-static declaration of %0 follows static declaration">;
5133 def err_extern_non_extern : Error<
5134   "extern declaration of %0 follows non-extern declaration">;
5135 def err_non_extern_extern : Error<
5136   "non-extern declaration of %0 follows extern declaration">;
5137 def err_non_thread_thread : Error<
5138   "non-thread-local declaration of %0 follows thread-local declaration">;
5139 def err_thread_non_thread : Error<
5140   "thread-local declaration of %0 follows non-thread-local declaration">;
5141 def err_thread_thread_different_kind : Error<
5142   "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5143   "follows declaration with %select{dynamic|static}1 initialization">;
5144 def err_mismatched_owning_module : Error<
5145   "declaration of %0 in %select{the global module|module %2}1 follows "
5146   "declaration in %select{the global module|module %4}3">;
5147 def err_redefinition_different_type : Error<
5148   "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5149 def err_redefinition_different_kind : Error<
5150   "redefinition of %0 as different kind of symbol">;
5151 def err_redefinition_different_namespace_alias : Error<
5152   "redefinition of %0 as an alias for a different namespace">;
5153 def note_previous_namespace_alias : Note<
5154   "previously defined as an alias for %0">;
5155 def warn_forward_class_redefinition : Warning<
5156   "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5157   InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5158 def err_redefinition_different_typedef : Error<
5159   "%select{typedef|type alias|type alias template}0 "
5160   "redefinition with different types%diff{ ($ vs $)|}1,2">;
5161 def err_tag_reference_non_tag : Error<
5162   "%select{non-struct type|non-class type|non-union type|non-enum "
5163   "type|typedef|type alias|template|type alias template|template "
5164   "template argument}1 %0 cannot be referenced with a "
5165   "%select{struct|interface|union|class|enum}2 specifier">;
5166 def err_tag_reference_conflict : Error<
5167   "implicit declaration introduced by elaborated type conflicts with a "
5168   "%select{non-struct type|non-class type|non-union type|non-enum "
5169   "type|typedef|type alias|template|type alias template|template "
5170   "template argument}0 of the same name">;
5171 def err_dependent_tag_decl : Error<
5172   "%select{declaration|definition}0 of "
5173   "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5174 def err_tag_definition_of_typedef : Error<
5175   "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5176 def err_conflicting_types : Error<"conflicting types for %0">;
5177 def err_different_pass_object_size_params : Error<
5178   "conflicting pass_object_size attributes on parameters">;
5179 def err_late_asm_label_name : Error<
5180   "cannot apply asm label to %select{variable|function}0 after its first use">;
5181 def err_different_asm_label : Error<"conflicting asm label">;
5182 def err_nested_redefinition : Error<"nested redefinition of %0">;
5183 def err_use_with_wrong_tag : Error<
5184   "use of %0 with tag type that does not match previous declaration">;
5185 def warn_struct_class_tag_mismatch : Warning<
5186   "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5187   "declared as a %select{struct|interface|class}3%select{| template}1; "
5188   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5189   InGroup<MismatchedTags>, DefaultIgnore;
5190 def warn_struct_class_previous_tag_mismatch : Warning<
5191   "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5192   "here but previously declared as "
5193   "%select{a struct|an interface|a class}3%select{| template}1; "
5194   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5195   InGroup<MismatchedTags>, DefaultIgnore;
5196 def note_struct_class_suggestion : Note<
5197   "did you mean %select{struct|interface|class}0 here?">;
5198 def ext_forward_ref_enum : Extension<
5199   "ISO C forbids forward references to 'enum' types">;
5200 def err_forward_ref_enum : Error<
5201   "ISO C++ forbids forward references to 'enum' types">;
5202 def ext_ms_forward_ref_enum : ExtWarn<
5203   "forward references to 'enum' types are a Microsoft extension">,
5204   InGroup<MicrosoftEnumForwardReference>;
5205 def ext_forward_ref_enum_def : Extension<
5206   "redeclaration of already-defined enum %0 is a GNU extension">,
5207   InGroup<GNURedeclaredEnum>;
5208
5209 def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5210 def err_duplicate_member : Error<"duplicate member %0">;
5211 def err_misplaced_ivar : Error<
5212   "instance variables may not be placed in %select{categories|class extension}0">;
5213 def warn_ivars_in_interface : Warning<
5214   "declaration of instance variables in the interface is deprecated">,
5215   InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5216 def ext_enum_value_not_int : Extension<
5217   "ISO C restricts enumerator values to range of 'int' (%0 is too "
5218   "%select{small|large}1)">;
5219 def ext_enum_too_large : ExtWarn<
5220   "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5221 def ext_enumerator_increment_too_large : ExtWarn<
5222   "incremented enumerator value %0 is not representable in the "
5223   "largest integer type">, InGroup<EnumTooLarge>;
5224 def warn_flag_enum_constant_out_of_range : Warning<
5225   "enumeration value %0 is out of range of flags in enumeration type %1">,
5226   InGroup<FlagEnum>;
5227
5228 def warn_illegal_constant_array_size : Extension<
5229   "size of static array must be an integer constant expression">;
5230 def err_vm_decl_in_file_scope : Error<
5231   "variably modified type declaration not allowed at file scope">;
5232 def err_vm_decl_has_extern_linkage : Error<
5233   "variably modified type declaration cannot have 'extern' linkage">;
5234 def err_typecheck_field_variable_size : Error<
5235   "fields must have a constant size: 'variable length array in structure' "
5236   "extension will never be supported">;
5237 def err_vm_func_decl : Error<
5238   "function declaration cannot have variably modified type">;
5239 def err_array_too_large : Error<
5240   "array is too large (%0 elements)">;
5241
5242 def err_typecheck_negative_array_size : Error<"array size is negative">;
5243 def warn_typecheck_function_qualifiers_ignored : Warning<
5244   "'%0' qualifier on function type %1 has no effect">,
5245   InGroup<IgnoredQualifiers>;
5246 def warn_typecheck_function_qualifiers_unspecified : Warning<
5247   "'%0' qualifier on function type %1 has unspecified behavior">;
5248 def warn_typecheck_reference_qualifiers : Warning<
5249   "'%0' qualifier on reference type %1 has no effect">,
5250   InGroup<IgnoredQualifiers>;
5251 def err_typecheck_invalid_restrict_not_pointer : Error<
5252   "restrict requires a pointer or reference (%0 is invalid)">;
5253 def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5254   "restrict requires a pointer or reference">;
5255 def err_typecheck_invalid_restrict_invalid_pointee : Error<
5256   "pointer to function type %0 may not be 'restrict' qualified">;
5257 def ext_typecheck_zero_array_size : Extension<
5258   "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5259 def err_typecheck_zero_array_size : Error<
5260   "zero-length arrays are not permitted in C++">;
5261 def warn_typecheck_zero_static_array_size : Warning<
5262   "'static' has no effect on zero-length arrays">,
5263   InGroup<ArrayBounds>;
5264 def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5265 def err_init_element_not_constant : Error<
5266   "initializer element is not a compile-time constant">;
5267 def ext_aggregate_init_not_constant : Extension<
5268   "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5269 def err_local_cant_init : Error<
5270   "'__local' variable cannot have an initializer">;
5271 def err_block_extern_cant_init : Error<
5272   "'extern' variable cannot have an initializer">;
5273 def warn_extern_init : Warning<"'extern' variable has an initializer">,
5274   InGroup<DiagGroup<"extern-initializer">>;
5275 def err_variable_object_no_init : Error<
5276   "variable-sized object may not be initialized">;
5277 def err_excess_initializers : Error<
5278   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5279 def ext_excess_initializers : ExtWarn<
5280   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5281 def err_excess_initializers_in_char_array_initializer : Error<
5282   "excess elements in char array initializer">;
5283 def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5284   "excess elements in char array initializer">;
5285 def err_initializer_string_for_char_array_too_long : Error<
5286   "initializer-string for char array is too long">;
5287 def ext_initializer_string_for_char_array_too_long : ExtWarn<
5288   "initializer-string for char array is too long">;
5289 def warn_missing_field_initializers : Warning<
5290   "missing field %0 initializer">,
5291   InGroup<MissingFieldInitializers>, DefaultIgnore;
5292 def warn_braces_around_scalar_init : Warning<
5293   "braces around scalar initializer">, InGroup<DiagGroup<"braced-scalar-init">>;
5294 def ext_many_braces_around_scalar_init : ExtWarn<
5295   "too many braces around scalar initializer">,
5296   InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5297 def ext_complex_component_init : Extension<
5298   "complex initialization specifying real and imaginary components "
5299   "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5300 def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5301 def warn_cxx98_compat_empty_scalar_initializer : Warning<
5302   "scalar initialized from empty initializer list is incompatible with C++98">,
5303   InGroup<CXX98Compat>, DefaultIgnore;
5304 def warn_cxx98_compat_reference_list_init : Warning<
5305   "reference initialized from initializer list is incompatible with C++98">,
5306   InGroup<CXX98Compat>, DefaultIgnore;
5307 def warn_cxx98_compat_initializer_list_init : Warning<
5308   "initialization of initializer_list object is incompatible with C++98">,
5309   InGroup<CXX98Compat>, DefaultIgnore;
5310 def warn_cxx98_compat_ctor_list_init : Warning<
5311   "constructor call from initializer list is incompatible with C++98">,
5312   InGroup<CXX98Compat>, DefaultIgnore;
5313 def err_illegal_initializer : Error<
5314   "illegal initializer (only variables can be initialized)">;
5315 def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5316 def ext_init_list_type_narrowing : ExtWarn<
5317   "type %0 cannot be narrowed to %1 in initializer list">,
5318   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5319 def ext_init_list_variable_narrowing : ExtWarn<
5320   "non-constant-expression cannot be narrowed from type %0 to %1 in "
5321   "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5322 def ext_init_list_constant_narrowing : ExtWarn<
5323   "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5324   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5325 def warn_init_list_type_narrowing : Warning<
5326   "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5327   InGroup<CXX11Narrowing>, DefaultIgnore;
5328 def warn_init_list_variable_narrowing : Warning<
5329   "non-constant-expression cannot be narrowed from type %0 to %1 in "
5330   "initializer list in C++11">,
5331   InGroup<CXX11Narrowing>, DefaultIgnore;
5332 def warn_init_list_constant_narrowing : Warning<
5333   "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5334   "C++11">,
5335   InGroup<CXX11Narrowing>, DefaultIgnore;
5336 def note_init_list_narrowing_silence : Note<
5337   "insert an explicit cast to silence this issue">;
5338 def err_init_objc_class : Error<
5339   "cannot initialize Objective-C class type %0">;
5340 def err_implicit_empty_initializer : Error<
5341   "initializer for aggregate with no elements requires explicit braces">;
5342 def err_bitfield_has_negative_width : Error<
5343   "bit-field %0 has negative width (%1)">;
5344 def err_anon_bitfield_has_negative_width : Error<
5345   "anonymous bit-field has negative width (%0)">;
5346 def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5347 def err_bitfield_width_exceeds_type_width : Error<
5348   "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
5349   "of its type (%3 bit%s3)">;
5350 def err_anon_bitfield_width_exceeds_type_width : Error<
5351   "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
5352   "of its type (%2 bit%s2)">;
5353 def err_incorrect_number_of_vector_initializers : Error<
5354   "number of elements must be either one or match the size of the vector">;
5355
5356 // Used by C++ which allows bit-fields that are wider than the type.
5357 def warn_bitfield_width_exceeds_type_width: Warning<
5358   "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5359   "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5360 def warn_anon_bitfield_width_exceeds_type_width : Warning<
5361   "width of anonymous bit-field (%0 bits) exceeds width of its type; value "
5362   "will be truncated to %1 bit%s1">, InGroup<BitFieldWidth>;
5363 def warn_bitfield_too_small_for_enum : Warning<
5364   "bit-field %0 is not wide enough to store all enumerators of %1">,
5365   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5366 def note_widen_bitfield : Note<
5367   "widen this field to %0 bits to store all values of %1">;
5368 def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5369   "assigning value of signed enum type %1 to unsigned bit-field %0; "
5370   "negative enumerators of enum %1 will be converted to positive values">,
5371   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5372 def warn_signed_bitfield_enum_conversion : Warning<
5373   "signed bit-field %0 needs an extra bit to represent the largest positive "
5374   "enumerators of %1">,
5375   InGroup<BitFieldEnumConversion>, DefaultIgnore;
5376 def note_change_bitfield_sign : Note<
5377   "consider making the bitfield type %select{unsigned|signed}0">;
5378
5379 def warn_missing_braces : Warning<
5380   "suggest braces around initialization of subobject">,
5381   InGroup<MissingBraces>, DefaultIgnore;
5382
5383 def err_redefinition_of_label : Error<"redefinition of label %0">;
5384 def err_undeclared_label_use : Error<"use of undeclared label %0">;
5385 def err_goto_ms_asm_label : Error<
5386   "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5387 def note_goto_ms_asm_label : Note<
5388   "inline assembly label %0 declared here">;
5389 def warn_unused_label : Warning<"unused label %0">,
5390   InGroup<UnusedLabel>, DefaultIgnore;
5391
5392 def err_goto_into_protected_scope : Error<
5393   "cannot jump from this goto statement to its label">;
5394 def ext_goto_into_protected_scope : ExtWarn<
5395   "jump from this goto statement to its label is a Microsoft extension">,
5396   InGroup<MicrosoftGoto>;
5397 def warn_cxx98_compat_goto_into_protected_scope : Warning<
5398   "jump from this goto statement to its label is incompatible with C++98">,
5399   InGroup<CXX98Compat>, DefaultIgnore;
5400 def err_switch_into_protected_scope : Error<
5401   "cannot jump from switch statement to this case label">;
5402 def warn_cxx98_compat_switch_into_protected_scope : Warning<
5403   "jump from switch statement to this case label is incompatible with C++98">,
5404   InGroup<CXX98Compat>, DefaultIgnore;
5405 def err_indirect_goto_without_addrlabel : Error<
5406   "indirect goto in function with no address-of-label expressions">;
5407 def err_indirect_goto_in_protected_scope : Error<
5408   "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5409 def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5410   "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5411   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5412 def note_indirect_goto_target : Note<
5413   "possible target of %select{indirect|asm}0 goto statement">;
5414 def note_protected_by_variable_init : Note<
5415   "jump bypasses variable initialization">;
5416 def note_protected_by_variable_nontriv_destructor : Note<
5417   "jump bypasses variable with a non-trivial destructor">;
5418 def note_protected_by_variable_non_pod : Note<
5419   "jump bypasses initialization of non-POD variable">;
5420 def note_protected_by_cleanup : Note<
5421   "jump bypasses initialization of variable with __attribute__((cleanup))">;
5422 def note_protected_by_vla_typedef : Note<
5423   "jump bypasses initialization of VLA typedef">;
5424 def note_protected_by_vla_type_alias : Note<
5425   "jump bypasses initialization of VLA type alias">;
5426 def note_protected_by_constexpr_if : Note<
5427   "jump enters controlled statement of constexpr if">;
5428 def note_protected_by_if_available : Note<
5429   "jump enters controlled statement of if available">;
5430 def note_protected_by_vla : Note<
5431   "jump bypasses initialization of variable length array">;
5432 def note_protected_by_objc_fast_enumeration : Note<
5433   "jump enters Objective-C fast enumeration loop">;
5434 def note_protected_by_objc_try : Note<
5435   "jump bypasses initialization of @try block">;
5436 def note_protected_by_objc_catch : Note<
5437   "jump bypasses initialization of @catch block">;
5438 def note_protected_by_objc_finally : Note<
5439   "jump bypasses initialization of @finally block">;
5440 def note_protected_by_objc_synchronized : Note<
5441   "jump bypasses initialization of @synchronized block">;
5442 def note_protected_by_objc_autoreleasepool : Note<
5443   "jump bypasses auto release push of @autoreleasepool block">;
5444 def note_protected_by_cxx_try : Note<
5445   "jump bypasses initialization of try block">;
5446 def note_protected_by_cxx_catch : Note<
5447   "jump bypasses initialization of catch block">;
5448 def note_protected_by_seh_try : Note<
5449   "jump bypasses initialization of __try block">;
5450 def note_protected_by_seh_except : Note<
5451   "jump bypasses initialization of __except block">;
5452 def note_protected_by_seh_finally : Note<
5453   "jump bypasses initialization of __finally block">;
5454 def note_protected_by___block : Note<
5455   "jump bypasses setup of __block variable">;
5456 def note_protected_by_objc_strong_init : Note<
5457   "jump bypasses initialization of __strong variable">;
5458 def note_protected_by_objc_weak_init : Note<
5459   "jump bypasses initialization of __weak variable">;
5460 def note_protected_by_non_trivial_c_struct_init : Note<
5461   "jump bypasses initialization of variable of non-trivial C struct type">;
5462 def note_enters_block_captures_cxx_obj : Note<
5463   "jump enters lifetime of block which captures a destructible C++ object">;
5464 def note_enters_block_captures_strong : Note<
5465   "jump enters lifetime of block which strongly captures a variable">;
5466 def note_enters_block_captures_weak : Note<
5467   "jump enters lifetime of block which weakly captures a variable">;
5468 def note_enters_block_captures_non_trivial_c_struct : Note<
5469   "jump enters lifetime of block which captures a C struct that is non-trivial "
5470   "to destroy">;
5471
5472 def note_exits_cleanup : Note<
5473   "jump exits scope of variable with __attribute__((cleanup))">;
5474 def note_exits_dtor : Note<
5475   "jump exits scope of variable with non-trivial destructor">;
5476 def note_exits_temporary_dtor : Note<
5477   "jump exits scope of lifetime-extended temporary with non-trivial "
5478   "destructor">;
5479 def note_exits___block : Note<
5480   "jump exits scope of __block variable">;
5481 def note_exits_objc_try : Note<
5482   "jump exits @try block">;
5483 def note_exits_objc_catch : Note<
5484   "jump exits @catch block">;
5485 def note_exits_objc_finally : Note<
5486   "jump exits @finally block">;
5487 def note_exits_objc_synchronized : Note<
5488   "jump exits @synchronized block">;
5489 def note_exits_cxx_try : Note<
5490   "jump exits try block">;
5491 def note_exits_cxx_catch : Note<
5492   "jump exits catch block">;
5493 def note_exits_seh_try : Note<
5494   "jump exits __try block">;
5495 def note_exits_seh_except : Note<
5496   "jump exits __except block">;
5497 def note_exits_seh_finally : Note<
5498   "jump exits __finally block">;
5499 def note_exits_objc_autoreleasepool : Note<
5500   "jump exits autoreleasepool block">;
5501 def note_exits_objc_strong : Note<
5502   "jump exits scope of __strong variable">;
5503 def note_exits_objc_weak : Note<
5504   "jump exits scope of __weak variable">;
5505 def note_exits_block_captures_cxx_obj : Note<
5506   "jump exits lifetime of block which captures a destructible C++ object">;
5507 def note_exits_block_captures_strong : Note<
5508   "jump exits lifetime of block which strongly captures a variable">;
5509 def note_exits_block_captures_weak : Note<
5510   "jump exits lifetime of block which weakly captures a variable">;
5511 def note_exits_block_captures_non_trivial_c_struct : Note<
5512   "jump exits lifetime of block which captures a C struct that is non-trivial "
5513   "to destroy">;
5514
5515 def err_func_returning_qualified_void : ExtWarn<
5516   "function cannot return qualified void type %0">,
5517   InGroup<DiagGroup<"qualified-void-return-type">>;
5518 def err_func_returning_array_function : Error<
5519   "function cannot return %select{array|function}0 type %1">;
5520 def err_field_declared_as_function : Error<"field %0 declared as a function">;
5521 def err_field_incomplete : Error<"field has incomplete type %0">;
5522 def ext_variable_sized_type_in_struct : ExtWarn<
5523   "field %0 with variable sized type %1 not at the end of a struct or class is"
5524   " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5525
5526 def ext_c99_flexible_array_member : Extension<
5527   "flexible array members are a C99 feature">, InGroup<C99>;
5528 def err_flexible_array_virtual_base : Error<
5529   "flexible array member %0 not allowed in "
5530   "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5531 def err_flexible_array_empty_aggregate : Error<
5532   "flexible array member %0 not allowed in otherwise empty "
5533   "%select{struct|interface|union|class|enum}1">;
5534 def err_flexible_array_has_nontrivial_dtor : Error<
5535   "flexible array member %0 of type %1 with non-trivial destruction">;
5536 def ext_flexible_array_in_struct : Extension<
5537   "%0 may not be nested in a struct due to flexible array member">,
5538   InGroup<FlexibleArrayExtensions>;
5539 def ext_flexible_array_in_array : Extension<
5540   "%0 may not be used as an array element due to flexible array member">,
5541   InGroup<FlexibleArrayExtensions>;
5542 def err_flexible_array_init : Error<
5543   "initialization of flexible array member is not allowed">;
5544 def ext_flexible_array_empty_aggregate_ms : Extension<
5545   "flexible array member %0 in otherwise empty "
5546   "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
5547   InGroup<MicrosoftFlexibleArray>;
5548 def err_flexible_array_union : Error<
5549   "flexible array member %0 in a union is not allowed">;
5550 def ext_flexible_array_union_ms : Extension<
5551   "flexible array member %0 in a union is a Microsoft extension">,
5552   InGroup<MicrosoftFlexibleArray>;
5553 def ext_flexible_array_empty_aggregate_gnu : Extension<
5554   "flexible array member %0 in otherwise empty "
5555   "%select{struct|interface|union|class|enum}1 is a GNU extension">,
5556   InGroup<GNUEmptyStruct>;
5557 def ext_flexible_array_union_gnu : Extension<
5558   "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
5559
5560 def err_flexible_array_not_at_end : Error<
5561   "flexible array member %0 with type %1 is not at the end of"
5562   " %select{struct|interface|union|class|enum}2">;
5563 def err_objc_variable_sized_type_not_at_end : Error<
5564   "field %0 with variable sized type %1 is not at the end of class">;
5565 def note_next_field_declaration : Note<
5566   "next field declaration is here">;
5567 def note_next_ivar_declaration : Note<
5568   "next %select{instance variable declaration|synthesized instance variable}0"
5569   " is here">;
5570 def err_synthesize_variable_sized_ivar : Error<
5571   "synthesized property with variable size type %0"
5572   " requires an existing instance variable">;
5573 def err_flexible_array_arc_retainable : Error<
5574   "ARC forbids flexible array members with retainable object type">;
5575 def warn_variable_sized_ivar_visibility : Warning<
5576   "field %0 with variable sized type %1 is not visible to subclasses and"
5577   " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
5578 def warn_superclass_variable_sized_type_not_at_end : Warning<
5579   "field %0 can overwrite instance variable %1 with variable sized type %2"
5580   " in superclass %3">, InGroup<ObjCFlexibleArray>;
5581
5582 let CategoryName = "ARC Semantic Issue" in {
5583
5584 // ARC-mode diagnostics.
5585
5586 let CategoryName = "ARC Weak References" in {
5587
5588 def err_arc_weak_no_runtime : Error<
5589   "cannot create __weak reference because the current deployment target "
5590   "does not support weak references">;
5591 def err_arc_weak_disabled : Error<
5592   "cannot create __weak reference in file using manual reference counting">;
5593 def err_synthesizing_arc_weak_property_disabled : Error<
5594   "cannot synthesize weak property in file using manual reference counting">;
5595 def err_synthesizing_arc_weak_property_no_runtime : Error<
5596   "cannot synthesize weak property because the current deployment target "
5597   "does not support weak references">;
5598 def err_arc_unsupported_weak_class : Error<
5599   "class is incompatible with __weak references">;
5600 def err_arc_weak_unavailable_assign : Error<
5601   "assignment of a weak-unavailable object to a __weak object">;
5602 def err_arc_weak_unavailable_property : Error<
5603   "synthesizing __weak instance variable of type %0, which does not "
5604   "support weak references">;
5605 def note_implemented_by_class : Note<
5606   "when implemented by class %0">;
5607 def err_arc_convesion_of_weak_unavailable : Error<
5608   "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
5609   " a __weak object of type %2">;
5610
5611 } // end "ARC Weak References" category
5612
5613 let CategoryName = "ARC Restrictions" in {
5614
5615 def err_unavailable_in_arc : Error<
5616   "%0 is unavailable in ARC">;
5617 def note_arc_forbidden_type : Note<
5618   "declaration uses type that is ill-formed in ARC">;
5619 def note_performs_forbidden_arc_conversion : Note<
5620   "inline function performs a conversion which is forbidden in ARC">;
5621 def note_arc_init_returns_unrelated : Note<
5622   "init method must return a type related to its receiver type">;
5623 def note_arc_weak_disabled : Note<
5624   "declaration uses __weak, but ARC is disabled">;
5625 def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
5626   "the current deployment target does not support">;
5627 def note_arc_field_with_ownership : Note<
5628   "field has non-trivial ownership qualification">;
5629
5630 def err_arc_illegal_explicit_message : Error<
5631   "ARC forbids explicit message send of %0">;
5632 def err_arc_unused_init_message : Error<
5633   "the result of a delegate init call must be immediately returned "
5634   "or assigned to 'self'">;
5635 def err_arc_mismatched_cast : Error<
5636   "%select{implicit conversion|cast}0 of "
5637   "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
5638   "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
5639   " to %3 is disallowed with ARC">;
5640 def err_arc_nolifetime_behavior : Error<
5641   "explicit ownership qualifier on cast result has no effect">;
5642 def err_arc_objc_property_default_assign_on_object : Error<
5643   "ARC forbids synthesizing a property of an Objective-C object "
5644   "with unspecified ownership or storage attribute">;
5645 def err_arc_illegal_selector : Error<
5646   "ARC forbids use of %0 in a @selector">;
5647 def err_arc_illegal_method_def : Error<
5648   "ARC forbids %select{implementation|synthesis}0 of %1">;
5649 def warn_arc_strong_pointer_objc_pointer : Warning<
5650   "method parameter of type %0 with no explicit ownership">,
5651   InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
5652
5653 } // end "ARC Restrictions" category
5654
5655 def err_arc_lost_method_convention : Error<
5656   "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
5657   "method, but its implementation doesn't match because %select{"
5658   "its result type is not an object pointer|"
5659   "its result type is unrelated to its receiver type}1">;
5660 def note_arc_lost_method_convention : Note<"declaration in interface">;
5661 def err_arc_gained_method_convention : Error<
5662   "method implementation does not match its declaration">;
5663 def note_arc_gained_method_convention : Note<
5664   "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
5665   "family because %select{its result type is not an object pointer|"
5666   "its result type is unrelated to its receiver type}1">;
5667 def err_typecheck_arc_assign_self : Error<
5668   "cannot assign to 'self' outside of a method in the init family">;
5669 def err_typecheck_arc_assign_self_class_method : Error<
5670   "cannot assign to 'self' in a class method">;
5671 def err_typecheck_arr_assign_enumeration : Error<
5672   "fast enumeration variables cannot be modified in ARC by default; "
5673   "declare the variable __strong to allow this">;
5674 def err_typecheck_arc_assign_externally_retained : Error<
5675   "variable declared with 'objc_externally_retained' "
5676   "cannot be modified in ARC">;
5677 def warn_arc_retained_assign : Warning<
5678   "assigning retained object to %select{weak|unsafe_unretained}0 "
5679   "%select{property|variable}1"
5680   "; object will be released after assignment">,
5681   InGroup<ARCUnsafeRetainedAssign>;
5682 def warn_arc_retained_property_assign : Warning<
5683   "assigning retained object to unsafe property"
5684   "; object will be released after assignment">,
5685   InGroup<ARCUnsafeRetainedAssign>;
5686 def warn_arc_literal_assign : Warning<
5687   "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
5688   " to a weak %select{property|variable}1"
5689   "; object will be released after assignment">,
5690   InGroup<ARCUnsafeRetainedAssign>;
5691 def err_arc_new_array_without_ownership : Error<
5692   "'new' cannot allocate an array of %0 with no explicit ownership">;
5693 def err_arc_autoreleasing_var : Error<
5694   "%select{__block variables|global variables|fields|instance variables}0 cannot have "
5695   "__autoreleasing ownership">;
5696 def err_arc_autoreleasing_capture : Error<
5697   "cannot capture __autoreleasing variable in a "
5698   "%select{block|lambda by copy}0">;
5699 def err_arc_thread_ownership : Error<
5700   "thread-local variable has non-trivial ownership: type is %0">;
5701 def err_arc_indirect_no_ownership : Error<
5702   "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
5703 def err_arc_array_param_no_ownership : Error<
5704   "must explicitly describe intended ownership of an object array parameter">;
5705 def err_arc_pseudo_dtor_inconstant_quals : Error<
5706   "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
5707   "type %1">;
5708 def err_arc_init_method_unrelated_result_type : Error<
5709   "init methods must return a type related to the receiver type">;
5710 def err_arc_nonlocal_writeback : Error<
5711   "passing address of %select{non-local|non-scalar}0 object to "
5712   "__autoreleasing parameter for write-back">;
5713 def err_arc_method_not_found : Error<
5714   "no known %select{instance|class}1 method for selector %0">;
5715 def err_arc_receiver_forward_class : Error<
5716   "receiver %0 for class message is a forward declaration">;
5717 def err_arc_may_not_respond : Error<
5718   "no visible @interface for %0 declares the selector %1">;
5719 def err_arc_receiver_forward_instance : Error<
5720   "receiver type %0 for instance message is a forward declaration">;
5721 def warn_receiver_forward_instance : Warning<
5722   "receiver type %0 for instance message is a forward declaration">,
5723   InGroup<ForwardClassReceiver>, DefaultIgnore;
5724 def err_arc_collection_forward : Error<
5725   "collection expression type %0 is a forward declaration">;
5726 def err_arc_multiple_method_decl : Error<
5727   "multiple methods named %0 found with mismatched result, "
5728   "parameter type or attributes">;
5729 def warn_arc_lifetime_result_type : Warning<
5730   "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
5731   "lifetime qualifier on return type is ignored">,
5732   InGroup<IgnoredQualifiers>;
5733
5734 let CategoryName = "ARC Retain Cycle" in {
5735
5736 def warn_arc_retain_cycle : Warning<
5737   "capturing %0 strongly in this block is likely to lead to a retain cycle">,
5738   InGroup<ARCRetainCycles>;
5739 def note_arc_retain_cycle_owner : Note<
5740   "block will be retained by %select{the captured object|an object strongly "
5741   "retained by the captured object}0">;
5742
5743 } // end "ARC Retain Cycle" category
5744
5745 def warn_arc_object_memaccess : Warning<
5746   "%select{destination for|source of}0 this %1 call is a pointer to "
5747   "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
5748
5749 let CategoryName = "ARC and @properties" in {
5750
5751 def err_arc_strong_property_ownership : Error<
5752   "existing instance variable %1 for strong property %0 may not be "
5753   "%select{|__unsafe_unretained||__weak}2">;
5754 def err_arc_assign_property_ownership : Error<
5755   "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
5756   "attribute must be __unsafe_unretained">;
5757 def err_arc_inconsistent_property_ownership : Error<
5758   "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
5759   "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
5760
5761 } // end "ARC and @properties" category
5762
5763 def warn_block_capture_autoreleasing : Warning<
5764   "block captures an autoreleasing out-parameter, which may result in "
5765   "use-after-free bugs">,
5766   InGroup<BlockCaptureAutoReleasing>;
5767 def note_declare_parameter_strong : Note<
5768   "declare the parameter __strong or capture a __block __strong variable to "
5769   "keep values alive across autorelease pools">;
5770
5771 def err_arc_atomic_ownership : Error<
5772   "cannot perform atomic operation on a pointer to type %0: type has "
5773   "non-trivial ownership">;
5774
5775 let CategoryName = "ARC Casting Rules" in {
5776
5777 def err_arc_bridge_cast_incompatible : Error<
5778   "incompatible types casting %0 to %1 with a %select{__bridge|"
5779   "__bridge_transfer|__bridge_retained}2 cast">;
5780 def err_arc_bridge_cast_wrong_kind : Error<
5781   "cast of %select{Objective-C|block|C}0 pointer type %1 to "
5782   "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
5783   "__bridge_transfer|__bridge_retained}4">;
5784 def err_arc_cast_requires_bridge : Error<
5785   "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
5786   "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
5787   "requires a bridged cast">;
5788 def note_arc_bridge : Note<
5789   "use __bridge to convert directly (no change in ownership)">;
5790 def note_arc_cstyle_bridge : Note<
5791   "use __bridge with C-style cast to convert directly (no change in ownership)">;
5792 def note_arc_bridge_transfer : Note<
5793   "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
5794   "ownership of a +1 %0 into ARC">;
5795 def note_arc_cstyle_bridge_transfer : Note<
5796   "use __bridge_transfer with C-style cast to transfer "
5797   "ownership of a +1 %0 into ARC">;
5798 def note_arc_bridge_retained : Note<
5799   "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
5800   "ARC object available as a +1 %0">;
5801 def note_arc_cstyle_bridge_retained : Note<
5802   "use __bridge_retained with C-style cast to make an "
5803   "ARC object available as a +1 %0">;
5804
5805 } // ARC Casting category
5806
5807 } // ARC category name
5808
5809 def err_flexible_array_init_needs_braces : Error<
5810   "flexible array requires brace-enclosed initializer">;
5811 def err_illegal_decl_array_of_functions : Error<
5812   "'%0' declared as array of functions of type %1">;
5813 def err_illegal_decl_array_incomplete_type : Error<
5814   "array has incomplete element type %0">;
5815 def err_illegal_message_expr_incomplete_type : Error<
5816   "Objective-C message has incomplete result type %0">;
5817 def err_illegal_decl_array_of_references : Error<
5818   "'%0' declared as array of references of type %1">;
5819 def err_decl_negative_array_size : Error<
5820   "'%0' declared as an array with a negative size">;
5821 def err_array_static_outside_prototype : Error<
5822   "%0 used in array declarator outside of function prototype">;
5823 def err_array_static_not_outermost : Error<
5824   "%0 used in non-outermost array type derivation">;
5825 def err_array_star_outside_prototype : Error<
5826   "star modifier used outside of function prototype">;
5827 def err_illegal_decl_pointer_to_reference : Error<
5828   "'%0' declared as a pointer to a reference of type %1">;
5829 def err_illegal_decl_mempointer_to_reference : Error<
5830   "'%0' declared as a member pointer to a reference of type %1">;
5831 def err_illegal_decl_mempointer_to_void : Error<
5832   "'%0' declared as a member pointer to void">;
5833 def err_illegal_decl_mempointer_in_nonclass : Error<
5834   "'%0' does not point into a class">;
5835 def err_mempointer_in_nonclass_type : Error<
5836   "member pointer refers into non-class type %0">;
5837 def err_reference_to_void : Error<"cannot form a reference to 'void'">;
5838 def err_nonfunction_block_type : Error<
5839   "block pointer to non-function type is invalid">;
5840 def err_return_block_has_expr : Error<"void block should not return a value">;
5841 def err_block_return_missing_expr : Error<
5842   "non-void block should return a value">;
5843 def err_func_def_incomplete_result : Error<
5844   "incomplete result type %0 in function definition">;
5845 def err_atomic_specifier_bad_type : Error<
5846   "_Atomic cannot be applied to "
5847   "%select{incomplete |array |function |reference |atomic |qualified |}0type "
5848   "%1 %select{||||||which is not trivially copyable}0">;
5849
5850 // Expressions.
5851 def select_unary_expr_or_type_trait_kind : TextSubstitution<
5852   "%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align|"
5853   "__alignof}0">;
5854 def ext_sizeof_alignof_function_type : Extension<
5855   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5856   "to a function type">, InGroup<PointerArith>;
5857 def ext_sizeof_alignof_void_type : Extension<
5858   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5859   "to a void type">, InGroup<PointerArith>;
5860 def err_opencl_sizeof_alignof_type : Error<
5861   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5862   "to a void type">;
5863 def err_sizeof_alignof_incomplete_type : Error<
5864   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5865   "to an incomplete type %1">;
5866 def err_sizeof_alignof_function_type : Error<
5867   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5868   "to a function type">;
5869 def err_openmp_default_simd_align_expr : Error<
5870   "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
5871 def err_sizeof_alignof_typeof_bitfield : Error<
5872   "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
5873 def err_alignof_member_of_incomplete_type : Error<
5874   "invalid application of 'alignof' to a field of a class still being defined">;
5875 def err_vecstep_non_scalar_vector_type : Error<
5876   "'vec_step' requires built-in scalar or vector type, %0 invalid">;
5877 def err_offsetof_incomplete_type : Error<
5878   "offsetof of incomplete type %0">;
5879 def err_offsetof_record_type : Error<
5880   "offsetof requires struct, union, or class type, %0 invalid">;
5881 def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
5882 def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
5883   InGroup<InvalidOffsetof>;
5884 def ext_offsetof_non_standardlayout_type : ExtWarn<
5885   "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
5886 def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
5887 def err_offsetof_field_of_virtual_base : Error<
5888   "invalid application of 'offsetof' to a field of a virtual base">;
5889 def warn_sub_ptr_zero_size_types : Warning<
5890   "subtraction of pointers to type %0 of zero size has undefined behavior">,
5891   InGroup<PointerArith>;
5892 def warn_pointer_arith_null_ptr : Warning<
5893   "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
5894   InGroup<NullPointerArithmetic>, DefaultIgnore;
5895 def warn_gnu_null_ptr_arith : Warning<
5896   "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
5897   InGroup<NullPointerArithmetic>, DefaultIgnore;
5898
5899 def warn_floatingpoint_eq : Warning<
5900   "comparing floating point with == or != is unsafe">,
5901   InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
5902
5903 def warn_remainder_division_by_zero : Warning<
5904   "%select{remainder|division}0 by zero is undefined">,
5905   InGroup<DivZero>;
5906 def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
5907   InGroup<DiagGroup<"shift-negative-value">>;
5908 def warn_shift_negative : Warning<"shift count is negative">,
5909   InGroup<DiagGroup<"shift-count-negative">>;
5910 def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
5911   InGroup<DiagGroup<"shift-count-overflow">>;
5912 def warn_shift_result_gt_typewidth : Warning<
5913   "signed shift result (%0) requires %1 bits to represent, but %2 only has "
5914   "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
5915 def warn_shift_result_sets_sign_bit : Warning<
5916   "signed shift result (%0) sets the sign bit of the shift expression's "
5917   "type (%1) and becomes negative">,
5918   InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
5919
5920 def warn_precedence_bitwise_rel : Warning<
5921   "%0 has lower precedence than %1; %1 will be evaluated first">,
5922   InGroup<Parentheses>;
5923 def note_precedence_bitwise_first : Note<
5924   "place parentheses around the %0 expression to evaluate it first">;
5925 def note_precedence_silence : Note<
5926   "place parentheses around the '%0' expression to silence this warning">;
5927
5928 def warn_precedence_conditional : Warning<
5929   "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
5930   InGroup<Parentheses>;
5931 def warn_precedence_bitwise_conditional : Warning<
5932   "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
5933   InGroup<BitwiseConditionalParentheses>;
5934 def note_precedence_conditional_first : Note<
5935   "place parentheses around the '?:' expression to evaluate it first">;
5936
5937 def warn_enum_constant_in_bool_context : Warning<
5938   "converting the enum constant to a boolean">,
5939   InGroup<IntInBoolContext>, DefaultIgnore;
5940 def warn_left_shift_in_bool_context : Warning<
5941   "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
5942   InGroup<IntInBoolContext>, DefaultIgnore;
5943 def warn_logical_instead_of_bitwise : Warning<
5944   "use of logical '%0' with constant operand">,
5945   InGroup<DiagGroup<"constant-logical-operand">>;
5946 def note_logical_instead_of_bitwise_change_operator : Note<
5947   "use '%0' for a bitwise operation">;
5948 def note_logical_instead_of_bitwise_remove_constant : Note<
5949   "remove constant to silence this warning">;
5950
5951 def warn_bitwise_op_in_bitwise_op : Warning<
5952   "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
5953
5954 def warn_logical_and_in_logical_or : Warning<
5955   "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
5956
5957 def warn_overloaded_shift_in_comparison :Warning<
5958   "overloaded operator %select{>>|<<}0 has higher precedence than "
5959   "comparison operator">,
5960   InGroup<OverloadedShiftOpParentheses>;
5961 def note_evaluate_comparison_first :Note<
5962   "place parentheses around comparison expression to evaluate it first">;
5963
5964 def warn_addition_in_bitshift : Warning<
5965   "operator '%0' has lower precedence than '%1'; "
5966   "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
5967
5968 def warn_self_assignment_builtin : Warning<
5969   "explicitly assigning value of variable of type %0 to itself">,
5970   InGroup<SelfAssignment>, DefaultIgnore;
5971 def warn_self_assignment_overloaded : Warning<
5972   "explicitly assigning value of variable of type %0 to itself">,
5973   InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
5974 def warn_self_move : Warning<
5975   "explicitly moving variable of type %0 to itself">,
5976   InGroup<SelfMove>, DefaultIgnore;
5977
5978 def warn_redundant_move_on_return : Warning<
5979   "redundant move in return statement">,
5980   InGroup<RedundantMove>, DefaultIgnore;
5981 def warn_pessimizing_move_on_return : Warning<
5982   "moving a local object in a return statement prevents copy elision">,
5983   InGroup<PessimizingMove>, DefaultIgnore;
5984 def warn_pessimizing_move_on_initialization : Warning<
5985   "moving a temporary object prevents copy elision">,
5986   InGroup<PessimizingMove>, DefaultIgnore;
5987 def note_remove_move : Note<"remove std::move call here">;
5988
5989 def warn_return_std_move : Warning<
5990   "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
5991   InGroup<ReturnStdMove>, DefaultIgnore;
5992 def note_add_std_move : Note<
5993   "call 'std::move' explicitly to avoid copying">;
5994 def warn_return_std_move_in_cxx11 : Warning<
5995   "prior to the resolution of a defect report against ISO C++11, "
5996   "local variable %0 would have been copied despite being returned by name, "
5997   "due to its not matching the function return type%diff{ ($ vs $)|}1,2">,
5998   InGroup<ReturnStdMoveInCXX11>, DefaultIgnore;
5999 def note_add_std_move_in_cxx11 : Note<
6000   "call 'std::move' explicitly to avoid copying on older compilers">;
6001
6002 def warn_string_plus_int : Warning<
6003   "adding %0 to a string does not append to the string">,
6004   InGroup<StringPlusInt>;
6005 def warn_string_plus_char : Warning<
6006   "adding %0 to a string pointer does not append to the string">,
6007   InGroup<StringPlusChar>;
6008 def note_string_plus_scalar_silence : Note<
6009   "use array indexing to silence this warning">;
6010
6011 def warn_sizeof_array_param : Warning<
6012   "sizeof on array function parameter will return size of %0 instead of %1">,
6013   InGroup<SizeofArrayArgument>;
6014
6015 def warn_sizeof_array_decay : Warning<
6016   "sizeof on pointer operation will return size of %0 instead of %1">,
6017   InGroup<SizeofArrayDecay>;
6018
6019 def err_sizeof_nonfragile_interface : Error<
6020   "application of '%select{alignof|sizeof}1' to interface %0 is "
6021   "not supported on this architecture and platform">;
6022 def err_atdef_nonfragile_interface : Error<
6023   "use of @defs is not supported on this architecture and platform">;
6024 def err_subscript_nonfragile_interface : Error<
6025   "subscript requires size of interface %0, which is not constant for "
6026   "this architecture and platform">;
6027
6028 def err_arithmetic_nonfragile_interface : Error<
6029   "arithmetic on pointer to interface %0, which is not a constant size for "
6030   "this architecture and platform">;
6031
6032 def warn_deprecated_comma_subscript : Warning<
6033   "top-level comma expression in array subscript is deprecated">,
6034   InGroup<DeprecatedCommaSubscript>;
6035
6036 def ext_subscript_non_lvalue : Extension<
6037   "ISO C90 does not allow subscripting non-lvalue array">;
6038 def err_typecheck_subscript_value : Error<
6039   "subscripted value is not an array, pointer, or vector">;
6040 def err_typecheck_subscript_not_integer : Error<
6041   "array subscript is not an integer">;
6042 def err_subscript_function_type : Error<
6043   "subscript of pointer to function type %0">;
6044 def err_subscript_incomplete_type : Error<
6045   "subscript of pointer to incomplete type %0">;
6046 def err_dereference_incomplete_type : Error<
6047   "dereference of pointer to incomplete type %0">;
6048 def ext_gnu_subscript_void_type : Extension<
6049   "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6050 def err_typecheck_member_reference_struct_union : Error<
6051   "member reference base type %0 is not a structure or union">;
6052 def err_typecheck_member_reference_ivar : Error<
6053   "%0 does not have a member named %1">;
6054 def err_arc_weak_ivar_access : Error<
6055   "dereferencing a __weak pointer is not allowed due to possible "
6056   "null value caused by race condition, assign it to strong variable first">;
6057 def err_typecheck_member_reference_arrow : Error<
6058   "member reference type %0 is not a pointer">;
6059 def err_typecheck_member_reference_suggestion : Error<
6060   "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6061 def note_typecheck_member_reference_suggestion : Note<
6062   "did you mean to use '.' instead?">;
6063 def note_member_reference_arrow_from_operator_arrow : Note<
6064   "'->' applied to return value of the operator->() declared here">;
6065 def err_typecheck_member_reference_type : Error<
6066   "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6067 def err_typecheck_member_reference_unknown : Error<
6068   "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6069 def err_member_reference_needs_call : Error<
6070   "base of member reference is a function; perhaps you meant to call "
6071   "it%select{| with no arguments}0?">;
6072 def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6073   InGroup<CharSubscript>, DefaultIgnore;
6074
6075 def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6076 def err_no_member : Error<"no member named %0 in %1">;
6077 def err_no_member_overloaded_arrow : Error<
6078   "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6079
6080 def err_member_not_yet_instantiated : Error<
6081   "no member %0 in %1; it has not yet been instantiated">;
6082 def note_non_instantiated_member_here : Note<
6083   "not-yet-instantiated member is declared here">;
6084
6085 def err_enumerator_does_not_exist : Error<
6086   "enumerator %0 does not exist in instantiation of %1">;
6087 def note_enum_specialized_here : Note<
6088   "enum %0 was explicitly specialized here">;
6089
6090 def err_specialization_not_primary_template : Error<
6091   "cannot reference member of primary template because deduced class "
6092   "template specialization %0 is %select{instantiated from a partial|"
6093   "an explicit}1 specialization">;
6094
6095 def err_member_redeclared : Error<"class member cannot be redeclared">;
6096 def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6097   InGroup<RedeclaredClassMember>;
6098 def err_member_redeclared_in_instantiation : Error<
6099   "multiple overloads of %0 instantiate to the same signature %1">;
6100 def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6101 def err_member_def_undefined_record : Error<
6102   "out-of-line definition of %0 from class %1 without definition">;
6103 def err_member_decl_does_not_match : Error<
6104   "out-of-line %select{declaration|definition}2 of %0 "
6105   "does not match any declaration in %1">;
6106 def err_friend_decl_with_def_arg_must_be_def : Error<
6107   "friend declaration specifying a default argument must be a definition">;
6108 def err_friend_decl_with_def_arg_redeclared : Error<
6109   "friend declaration specifying a default argument must be the only declaration">;
6110 def err_friend_decl_does_not_match : Error<
6111   "friend declaration of %0 does not match any declaration in %1">;
6112 def err_member_decl_does_not_match_suggest : Error<
6113   "out-of-line %select{declaration|definition}2 of %0 "
6114   "does not match any declaration in %1; did you mean %3?">;
6115 def err_member_def_does_not_match_ret_type : Error<
6116   "return type of out-of-line definition of %q0 differs from "
6117   "that in the declaration">;
6118 def err_nonstatic_member_out_of_line : Error<
6119   "non-static data member defined out-of-line">;
6120 def err_qualified_typedef_declarator : Error<
6121   "typedef declarator cannot be qualified">;
6122 def err_qualified_param_declarator : Error<
6123   "parameter declarator cannot be qualified">;
6124 def ext_out_of_line_declaration : ExtWarn<
6125   "out-of-line declaration of a member must be a definition">,
6126   InGroup<OutOfLineDeclaration>, DefaultError;
6127 def err_member_extra_qualification : Error<
6128   "extra qualification on member %0">;
6129 def warn_member_extra_qualification : Warning<
6130   err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6131 def warn_namespace_member_extra_qualification : Warning<
6132   "extra qualification on member %0">,
6133   InGroup<DiagGroup<"extra-qualification">>;
6134 def err_member_qualification : Error<
6135   "non-friend class member %0 cannot have a qualified name">;
6136 def note_member_def_close_match : Note<"member declaration nearly matches">;
6137 def note_member_def_close_const_match : Note<
6138   "member declaration does not match because "
6139   "it %select{is|is not}0 const qualified">;
6140 def note_member_def_close_param_match : Note<
6141   "type of %ordinal0 parameter of member declaration does not match definition"
6142   "%diff{ ($ vs $)|}1,2">;
6143 def note_local_decl_close_match : Note<"local declaration nearly matches">;
6144 def note_local_decl_close_param_match : Note<
6145   "type of %ordinal0 parameter of local declaration does not match definition"
6146   "%diff{ ($ vs $)|}1,2">;
6147 def err_typecheck_ivar_variable_size : Error<
6148   "instance variables must have a constant size">;
6149 def err_ivar_reference_type : Error<
6150   "instance variables cannot be of reference type">;
6151 def err_typecheck_illegal_increment_decrement : Error<
6152   "cannot %select{decrement|increment}1 value of type %0">;
6153 def err_typecheck_expect_int : Error<
6154   "used type %0 where integer is required">;
6155 def err_typecheck_arithmetic_incomplete_type : Error<
6156   "arithmetic on a pointer to an incomplete type %0">;
6157 def err_typecheck_pointer_arith_function_type : Error<
6158   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6159   "function type%select{|s}2 %1%select{| and %3}2">;
6160 def err_typecheck_pointer_arith_void_type : Error<
6161   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6162 def err_typecheck_decl_incomplete_type : Error<
6163   "variable has incomplete type %0">;
6164 def ext_typecheck_decl_incomplete_type : ExtWarn<
6165   "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6166   InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6167 def err_tentative_def_incomplete_type : Error<
6168   "tentative definition has type %0 that is never completed">;
6169 def warn_tentative_incomplete_array : Warning<
6170   "tentative array definition assumed to have one element">;
6171 def err_typecheck_incomplete_array_needs_initializer : Error<
6172   "definition of variable with array type needs an explicit size "
6173   "or an initializer">;
6174 def err_array_init_not_init_list : Error<
6175   "array initializer must be an initializer "
6176   "list%select{| or string literal| or wide string literal}0">;
6177 def err_array_init_narrow_string_into_wchar : Error<
6178   "initializing wide char array with non-wide string literal">;
6179 def err_array_init_wide_string_into_char : Error<
6180   "initializing char array with wide string literal">;
6181 def err_array_init_incompat_wide_string_into_wchar : Error<
6182   "initializing wide char array with incompatible wide string literal">;
6183 def err_array_init_plain_string_into_char8_t : Error<
6184   "initializing 'char8_t' array with plain string literal">;
6185 def note_array_init_plain_string_into_char8_t : Note<
6186   "add 'u8' prefix to form a 'char8_t' string literal">;
6187 def err_array_init_utf8_string_into_char : Error<
6188   "%select{|ISO C++20 does not permit }0initialization of char array with "
6189   "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6190 def warn_cxx2a_compat_utf8_string : Warning<
6191   "type of UTF-8 string literal will change from array of const char to "
6192   "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6193 def note_cxx2a_compat_utf8_string_remove_u8 : Note<
6194   "remove 'u8' prefix to avoid a change of behavior; "
6195   "Clang encodes unprefixed narrow string literals as UTF-8">;
6196 def err_array_init_different_type : Error<
6197   "cannot initialize array %diff{of type $ with array of type $|"
6198   "with different type of array}0,1">;
6199 def err_array_init_non_constant_array : Error<
6200   "cannot initialize array %diff{of type $ with non-constant array of type $|"
6201   "with different type of array}0,1">;
6202 def ext_array_init_copy : Extension<
6203   "initialization of an array "
6204   "%diff{of type $ from a compound literal of type $|"
6205   "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6206 // This is intentionally not disabled by -Wno-gnu.
6207 def ext_array_init_parens : ExtWarn<
6208   "parenthesized initialization of a member array is a GNU extension">,
6209   InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6210 def warn_deprecated_string_literal_conversion : Warning<
6211   "conversion from string literal to %0 is deprecated">,
6212   InGroup<CXX11CompatDeprecatedWritableStr>;
6213 def ext_deprecated_string_literal_conversion : ExtWarn<
6214   "ISO C++11 does not allow conversion from string literal to %0">,
6215   InGroup<WritableStrings>, SFINAEFailure;
6216 def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6217 def err_typecheck_sclass_fscope : Error<
6218   "illegal storage class on file-scoped variable">;
6219 def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6220   InGroup<MissingDeclarations>;
6221 def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6222   "of a type">, InGroup<MissingDeclarations>;
6223 def err_standalone_class_nested_name_specifier : Error<
6224   "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6225   "have a nested name specifier">;
6226 def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6227 def err_static_block_func : Error<
6228   "function declared in block scope cannot have 'static' storage class">;
6229 def err_typecheck_address_of : Error<"address of %select{bit-field"
6230   "|vector element|property expression|register variable}0 requested">;
6231 def ext_typecheck_addrof_void : Extension<
6232   "ISO C forbids taking the address of an expression of type 'void'">;
6233 def err_unqualified_pointer_member_function : Error<
6234   "must explicitly qualify name of member function when taking its address">;
6235 def err_invalid_form_pointer_member_function : Error<
6236   "cannot create a non-constant pointer to member function">;
6237 def err_address_of_function_with_pass_object_size_params: Error<
6238   "cannot take address of function %0 because parameter %1 has "
6239   "pass_object_size attribute">;
6240 def err_parens_pointer_member_function : Error<
6241   "cannot parenthesize the name of a method when forming a member pointer">;
6242 def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6243   "extra '&' taking address of overloaded function">;
6244 def err_typecheck_invalid_lvalue_addrof : Error<
6245   "cannot take the address of an rvalue of type %0">;
6246 def ext_typecheck_addrof_temporary : ExtWarn<
6247   "taking the address of a temporary object of type %0">,
6248   InGroup<AddressOfTemporary>, DefaultError;
6249 def err_typecheck_addrof_temporary : Error<
6250   "taking the address of a temporary object of type %0">;
6251 def err_typecheck_addrof_dtor : Error<
6252   "taking the address of a destructor">;
6253 def err_typecheck_unary_expr : Error<
6254   "invalid argument type %0 to unary expression">;
6255 def err_typecheck_indirection_requires_pointer : Error<
6256   "indirection requires pointer operand (%0 invalid)">;
6257 def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6258   "ISO C++ does not allow indirection on operand of type %0">,
6259   InGroup<DiagGroup<"void-ptr-dereference">>;
6260 def warn_indirection_through_null : Warning<
6261   "indirection of non-volatile null pointer will be deleted, not trap">,
6262   InGroup<NullDereference>;
6263 def warn_binding_null_to_reference : Warning<
6264   "binding dereferenced null pointer to reference has undefined behavior">,
6265   InGroup<NullDereference>;
6266 def note_indirection_through_null : Note<
6267   "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6268 def warn_pointer_indirection_from_incompatible_type : Warning<
6269   "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6270   "behavior">,
6271   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6272 def warn_taking_address_of_packed_member : Warning<
6273   "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6274   InGroup<DiagGroup<"address-of-packed-member">>;
6275
6276 def err_objc_object_assignment : Error<
6277   "cannot assign to class object (%0 invalid)">;
6278 def err_typecheck_invalid_operands : Error<
6279   "invalid operands to binary expression (%0 and %1)">;
6280 def note_typecheck_invalid_operands_converted : Note<
6281   "%select{first|second}0 operand was implicitly converted to type %1">;
6282 def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6283   "logical expression with vector %select{type %1 and non-vector type %2|types"
6284   " %1 and %2}0 is only supported in C++">;
6285 def err_typecheck_sub_ptr_compatible : Error<
6286   "%diff{$ and $ are not pointers to compatible types|"
6287   "pointers to incompatible types}0,1">;
6288 def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6289   "ordered comparison between pointer and integer (%0 and %1)">;
6290 def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6291   "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6292 def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6293   "ordered comparison between pointer and zero (%0 and %1)">;
6294 def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6295   "three-way comparison between pointer and zero">;
6296 def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6297   "ordered comparison of function pointers (%0 and %1)">,
6298   InGroup<DiagGroup<"ordered-compare-function-pointers">>;
6299 def ext_typecheck_comparison_of_fptr_to_void : Extension<
6300   "equality comparison between function pointer and void pointer (%0 and %1)">;
6301 def err_typecheck_comparison_of_fptr_to_void : Error<
6302   "equality comparison between function pointer and void pointer (%0 and %1)">;
6303 def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6304   "comparison between pointer and integer (%0 and %1)">,
6305   InGroup<DiagGroup<"pointer-integer-compare">>;
6306 def err_typecheck_comparison_of_pointer_integer : Error<
6307   "comparison between pointer and integer (%0 and %1)">;
6308 def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6309   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6310   InGroup<CompareDistinctPointerType>;
6311 def ext_typecheck_cond_incompatible_operands : ExtWarn<
6312   "incompatible operand types (%0 and %1)">;
6313 def err_cond_voidptr_arc : Error <
6314   "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6315   "in ARC mode">;
6316 def err_typecheck_comparison_of_distinct_pointers : Error<
6317   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6318 def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6319   "%select{comparison between %diff{ ($ and $)|}0,1"
6320   "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6321   "|conditional operator with the second and third operands of type "
6322   "%diff{ ($ and $)|}0,1}2"
6323   " which are pointers to non-overlapping address spaces">;
6324
6325 def select_arith_conv_kind : TextSubstitution<
6326   "%select{arithmetic between|bitwise operation between|comparison of|"
6327   "conditional expression between|compound assignment of}0">;
6328 def warn_arith_conv_enum_float : Warning<
6329   "%sub{select_arith_conv_kind}0 "
6330   "%select{floating-point|enumeration}1 type %2 "
6331   "%plural{2:with|4:from|:and}0 "
6332   "%select{enumeration|floating-point}1 type %3">,
6333   InGroup<EnumFloatConversion>, DefaultIgnore;
6334 def warn_arith_conv_enum_float_cxx2a : Warning<
6335   "%sub{select_arith_conv_kind}0 "
6336   "%select{floating-point|enumeration}1 type %2 "
6337   "%plural{2:with|4:from|:and}0 "
6338   "%select{enumeration|floating-point}1 type %3 is deprecated">,
6339   InGroup<DeprecatedEnumFloatConversion>;
6340 def warn_arith_conv_mixed_enum_types : Warning<
6341   "%sub{select_arith_conv_kind}0 "
6342   "different enumeration types%diff{ ($ and $)|}1,2">,
6343   InGroup<EnumEnumConversion>, DefaultIgnore;
6344 def warn_arith_conv_mixed_enum_types_cxx2a : Warning<
6345   "%sub{select_arith_conv_kind}0 "
6346   "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6347   InGroup<DeprecatedEnumEnumConversion>;
6348 def warn_arith_conv_mixed_anon_enum_types : Warning<
6349   warn_arith_conv_mixed_enum_types.Text>,
6350   InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6351 def warn_arith_conv_mixed_anon_enum_types_cxx2a : Warning<
6352   warn_arith_conv_mixed_enum_types_cxx2a.Text>,
6353   InGroup<DeprecatedAnonEnumEnumConversion>;
6354 def warn_conditional_mixed_enum_types : Warning<
6355   warn_arith_conv_mixed_enum_types.Text>,
6356   InGroup<EnumCompareConditional>, DefaultIgnore;
6357 def warn_conditional_mixed_enum_types_cxx2a : Warning<
6358   warn_arith_conv_mixed_enum_types_cxx2a.Text>,
6359   InGroup<DeprecatedEnumCompareConditional>;
6360 def warn_comparison_mixed_enum_types : Warning<
6361   warn_arith_conv_mixed_enum_types.Text>,
6362   InGroup<EnumCompare>;
6363 def warn_comparison_mixed_enum_types_cxx2a : Warning<
6364   warn_arith_conv_mixed_enum_types_cxx2a.Text>,
6365   InGroup<DeprecatedEnumCompare>;
6366 def warn_comparison_of_mixed_enum_types_switch : Warning<
6367   "comparison of different enumeration types in switch statement"
6368   "%diff{ ($ and $)|}0,1">,
6369   InGroup<EnumCompareSwitch>;
6370
6371 def err_typecheck_assign_const : Error<
6372   "%select{"
6373   "cannot assign to return value because function %1 returns a const value|"
6374   "cannot assign to variable %1 with const-qualified type %2|"
6375   "cannot assign to %select{non-|}1static data member %2 "
6376   "with const-qualified type %3|"
6377   "cannot assign to non-static data member within const member function %1|"
6378   "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6379   "with %select{|nested }3const-qualified data member %4|"
6380   "read-only variable is not assignable}0">;
6381
6382 def note_typecheck_assign_const : Note<
6383   "%select{"
6384   "function %1 which returns const-qualified type %2 declared here|"
6385   "variable %1 declared const here|"
6386   "%select{non-|}1static data member %2 declared const here|"
6387   "member function %q1 is declared const here|"
6388   "%select{|nested }1data member %2 declared const here}0">;
6389
6390 def warn_unsigned_always_true_comparison : Warning<
6391   "result of comparison of %select{%3|unsigned expression}0 %2 "
6392   "%select{unsigned expression|%3}0 is always %4">,
6393   InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6394 def warn_unsigned_enum_always_true_comparison : Warning<
6395   "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6396   "%select{unsigned enum expression|%3}0 is always %4">,
6397   InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6398 def warn_tautological_constant_compare : Warning<
6399   "result of comparison %select{%3|%1}0 %2 "
6400   "%select{%1|%3}0 is always %4">,
6401   InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6402 def warn_tautological_compare_objc_bool : Warning<
6403   "result of comparison of constant %0 with expression of type 'BOOL'"
6404   " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6405   InGroup<TautologicalObjCBoolCompare>;
6406
6407 def warn_mixed_sign_comparison : Warning<
6408   "comparison of integers of different signs: %0 and %1">,
6409   InGroup<SignCompare>, DefaultIgnore;
6410 def warn_out_of_range_compare : Warning<
6411   "result of comparison of %select{constant %0|true|false}1 with "
6412   "%select{expression of type %2|boolean expression}3 is always %4">,
6413   InGroup<TautologicalOutOfRangeCompare>;
6414 def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6415   InGroup<TautologicalConstantCompare>;
6416 def warn_integer_constants_in_conditional_always_true : Warning<
6417   "converting the result of '?:' with integer constants to a boolean always "
6418   "evaluates to 'true'">,
6419   InGroup<TautologicalConstantCompare>;
6420 def warn_left_shift_always : Warning<
6421   "converting the result of '<<' to a boolean always evaluates "
6422   "to %select{false|true}0">,
6423   InGroup<TautologicalConstantCompare>;
6424 def warn_null_in_arithmetic_operation : Warning<
6425   "use of NULL in arithmetic operation">,
6426   InGroup<NullArithmetic>;
6427 def warn_null_in_comparison_operation : Warning<
6428   "comparison between NULL and non-pointer "
6429   "%select{(%1 and NULL)|(NULL and %1)}0">,
6430   InGroup<NullArithmetic>;
6431 def err_shift_rhs_only_vector : Error<
6432   "requested shift is a vector of type %0 but the first operand is not a "
6433   "vector (%1)">;
6434
6435 def warn_logical_not_on_lhs_of_check : Warning<
6436   "logical not is only applied to the left hand side of this "
6437   "%select{comparison|bitwise operator}0">,
6438   InGroup<LogicalNotParentheses>;
6439 def note_logical_not_fix : Note<
6440   "add parentheses after the '!' to evaluate the "
6441   "%select{comparison|bitwise operator}0 first">;
6442 def note_logical_not_silence_with_parens : Note<
6443   "add parentheses around left hand side expression to silence this warning">;
6444
6445 def err_invalid_this_use : Error<
6446   "invalid use of 'this' outside of a non-static member function">;
6447 def err_this_static_member_func : Error<
6448   "'this' cannot be%select{| implicitly}0 used in a static member function "
6449   "declaration">;
6450 def err_invalid_member_use_in_static_method : Error<
6451   "invalid use of member %0 in static member function">;
6452 def err_invalid_qualified_function_type : Error<
6453   "%select{non-member function|static member function|deduction guide}0 "
6454   "%select{of type %2 |}1cannot have '%3' qualifier">;
6455 def err_compound_qualified_function_type : Error<
6456   "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6457   "cannot have '%3' qualifier">;
6458 def err_qualified_function_typeid : Error<
6459   "type operand %0 of 'typeid' cannot have '%1' qualifier">;
6460
6461 def err_ref_qualifier_overload : Error<
6462   "cannot overload a member function %select{without a ref-qualifier|with "
6463   "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6464   "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6465
6466 def err_invalid_non_static_member_use : Error<
6467   "invalid use of non-static data member %0">;
6468 def err_nested_non_static_member_use : Error<
6469   "%select{call to non-static member function|use of non-static data member}0 "
6470   "%2 of %1 from nested type %3">;
6471 def warn_cxx98_compat_non_static_member_use : Warning<
6472   "use of non-static data member %0 in an unevaluated context is "
6473   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6474 def err_invalid_incomplete_type_use : Error<
6475   "invalid use of incomplete type %0">;
6476 def err_builtin_func_cast_more_than_one_arg : Error<
6477   "function-style cast to a builtin type can only take one argument">;
6478 def err_value_init_for_array_type : Error<
6479   "array types cannot be value-initialized">;
6480 def err_init_for_function_type : Error<
6481   "cannot create object of function type %0">;
6482 def warn_format_nonliteral_noargs : Warning<
6483   "format string is not a string literal (potentially insecure)">,
6484   InGroup<FormatSecurity>;
6485 def warn_format_nonliteral : Warning<
6486   "format string is not a string literal">,
6487   InGroup<FormatNonLiteral>, DefaultIgnore;
6488
6489 def err_unexpected_interface : Error<
6490   "unexpected interface name %0: expected expression">;
6491 def err_ref_non_value : Error<"%0 does not refer to a value">;
6492 def err_ref_vm_type : Error<
6493   "cannot refer to declaration with a variably modified type inside block">;
6494 def err_ref_flexarray_type : Error<
6495   "cannot refer to declaration of structure variable with flexible array member "
6496   "inside block">;
6497 def err_ref_array_type : Error<
6498   "cannot refer to declaration with an array type inside block">;
6499 def err_property_not_found : Error<
6500   "property %0 not found on object of type %1">;
6501 def err_invalid_property_name : Error<
6502   "%0 is not a valid property name (accessing an object of type %1)">;
6503 def err_getter_not_found : Error<
6504   "no getter method for read from property">;
6505 def err_objc_subscript_method_not_found : Error<
6506   "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6507   "found on object of type %0">;
6508 def err_objc_subscript_index_type : Error<
6509   "method index parameter type %0 is not integral type">;
6510 def err_objc_subscript_key_type : Error<
6511   "method key parameter type %0 is not object type">;
6512 def err_objc_subscript_dic_object_type : Error<
6513   "method object parameter type %0 is not object type">;
6514 def err_objc_subscript_object_type : Error<
6515   "cannot assign to this %select{dictionary|array}1 because assigning method's "
6516   "2nd parameter of type %0 is not an Objective-C pointer type">;
6517 def err_objc_subscript_base_type : Error<
6518   "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6519 def err_objc_multiple_subscript_type_conversion : Error<
6520   "indexing expression is invalid because subscript type %0 has "
6521   "multiple type conversion functions">;
6522 def err_objc_subscript_type_conversion : Error<
6523   "indexing expression is invalid because subscript type %0 is not an integral"
6524   " or Objective-C pointer type">;
6525 def err_objc_subscript_pointer : Error<
6526   "indexing expression is invalid because subscript type %0 is not an"
6527   " Objective-C pointer">;
6528 def err_objc_indexing_method_result_type : Error<
6529   "method for accessing %select{dictionary|array}1 element must have Objective-C"
6530   " object return type instead of %0">;
6531 def err_objc_index_incomplete_class_type : Error<
6532   "Objective-C index expression has incomplete class type %0">;
6533 def err_illegal_container_subscripting_op : Error<
6534   "illegal operation on Objective-C container subscripting">;
6535 def err_property_not_found_forward_class : Error<
6536   "property %0 cannot be found in forward class object %1">;
6537 def err_property_not_as_forward_class : Error<
6538   "property %0 refers to an incomplete Objective-C class %1 "
6539   "(with no @interface available)">;
6540 def note_forward_class : Note<
6541   "forward declaration of class here">;
6542 def err_duplicate_property : Error<
6543   "property has a previous declaration">;
6544 def ext_gnu_void_ptr : Extension<
6545   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
6546   InGroup<PointerArith>;
6547 def ext_gnu_ptr_func_arith : Extension<
6548   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
6549   "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
6550   InGroup<PointerArith>;
6551 def err_readonly_message_assignment : Error<
6552   "assigning to 'readonly' return result of an Objective-C message not allowed">;
6553 def ext_integer_increment_complex : Extension<
6554   "ISO C does not support '++'/'--' on complex integer type %0">;
6555 def ext_integer_complement_complex : Extension<
6556   "ISO C does not support '~' for complex conjugation of %0">;
6557 def err_nosetter_property_assignment : Error<
6558   "%select{assignment to readonly property|"
6559   "no setter method %1 for assignment to property}0">;
6560 def err_nosetter_property_incdec : Error<
6561   "%select{%select{increment|decrement}1 of readonly property|"
6562   "no setter method %2 for %select{increment|decrement}1 of property}0">;
6563 def err_nogetter_property_compound_assignment : Error<
6564   "a getter method is needed to perform a compound assignment on a property">;
6565 def err_nogetter_property_incdec : Error<
6566   "no getter method %1 for %select{increment|decrement}0 of property">;
6567 def err_no_subobject_property_setting : Error<
6568   "expression is not assignable">;
6569 def err_qualified_objc_access : Error<
6570   "%select{property|instance variable}0 access cannot be qualified with '%1'">;
6571
6572 def ext_freestanding_complex : Extension<
6573   "complex numbers are an extension in a freestanding C99 implementation">;
6574
6575 // FIXME: Remove when we support imaginary.
6576 def err_imaginary_not_supported : Error<"imaginary types are not supported">;
6577
6578 // Obj-c expressions
6579 def warn_root_inst_method_not_found : Warning<
6580   "instance method %0 is being used on 'Class' which is not in the root class">,
6581   InGroup<MethodAccess>;
6582 def warn_class_method_not_found : Warning<
6583   "class method %objcclass0 not found (return type defaults to 'id')">,
6584   InGroup<MethodAccess>;
6585 def warn_instance_method_on_class_found : Warning<
6586   "instance method %0 found instead of class method %1">,
6587   InGroup<MethodAccess>;
6588 def warn_inst_method_not_found : Warning<
6589   "instance method %objcinstance0 not found (return type defaults to 'id')">,
6590   InGroup<MethodAccess>;
6591 def warn_instance_method_not_found_with_typo : Warning<
6592   "instance method %objcinstance0 not found (return type defaults to 'id')"
6593   "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
6594 def warn_class_method_not_found_with_typo : Warning<
6595   "class method %objcclass0 not found (return type defaults to 'id')"
6596   "; did you mean %objcclass2?">, InGroup<MethodAccess>;
6597 def err_method_not_found_with_typo : Error<
6598   "%select{instance|class}1 method %0 not found "
6599   "; did you mean %2?">;
6600 def err_no_super_class_message : Error<
6601   "no @interface declaration found in class messaging of %0">;
6602 def err_root_class_cannot_use_super : Error<
6603   "%0 cannot use 'super' because it is a root class">;
6604 def err_invalid_receiver_to_message_super : Error<
6605   "'super' is only valid in a method body">;
6606 def err_invalid_receiver_class_message : Error<
6607   "receiver type %0 is not an Objective-C class">;
6608 def err_missing_open_square_message_send : Error<
6609   "missing '[' at start of message send expression">;
6610 def warn_bad_receiver_type : Warning<
6611   "receiver type %0 is not 'id' or interface pointer, consider "
6612   "casting it to 'id'">,InGroup<ObjCReceiver>;
6613 def err_bad_receiver_type : Error<"bad receiver type %0">;
6614 def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
6615 def err_unknown_receiver_suggest : Error<
6616   "unknown receiver %0; did you mean %1?">;
6617 def err_objc_throw_expects_object : Error<
6618   "@throw requires an Objective-C object type (%0 invalid)">;
6619 def err_objc_synchronized_expects_object : Error<
6620   "@synchronized requires an Objective-C object type (%0 invalid)">;
6621 def err_rethrow_used_outside_catch : Error<
6622   "@throw (rethrow) used outside of a @catch block">;
6623 def err_attribute_multiple_objc_gc : Error<
6624   "multiple garbage collection attributes specified for type">;
6625 def err_catch_param_not_objc_type : Error<
6626   "@catch parameter is not a pointer to an interface type">;
6627 def err_illegal_qualifiers_on_catch_parm : Error<
6628   "illegal qualifiers on @catch parameter">;
6629 def err_storage_spec_on_catch_parm : Error<
6630   "@catch parameter cannot have storage specifier '%0'">;
6631 def warn_register_objc_catch_parm : Warning<
6632   "'register' storage specifier on @catch parameter will be ignored">;
6633 def err_qualified_objc_catch_parm : Error<
6634   "@catch parameter declarator cannot be qualified">;
6635 def warn_objc_pointer_cxx_catch_fragile : Warning<
6636   "cannot catch an exception thrown with @throw in C++ in the non-unified "
6637   "exception model">, InGroup<ObjCNonUnifiedException>;
6638 def err_objc_object_catch : Error<
6639   "cannot catch an Objective-C object by value">;
6640 def err_incomplete_type_objc_at_encode : Error<
6641   "'@encode' of incomplete type %0">;
6642 def warn_objc_circular_container : Warning<
6643   "adding %0 to %1 might cause circular dependency in container">,
6644   InGroup<DiagGroup<"objc-circular-container">>;
6645 def note_objc_circular_container_declared_here : Note<"%0 declared here">;
6646 def warn_objc_unsafe_perform_selector : Warning<
6647   "%0 is incompatible with selectors that return a "
6648   "%select{struct|union|vector}1 type">,
6649   InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
6650 def note_objc_unsafe_perform_selector_method_declared_here :  Note<
6651   "method %0 that returns %1 declared here">;
6652 def err_attribute_arm_mve_alias : Error<
6653   "'__clang_arm_mve_alias' attribute can only be applied to an ARM MVE builtin">;
6654
6655 def warn_setter_getter_impl_required : Warning<
6656   "property %0 requires method %1 to be defined - "
6657   "use @synthesize, @dynamic or provide a method implementation "
6658   "in this class implementation">,
6659   InGroup<ObjCPropertyImpl>;
6660 def warn_setter_getter_impl_required_in_category : Warning<
6661   "property %0 requires method %1 to be defined - "
6662   "use @dynamic or provide a method implementation in this category">,
6663   InGroup<ObjCPropertyImpl>;
6664 def note_parameter_named_here : Note<
6665   "passing argument to parameter %0 here">;
6666 def note_parameter_here : Note<
6667   "passing argument to parameter here">;
6668 def note_method_return_type_change : Note<
6669   "compiler has implicitly changed method %0 return type">;
6670
6671 def warn_impl_required_for_class_property : Warning<
6672   "class property %0 requires method %1 to be defined - "
6673   "use @dynamic or provide a method implementation "
6674   "in this class implementation">,
6675   InGroup<ObjCPropertyImpl>;
6676 def warn_impl_required_in_category_for_class_property : Warning<
6677   "class property %0 requires method %1 to be defined - "
6678   "use @dynamic or provide a method implementation in this category">,
6679   InGroup<ObjCPropertyImpl>;
6680
6681 // C++ casts
6682 // These messages adhere to the TryCast pattern: %0 is an int specifying the
6683 // cast type, %1 is the source type, %2 is the destination type.
6684 def err_bad_reinterpret_cast_overload : Error<
6685   "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
6686
6687 def warn_reinterpret_different_from_static : Warning<
6688   "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
6689   "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
6690   "'static_cast'">, InGroup<ReinterpretBaseClass>;
6691 def note_reinterpret_updowncast_use_static: Note<
6692   "use 'static_cast' to adjust the pointer correctly while "
6693   "%select{upcasting|downcasting}0">;
6694
6695 def err_bad_static_cast_overload : Error<
6696   "address of overloaded function %0 cannot be static_cast to type %1">;
6697
6698 def err_bad_cstyle_cast_overload : Error<
6699   "address of overloaded function %0 cannot be cast to type %1">;
6700
6701
6702 def err_bad_cxx_cast_generic : Error<
6703   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6704   "functional-style cast}0 from %1 to %2 is not allowed">;
6705 def err_bad_cxx_cast_unrelated_class : Error<
6706   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6707   "functional-style cast}0 from %1 to %2, which are not related by "
6708   "inheritance, is not allowed">;
6709 def note_type_incomplete : Note<"%0 is incomplete">;
6710 def err_bad_cxx_cast_rvalue : Error<
6711   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6712   "functional-style cast}0 from rvalue to reference type %2">;
6713 def err_bad_cxx_cast_bitfield : Error<
6714   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6715   "functional-style cast}0 from bit-field lvalue to reference type %2">;
6716 def err_bad_cxx_cast_qualifiers_away : Error<
6717   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6718   "functional-style cast}0 from %1 to %2 casts away qualifiers">;
6719 def err_bad_cxx_cast_addr_space_mismatch : Error<
6720   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6721   "functional-style cast}0 from %1 to %2 converts between mismatching address"
6722   " spaces">;
6723 def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
6724   "ISO C++ does not allow "
6725   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6726   "functional-style cast}0 from %1 to %2 because it casts away qualifiers, "
6727   "even though the source and destination types are unrelated">,
6728   SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
6729 def err_bad_const_cast_dest : Error<
6730   "%select{const_cast||||C-style cast|functional-style cast}0 to %2, "
6731   "which is not a reference, pointer-to-object, or pointer-to-data-member">;
6732 def ext_cast_fn_obj : Extension<
6733   "cast between pointer-to-function and pointer-to-object is an extension">;
6734 def ext_ms_cast_fn_obj : ExtWarn<
6735   "static_cast between pointer-to-function and pointer-to-object is a "
6736   "Microsoft extension">, InGroup<MicrosoftCast>;
6737 def warn_cxx98_compat_cast_fn_obj : Warning<
6738   "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
6739   InGroup<CXX98CompatPedantic>, DefaultIgnore;
6740 def err_bad_reinterpret_cast_small_int : Error<
6741   "cast from pointer to smaller type %2 loses information">;
6742 def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
6743   "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6744   "to scalar %2 of different size">;
6745 def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
6746   "%select{||reinterpret_cast||C-style cast|}0 from scalar %1 "
6747   "to vector %2 of different size">;
6748 def err_bad_cxx_cast_vector_to_vector_different_size : Error<
6749   "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6750   "to vector %2 of different size">;
6751 def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
6752   "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
6753   "changes address space of nested pointers">,
6754   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6755 def err_bad_lvalue_to_rvalue_cast : Error<
6756   "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
6757   "not compatible">;
6758 def err_bad_rvalue_to_rvalue_cast : Error<
6759   "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
6760   "not compatible">;
6761 def err_bad_static_cast_pointer_nonpointer : Error<
6762   "cannot cast from type %1 to pointer type %2">;
6763 def err_bad_static_cast_member_pointer_nonmp : Error<
6764   "cannot cast from type %1 to member pointer type %2">;
6765 def err_bad_cxx_cast_member_pointer_size : Error<
6766   "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer "
6767   "type %1 to member pointer type %2 of different size">;
6768 def err_bad_reinterpret_cast_reference : Error<
6769   "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
6770 def warn_undefined_reinterpret_cast : Warning<
6771   "reinterpret_cast from %0 to %1 has undefined behavior">,
6772   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6773
6774 // These messages don't adhere to the pattern.
6775 // FIXME: Display the path somehow better.
6776 def err_ambiguous_base_to_derived_cast : Error<
6777   "ambiguous cast from base %0 to derived %1:%2">;
6778 def err_static_downcast_via_virtual : Error<
6779   "cannot cast %0 to %1 via virtual base %2">;
6780 def err_downcast_from_inaccessible_base : Error<
6781   "cannot cast %select{private|protected}2 base class %1 to %0">;
6782 def err_upcast_to_inaccessible_base : Error<
6783   "cannot cast %0 to its %select{private|protected}2 base class %1">;
6784 def err_bad_dynamic_cast_not_ref_or_ptr : Error<
6785   "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
6786 def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
6787 def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
6788 def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
6789 def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
6790
6791 // Other C++ expressions
6792 def err_need_header_before_typeid : Error<
6793   "you need to include <typeinfo> before using the 'typeid' operator">;
6794 def err_need_header_before_ms_uuidof : Error<
6795   "you need to include <guiddef.h> before using the '__uuidof' operator">;
6796 def err_ms___leave_not_in___try : Error<
6797   "'__leave' statement not in __try block">;
6798 def err_uuidof_without_guid : Error<
6799   "cannot call operator __uuidof on a type with no GUID">;
6800 def err_uuidof_with_multiple_guids : Error<
6801   "cannot call operator __uuidof on a type with multiple GUIDs">;
6802 def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
6803 def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
6804 def err_static_illegal_in_new : Error<
6805   "the 'static' modifier for the array size is not legal in new expressions">;
6806 def err_array_new_needs_size : Error<
6807   "array size must be specified in new expression with no initializer">;
6808 def err_bad_new_type : Error<
6809   "cannot allocate %select{function|reference}1 type %0 with new">;
6810 def err_new_incomplete_type : Error<
6811   "allocation of incomplete type %0">;
6812 def err_new_array_nonconst : Error<
6813   "only the first dimension of an allocated array may have dynamic size">;
6814 def err_new_array_size_unknown_from_init : Error<
6815   "cannot determine allocated array size from initializer">;
6816 def err_new_array_init_args : Error<
6817   "array 'new' cannot have initialization arguments">;
6818 def ext_new_paren_array_nonconst : ExtWarn<
6819   "when type is in parentheses, array cannot have dynamic size">;
6820 def err_placement_new_non_placement_delete : Error<
6821   "'new' expression with placement arguments refers to non-placement "
6822   "'operator delete'">;
6823 def err_array_size_not_integral : Error<
6824   "array size expression must have integral or %select{|unscoped }0"
6825   "enumeration type, not %1">;
6826 def err_array_size_incomplete_type : Error<
6827   "array size expression has incomplete class type %0">;
6828 def err_array_size_explicit_conversion : Error<
6829   "array size expression of type %0 requires explicit conversion to type %1">;
6830 def note_array_size_conversion : Note<
6831   "conversion to %select{integral|enumeration}0 type %1 declared here">;
6832 def err_array_size_ambiguous_conversion : Error<
6833   "ambiguous conversion of array size expression of type %0 to an integral or "
6834   "enumeration type">;
6835 def ext_array_size_conversion : Extension<
6836   "implicit conversion from array size expression of type %0 to "
6837   "%select{integral|enumeration}1 type %2 is a C++11 extension">,
6838   InGroup<CXX11>;
6839 def warn_cxx98_compat_array_size_conversion : Warning<
6840   "implicit conversion from array size expression of type %0 to "
6841   "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
6842   InGroup<CXX98CompatPedantic>, DefaultIgnore;
6843 def err_address_space_qualified_new : Error<
6844   "'new' cannot allocate objects of type %0 in address space '%1'">;
6845 def err_address_space_qualified_delete : Error<
6846   "'delete' cannot delete objects of type %0 in address space '%1'">;
6847
6848 def err_default_init_const : Error<
6849   "default initialization of an object of const type %0"
6850   "%select{| without a user-provided default constructor}1">;
6851 def ext_default_init_const : ExtWarn<
6852   "default initialization of an object of const type %0"
6853   "%select{| without a user-provided default constructor}1 "
6854   "is a Microsoft extension">,
6855   InGroup<MicrosoftConstInit>;
6856 def err_delete_operand : Error<"cannot delete expression of type %0">;
6857 def ext_delete_void_ptr_operand : ExtWarn<
6858   "cannot delete expression with pointer-to-'void' type %0">,
6859   InGroup<DeleteIncomplete>;
6860 def err_ambiguous_delete_operand : Error<
6861   "ambiguous conversion of delete expression of type %0 to a pointer">;
6862 def warn_delete_incomplete : Warning<
6863   "deleting pointer to incomplete type %0 may cause undefined behavior">,
6864   InGroup<DeleteIncomplete>;
6865 def err_delete_incomplete_class_type : Error<
6866   "deleting incomplete class type %0; no conversions to pointer type">;
6867 def err_delete_explicit_conversion : Error<
6868   "converting delete expression from type %0 to type %1 invokes an explicit "
6869   "conversion function">;
6870 def note_delete_conversion : Note<"conversion to pointer type %0">;
6871 def warn_delete_array_type : Warning<
6872   "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
6873 def warn_mismatched_delete_new : Warning<
6874   "'delete%select{|[]}0' applied to a pointer that was allocated with "
6875   "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
6876   InGroup<DiagGroup<"mismatched-new-delete">>;
6877 def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
6878 def err_no_suitable_delete_member_function_found : Error<
6879   "no suitable member %0 in %1">;
6880 def err_ambiguous_suitable_delete_member_function_found : Error<
6881   "multiple suitable %0 functions in %1">;
6882 def warn_ambiguous_suitable_delete_function_found : Warning<
6883   "multiple suitable %0 functions for %1; no 'operator delete' function "
6884   "will be invoked if initialization throws an exception">,
6885   InGroup<DiagGroup<"ambiguous-delete">>;
6886 def note_member_declared_here : Note<
6887   "member %0 declared here">;
6888 def note_member_first_declared_here : Note<
6889   "member %0 first declared here">;
6890 def warn_bitwise_negation_bool : Warning<
6891   "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
6892   "did you mean logical negation?">,
6893   InGroup<DiagGroup<"bool-operation">>;
6894 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
6895 def warn_increment_bool : Warning<
6896   "incrementing expression of type bool is deprecated and "
6897   "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
6898 def ext_increment_bool : ExtWarn<
6899   "ISO C++17 does not allow incrementing expression of type bool">,
6900   DefaultError, InGroup<IncrementBool>;
6901 def err_increment_decrement_enum : Error<
6902   "cannot %select{decrement|increment}0 expression of enum type %1">;
6903
6904 def warn_deprecated_increment_decrement_volatile : Warning<
6905   "%select{decrement|increment}0 of object of volatile-qualified type %1 "
6906   "is deprecated">, InGroup<DeprecatedVolatile>;
6907 def warn_deprecated_simple_assign_volatile : Warning<
6908   "use of result of assignment to object of volatile-qualified type %0 "
6909   "is deprecated">, InGroup<DeprecatedVolatile>;
6910 def warn_deprecated_compound_assign_volatile : Warning<
6911   "compound assignment to object of volatile-qualified type %0 is deprecated">,
6912   InGroup<DeprecatedVolatile>;
6913 def warn_deprecated_volatile_return : Warning<
6914   "volatile-qualified return type %0 is deprecated">,
6915   InGroup<DeprecatedVolatile>;
6916 def warn_deprecated_volatile_param : Warning<
6917   "volatile-qualified parameter type %0 is deprecated">,
6918   InGroup<DeprecatedVolatile>;
6919 def warn_deprecated_volatile_structured_binding : Warning<
6920   "volatile qualifier in structured binding declaration is deprecated">,
6921   InGroup<DeprecatedVolatile>;
6922
6923 def err_catch_incomplete_ptr : Error<
6924   "cannot catch pointer to incomplete type %0">;
6925 def err_catch_incomplete_ref : Error<
6926   "cannot catch reference to incomplete type %0">;
6927 def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
6928 def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
6929 def err_catch_variably_modified : Error<
6930   "cannot catch variably modified type %0">;
6931 def err_qualified_catch_declarator : Error<
6932   "exception declarator cannot be qualified">;
6933 def err_early_catch_all : Error<"catch-all handler must come last">;
6934 def err_bad_memptr_rhs : Error<
6935   "right hand operand to %0 has non-pointer-to-member type %1">;
6936 def err_bad_memptr_lhs : Error<
6937   "left hand operand to %0 must be a %select{|pointer to }1class "
6938   "compatible with the right hand operand, but is %2">;
6939 def err_memptr_incomplete : Error<
6940   "member pointer has incomplete base type %0">;
6941 def warn_exception_caught_by_earlier_handler : Warning<
6942   "exception of type %0 will be caught by earlier handler">,
6943   InGroup<Exceptions>;
6944 def note_previous_exception_handler : Note<"for type %0">;
6945 def err_exceptions_disabled : Error<
6946   "cannot use '%0' with exceptions disabled">;
6947 def err_objc_exceptions_disabled : Error<
6948   "cannot use '%0' with Objective-C exceptions disabled">;
6949 def warn_throw_in_noexcept_func : Warning<
6950   "%0 has a non-throwing exception specification but can still throw">,
6951   InGroup<Exceptions>;
6952 def note_throw_in_dtor : Note<
6953   "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
6954   "non-throwing}1 exception specification">;
6955 def note_throw_in_function : Note<"function declared non-throwing here">;
6956 def err_seh_try_outside_functions : Error<
6957   "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
6958 def err_mixing_cxx_try_seh_try : Error<
6959   "cannot use C++ 'try' in the same function as SEH '__try'">;
6960 def err_seh_try_unsupported : Error<
6961   "SEH '__try' is not supported on this target">;
6962 def note_conflicting_try_here : Note<
6963   "conflicting %0 here">;
6964 def warn_jump_out_of_seh_finally : Warning<
6965   "jump out of __finally block has undefined behavior">,
6966   InGroup<DiagGroup<"jump-seh-finally">>;
6967 def warn_non_virtual_dtor : Warning<
6968   "%0 has virtual functions but non-virtual destructor">,
6969   InGroup<NonVirtualDtor>, DefaultIgnore;
6970 def warn_delete_non_virtual_dtor : Warning<
6971   "%select{delete|destructor}0 called on non-final %1 that has "
6972   "virtual functions but non-virtual destructor">,
6973   InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
6974 def note_delete_non_virtual : Note<
6975   "qualify call to silence this warning">;
6976 def warn_delete_abstract_non_virtual_dtor : Warning<
6977   "%select{delete|destructor}0 called on %1 that is abstract but has "
6978   "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
6979 def warn_overloaded_virtual : Warning<
6980   "%q0 hides overloaded virtual %select{function|functions}1">,
6981   InGroup<OverloadedVirtual>, DefaultIgnore;
6982 def note_hidden_overloaded_virtual_declared_here : Note<
6983   "hidden overloaded virtual function %q0 declared here"
6984   "%select{|: different classes%diff{ ($ vs $)|}2,3"
6985   "|: different number of parameters (%2 vs %3)"
6986   "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
6987   "|: different return type%diff{ ($ vs $)|}2,3"
6988   "|: different qualifiers (%2 vs %3)"
6989   "|: different exception specifications}1">;
6990 def warn_using_directive_in_header : Warning<
6991   "using namespace directive in global context in header">,
6992   InGroup<HeaderHygiene>, DefaultIgnore;
6993 def warn_overaligned_type : Warning<
6994   "type %0 requires %1 bytes of alignment and the default allocator only "
6995   "guarantees %2 bytes">,
6996   InGroup<OveralignedType>, DefaultIgnore;
6997 def err_aligned_allocation_unavailable : Error<
6998   "aligned %select{allocation|deallocation}0 function of type '%1' is only "
6999   "available on %2 %3 or newer">;
7000 def note_silence_aligned_allocation_unavailable : Note<
7001   "if you supply your own aligned allocation functions, use "
7002   "-faligned-allocation to silence this diagnostic">;
7003
7004 def err_conditional_void_nonvoid : Error<
7005   "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7006   "is of type %0">;
7007 def err_conditional_ambiguous : Error<
7008   "conditional expression is ambiguous; "
7009   "%diff{$ can be converted to $ and vice versa|"
7010   "types can be convert to each other}0,1">;
7011 def err_conditional_ambiguous_ovl : Error<
7012   "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7013   "can be converted to several common types">;
7014 def err_conditional_vector_size : Error<
7015   "vector condition type %0 and result type %1 do not have the same number "
7016   "of elements">;
7017 def err_conditional_vector_element_size : Error<
7018   "vector condition type %0 and result type %1 do not have elements of the "
7019   "same size">;
7020 def err_conditional_vector_has_void : Error<
7021   "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7022 def err_conditional_vector_operand_type
7023     : Error<"%select{enumeration|extended vector}0 type %1 is not allowed in a "
7024             "vector conditional">;
7025 def err_conditional_vector_mismatched_vectors
7026     : Error<"vector operands to the vector conditional must be the same type "
7027             "%diff{($ and $)|}0,1}">;
7028
7029 def err_throw_incomplete : Error<
7030   "cannot throw object of incomplete type %0">;
7031 def err_throw_incomplete_ptr : Error<
7032   "cannot throw pointer to object of incomplete type %0">;
7033 def warn_throw_underaligned_obj : Warning<
7034   "underaligned exception object thrown">,
7035   InGroup<UnderalignedExceptionObject>;
7036 def note_throw_underaligned_obj : Note<
7037   "required alignment of type %0 (%1 bytes) is larger than the supported "
7038   "alignment of C++ exception objects on this target (%2 bytes)">;
7039 def err_return_in_constructor_handler : Error<
7040   "return in the catch of a function try block of a constructor is illegal">;
7041 def warn_cdtor_function_try_handler_mem_expr : Warning<
7042   "cannot refer to a non-static member from the handler of a "
7043   "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7044
7045 let CategoryName = "Lambda Issue" in {
7046   def err_capture_more_than_once : Error<
7047     "%0 can appear only once in a capture list">;
7048   def err_reference_capture_with_reference_default : Error<
7049     "'&' cannot precede a capture when the capture default is '&'">;
7050   def err_copy_capture_with_copy_default : Error<
7051     "'&' must precede a capture when the capture default is '='">;
7052   def err_capture_does_not_name_variable : Error<
7053     "%0 in capture list does not name a variable">;
7054   def err_capture_non_automatic_variable : Error<
7055     "%0 cannot be captured because it does not have automatic storage "
7056     "duration">;
7057   def err_this_capture : Error<
7058     "'this' cannot be %select{implicitly |}0captured in this context">;
7059   def err_lambda_capture_anonymous_var : Error<
7060     "unnamed variable cannot be implicitly captured in a lambda expression">;
7061   def err_lambda_capture_flexarray_type : Error<
7062     "variable %0 with flexible array member cannot be captured in "
7063     "a lambda expression">;
7064   def err_lambda_impcap : Error<
7065     "variable %0 cannot be implicitly captured in a lambda with no "
7066     "capture-default specified">;
7067   def note_lambda_decl : Note<"lambda expression begins here">;
7068   def err_lambda_unevaluated_operand : Error<
7069     "lambda expression in an unevaluated operand">;
7070   def err_lambda_in_constant_expression : Error<
7071     "a lambda expression may not appear inside of a constant expression">;
7072   def err_lambda_in_invalid_context : Error<
7073     "a lambda expression cannot appear in this context">;
7074   def err_lambda_return_init_list : Error<
7075     "cannot deduce lambda return type from initializer list">;
7076   def err_lambda_capture_default_arg : Error<
7077     "lambda expression in default argument cannot capture any entity">;
7078   def err_lambda_incomplete_result : Error<
7079     "incomplete result type %0 in lambda expression">;
7080   def err_noreturn_lambda_has_return_expr : Error<
7081     "lambda declared 'noreturn' should not return">;
7082   def warn_maybe_falloff_nonvoid_lambda : Warning<
7083     "non-void lambda does not return a value in all control paths">,
7084     InGroup<ReturnType>;
7085   def warn_falloff_nonvoid_lambda : Warning<
7086     "non-void lambda does not return a value">,
7087     InGroup<ReturnType>;
7088   def err_access_lambda_capture : Error<
7089     // The ERRORs represent other special members that aren't constructors, in
7090     // hopes that someone will bother noticing and reporting if they appear
7091     "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7092     "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7093     AccessControl;
7094   def note_lambda_to_block_conv : Note<
7095     "implicit capture of lambda object due to conversion to block pointer "
7096     "here">;
7097   def note_var_explicitly_captured_here : Note<"variable %0 is"
7098     "%select{| explicitly}1 captured here">;
7099
7100   // C++14 lambda init-captures.
7101   def warn_cxx11_compat_init_capture : Warning<
7102     "initialized lambda captures are incompatible with C++ standards "
7103     "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7104   def ext_init_capture : ExtWarn<
7105     "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7106   def err_init_capture_no_expression : Error<
7107     "initializer missing for lambda capture %0">;
7108   def err_init_capture_multiple_expressions : Error<
7109     "initializer for lambda capture %0 contains multiple expressions">;
7110   def err_init_capture_paren_braces : Error<
7111     "cannot deduce type for lambda capture %1 from "
7112     "%select{parenthesized|nested}0 initializer list">;
7113   def err_init_capture_deduction_failure : Error<
7114     "cannot deduce type for lambda capture %0 from initializer of type %2">;
7115   def err_init_capture_deduction_failure_from_init_list : Error<
7116     "cannot deduce type for lambda capture %0 from initializer list">;
7117   def warn_cxx17_compat_init_capture_pack : Warning<
7118     "initialized lambda capture packs are incompatible with C++ standards "
7119     "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7120   def ext_init_capture_pack : ExtWarn<
7121     "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7122
7123   // C++14 generic lambdas.
7124   def warn_cxx11_compat_generic_lambda : Warning<
7125     "generic lambdas are incompatible with C++11">,
7126     InGroup<CXXPre14Compat>, DefaultIgnore;
7127
7128   // C++17 '*this' captures.
7129   def warn_cxx14_compat_star_this_lambda_capture : Warning<
7130     "by value capture of '*this' is incompatible with C++ standards before C++17">,
7131      InGroup<CXXPre17Compat>, DefaultIgnore;
7132   def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7133     "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7134
7135   // C++17 parameter shadows capture
7136   def err_parameter_shadow_capture : Error<
7137     "a lambda parameter cannot shadow an explicitly captured entity">;
7138
7139   // C++20 [=, this] captures.
7140   def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7141     "explicit capture of 'this' with a capture default of '=' is incompatible "
7142     "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7143   def ext_equals_this_lambda_capture_cxx2a : ExtWarn<
7144     "explicit capture of 'this' with a capture default of '=' "
7145     "is a C++20 extension">, InGroup<CXX20>;
7146   def warn_deprecated_this_capture : Warning<
7147     "implicit capture of 'this' with a capture default of '=' is deprecated">,
7148     InGroup<DeprecatedThisCapture>, DefaultIgnore;
7149   def note_deprecated_this_capture : Note<
7150     "add an explicit capture of 'this' to capture '*this' by reference">;
7151
7152   // C++20 default constructible / assignable lambdas.
7153   def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7154     "%select{default construction|assignment}0 of lambda is incompatible with "
7155     "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7156 }
7157
7158 def err_return_in_captured_stmt : Error<
7159   "cannot return from %0">;
7160 def err_capture_block_variable : Error<
7161   "__block variable %0 cannot be captured in a "
7162   "%select{lambda expression|captured statement}1">;
7163
7164 def err_operator_arrow_circular : Error<
7165   "circular pointer delegation detected">;
7166 def err_operator_arrow_depth_exceeded : Error<
7167   "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7168   "'operator->' calls">;
7169 def note_operator_arrow_here : Note<
7170   "'operator->' declared here produces an object of type %0">;
7171 def note_operator_arrows_suppressed : Note<
7172   "(skipping %0 'operator->'%s0 in backtrace)">;
7173 def note_operator_arrow_depth : Note<
7174   "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7175
7176 def err_pseudo_dtor_base_not_scalar : Error<
7177   "object expression of non-scalar type %0 cannot be used in a "
7178   "pseudo-destructor expression">;
7179 def ext_pseudo_dtor_on_void : ExtWarn<
7180   "pseudo-destructors on type void are a Microsoft extension">,
7181   InGroup<MicrosoftVoidPseudoDtor>;
7182 def err_pseudo_dtor_type_mismatch : Error<
7183   "the type of object expression "
7184   "%diff{($) does not match the type being destroyed ($)|"
7185   "does not match the type being destroyed}0,1 "
7186   "in pseudo-destructor expression">;
7187 def err_pseudo_dtor_call_with_args : Error<
7188   "call to pseudo-destructor cannot have any arguments">;
7189 def err_dtor_expr_without_call : Error<
7190   "reference to %select{destructor|pseudo-destructor}0 must be called"
7191   "%select{|; did you mean to call it with no arguments?}1">;
7192 def err_pseudo_dtor_destructor_non_type : Error<
7193   "%0 does not refer to a type name in pseudo-destructor expression; expected "
7194   "the name of type %1">;
7195 def err_invalid_use_of_function_type : Error<
7196   "a function type is not allowed here">;
7197 def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7198 def err_typecheck_bool_condition : Error<
7199   "value of type %0 is not contextually convertible to 'bool'">;
7200 def err_typecheck_ambiguous_condition : Error<
7201   "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7202 def err_typecheck_nonviable_condition : Error<
7203   "no viable conversion%select{%diff{ from $ to $|}1,2|"
7204   "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7205 def err_typecheck_nonviable_condition_incomplete : Error<
7206   "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7207 def err_typecheck_deleted_function : Error<
7208   "conversion function %diff{from $ to $|between types}0,1 "
7209   "invokes a deleted function">;
7210
7211 def err_expected_class_or_namespace : Error<"%0 is not a class"
7212   "%select{ or namespace|, namespace, or enumeration}1">;
7213 def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7214   "because namespace %1 does not enclose namespace %2">;
7215 def err_invalid_declarator_global_scope : Error<
7216   "definition or redeclaration of %0 cannot name the global scope">;
7217 def err_invalid_declarator_in_function : Error<
7218   "definition or redeclaration of %0 not allowed inside a function">;
7219 def err_invalid_declarator_in_block : Error<
7220   "definition or redeclaration of %0 not allowed inside a block">;
7221 def err_not_tag_in_scope : Error<
7222   "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7223
7224 def err_no_typeid_with_fno_rtti : Error<
7225   "use of typeid requires -frtti">;
7226 def err_no_dynamic_cast_with_fno_rtti : Error<
7227   "use of dynamic_cast requires -frtti">;
7228
7229 def err_cannot_form_pointer_to_member_of_reference_type : Error<
7230   "cannot form a pointer-to-member to member %0 of reference type %1">;
7231 def err_incomplete_object_call : Error<
7232   "incomplete type in call to object of type %0">;
7233
7234 def warn_condition_is_assignment : Warning<"using the result of an "
7235   "assignment as a condition without parentheses">,
7236   InGroup<Parentheses>;
7237 // Completely identical except off by default.
7238 def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7239   "of an assignment as a condition without parentheses">,
7240   InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7241 def note_condition_assign_to_comparison : Note<
7242   "use '==' to turn this assignment into an equality comparison">;
7243 def note_condition_or_assign_to_comparison : Note<
7244   "use '!=' to turn this compound assignment into an inequality comparison">;
7245 def note_condition_assign_silence : Note<
7246   "place parentheses around the assignment to silence this warning">;
7247
7248 def warn_equality_with_extra_parens : Warning<"equality comparison with "
7249   "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7250 def note_equality_comparison_to_assign : Note<
7251   "use '=' to turn this equality comparison into an assignment">;
7252 def note_equality_comparison_silence : Note<
7253   "remove extraneous parentheses around the comparison to silence this warning">;
7254
7255 // assignment related diagnostics (also for argument passing, returning, etc).
7256 // In most of these diagnostics the %2 is a value from the
7257 // Sema::AssignmentAction enumeration
7258 def err_typecheck_convert_incompatible : Error<
7259   "%select{%diff{assigning to $ from incompatible type $|"
7260   "assigning to type from incompatible type}0,1"
7261   "|%diff{passing $ to parameter of incompatible type $|"
7262   "passing type to parameter of incompatible type}0,1"
7263   "|%diff{returning $ from a function with incompatible result type $|"
7264   "returning type from a function with incompatible result type}0,1"
7265   "|%diff{converting $ to incompatible type $|"
7266   "converting type to incompatible type}0,1"
7267   "|%diff{initializing $ with an expression of incompatible type $|"
7268   "initializing type with an expression of incompatible type}0,1"
7269   "|%diff{sending $ to parameter of incompatible type $|"
7270   "sending type to parameter of incompatible type}0,1"
7271   "|%diff{casting $ to incompatible type $|"
7272   "casting type to incompatible type}0,1}2"
7273   "%select{|; dereference with *|"
7274   "; take the address with &|"
7275   "; remove *|"
7276   "; remove &}3"
7277   "%select{|: different classes%diff{ ($ vs $)|}5,6"
7278   "|: different number of parameters (%5 vs %6)"
7279   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7280   "|: different return type%diff{ ($ vs $)|}5,6"
7281   "|: different qualifiers (%5 vs %6)"
7282   "|: different exception specifications}4">;
7283 def err_typecheck_missing_return_type_incompatible : Error<
7284   "%diff{return type $ must match previous return type $|"
7285   "return type must match previous return type}0,1 when %select{block "
7286   "literal|lambda expression}2 has unspecified explicit return type">;
7287
7288 def note_incomplete_class_and_qualified_id : Note<
7289   "conformance of forward class %0 to protocol %1 can not be confirmed">;
7290 def warn_incompatible_qualified_id : Warning<
7291   "%select{%diff{assigning to $ from incompatible type $|"
7292   "assigning to type from incompatible type}0,1"
7293   "|%diff{passing $ to parameter of incompatible type $|"
7294   "passing type to parameter of incompatible type}0,1"
7295   "|%diff{returning $ from a function with incompatible result type $|"
7296   "returning type from a function with incompatible result type}0,1"
7297   "|%diff{converting $ to incompatible type $|"
7298   "converting type to incompatible type}0,1"
7299   "|%diff{initializing $ with an expression of incompatible type $|"
7300   "initializing type with an expression of incompatible type}0,1"
7301   "|%diff{sending $ to parameter of incompatible type $|"
7302   "sending type to parameter of incompatible type}0,1"
7303   "|%diff{casting $ to incompatible type $|"
7304   "casting type to incompatible type}0,1}2">;
7305 def ext_typecheck_convert_pointer_int : ExtWarn<
7306   "incompatible pointer to integer conversion "
7307   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7308   "|%diff{passing $ to parameter of type $|"
7309   "passing to parameter of different type}0,1"
7310   "|%diff{returning $ from a function with result type $|"
7311   "returning from function with different return type}0,1"
7312   "|%diff{converting $ to type $|converting between types}0,1"
7313   "|%diff{initializing $ with an expression of type $|"
7314   "initializing with expression of different type}0,1"
7315   "|%diff{sending $ to parameter of type $|"
7316   "sending to parameter of different type}0,1"
7317   "|%diff{casting $ to type $|casting between types}0,1}2"
7318   "%select{|; dereference with *|"
7319   "; take the address with &|"
7320   "; remove *|"
7321   "; remove &}3">,
7322   InGroup<IntConversion>;
7323 def ext_typecheck_convert_int_pointer : ExtWarn<
7324   "incompatible integer to pointer conversion "
7325   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7326   "|%diff{passing $ to parameter of type $|"
7327   "passing to parameter of different type}0,1"
7328   "|%diff{returning $ from a function with result type $|"
7329   "returning from function with different return type}0,1"
7330   "|%diff{converting $ to type $|converting between types}0,1"
7331   "|%diff{initializing $ with an expression of type $|"
7332   "initializing with expression of different type}0,1"
7333   "|%diff{sending $ to parameter of type $|"
7334   "sending to parameter of different type}0,1"
7335   "|%diff{casting $ to type $|casting between types}0,1}2"
7336   "%select{|; dereference with *|"
7337   "; take the address with &|"
7338   "; remove *|"
7339   "; remove &}3">,
7340   InGroup<IntConversion>, SFINAEFailure;
7341 def ext_typecheck_convert_pointer_void_func : Extension<
7342   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7343   "|%diff{passing $ to parameter of type $|"
7344   "passing to parameter of different type}0,1"
7345   "|%diff{returning $ from a function with result type $|"
7346   "returning from function with different return type}0,1"
7347   "|%diff{converting $ to type $|converting between types}0,1"
7348   "|%diff{initializing $ with an expression of type $|"
7349   "initializing with expression of different type}0,1"
7350   "|%diff{sending $ to parameter of type $|"
7351   "sending to parameter of different type}0,1"
7352   "|%diff{casting $ to type $|casting between types}0,1}2"
7353   " converts between void pointer and function pointer">;
7354 def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
7355   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7356   "|%diff{passing $ to parameter of type $|"
7357   "passing to parameter of different type}0,1"
7358   "|%diff{returning $ from a function with result type $|"
7359   "returning from function with different return type}0,1"
7360   "|%diff{converting $ to type $|converting between types}0,1"
7361   "|%diff{initializing $ with an expression of type $|"
7362   "initializing with expression of different type}0,1"
7363   "|%diff{sending $ to parameter of type $|"
7364   "sending to parameter of different type}0,1"
7365   "|%diff{casting $ to type $|casting between types}0,1}2"
7366   " converts between pointers to integer types with different sign">,
7367   InGroup<DiagGroup<"pointer-sign">>;
7368 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
7369   "incompatible pointer types "
7370   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7371   "|%diff{passing $ to parameter of type $|"
7372   "passing to parameter of different type}0,1"
7373   "|%diff{returning $ from a function with result type $|"
7374   "returning from function with different return type}0,1"
7375   "|%diff{converting $ to type $|converting between types}0,1"
7376   "|%diff{initializing $ with an expression of type $|"
7377   "initializing with expression of different type}0,1"
7378   "|%diff{sending $ to parameter of type $|"
7379   "sending to parameter of different type}0,1"
7380   "|%diff{casting $ to type $|casting between types}0,1}2"
7381   "%select{|; dereference with *|"
7382   "; take the address with &|"
7383   "; remove *|"
7384   "; remove &}3">,
7385   InGroup<IncompatiblePointerTypes>;
7386 def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
7387   "incompatible function pointer types "
7388   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7389   "|%diff{passing $ to parameter of type $|"
7390   "passing to parameter of different type}0,1"
7391   "|%diff{returning $ from a function with result type $|"
7392   "returning from function with different return type}0,1"
7393   "|%diff{converting $ to type $|converting between types}0,1"
7394   "|%diff{initializing $ with an expression of type $|"
7395   "initializing with expression of different type}0,1"
7396   "|%diff{sending $ to parameter of type $|"
7397   "sending to parameter of different type}0,1"
7398   "|%diff{casting $ to type $|casting between types}0,1}2"
7399   "%select{|; dereference with *|"
7400   "; take the address with &|"
7401   "; remove *|"
7402   "; remove &}3">,
7403   InGroup<IncompatibleFunctionPointerTypes>;
7404 def ext_typecheck_convert_discards_qualifiers : ExtWarn<
7405   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7406   "|%diff{passing $ to parameter of type $|"
7407   "passing to parameter of different type}0,1"
7408   "|%diff{returning $ from a function with result type $|"
7409   "returning from function with different return type}0,1"
7410   "|%diff{converting $ to type $|converting between types}0,1"
7411   "|%diff{initializing $ with an expression of type $|"
7412   "initializing with expression of different type}0,1"
7413   "|%diff{sending $ to parameter of type $|"
7414   "sending to parameter of different type}0,1"
7415   "|%diff{casting $ to type $|casting between types}0,1}2"
7416   " discards qualifiers">,
7417   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7418 def ext_nested_pointer_qualifier_mismatch : ExtWarn<
7419   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7420   "|%diff{passing $ to parameter of type $|"
7421   "passing to parameter of different type}0,1"
7422   "|%diff{returning $ from a function with result type $|"
7423   "returning from function with different return type}0,1"
7424   "|%diff{converting $ to type $|converting between types}0,1"
7425   "|%diff{initializing $ with an expression of type $|"
7426   "initializing with expression of different type}0,1"
7427   "|%diff{sending $ to parameter of type $|"
7428   "sending to parameter of different type}0,1"
7429   "|%diff{casting $ to type $|casting between types}0,1}2"
7430   " discards qualifiers in nested pointer types">,
7431   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7432 def warn_incompatible_vectors : Warning<
7433   "incompatible vector types "
7434   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7435   "|%diff{passing $ to parameter of type $|"
7436   "passing to parameter of different type}0,1"
7437   "|%diff{returning $ from a function with result type $|"
7438   "returning from function with different return type}0,1"
7439   "|%diff{converting $ to type $|converting between types}0,1"
7440   "|%diff{initializing $ with an expression of type $|"
7441   "initializing with expression of different type}0,1"
7442   "|%diff{sending $ to parameter of type $|"
7443   "sending to parameter of different type}0,1"
7444   "|%diff{casting $ to type $|casting between types}0,1}2">,
7445   InGroup<VectorConversion>, DefaultIgnore;
7446 def err_int_to_block_pointer : Error<
7447   "invalid block pointer conversion "
7448   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7449   "|%diff{passing $ to parameter of type $|"
7450   "passing to parameter of different type}0,1"
7451   "|%diff{returning $ from a function with result type $|"
7452   "returning from function with different return type}0,1"
7453   "|%diff{converting $ to type $|converting between types}0,1"
7454   "|%diff{initializing $ with an expression of type $|"
7455   "initializing with expression of different type}0,1"
7456   "|%diff{sending $ to parameter of type $|"
7457   "sending to parameter of different type}0,1"
7458   "|%diff{casting $ to type $|casting between types}0,1}2">;
7459 def err_typecheck_convert_incompatible_block_pointer : Error<
7460   "incompatible block pointer types "
7461   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7462   "|%diff{passing $ to parameter of type $|"
7463   "passing to parameter of different type}0,1"
7464   "|%diff{returning $ from a function with result type $|"
7465   "returning from function with different return type}0,1"
7466   "|%diff{converting $ to type $|converting between types}0,1"
7467   "|%diff{initializing $ with an expression of type $|"
7468   "initializing with expression of different type}0,1"
7469   "|%diff{sending $ to parameter of type $|"
7470   "sending to parameter of different type}0,1"
7471   "|%diff{casting $ to type $|casting between types}0,1}2">;
7472 def err_typecheck_incompatible_address_space : Error<
7473   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7474   "|%diff{passing $ to parameter of type $|"
7475   "passing to parameter of different type}0,1"
7476   "|%diff{returning $ from a function with result type $|"
7477   "returning from function with different return type}0,1"
7478   "|%diff{converting $ to type $|converting between types}0,1"
7479   "|%diff{initializing $ with an expression of type $|"
7480   "initializing with expression of different type}0,1"
7481   "|%diff{sending $ to parameter of type $|"
7482   "sending to parameter of different type}0,1"
7483   "|%diff{casting $ to type $|casting between types}0,1}2"
7484   " changes address space of pointer">;
7485 def err_typecheck_incompatible_nested_address_space : Error<
7486   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7487   "|%diff{passing $ to parameter of type $|"
7488   "passing to parameter of different type}0,1"
7489   "|%diff{returning $ from a function with result type $|"
7490   "returning from function with different return type}0,1"
7491   "|%diff{converting $ to type $|converting between types}0,1"
7492   "|%diff{initializing $ with an expression of type $|"
7493   "initializing with expression of different type}0,1"
7494   "|%diff{sending $ to parameter of type $|"
7495   "sending to parameter of different type}0,1"
7496   "|%diff{casting $ to type $|casting between types}0,1}2"
7497   " changes address space of nested pointer">;
7498 def err_typecheck_incompatible_ownership : Error<
7499   "%select{%diff{assigning $ to $|assigning to different types}1,0"
7500   "|%diff{passing $ to parameter of type $|"
7501   "passing to parameter of different type}0,1"
7502   "|%diff{returning $ from a function with result type $|"
7503   "returning from function with different return type}0,1"
7504   "|%diff{converting $ to type $|converting between types}0,1"
7505   "|%diff{initializing $ with an expression of type $|"
7506   "initializing with expression of different type}0,1"
7507   "|%diff{sending $ to parameter of type $|"
7508   "sending to parameter of different type}0,1"
7509   "|%diff{casting $ to type $|casting between types}0,1}2"
7510   " changes retain/release properties of pointer">;
7511 def err_typecheck_comparison_of_distinct_blocks : Error<
7512   "comparison of distinct block types%diff{ ($ and $)|}0,1">;
7513
7514 def err_typecheck_array_not_modifiable_lvalue : Error<
7515   "array type %0 is not assignable">;
7516 def err_typecheck_non_object_not_modifiable_lvalue : Error<
7517   "non-object type %0 is not assignable">;
7518 def err_typecheck_expression_not_modifiable_lvalue : Error<
7519   "expression is not assignable">;
7520 def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
7521   "incomplete type %0 is not assignable">;
7522 def err_typecheck_lvalue_casts_not_supported : Error<
7523   "assignment to cast is illegal, lvalue casts are not supported">;
7524
7525 def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
7526   "vector is not assignable (contains duplicate components)">;
7527 def err_block_decl_ref_not_modifiable_lvalue : Error<
7528   "variable is not assignable (missing __block type specifier)">;
7529 def err_lambda_decl_ref_not_modifiable_lvalue : Error<
7530   "cannot assign to a variable captured by copy in a non-mutable lambda">;
7531 def err_typecheck_call_not_function : Error<
7532   "called object type %0 is not a function or function pointer">;
7533 def err_call_incomplete_return : Error<
7534   "calling function with incomplete return type %0">;
7535 def err_call_function_incomplete_return : Error<
7536   "calling %0 with incomplete return type %1">;
7537 def err_call_incomplete_argument : Error<
7538   "argument type %0 is incomplete">;
7539 def err_typecheck_call_too_few_args : Error<
7540   "too few %select{|||execution configuration }0arguments to "
7541   "%select{function|block|method|kernel function}0 call, "
7542   "expected %1, have %2">;
7543 def err_typecheck_call_too_few_args_one : Error<
7544   "too few %select{|||execution configuration }0arguments to "
7545   "%select{function|block|method|kernel function}0 call, "
7546   "single argument %1 was not specified">;
7547 def err_typecheck_call_too_few_args_at_least : Error<
7548   "too few %select{|||execution configuration }0arguments to "
7549   "%select{function|block|method|kernel function}0 call, "
7550   "expected at least %1, have %2">;
7551 def err_typecheck_call_too_few_args_at_least_one : Error<
7552   "too few %select{|||execution configuration }0arguments to "
7553   "%select{function|block|method|kernel function}0 call, "
7554   "at least argument %1 must be specified">;
7555 def err_typecheck_call_too_few_args_suggest : Error<
7556   "too few %select{|||execution configuration }0arguments to "
7557   "%select{function|block|method|kernel function}0 call, "
7558   "expected %1, have %2; did you mean %3?">;
7559 def err_typecheck_call_too_few_args_at_least_suggest : Error<
7560   "too few %select{|||execution configuration }0arguments to "
7561   "%select{function|block|method|kernel function}0 call, "
7562   "expected at least %1, have %2; did you mean %3?">;
7563 def err_typecheck_call_too_many_args : Error<
7564   "too many %select{|||execution configuration }0arguments to "
7565   "%select{function|block|method|kernel function}0 call, "
7566   "expected %1, have %2">;
7567 def err_typecheck_call_too_many_args_one : Error<
7568   "too many %select{|||execution configuration }0arguments to "
7569   "%select{function|block|method|kernel function}0 call, "
7570   "expected single argument %1, have %2 arguments">;
7571 def err_typecheck_call_too_many_args_at_most : Error<
7572   "too many %select{|||execution configuration }0arguments to "
7573   "%select{function|block|method|kernel function}0 call, "
7574   "expected at most %1, have %2">;
7575 def err_typecheck_call_too_many_args_at_most_one : Error<
7576   "too many %select{|||execution configuration }0arguments to "
7577   "%select{function|block|method|kernel function}0 call, "
7578   "expected at most single argument %1, have %2 arguments">;
7579 def err_typecheck_call_too_many_args_suggest : Error<
7580   "too many %select{|||execution configuration }0arguments to "
7581   "%select{function|block|method|kernel function}0 call, "
7582   "expected %1, have %2; did you mean %3?">;
7583 def err_typecheck_call_too_many_args_at_most_suggest : Error<
7584   "too many %select{|||execution configuration }0arguments to "
7585   "%select{function|block|method|kernel function}0 call, "
7586   "expected at most %1, have %2; did you mean %3?">;
7587
7588 def err_arc_typecheck_convert_incompatible_pointer : Error<
7589   "incompatible pointer types passing retainable parameter of type %0"
7590   "to a CF function expecting %1 type">;
7591
7592 def err_builtin_fn_use : Error<"builtin functions must be directly called">;
7593
7594 def warn_call_wrong_number_of_arguments : Warning<
7595   "too %select{few|many}0 arguments in call to %1">;
7596 def err_atomic_builtin_must_be_pointer : Error<
7597   "address argument to atomic builtin must be a pointer (%0 invalid)">;
7598 def err_atomic_builtin_must_be_pointer_intptr : Error<
7599   "address argument to atomic builtin must be a pointer to integer or pointer"
7600   " (%0 invalid)">;
7601 def err_atomic_builtin_cannot_be_const : Error<
7602   "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
7603 def err_atomic_builtin_must_be_pointer_intfltptr : Error<
7604   "address argument to atomic builtin must be a pointer to integer,"
7605   " floating-point or pointer (%0 invalid)">;
7606 def err_atomic_builtin_pointer_size : Error<
7607   "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
7608   "type (%0 invalid)">;
7609 def err_atomic_exclusive_builtin_pointer_size : Error<
7610   "address argument to load or store exclusive builtin must be a pointer to"
7611   " 1,2,4 or 8 byte type (%0 invalid)">;
7612 def err_atomic_op_needs_atomic : Error<
7613   "address argument to atomic operation must be a pointer to _Atomic "
7614   "type (%0 invalid)">;
7615 def err_atomic_op_needs_non_const_atomic : Error<
7616   "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
7617   "type (%1 invalid)">;
7618 def err_atomic_op_needs_non_const_pointer : Error<
7619   "address argument to atomic operation must be a pointer to non-const "
7620   "type (%0 invalid)">;
7621 def err_atomic_op_needs_trivial_copy : Error<
7622   "address argument to atomic operation must be a pointer to a "
7623   "trivially-copyable type (%0 invalid)">;
7624 def err_atomic_op_needs_atomic_int_or_ptr : Error<
7625   "address argument to atomic operation must be a pointer to %select{|atomic }0"
7626   "integer or pointer (%1 invalid)">;
7627 def err_atomic_op_needs_atomic_int : Error<
7628   "address argument to atomic operation must be a pointer to "
7629   "%select{|atomic }0integer (%1 invalid)">;
7630 def warn_atomic_op_has_invalid_memory_order : Warning<
7631   "memory order argument to atomic operation is invalid">,
7632   InGroup<DiagGroup<"atomic-memory-ordering">>;
7633 def err_atomic_op_has_invalid_synch_scope : Error<
7634   "synchronization scope argument to atomic operation is invalid">;
7635 def warn_atomic_implicit_seq_cst : Warning<
7636   "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
7637   InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
7638
7639 def err_overflow_builtin_must_be_int : Error<
7640   "operand argument to overflow builtin must be an integer (%0 invalid)">;
7641 def err_overflow_builtin_must_be_ptr_int : Error<
7642   "result argument to overflow builtin must be a pointer "
7643   "to a non-const integer (%0 invalid)">;
7644
7645 def err_atomic_load_store_uses_lib : Error<
7646   "atomic %select{load|store}0 requires runtime support that is not "
7647   "available for this target">;
7648
7649 def err_nontemporal_builtin_must_be_pointer : Error<
7650   "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
7651 def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
7652   "address argument to nontemporal builtin must be a pointer to integer, float, "
7653   "pointer, or a vector of such types (%0 invalid)">;
7654
7655 def err_deleted_function_use : Error<"attempt to use a deleted function">;
7656 def err_deleted_inherited_ctor_use : Error<
7657   "constructor inherited by %0 from base class %1 is implicitly deleted">;
7658
7659 def note_called_by : Note<"called by %0">;
7660 def err_kern_type_not_void_return : Error<
7661   "kernel function type %0 must have void return type">;
7662 def err_kern_is_nonstatic_method : Error<
7663   "kernel function %0 must be a free function or static member function">;
7664 def err_config_scalar_return : Error<
7665   "CUDA special function '%0' must have scalar return type">;
7666 def err_kern_call_not_global_function : Error<
7667   "kernel call to non-global function %0">;
7668 def err_global_call_not_config : Error<
7669   "call to global function %0 not configured">;
7670 def err_ref_bad_target : Error<
7671   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7672   "function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
7673 def err_ref_bad_target_global_initializer : Error<
7674   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7675   "function %1 in global initializer">;
7676 def warn_kern_is_method : Extension<
7677   "kernel function %0 is a member function; this may not be accepted by nvcc">,
7678   InGroup<CudaCompat>;
7679 def warn_kern_is_inline : Warning<
7680   "ignored 'inline' attribute on kernel function %0">,
7681   InGroup<CudaCompat>;
7682 def err_variadic_device_fn : Error<
7683   "CUDA device code does not support variadic functions">;
7684 def err_va_arg_in_device : Error<
7685   "CUDA device code does not support va_arg">;
7686 def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
7687 def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
7688   "constexpr function %0 without __host__ or __device__ attributes cannot "
7689   "overload __device__ function with same signature.  Add a __host__ "
7690   "attribute, or build with -fno-cuda-host-device-constexpr.">;
7691 def note_cuda_conflicting_device_function_declared_here : Note<
7692   "conflicting __device__ function declared here">;
7693 def err_cuda_device_exceptions : Error<
7694   "cannot use '%0' in "
7695   "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
7696 def err_dynamic_var_init : Error<
7697     "dynamic initialization is not supported for "
7698     "__device__, __constant__, and __shared__ variables.">;
7699 def err_shared_var_init : Error<
7700     "initialization is not supported for __shared__ variables.">;
7701 def err_device_static_local_var : Error<
7702     "within a %select{__device__|__global__|__host__|__host__ __device__}0 "
7703     "function, only __shared__ variables or const variables without device "
7704     "memory qualifier may be marked 'static'">;
7705 def err_cuda_vla : Error<
7706     "cannot use variable-length arrays in "
7707     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7708 def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
7709 def err_cuda_host_shared : Error<
7710     "__shared__ local variables not allowed in "
7711     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7712 def err_cuda_nonglobal_constant : Error<"__constant__ variables must be global">;
7713 def err_cuda_ovl_target : Error<
7714   "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
7715   "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
7716 def note_cuda_ovl_candidate_target_mismatch : Note<
7717     "candidate template ignored: target attributes do not match">;
7718
7719 def warn_non_pod_vararg_with_format_string : Warning<
7720   "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
7721   "%select{function|block|method|constructor}2; expected type from format "
7722   "string was %3">, InGroup<NonPODVarargs>, DefaultError;
7723 // The arguments to this diagnostic should match the warning above.
7724 def err_cannot_pass_objc_interface_to_vararg_format : Error<
7725   "cannot pass object with interface type %1 by value to variadic "
7726   "%select{function|block|method|constructor}2; expected type from format "
7727   "string was %3">;
7728 def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
7729   "cannot pass non-trivial C object of type %0 by value to variadic "
7730   "%select{function|block|method|constructor}1">;
7731
7732
7733 def err_cannot_pass_objc_interface_to_vararg : Error<
7734   "cannot pass object with interface type %0 by value through variadic "
7735   "%select{function|block|method|constructor}1">;
7736 def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
7737   "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
7738   " %select{function|block|method|constructor}2; call will abort at runtime">,
7739   InGroup<NonPODVarargs>, DefaultError;
7740 def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
7741   "passing object of trivial but non-POD type %0 through variadic"
7742   " %select{function|block|method|constructor}1 is incompatible with C++98">,
7743   InGroup<CXX98Compat>, DefaultIgnore;
7744 def warn_pass_class_arg_to_vararg : Warning<
7745   "passing object of class type %0 through variadic "
7746   "%select{function|block|method|constructor}1"
7747   "%select{|; did you mean to call '%3'?}2">,
7748   InGroup<ClassVarargs>, DefaultIgnore;
7749 def err_cannot_pass_to_vararg : Error<
7750   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7751   "%select{function|block|method|constructor}2">;
7752 def err_cannot_pass_to_vararg_format : Error<
7753   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7754   "%select{function|block|method|constructor}2; expected type from format "
7755   "string was %3">;
7756
7757 def err_typecheck_call_invalid_ordered_compare : Error<
7758   "ordered compare requires two args of floating point type"
7759   "%diff{ ($ and $)|}0,1">;
7760 def err_typecheck_call_invalid_unary_fp : Error<
7761   "floating point classification requires argument of floating point type "
7762   "(passed in %0)">;
7763 def err_typecheck_cond_expect_int_float : Error<
7764   "used type %0 where integer or floating point type is required">;
7765 def err_typecheck_cond_expect_scalar : Error<
7766   "used type %0 where arithmetic or pointer type is required">;
7767 def err_typecheck_cond_expect_nonfloat : Error<
7768   "used type %0 where floating point type is not allowed">;
7769 def ext_typecheck_cond_one_void : Extension<
7770   "C99 forbids conditional expressions with only one void side">;
7771 def err_typecheck_cast_to_incomplete : Error<
7772   "cast to incomplete type %0">;
7773 def ext_typecheck_cast_nonscalar : Extension<
7774   "C99 forbids casting nonscalar type %0 to the same type">;
7775 def ext_typecheck_cast_to_union : Extension<
7776   "cast to union type is a GNU extension">,
7777   InGroup<GNUUnionCast>;
7778 def err_typecheck_cast_to_union_no_type : Error<
7779   "cast to union type from type %0 not present in union">;
7780 def err_cast_pointer_from_non_pointer_int : Error<
7781   "operand of type %0 cannot be cast to a pointer type">;
7782 def warn_cast_pointer_from_sel : Warning<
7783   "cast of type %0 to %1 is deprecated; use sel_getName instead">,
7784   InGroup<SelTypeCast>;
7785 def warn_function_def_in_objc_container : Warning<
7786   "function definition inside an Objective-C container is deprecated">,
7787   InGroup<FunctionDefInObjCContainer>;
7788
7789 def warn_cast_calling_conv : Warning<
7790   "cast between incompatible calling conventions '%0' and '%1'; "
7791   "calls through this pointer may abort at runtime">,
7792   InGroup<DiagGroup<"cast-calling-convention">>;
7793 def note_change_calling_conv_fixit : Note<
7794   "consider defining %0 with the '%1' calling convention">;
7795 def warn_bad_function_cast : Warning<
7796   "cast from function call of type %0 to non-matching type %1">,
7797   InGroup<BadFunctionCast>, DefaultIgnore;
7798 def err_cast_pointer_to_non_pointer_int : Error<
7799   "pointer cannot be cast to type %0">;
7800 def err_typecheck_expect_scalar_operand : Error<
7801   "operand of type %0 where arithmetic or pointer type is required">;
7802 def err_typecheck_cond_incompatible_operands : Error<
7803   "incompatible operand types%diff{ ($ and $)|}0,1">;
7804 def err_cast_selector_expr : Error<
7805   "cannot type cast @selector expression">;
7806 def ext_typecheck_cond_incompatible_pointers : ExtWarn<
7807   "pointer type mismatch%diff{ ($ and $)|}0,1">,
7808   InGroup<DiagGroup<"pointer-type-mismatch">>;
7809 def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
7810   "pointer/integer type mismatch in conditional expression"
7811   "%diff{ ($ and $)|}0,1">,
7812   InGroup<DiagGroup<"conditional-type-mismatch">>;
7813 def err_typecheck_choose_expr_requires_constant : Error<
7814   "'__builtin_choose_expr' requires a constant expression">;
7815 def warn_unused_expr : Warning<"expression result unused">,
7816   InGroup<UnusedValue>;
7817 def warn_unused_voidptr : Warning<
7818   "expression result unused; should this cast be to 'void'?">,
7819   InGroup<UnusedValue>;
7820 def warn_unused_property_expr : Warning<
7821  "property access result unused - getters should not be used for side effects">,
7822   InGroup<UnusedGetterReturnValue>;
7823 def warn_unused_container_subscript_expr : Warning<
7824  "container access result unused - container access should not be used for side effects">,
7825   InGroup<UnusedValue>;
7826 def warn_unused_call : Warning<
7827   "ignoring return value of function declared with %0 attribute">,
7828   InGroup<UnusedValue>;
7829 def warn_unused_constructor : Warning<
7830   "ignoring temporary created by a constructor declared with %0 attribute">,
7831   InGroup<UnusedValue>;
7832 def warn_unused_constructor_msg : Warning<
7833   "ignoring temporary created by a constructor declared with %0 attribute: %1">,
7834   InGroup<UnusedValue>;
7835 def warn_side_effects_unevaluated_context : Warning<
7836   "expression with side effects has no effect in an unevaluated context">,
7837   InGroup<UnevaluatedExpression>;
7838 def warn_side_effects_typeid : Warning<
7839   "expression with side effects will be evaluated despite being used as an "
7840   "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
7841 def warn_unused_result : Warning<
7842   "ignoring return value of function declared with %0 attribute">,
7843   InGroup<UnusedResult>;
7844 def warn_unused_result_msg : Warning<
7845   "ignoring return value of function declared with %0 attribute: %1">,
7846   InGroup<UnusedResult>;
7847 def warn_unused_volatile : Warning<
7848   "expression result unused; assign into a variable to force a volatile load">,
7849   InGroup<DiagGroup<"unused-volatile-lvalue">>;
7850
7851 def ext_cxx14_attr : Extension<
7852   "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
7853 def ext_cxx17_attr : Extension<
7854   "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
7855 def ext_cxx2a_attr : Extension<
7856   "use of the %0 attribute is a C++20 extension">, InGroup<CXX20>;
7857
7858 def warn_unused_comparison : Warning<
7859   "%select{equality|inequality|relational|three-way}0 comparison result unused">,
7860   InGroup<UnusedComparison>;
7861 def note_inequality_comparison_to_or_assign : Note<
7862   "use '|=' to turn this inequality comparison into an or-assignment">;
7863
7864 def err_incomplete_type_used_in_type_trait_expr : Error<
7865   "incomplete type %0 used in type trait expression">;
7866
7867 // C++20 constinit and require_constant_initialization attribute
7868 def warn_cxx20_compat_constinit : Warning<
7869   "'constinit' specifier is incompatible with C++ standards before C++20">,
7870   InGroup<CXX20Compat>, DefaultIgnore;
7871 def err_constinit_local_variable : Error<
7872   "local variable cannot be declared 'constinit'">;
7873 def err_require_constant_init_failed : Error<
7874   "variable does not have a constant initializer">;
7875 def note_declared_required_constant_init_here : Note<
7876   "required by %select{'require_constant_initialization' attribute|"
7877   "'constinit' specifier}0 here">;
7878 def ext_constinit_missing : ExtWarn<
7879   "'constinit' specifier missing on initializing declaration of %0">,
7880   InGroup<DiagGroup<"missing-constinit">>;
7881 def note_constinit_specified_here : Note<"variable declared constinit here">;
7882 def err_constinit_added_too_late : Error<
7883   "'constinit' specifier added after initialization of variable">;
7884 def warn_require_const_init_added_too_late : Warning<
7885   "'require_constant_initialization' attribute added after initialization "
7886   "of variable">, InGroup<IgnoredAttributes>;
7887 def note_constinit_missing_here : Note<
7888   "add the "
7889   "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
7890   "to the initializing declaration here">;
7891
7892 def err_dimension_expr_not_constant_integer : Error<
7893   "dimension expression does not evaluate to a constant unsigned int">;
7894
7895 def err_typecheck_cond_incompatible_operands_null : Error<
7896   "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
7897 def ext_empty_struct_union : Extension<
7898   "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
7899 def ext_no_named_members_in_struct_union : Extension<
7900   "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
7901 def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
7902   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7903   InGroup<CXXCompat>, DefaultIgnore;
7904 def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
7905   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7906   InGroup<ExternCCompat>;
7907 def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
7908   "volatile qualifiers|const qualifier|volatile qualifier}2">,
7909   InGroup<CastQual>, DefaultIgnore;
7910 def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
7911   "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
7912 def warn_redefine_extname_not_applied : Warning<
7913   "#pragma redefine_extname is applicable to external C declarations only; "
7914   "not applied to %select{function|variable}0 %1">,
7915   InGroup<Pragmas>;
7916 } // End of general sema category.
7917
7918 // inline asm.
7919 let CategoryName = "Inline Assembly Issue" in {
7920   def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
7921   def err_asm_invalid_output_constraint : Error<
7922     "invalid output constraint '%0' in asm">;
7923   def err_asm_invalid_lvalue_in_input : Error<
7924     "invalid lvalue in asm input for constraint '%0'">;
7925   def err_asm_invalid_input_constraint : Error<
7926     "invalid input constraint '%0' in asm">;
7927   def err_asm_tying_incompatible_types : Error<
7928     "unsupported inline asm: input with type "
7929     "%diff{$ matching output with type $|}0,1">;
7930   def err_asm_unexpected_constraint_alternatives : Error<
7931     "asm constraint has an unexpected number of alternatives: %0 vs %1">;
7932   def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
7933   def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
7934   def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
7935     "global register variables on this target">;
7936   def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
7937     "match variable size">;
7938   def err_asm_bad_register_type : Error<"bad type for named register variable">;
7939   def err_asm_invalid_input_size : Error<
7940     "invalid input size for constraint '%0'">;
7941   def err_asm_invalid_output_size : Error<
7942     "invalid output size for constraint '%0'">;
7943   def err_invalid_asm_cast_lvalue : Error<
7944     "invalid use of a cast in a inline asm context requiring an l-value: "
7945     "remove the cast or build with -fheinous-gnu-extensions">;
7946   def err_invalid_asm_value_for_constraint
7947       : Error <"value '%0' out of range for constraint '%1'">;
7948   def err_asm_non_addr_value_in_memory_constraint : Error <
7949     "reference to a %select{bit-field|vector element|global register variable}0"
7950     " in asm %select{input|output}1 with a memory constraint '%2'">;
7951   def err_asm_input_duplicate_match : Error<
7952     "more than one input constraint matches the same output '%0'">;
7953
7954   def warn_asm_label_on_auto_decl : Warning<
7955     "ignored asm label '%0' on automatic variable">;
7956   def warn_invalid_asm_cast_lvalue : Warning<
7957     "invalid use of a cast in an inline asm context requiring an l-value: "
7958     "accepted due to -fheinous-gnu-extensions, but clang may remove support "
7959     "for this in the future">;
7960   def warn_asm_mismatched_size_modifier : Warning<
7961     "value size does not match register size specified by the constraint "
7962     "and modifier">,
7963     InGroup<ASMOperandWidths>;
7964
7965   def note_asm_missing_constraint_modifier : Note<
7966     "use constraint modifier \"%0\"">;
7967   def note_asm_input_duplicate_first : Note<
7968     "constraint '%0' is already present here">;
7969  def error_duplicate_asm_operand_name : Error<
7970     "duplicate use of asm operand name \"%0\"">;
7971  def note_duplicate_asm_operand_name : Note<
7972     "asm operand name \"%0\" first referenced here">;
7973 }
7974
7975   def error_inoutput_conflict_with_clobber : Error<
7976     "asm-specifier for input or output variable conflicts with asm"
7977     " clobber list">;
7978
7979 let CategoryName = "Semantic Issue" in {
7980
7981 def err_invalid_conversion_between_vectors : Error<
7982   "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
7983   "size">;
7984 def err_invalid_conversion_between_vector_and_integer : Error<
7985   "invalid conversion between vector type %0 and integer type %1 "
7986   "of different size">;
7987
7988 def err_opencl_function_pointer : Error<
7989   "pointers to functions are not allowed">;
7990
7991 def err_opencl_taking_address_capture : Error<
7992   "taking address of a capture is not allowed">;
7993
7994 def err_invalid_conversion_between_vector_and_scalar : Error<
7995   "invalid conversion between vector type %0 and scalar type %1">;
7996
7997 // C++ member initializers.
7998 def err_only_constructors_take_base_inits : Error<
7999   "only constructors take base initializers">;
8000
8001 def err_multiple_mem_initialization : Error <
8002   "multiple initializations given for non-static member %0">;
8003 def err_multiple_mem_union_initialization : Error <
8004   "initializing multiple members of union">;
8005 def err_multiple_base_initialization : Error <
8006   "multiple initializations given for base %0">;
8007
8008 def err_mem_init_not_member_or_class : Error<
8009   "member initializer %0 does not name a non-static data member or base "
8010   "class">;
8011
8012 def warn_initializer_out_of_order : Warning<
8013   "%select{field|base class}0 %1 will be initialized after "
8014   "%select{field|base}2 %3">,
8015   InGroup<ReorderCtor>, DefaultIgnore;
8016 def warn_abstract_vbase_init_ignored : Warning<
8017   "initializer for virtual base class %0 of abstract class %1 "
8018   "will never be used">,
8019   InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8020
8021 def err_base_init_does_not_name_class : Error<
8022   "constructor initializer %0 does not name a class">;
8023 def err_base_init_direct_and_virtual : Error<
8024   "base class initializer %0 names both a direct base class and an "
8025   "inherited virtual base class">;
8026 def err_not_direct_base_or_virtual : Error<
8027   "type %0 is not a direct or virtual base of %1">;
8028
8029 def err_in_class_initializer_non_const : Error<
8030   "non-const static data member must be initialized out of line">;
8031 def err_in_class_initializer_volatile : Error<
8032   "static const volatile data member must be initialized out of line">;
8033 def err_in_class_initializer_bad_type : Error<
8034   "static data member of type %0 must be initialized out of line">;
8035 def ext_in_class_initializer_float_type : ExtWarn<
8036   "in-class initializer for static data member of type %0 is a GNU extension">,
8037   InGroup<GNUStaticFloatInit>;
8038 def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8039   "in-class initializer for static data member of type %0 requires "
8040   "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8041 def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8042 def err_in_class_initializer_literal_type : Error<
8043   "in-class initializer for static data member of type %0 requires "
8044   "'constexpr' specifier">;
8045 def err_in_class_initializer_non_constant : Error<
8046   "in-class initializer for static data member is not a constant expression">;
8047 def err_in_class_initializer_not_yet_parsed : Error<
8048   "default member initializer for %1 needed within definition of enclosing "
8049   "class %0 outside of member functions">;
8050 def note_in_class_initializer_not_yet_parsed : Note<
8051   "default member initializer declared here">;
8052 def err_in_class_initializer_cycle
8053     : Error<"default member initializer for %0 uses itself">;
8054
8055 def ext_in_class_initializer_non_constant : Extension<
8056   "in-class initializer for static data member is not a constant expression; "
8057   "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8058
8059 def err_thread_dynamic_init : Error<
8060   "initializer for thread-local variable must be a constant expression">;
8061 def err_thread_nontrivial_dtor : Error<
8062   "type of thread-local variable has non-trivial destruction">;
8063 def note_use_thread_local : Note<
8064   "use 'thread_local' to allow this">;
8065
8066 // C++ anonymous unions and GNU anonymous structs/unions
8067 def ext_anonymous_union : Extension<
8068   "anonymous unions are a C11 extension">, InGroup<C11>;
8069 def ext_gnu_anonymous_struct : Extension<
8070   "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8071 def ext_c11_anonymous_struct : Extension<
8072   "anonymous structs are a C11 extension">, InGroup<C11>;
8073 def err_anonymous_union_not_static : Error<
8074   "anonymous unions at namespace or global scope must be declared 'static'">;
8075 def err_anonymous_union_with_storage_spec : Error<
8076   "anonymous union at class scope must not have a storage specifier">;
8077 def err_anonymous_struct_not_member : Error<
8078   "anonymous %select{structs|structs and classes}0 must be "
8079   "%select{struct or union|class}0 members">;
8080 def err_anonymous_record_member_redecl : Error<
8081   "member of anonymous %select{struct|union}0 redeclares %1">;
8082 def err_anonymous_record_with_type : Error<
8083   "types cannot be declared in an anonymous %select{struct|union}0">;
8084 def ext_anonymous_record_with_type : Extension<
8085   "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8086   "extension">, InGroup<MicrosoftAnonTag>;
8087 def ext_anonymous_record_with_anonymous_type : Extension<
8088   "anonymous types declared in an anonymous %select{struct|union}0 "
8089   "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8090 def err_anonymous_record_with_function : Error<
8091   "functions cannot be declared in an anonymous %select{struct|union}0">;
8092 def err_anonymous_record_with_static : Error<
8093   "static members cannot be declared in an anonymous %select{struct|union}0">;
8094 def err_anonymous_record_bad_member : Error<
8095   "anonymous %select{struct|union}0 can only contain non-static data members">;
8096 def err_anonymous_record_nonpublic_member : Error<
8097   "anonymous %select{struct|union}0 cannot contain a "
8098   "%select{private|protected}1 data member">;
8099 def ext_ms_anonymous_record : ExtWarn<
8100   "anonymous %select{structs|unions}0 are a Microsoft extension">,
8101   InGroup<MicrosoftAnonTag>;
8102
8103 // C++ local classes
8104 def err_reference_to_local_in_enclosing_context : Error<
8105   "reference to local %select{variable|binding}1 %0 declared in enclosing "
8106   "%select{%3|block literal|lambda expression|context}2">;
8107
8108 def err_static_data_member_not_allowed_in_local_class : Error<
8109   "static data member %0 not allowed in local class %1">;
8110
8111 // C++ derived classes
8112 def err_base_clause_on_union : Error<"unions cannot have base classes">;
8113 def err_base_must_be_class : Error<"base specifier must name a class">;
8114 def err_union_as_base_class : Error<"unions cannot be base classes">;
8115 def err_circular_inheritance : Error<
8116   "circular inheritance between %0 and %1">;
8117 def err_base_class_has_flexible_array_member : Error<
8118   "base class %0 has a flexible array member">;
8119 def err_incomplete_base_class : Error<"base class has incomplete type">;
8120 def err_duplicate_base_class : Error<
8121   "base class %0 specified more than once as a direct base class">;
8122 def warn_inaccessible_base_class : Warning<
8123   "direct base %0 is inaccessible due to ambiguity:%1">,
8124   InGroup<DiagGroup<"inaccessible-base">>;
8125 // FIXME: better way to display derivation?  Pass entire thing into diagclient?
8126 def err_ambiguous_derived_to_base_conv : Error<
8127   "ambiguous conversion from derived class %0 to base class %1:%2">;
8128 def err_ambiguous_memptr_conv : Error<
8129   "ambiguous conversion from pointer to member of %select{base|derived}0 "
8130   "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8131 def ext_ms_ambiguous_direct_base : ExtWarn<
8132   "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8133   InGroup<MicrosoftInaccessibleBase>;
8134
8135 def err_memptr_conv_via_virtual : Error<
8136   "conversion from pointer to member of class %0 to pointer to member "
8137   "of class %1 via virtual base %2 is not allowed">;
8138
8139 // C++ member name lookup
8140 def err_ambiguous_member_multiple_subobjects : Error<
8141   "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8142 def err_ambiguous_member_multiple_subobject_types : Error<
8143   "member %0 found in multiple base classes of different types">;
8144 def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8145 def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8146 def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8147 def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8148   "declaration in a different namespace">;
8149 def note_hidden_tag : Note<"type declaration hidden">;
8150 def note_hiding_object : Note<"declaration hides type">;
8151
8152 // C++ operator overloading
8153 def err_operator_overload_needs_class_or_enum : Error<
8154   "overloaded %0 must have at least one parameter of class "
8155   "or enumeration type">;
8156
8157 def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8158 def err_operator_overload_static : Error<
8159   "overloaded %0 cannot be a static member function">;
8160 def err_operator_overload_default_arg : Error<
8161   "parameter of overloaded %0 cannot have a default argument">;
8162 def err_operator_overload_must_be : Error<
8163   "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8164   "(has %1 parameter%s1)">;
8165
8166 def err_operator_overload_must_be_member : Error<
8167   "overloaded %0 must be a non-static member function">;
8168 def err_operator_overload_post_incdec_must_be_int : Error<
8169   "parameter of overloaded post-%select{increment|decrement}1 operator must "
8170   "have type 'int' (not %0)">;
8171
8172 // C++ allocation and deallocation functions.
8173 def err_operator_new_delete_declared_in_namespace : Error<
8174   "%0 cannot be declared inside a namespace">;
8175 def err_operator_new_delete_declared_static : Error<
8176   "%0 cannot be declared static in global scope">;
8177 def ext_operator_new_delete_declared_inline : ExtWarn<
8178   "replacement function %0 cannot be declared 'inline'">,
8179   InGroup<DiagGroup<"inline-new-delete">>;
8180 def err_operator_new_delete_invalid_result_type : Error<
8181   "%0 must return type %1">;
8182 def err_operator_new_delete_dependent_result_type : Error<
8183   "%0 cannot have a dependent return type; use %1 instead">;
8184 def err_operator_new_delete_too_few_parameters : Error<
8185   "%0 must have at least one parameter">;
8186 def err_operator_new_delete_template_too_few_parameters : Error<
8187   "%0 template must have at least two parameters">;
8188 def warn_operator_new_returns_null : Warning<
8189   "%0 should not return a null pointer unless it is declared 'throw()'"
8190   "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
8191
8192 def err_operator_new_dependent_param_type : Error<
8193   "%0 cannot take a dependent type as first parameter; "
8194   "use size_t (%1) instead">;
8195 def err_operator_new_param_type : Error<
8196   "%0 takes type size_t (%1) as first parameter">;
8197 def err_operator_new_default_arg: Error<
8198   "parameter of %0 cannot have a default argument">;
8199 def err_operator_delete_dependent_param_type : Error<
8200   "%0 cannot take a dependent type as first parameter; use %1 instead">;
8201 def err_operator_delete_param_type : Error<
8202   "first parameter of %0 must have type %1">;
8203 def err_destroying_operator_delete_not_usual : Error<
8204   "destroying operator delete can have only an optional size and optional "
8205   "alignment parameter">;
8206 def note_implicit_delete_this_in_destructor_here : Note<
8207   "while checking implicit 'delete this' for virtual destructor">;
8208 def err_builtin_operator_new_delete_not_usual : Error<
8209   "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
8210   "selects non-usual %select{allocation|deallocation}0 function">;
8211 def note_non_usual_function_declared_here : Note<
8212   "non-usual %0 declared here">;
8213
8214 // C++ literal operators
8215 def err_literal_operator_outside_namespace : Error<
8216   "literal operator %0 must be in a namespace or global scope">;
8217 def err_literal_operator_id_outside_namespace : Error<
8218   "non-namespace scope '%0' cannot have a literal operator member">;
8219 def err_literal_operator_default_argument : Error<
8220   "literal operator cannot have a default argument">;
8221 def err_literal_operator_bad_param_count : Error<
8222   "non-template literal operator must have one or two parameters">;
8223 def err_literal_operator_invalid_param : Error<
8224   "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
8225 def err_literal_operator_param : Error<
8226   "invalid literal operator parameter type %0, did you mean %1?">;
8227 def err_literal_operator_template_with_params : Error<
8228   "literal operator template cannot have any parameters">;
8229 def err_literal_operator_template : Error<
8230   "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
8231 def err_literal_operator_extern_c : Error<
8232   "literal operator must have C++ linkage">;
8233 def ext_string_literal_operator_template : ExtWarn<
8234   "string literal operator templates are a GNU extension">,
8235   InGroup<GNUStringLiteralOperatorTemplate>;
8236 def warn_user_literal_reserved : Warning<
8237   "user-defined literal suffixes not starting with '_' are reserved"
8238   "%select{; no literal will invoke this operator|}0">,
8239   InGroup<UserDefinedLiterals>;
8240
8241 // C++ conversion functions
8242 def err_conv_function_not_member : Error<
8243   "conversion function must be a non-static member function">;
8244 def err_conv_function_return_type : Error<
8245   "conversion function cannot have a return type">;
8246 def err_conv_function_with_params : Error<
8247   "conversion function cannot have any parameters">;
8248 def err_conv_function_variadic : Error<
8249   "conversion function cannot be variadic">;
8250 def err_conv_function_to_array : Error<
8251   "conversion function cannot convert to an array type">;
8252 def err_conv_function_to_function : Error<
8253   "conversion function cannot convert to a function type">;
8254 def err_conv_function_with_complex_decl : Error<
8255   "cannot specify any part of a return type in the "
8256   "declaration of a conversion function"
8257   "%select{"
8258   "; put the complete type after 'operator'|"
8259   "; use a typedef to declare a conversion to %1|"
8260   "; use an alias template to declare a conversion to %1|"
8261   "}0">;
8262 def err_conv_function_redeclared : Error<
8263   "conversion function cannot be redeclared">;
8264 def warn_conv_to_self_not_used : Warning<
8265   "conversion function converting %0 to itself will never be used">;
8266 def warn_conv_to_base_not_used : Warning<
8267   "conversion function converting %0 to its base class %1 will never be used">;
8268 def warn_conv_to_void_not_used : Warning<
8269   "conversion function converting %0 to %1 will never be used">;
8270
8271 def warn_not_compound_assign : Warning<
8272   "use of unary operator that may be intended as compound assignment (%0=)">;
8273
8274 // C++11 explicit conversion operators
8275 def ext_explicit_conversion_functions : ExtWarn<
8276   "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
8277 def warn_cxx98_compat_explicit_conversion_functions : Warning<
8278   "explicit conversion functions are incompatible with C++98">,
8279   InGroup<CXX98Compat>, DefaultIgnore;
8280
8281 // C++11 defaulted functions
8282 def err_defaulted_special_member_params : Error<
8283   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8284   "have default arguments">;
8285 def err_defaulted_special_member_variadic : Error<
8286   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8287   "be variadic">;
8288 def err_defaulted_special_member_return_type : Error<
8289   "explicitly-defaulted %select{copy|move}0 assignment operator must "
8290   "return %1">;
8291 def err_defaulted_special_member_quals : Error<
8292   "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
8293   "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
8294 def err_defaulted_special_member_volatile_param : Error<
8295   "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
8296   "may not be volatile">;
8297 def err_defaulted_special_member_move_const_param : Error<
8298   "the parameter for an explicitly-defaulted move "
8299   "%select{constructor|assignment operator}0 may not be const">;
8300 def err_defaulted_special_member_copy_const_param : Error<
8301   "the parameter for this explicitly-defaulted copy "
8302   "%select{constructor|assignment operator}0 is const, but a member or base "
8303   "requires it to be non-const">;
8304 def err_defaulted_copy_assign_not_ref : Error<
8305   "the parameter for an explicitly-defaulted copy assignment operator must be an "
8306   "lvalue reference type">;
8307 def err_incorrect_defaulted_constexpr : Error<
8308   "defaulted definition of %sub{select_special_member_kind}0 "
8309   "is not constexpr">;
8310 def err_incorrect_defaulted_consteval : Error<
8311   "defaulted declaration of %sub{select_special_member_kind}0 "
8312   "cannot be consteval because implicit definition is not constexpr">;
8313 def warn_defaulted_method_deleted : Warning<
8314   "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
8315   "deleted">, InGroup<DefaultedFunctionDeleted>;
8316 def err_out_of_line_default_deletes : Error<
8317   "defaulting this %sub{select_special_member_kind}0 "
8318   "would delete it after its first declaration">;
8319 def note_deleted_type_mismatch : Note<
8320   "function is implicitly deleted because its declared type does not match "
8321   "the type of an implicit %sub{select_special_member_kind}0">;
8322 def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
8323   "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
8324   "different from the implicit type is incompatible with C++ standards before "
8325   "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8326 def warn_vbase_moved_multiple_times : Warning<
8327   "defaulted move assignment operator of %0 will move assign virtual base "
8328   "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
8329 def note_vbase_moved_here : Note<
8330   "%select{%1 is a virtual base class of base class %2 declared here|"
8331   "virtual base class %1 declared here}0">;
8332
8333 // C++20 defaulted comparisons
8334 // This corresponds to values of Sema::DefaultedComparisonKind.
8335 def select_defaulted_comparison_kind : TextSubstitution<
8336   "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
8337   "operator">;
8338 def ext_defaulted_comparison : ExtWarn<
8339   "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
8340 def warn_cxx17_compat_defaulted_comparison : Warning<
8341   "defaulted comparison operators are incompatible with C++ standards "
8342   "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
8343 def err_defaulted_comparison_template : Error<
8344   "comparison operator template cannot be defaulted">;
8345 def err_defaulted_comparison_out_of_class : Error<
8346   "%sub{select_defaulted_comparison_kind}0 can only be defaulted in a class "
8347   "definition">;
8348 def err_defaulted_comparison_param : Error<
8349   "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
8350   "; found %1, expected %2%select{| or %4}3">;
8351 def err_defaulted_comparison_param_mismatch : Error<
8352   "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
8353   "must have the same type%diff{ (found $ vs $)|}1,2">;
8354 def err_defaulted_comparison_non_const : Error<
8355   "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
8356   "const-qualified">;
8357 def err_defaulted_comparison_return_type_not_bool : Error<
8358   "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8359   "must be 'bool', not %1">;
8360 def err_defaulted_comparison_deduced_return_type_not_auto : Error<
8361   "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
8362   "must be 'auto', not %1">;
8363 def warn_defaulted_comparison_deleted : Warning<
8364   "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
8365   "deleted">, InGroup<DefaultedFunctionDeleted>;
8366 def err_non_first_default_compare_deletes : Error<
8367   "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
8368   "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
8369   "would delete it after its first declaration">;
8370 def note_defaulted_comparison_union : Note<
8371   "defaulted %0 is implicitly deleted because "
8372   "%2 is a %select{union-like class|union}1 with variant members">;
8373 def note_defaulted_comparison_reference_member : Note<
8374   "defaulted %0 is implicitly deleted because "
8375   "class %1 has a reference member">;
8376 def note_defaulted_comparison_ambiguous : Note<
8377   "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
8378   "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
8379 def note_defaulted_comparison_inaccessible : Note<
8380   "defaulted %0 is implicitly deleted because it would invoke a "
8381   "%select{private|protected}3 %4%select{ member of %6|"
8382   " member of %6 to compare member %2| to compare base class %2}1">;
8383 def note_defaulted_comparison_calls_deleted : Note<
8384   "defaulted %0 is implicitly deleted because it would invoke a deleted "
8385   "comparison function%select{| for member %2| for base class %2}1">;
8386 def note_defaulted_comparison_no_viable_function : Note<
8387   "defaulted %0 is implicitly deleted because there is no viable comparison "
8388   "function%select{| for member %2| for base class %2}1">;
8389 def note_defaulted_comparison_no_viable_function_synthesized : Note<
8390   "three-way comparison cannot be synthesized because there is no viable "
8391   "function for %select{'=='|'<'}0 comparison">;
8392 def note_defaulted_comparison_not_rewritten_callee : Note<
8393   "defaulted %0 is implicitly deleted because this non-rewritten comparison "
8394   "function would be the best match for the comparison">;
8395 def note_defaulted_comparison_cannot_deduce : Note<
8396   "return type of defaulted 'operator<=>' cannot be deduced because "
8397   "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
8398   "is not a standard comparison category type">;
8399 def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
8400   "return type of defaulted 'operator<=>' cannot be deduced because "
8401   "three-way comparison for %select{|member|base class}0 %1 "
8402   "has a deduced return type and is not yet defined">;
8403 def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
8404   "%select{|member|base class}0 %1 declared here">;
8405 def note_defaulted_comparison_cannot_deduce_callee : Note<
8406   "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
8407 def err_incorrect_defaulted_comparison_constexpr : Error<
8408   "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
8409   "three-way comparison operator}0 "
8410   "cannot be declared %select{constexpr|consteval}2 because "
8411   "%select{it|the corresponding implicit 'operator=='}0 "
8412   "invokes a non-constexpr comparison function">;
8413 def note_defaulted_comparison_not_constexpr : Note<
8414   "non-constexpr comparison function would be used to compare "
8415   "%select{|member %1|base class %1}0">;
8416 def note_defaulted_comparison_not_constexpr_here : Note<
8417   "non-constexpr comparison function declared here">;
8418 def note_in_declaration_of_implicit_equality_comparison : Note<
8419   "while declaring the corresponding implicit 'operator==' "
8420   "for this defaulted 'operator<=>'">;
8421
8422 def ext_implicit_exception_spec_mismatch : ExtWarn<
8423   "function previously declared with an %select{explicit|implicit}0 exception "
8424   "specification redeclared with an %select{implicit|explicit}0 exception "
8425   "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
8426
8427 def warn_ptr_arith_precedes_bounds : Warning<
8428   "the pointer decremented by %0 refers before the beginning of the array">,
8429   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8430 def warn_ptr_arith_exceeds_bounds : Warning<
8431   "the pointer incremented by %0 refers past the end of the array (that "
8432   "contains %1 element%s2)">,
8433   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
8434 def warn_array_index_precedes_bounds : Warning<
8435   "array index %0 is before the beginning of the array">,
8436   InGroup<ArrayBounds>;
8437 def warn_array_index_exceeds_bounds : Warning<
8438   "array index %0 is past the end of the array (which contains %1 "
8439   "element%s2)">, InGroup<ArrayBounds>;
8440 def note_array_declared_here : Note<
8441   "array %0 declared here">;
8442
8443 def warn_printf_insufficient_data_args : Warning<
8444   "more '%%' conversions than data arguments">, InGroup<Format>;
8445 def warn_printf_data_arg_not_used : Warning<
8446   "data argument not used by format string">, InGroup<FormatExtraArgs>;
8447 def warn_format_invalid_conversion : Warning<
8448   "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
8449 def warn_printf_incomplete_specifier : Warning<
8450   "incomplete format specifier">, InGroup<Format>;
8451 def warn_missing_format_string : Warning<
8452   "format string missing">, InGroup<Format>;
8453 def warn_scanf_nonzero_width : Warning<
8454   "zero field width in scanf format string is unused">,
8455   InGroup<Format>;
8456 def warn_format_conversion_argument_type_mismatch : Warning<
8457   "format specifies type %0 but the argument has "
8458   "%select{type|underlying type}2 %1">,
8459   InGroup<Format>;
8460 def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
8461   warn_format_conversion_argument_type_mismatch.Text>,
8462   InGroup<FormatPedantic>;
8463 def warn_format_conversion_argument_type_mismatch_confusion : Warning<
8464   warn_format_conversion_argument_type_mismatch.Text>,
8465   InGroup<FormatTypeConfusion>, DefaultIgnore;
8466 def warn_format_argument_needs_cast : Warning<
8467   "%select{values of type|enum values with underlying type}2 '%0' should not "
8468   "be used as format arguments; add an explicit cast to %1 instead">,
8469   InGroup<Format>;
8470 def warn_format_argument_needs_cast_pedantic : Warning<
8471   warn_format_argument_needs_cast.Text>,
8472   InGroup<FormatPedantic>, DefaultIgnore;
8473 def warn_printf_positional_arg_exceeds_data_args : Warning <
8474   "data argument position '%0' exceeds the number of data arguments (%1)">,
8475   InGroup<Format>;
8476 def warn_format_zero_positional_specifier : Warning<
8477   "position arguments in format strings start counting at 1 (not 0)">,
8478   InGroup<Format>;
8479 def warn_format_invalid_positional_specifier : Warning<
8480   "invalid position specified for %select{field width|field precision}0">,
8481   InGroup<Format>;
8482 def warn_format_mix_positional_nonpositional_args : Warning<
8483   "cannot mix positional and non-positional arguments in format string">,
8484   InGroup<Format>;
8485 def warn_static_array_too_small : Warning<
8486   "array argument is too small; %select{contains %0 elements|is of size %0}2,"
8487   " callee requires at least %1">,
8488   InGroup<ArrayBounds>;
8489 def note_callee_static_array : Note<
8490   "callee declares array parameter as static here">;
8491 def warn_empty_format_string : Warning<
8492   "format string is empty">, InGroup<FormatZeroLength>;
8493 def warn_format_string_is_wide_literal : Warning<
8494   "format string should not be a wide string">, InGroup<Format>;
8495 def warn_printf_format_string_contains_null_char : Warning<
8496   "format string contains '\\0' within the string body">, InGroup<Format>;
8497 def warn_printf_format_string_not_null_terminated : Warning<
8498   "format string is not null-terminated">, InGroup<Format>;
8499 def warn_printf_asterisk_missing_arg : Warning<
8500   "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
8501   InGroup<Format>;
8502 def warn_printf_asterisk_wrong_type : Warning<
8503   "field %select{width|precision}0 should have type %1, but argument has type %2">,
8504   InGroup<Format>;
8505 def warn_printf_nonsensical_optional_amount: Warning<
8506   "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
8507   InGroup<Format>;
8508 def warn_printf_nonsensical_flag: Warning<
8509   "flag '%0' results in undefined behavior with '%1' conversion specifier">,
8510   InGroup<Format>;
8511 def warn_format_nonsensical_length: Warning<
8512   "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
8513   InGroup<Format>;
8514 def warn_format_non_standard_positional_arg: Warning<
8515   "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
8516 def warn_format_non_standard: Warning<
8517   "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
8518   InGroup<FormatNonStandard>, DefaultIgnore;
8519 def warn_format_non_standard_conversion_spec: Warning<
8520   "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
8521   InGroup<FormatNonStandard>, DefaultIgnore;
8522 def err_invalid_mask_type_size : Error<
8523   "mask type size must be between 1-byte and 8-bytes">;
8524 def warn_format_invalid_annotation : Warning<
8525   "using '%0' format specifier annotation outside of os_log()/os_trace()">,
8526   InGroup<Format>;
8527 def warn_format_P_no_precision : Warning<
8528   "using '%%P' format specifier without precision">,
8529   InGroup<Format>;
8530 def warn_printf_ignored_flag: Warning<
8531   "flag '%0' is ignored when flag '%1' is present">,
8532   InGroup<Format>;
8533 def warn_printf_empty_objc_flag: Warning<
8534   "missing object format flag">,
8535   InGroup<Format>;
8536 def warn_printf_ObjCflags_without_ObjCConversion: Warning<
8537   "object format flags cannot be used with '%0' conversion specifier">,
8538   InGroup<Format>;
8539 def warn_printf_invalid_objc_flag: Warning<
8540     "'%0' is not a valid object format flag">,
8541     InGroup<Format>;
8542 def warn_scanf_scanlist_incomplete : Warning<
8543   "no closing ']' for '%%[' in scanf format string">,
8544   InGroup<Format>;
8545 def warn_format_bool_as_character : Warning<
8546   "using '%0' format specifier, but argument has boolean value">,
8547   InGroup<Format>;
8548 def note_format_string_defined : Note<"format string is defined here">;
8549 def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
8550 def note_printf_c_str: Note<"did you mean to call the %0 method?">;
8551 def note_format_security_fixit: Note<
8552   "treat the string as an argument to avoid this">;
8553
8554 def warn_null_arg : Warning<
8555   "null passed to a callee that requires a non-null argument">,
8556   InGroup<NonNull>;
8557 def warn_null_ret : Warning<
8558   "null returned from %select{function|method}0 that requires a non-null return value">,
8559   InGroup<NonNull>;
8560
8561 def err_lifetimebound_no_object_param : Error<
8562   "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
8563   "function has no implicit object parameter">;
8564 def err_lifetimebound_ctor_dtor : Error<
8565   "'lifetimebound' attribute cannot be applied to a "
8566   "%select{constructor|destructor}0">;
8567
8568 // CHECK: returning address/reference of stack memory
8569 def warn_ret_stack_addr_ref : Warning<
8570   "%select{address of|reference to}0 stack memory associated with "
8571   "%select{local variable|parameter}2 %1 returned">,
8572   InGroup<ReturnStackAddress>;
8573 def warn_ret_local_temp_addr_ref : Warning<
8574   "returning %select{address of|reference to}0 local temporary object">,
8575   InGroup<ReturnStackAddress>;
8576 def warn_ret_addr_label : Warning<
8577   "returning address of label, which is local">,
8578   InGroup<ReturnStackAddress>;
8579 def err_ret_local_block : Error<
8580   "returning block that lives on the local stack">;
8581 def note_local_var_initializer : Note<
8582   "%select{via initialization of|binding reference}0 variable "
8583   "%select{%2 |}1here">;
8584 def note_init_with_default_member_initalizer : Note<
8585   "initializing field %0 with default member initializer">;
8586
8587 // Check for initializing a member variable with the address or a reference to
8588 // a constructor parameter.
8589 def warn_bind_ref_member_to_parameter : Warning<
8590   "binding reference member %0 to stack allocated "
8591   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
8592 def warn_init_ptr_member_to_parameter_addr : Warning<
8593   "initializing pointer member %0 with the stack address of "
8594   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
8595 def note_ref_or_ptr_member_declared_here : Note<
8596   "%select{reference|pointer}0 member declared here">;
8597
8598 def err_dangling_member : Error<
8599   "%select{reference|backing array for 'std::initializer_list'}2 "
8600   "%select{|subobject of }1member %0 "
8601   "%select{binds to|is}2 a temporary object "
8602   "whose lifetime would be shorter than the lifetime of "
8603   "the constructed object">;
8604 def warn_dangling_member : Warning<
8605   "%select{reference|backing array for 'std::initializer_list'}2 "
8606   "%select{|subobject of }1member %0 "
8607   "%select{binds to|is}2 a temporary object "
8608   "whose lifetime is shorter than the lifetime of the constructed object">,
8609   InGroup<DanglingField>;
8610 def warn_dangling_lifetime_pointer_member : Warning<
8611   "initializing pointer member %0 to point to a temporary object "
8612   "whose lifetime is shorter than the lifetime of the constructed object">,
8613   InGroup<DanglingGsl>;
8614 def note_lifetime_extending_member_declared_here : Note<
8615   "%select{%select{reference|'std::initializer_list'}0 member|"
8616   "member with %select{reference|'std::initializer_list'}0 subobject}1 "
8617   "declared here">;
8618 def warn_dangling_variable : Warning<
8619   "%select{temporary %select{whose address is used as value of|"
8620   "%select{|implicitly }2bound to}4 "
8621   "%select{%select{|reference }4member of local variable|"
8622   "local %select{variable|reference}4}1|"
8623   "array backing "
8624   "%select{initializer list subobject of local variable|"
8625   "local initializer list}1}0 "
8626   "%select{%3 |}2will be destroyed at the end of the full-expression">,
8627   InGroup<Dangling>;
8628 def warn_new_dangling_reference : Warning<
8629   "temporary bound to reference member of allocated object "
8630   "will be destroyed at the end of the full-expression">,
8631   InGroup<DanglingField>;
8632 def warn_dangling_lifetime_pointer : Warning<
8633   "object backing the pointer "
8634   "will be destroyed at the end of the full-expression">,
8635   InGroup<DanglingGsl>;
8636 def warn_new_dangling_initializer_list : Warning<
8637   "array backing "
8638   "%select{initializer list subobject of the allocated object|"
8639   "the allocated initializer list}0 "
8640   "will be destroyed at the end of the full-expression">,
8641   InGroup<DanglingInitializerList>;
8642 def warn_unsupported_lifetime_extension : Warning<
8643   "sorry, lifetime extension of "
8644   "%select{temporary|backing array of initializer list}0 created "
8645   "by aggregate initialization using default member initializer "
8646   "is not supported; lifetime of %select{temporary|backing array}0 "
8647   "will end at the end of the full-expression">, InGroup<Dangling>;
8648
8649 // For non-floating point, expressions of the form x == x or x != x
8650 // should result in a warning, since these always evaluate to a constant.
8651 // Array comparisons have similar warnings
8652 def warn_comparison_always : Warning<
8653   "%select{self-|array }0comparison always evaluates to "
8654   "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
8655   InGroup<TautologicalCompare>;
8656 def warn_comparison_bitwise_always : Warning<
8657   "bitwise comparison always evaluates to %select{false|true}0">,
8658   InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
8659 def warn_comparison_bitwise_or : Warning<
8660   "bitwise or with non-zero value always evaluates to true">,
8661   InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
8662 def warn_tautological_overlap_comparison : Warning<
8663   "overlapping comparisons always evaluate to %select{false|true}0">,
8664   InGroup<TautologicalOverlapCompare>, DefaultIgnore;
8665 def warn_depr_array_comparison : Warning<
8666   "comparison between two arrays is deprecated; "
8667   "to compare array addresses, use unary '+' to decay operands to pointers">,
8668   InGroup<DeprecatedArrayCompare>;
8669
8670 def warn_stringcompare : Warning<
8671   "result of comparison against %select{a string literal|@encode}0 is "
8672   "unspecified (use an explicit string comparison function instead)">,
8673   InGroup<StringCompare>;
8674
8675 def warn_identity_field_assign : Warning<
8676   "assigning %select{field|instance variable}0 to itself">,
8677   InGroup<SelfAssignmentField>;
8678
8679 // Type safety attributes
8680 def err_type_tag_for_datatype_not_ice : Error<
8681   "'type_tag_for_datatype' attribute requires the initializer to be "
8682   "an %select{integer|integral}0 constant expression">;
8683 def err_type_tag_for_datatype_too_large : Error<
8684   "'type_tag_for_datatype' attribute requires the initializer to be "
8685   "an %select{integer|integral}0 constant expression "
8686   "that can be represented by a 64 bit integer">;
8687 def err_tag_index_out_of_range : Error<
8688   "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
8689 def warn_type_tag_for_datatype_wrong_kind : Warning<
8690   "this type tag was not designed to be used with this function">,
8691   InGroup<TypeSafety>;
8692 def warn_type_safety_type_mismatch : Warning<
8693   "argument type %0 doesn't match specified %1 type tag "
8694   "%select{that requires %3|}2">, InGroup<TypeSafety>;
8695 def warn_type_safety_null_pointer_required : Warning<
8696   "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
8697
8698 // Generic selections.
8699 def err_assoc_type_incomplete : Error<
8700   "type %0 in generic association incomplete">;
8701 def err_assoc_type_nonobject : Error<
8702   "type %0 in generic association not an object type">;
8703 def err_assoc_type_variably_modified : Error<
8704   "type %0 in generic association is a variably modified type">;
8705 def err_assoc_compatible_types : Error<
8706   "type %0 in generic association compatible with previously specified type %1">;
8707 def note_compat_assoc : Note<
8708   "compatible type %0 specified here">;
8709 def err_generic_sel_no_match : Error<
8710   "controlling expression type %0 not compatible with any generic association type">;
8711 def err_generic_sel_multi_match : Error<
8712   "controlling expression type %0 compatible with %1 generic association types">;
8713
8714
8715 // Blocks
8716 def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
8717   " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
8718 def err_block_returning_array_function : Error<
8719   "block cannot return %select{array|function}0 type %1">;
8720
8721 // Builtin annotation
8722 def err_builtin_annotation_first_arg : Error<
8723   "first argument to __builtin_annotation must be an integer">;
8724 def err_builtin_annotation_second_arg : Error<
8725   "second argument to __builtin_annotation must be a non-wide string constant">;
8726 def err_msvc_annotation_wide_str : Error<
8727   "arguments to __annotation must be wide string constants">;
8728
8729 // CFString checking
8730 def err_cfstring_literal_not_string_constant : Error<
8731   "CFString literal is not a string constant">;
8732 def warn_cfstring_truncated : Warning<
8733   "input conversion stopped due to an input byte that does not "
8734   "belong to the input codeset UTF-8">,
8735   InGroup<DiagGroup<"CFString-literal">>;
8736
8737 // os_log checking
8738 // TODO: separate diagnostic for os_trace()
8739 def err_os_log_format_not_string_constant : Error<
8740   "os_log() format argument is not a string constant">;
8741 def err_os_log_argument_too_big : Error<
8742   "os_log() argument %0 is too big (%1 bytes, max %2)">;
8743 def warn_os_log_format_narg : Error<
8744  "os_log() '%%n' format specifier is not allowed">, DefaultError;
8745
8746 // Statements.
8747 def err_continue_not_in_loop : Error<
8748   "'continue' statement not in loop statement">;
8749 def err_break_not_in_loop_or_switch : Error<
8750   "'break' statement not in loop or switch statement">;
8751 def warn_loop_ctrl_binds_to_inner : Warning<
8752   "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
8753   InGroup<GccCompat>;
8754 def warn_break_binds_to_switch : Warning<
8755   "'break' is bound to loop, GCC binds it to switch">,
8756   InGroup<GccCompat>;
8757 def err_default_not_in_switch : Error<
8758   "'default' statement not in switch statement">;
8759 def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
8760 def warn_bool_switch_condition : Warning<
8761   "switch condition has boolean value">, InGroup<SwitchBool>;
8762 def warn_case_value_overflow : Warning<
8763   "overflow converting case value to switch condition type (%0 to %1)">,
8764   InGroup<Switch>;
8765 def err_duplicate_case : Error<"duplicate case value '%0'">;
8766 def err_duplicate_case_differing_expr : Error<
8767   "duplicate case value: '%0' and '%1' both equal '%2'">;
8768 def warn_case_empty_range : Warning<"empty case range specified">;
8769 def warn_missing_case_for_condition :
8770   Warning<"no case matching constant switch condition '%0'">;
8771
8772 def warn_def_missing_case : Warning<"%plural{"
8773   "1:enumeration value %1 not explicitly handled in switch|"
8774   "2:enumeration values %1 and %2 not explicitly handled in switch|"
8775   "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
8776   ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
8777   InGroup<SwitchEnum>, DefaultIgnore;
8778
8779 def warn_missing_case : Warning<"%plural{"
8780   "1:enumeration value %1 not handled in switch|"
8781   "2:enumeration values %1 and %2 not handled in switch|"
8782   "3:enumeration values %1, %2, and %3 not handled in switch|"
8783   ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
8784   InGroup<Switch>;
8785
8786 def warn_unannotated_fallthrough : Warning<
8787   "unannotated fall-through between switch labels">,
8788   InGroup<ImplicitFallthrough>, DefaultIgnore;
8789 def warn_unannotated_fallthrough_per_function : Warning<
8790   "unannotated fall-through between switch labels in partly-annotated "
8791   "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
8792 def note_insert_fallthrough_fixit : Note<
8793   "insert '%0;' to silence this warning">;
8794 def note_insert_break_fixit : Note<
8795   "insert 'break;' to avoid fall-through">;
8796 def err_fallthrough_attr_wrong_target : Error<
8797   "%0 attribute is only allowed on empty statements">;
8798 def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
8799 def err_fallthrough_attr_outside_switch : Error<
8800   "fallthrough annotation is outside switch statement">;
8801 def err_fallthrough_attr_invalid_placement : Error<
8802   "fallthrough annotation does not directly precede switch label">;
8803 def warn_fallthrough_attr_unreachable : Warning<
8804   "fallthrough annotation in unreachable code">,
8805   InGroup<ImplicitFallthrough>, DefaultIgnore;
8806
8807 def warn_unreachable_default : Warning<
8808   "default label in switch which covers all enumeration values">,
8809   InGroup<CoveredSwitchDefault>, DefaultIgnore;
8810 def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
8811   InGroup<Switch>;
8812 def warn_not_in_enum_assignment : Warning<"integer constant not in range "
8813   "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
8814 def err_typecheck_statement_requires_scalar : Error<
8815   "statement requires expression of scalar type (%0 invalid)">;
8816 def err_typecheck_statement_requires_integer : Error<
8817   "statement requires expression of integer type (%0 invalid)">;
8818 def err_multiple_default_labels_defined : Error<
8819   "multiple default labels in one switch">;
8820 def err_switch_multiple_conversions : Error<
8821   "multiple conversions from switch condition type %0 to an integral or "
8822   "enumeration type">;
8823 def note_switch_conversion : Note<
8824   "conversion to %select{integral|enumeration}0 type %1">;
8825 def err_switch_explicit_conversion : Error<
8826   "switch condition type %0 requires explicit conversion to %1">;
8827 def err_switch_incomplete_class_type : Error<
8828   "switch condition has incomplete class type %0">;
8829
8830 def warn_empty_if_body : Warning<
8831   "if statement has empty body">, InGroup<EmptyBody>;
8832 def warn_empty_for_body : Warning<
8833   "for loop has empty body">, InGroup<EmptyBody>;
8834 def warn_empty_range_based_for_body : Warning<
8835   "range-based for loop has empty body">, InGroup<EmptyBody>;
8836 def warn_empty_while_body : Warning<
8837   "while loop has empty body">, InGroup<EmptyBody>;
8838 def warn_empty_switch_body : Warning<
8839   "switch statement has empty body">, InGroup<EmptyBody>;
8840 def note_empty_body_on_separate_line : Note<
8841   "put the semicolon on a separate line to silence this warning">;
8842
8843 def err_va_start_captured_stmt : Error<
8844   "'va_start' cannot be used in a captured statement">;
8845 def err_va_start_outside_function : Error<
8846   "'va_start' cannot be used outside a function">;
8847 def err_va_start_fixed_function : Error<
8848   "'va_start' used in function with fixed args">;
8849 def err_va_start_used_in_wrong_abi_function : Error<
8850   "'va_start' used in %select{System V|Win64}0 ABI function">;
8851 def err_ms_va_start_used_in_sysv_function : Error<
8852   "'__builtin_ms_va_start' used in System V ABI function">;
8853 def warn_second_arg_of_va_start_not_last_named_param : Warning<
8854   "second argument to 'va_start' is not the last named parameter">,
8855   InGroup<Varargs>;
8856 def warn_va_start_type_is_undefined : Warning<
8857   "passing %select{an object that undergoes default argument promotion|"
8858   "an object of reference type|a parameter declared with the 'register' "
8859   "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
8860 def err_first_argument_to_va_arg_not_of_type_va_list : Error<
8861   "first argument to 'va_arg' is of type %0 and not 'va_list'">;
8862 def err_second_parameter_to_va_arg_incomplete: Error<
8863   "second argument to 'va_arg' is of incomplete type %0">;
8864 def err_second_parameter_to_va_arg_abstract: Error<
8865   "second argument to 'va_arg' is of abstract type %0">;
8866 def warn_second_parameter_to_va_arg_not_pod : Warning<
8867   "second argument to 'va_arg' is of non-POD type %0">,
8868   InGroup<NonPODVarargs>, DefaultError;
8869 def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
8870   "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
8871   InGroup<NonPODVarargs>, DefaultError;
8872 def warn_second_parameter_to_va_arg_never_compatible : Warning<
8873   "second argument to 'va_arg' is of promotable type %0; this va_arg has "
8874   "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
8875
8876 def warn_return_missing_expr : Warning<
8877   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8878   InGroup<ReturnType>;
8879 def ext_return_missing_expr : ExtWarn<
8880   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8881   InGroup<ReturnType>;
8882 def ext_return_has_expr : ExtWarn<
8883   "%select{void function|void method|constructor|destructor}1 %0 "
8884   "should not return a value">,
8885   DefaultError, InGroup<ReturnType>;
8886 def ext_return_has_void_expr : Extension<
8887   "void %select{function|method|block}1 %0 should not return void expression">;
8888 def err_return_init_list : Error<
8889   "%select{void function|void method|constructor|destructor}1 %0 "
8890   "must not return a value">;
8891 def err_ctor_dtor_returns_void : Error<
8892   "%select{constructor|destructor}1 %0 must not return void expression">;
8893 def warn_noreturn_function_has_return_expr : Warning<
8894   "function %0 declared 'noreturn' should not return">,
8895   InGroup<InvalidNoreturn>;
8896 def warn_falloff_noreturn_function : Warning<
8897   "function declared 'noreturn' should not return">,
8898   InGroup<InvalidNoreturn>;
8899 def err_noreturn_block_has_return_expr : Error<
8900   "block declared 'noreturn' should not return">;
8901 def err_noreturn_missing_on_first_decl : Error<
8902   "function declared '[[noreturn]]' after its first declaration">;
8903 def note_noreturn_missing_first_decl : Note<
8904   "declaration missing '[[noreturn]]' attribute is here">;
8905 def err_carries_dependency_missing_on_first_decl : Error<
8906   "%select{function|parameter}0 declared '[[carries_dependency]]' "
8907   "after its first declaration">;
8908 def note_carries_dependency_missing_first_decl : Note<
8909   "declaration missing '[[carries_dependency]]' attribute is here">;
8910 def err_carries_dependency_param_not_function_decl : Error<
8911   "'[[carries_dependency]]' attribute only allowed on parameter in a function "
8912   "declaration or lambda">;
8913 def err_block_on_nonlocal : Error<
8914   "__block attribute not allowed, only allowed on local variables">;
8915 def err_block_on_vm : Error<
8916   "__block attribute not allowed on declaration with a variably modified type">;
8917
8918 def err_vec_builtin_non_vector : Error<
8919  "first two arguments to %0 must be vectors">;
8920 def err_vec_builtin_incompatible_vector : Error<
8921   "first two arguments to %0 must have the same type">;
8922 def err_vsx_builtin_nonconstant_argument : Error<
8923   "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
8924
8925 def err_shufflevector_nonconstant_argument : Error<
8926   "index for __builtin_shufflevector must be a constant integer">;
8927 def err_shufflevector_argument_too_large : Error<
8928   "index for __builtin_shufflevector must be less than the total number "
8929   "of vector elements">;
8930
8931 def err_convertvector_non_vector : Error<
8932   "first argument to __builtin_convertvector must be a vector">;
8933 def err_convertvector_non_vector_type : Error<
8934   "second argument to __builtin_convertvector must be a vector type">;
8935 def err_convertvector_incompatible_vector : Error<
8936   "first two arguments to __builtin_convertvector must have the same number of elements">;
8937
8938 def err_first_argument_to_cwsc_not_call : Error<
8939   "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
8940 def err_first_argument_to_cwsc_block_call : Error<
8941   "first argument to __builtin_call_with_static_chain must not be a block call">;
8942 def err_first_argument_to_cwsc_builtin_call : Error<
8943   "first argument to __builtin_call_with_static_chain must not be a builtin call">;
8944 def err_first_argument_to_cwsc_pdtor_call : Error<
8945   "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
8946 def err_second_argument_to_cwsc_not_pointer : Error<
8947   "second argument to __builtin_call_with_static_chain must be of pointer type">;
8948
8949 def err_vector_incorrect_num_initializers : Error<
8950   "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
8951 def err_altivec_empty_initializer : Error<"expected initializer">;
8952
8953 def err_invalid_neon_type_code : Error<
8954   "incompatible constant for this __builtin_neon function">;
8955 def err_argument_invalid_range : Error<
8956   "argument value %0 is outside the valid range [%1, %2]">;
8957 def warn_argument_invalid_range : Warning<
8958   "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
8959   InGroup<DiagGroup<"argument-outside-range">>;
8960 def err_argument_not_multiple : Error<
8961   "argument should be a multiple of %0">;
8962 def err_argument_not_power_of_2 : Error<
8963   "argument should be a power of 2">;
8964 def err_argument_not_shifted_byte : Error<
8965   "argument should be an 8-bit value shifted by a multiple of 8 bits">;
8966 def err_argument_not_shifted_byte_or_xxff : Error<
8967   "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
8968 def warn_neon_vector_initializer_non_portable : Warning<
8969   "vector initializers are not compatible with NEON intrinsics in big endian "
8970   "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
8971 def note_neon_vector_initializer_non_portable : Note<
8972   "consider using vld1_%0%1() to initialize a vector from memory, or "
8973   "vcreate_%0%1() to initialize from an integer constant">;
8974 def note_neon_vector_initializer_non_portable_q : Note<
8975   "consider using vld1q_%0%1() to initialize a vector from memory, or "
8976   "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
8977   "constants">;
8978 def err_systemz_invalid_tabort_code : Error<
8979   "invalid transaction abort code">;
8980 def err_64_bit_builtin_32_bit_tgt : Error<
8981   "this builtin is only available on 64-bit targets">;
8982 def err_32_bit_builtin_64_bit_tgt : Error<
8983   "this builtin is only available on 32-bit targets">;
8984 def err_builtin_x64_aarch64_only : Error<
8985   "this builtin is only available on x86-64 and aarch64 targets">;
8986 def err_mips_builtin_requires_dsp : Error<
8987   "this builtin requires 'dsp' ASE, please use -mdsp">;
8988 def err_mips_builtin_requires_dspr2 : Error<
8989   "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
8990 def err_mips_builtin_requires_msa : Error<
8991   "this builtin requires 'msa' ASE, please use -mmsa">;
8992 def err_ppc_builtin_only_on_pwr7 : Error<
8993   "this builtin is only valid on POWER7 or later CPUs">;
8994 def err_x86_builtin_invalid_rounding : Error<
8995   "invalid rounding argument">;
8996 def err_x86_builtin_invalid_scale : Error<
8997   "scale argument must be 1, 2, 4, or 8">;
8998 def err_hexagon_builtin_unsupported_cpu : Error<
8999   "builtin is not supported on this CPU">;
9000 def err_hexagon_builtin_requires_hvx : Error<
9001   "builtin requires HVX">;
9002 def err_hexagon_builtin_unsupported_hvx : Error<
9003   "builtin is not supported on this version of HVX">;
9004
9005 def err_builtin_target_unsupported : Error<
9006   "builtin is not supported on this target">;
9007 def err_builtin_longjmp_unsupported : Error<
9008   "__builtin_longjmp is not supported for the current target">;
9009 def err_builtin_setjmp_unsupported : Error<
9010   "__builtin_setjmp is not supported for the current target">;
9011
9012 def err_builtin_longjmp_invalid_val : Error<
9013   "argument to __builtin_longjmp must be a constant 1">;
9014 def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9015
9016 def err_constant_integer_arg_type : Error<
9017   "argument to %0 must be a constant integer">;
9018
9019 def ext_mixed_decls_code : Extension<
9020   "ISO C90 forbids mixing declarations and code">,
9021   InGroup<DiagGroup<"declaration-after-statement">>;
9022
9023 def err_non_local_variable_decl_in_for : Error<
9024   "declaration of non-local variable in 'for' loop">;
9025 def err_non_variable_decl_in_for : Error<
9026   "non-variable declaration in 'for' loop">;
9027 def err_toomany_element_decls : Error<
9028   "only one element declaration is allowed">;
9029 def err_selector_element_not_lvalue : Error<
9030   "selector element is not a valid lvalue">;
9031 def err_selector_element_type : Error<
9032   "selector element type %0 is not a valid object">;
9033 def err_selector_element_const_type : Error<
9034   "selector element of type %0 cannot be a constant l-value expression">;
9035 def err_collection_expr_type : Error<
9036   "the type %0 is not a pointer to a fast-enumerable object">;
9037 def warn_collection_expr_type : Warning<
9038   "collection expression type %0 may not respond to %1">;
9039
9040 def err_invalid_conversion_between_ext_vectors : Error<
9041   "invalid conversion between ext-vector type %0 and %1">;
9042
9043 def warn_duplicate_attribute_exact : Warning<
9044   "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9045
9046 def warn_duplicate_attribute : Warning<
9047   "attribute %0 is already applied with different parameters">,
9048   InGroup<IgnoredAttributes>;
9049
9050 def warn_sync_fetch_and_nand_semantics_change : Warning<
9051   "the semantics of this intrinsic changed with GCC "
9052   "version 4.4 - the newer semantics are provided here">,
9053   InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9054
9055 // Type
9056 def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9057   InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9058 def warn_receiver_forward_class : Warning<
9059   "receiver %0 is a forward class and corresponding @interface may not exist">,
9060   InGroup<ForwardClassReceiver>;
9061 def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9062 def ext_missing_declspec : ExtWarn<
9063   "declaration specifier missing, defaulting to 'int'">;
9064 def ext_missing_type_specifier : ExtWarn<
9065   "type specifier missing, defaults to 'int'">,
9066   InGroup<ImplicitInt>;
9067 def err_decimal_unsupported : Error<
9068   "GNU decimal type extension not supported">;
9069 def err_missing_type_specifier : Error<
9070   "C++ requires a type specifier for all declarations">;
9071 def err_objc_array_of_interfaces : Error<
9072   "array of interface %0 is invalid (probably should be an array of pointers)">;
9073 def ext_c99_array_usage : Extension<
9074   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9075   "feature">, InGroup<C99>;
9076 def err_c99_array_usage_cxx : Error<
9077   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9078   "feature, not permitted in C++">;
9079 def err_type_unsupported : Error<
9080   "%0 is not supported on this target">;
9081 def err_nsconsumed_attribute_mismatch : Error<
9082   "overriding method has mismatched ns_consumed attribute on its"
9083   " parameter">;
9084 def err_nsreturns_retained_attribute_mismatch : Error<
9085   "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9086   " attributes">;
9087 def warn_nsconsumed_attribute_mismatch : Warning<
9088   err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9089 def warn_nsreturns_retained_attribute_mismatch : Warning<
9090   err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9091
9092 def note_getter_unavailable : Note<
9093   "or because setter is declared here, but no getter method %0 is found">;
9094 def err_invalid_protocol_qualifiers : Error<
9095   "invalid protocol qualifiers on non-ObjC type">;
9096 def warn_ivar_use_hidden : Warning<
9097   "local declaration of %0 hides instance variable">,
9098    InGroup<ShadowIvar>;
9099 def warn_direct_initialize_call : Warning<
9100   "explicit call to +initialize results in duplicate call to +initialize">,
9101    InGroup<ExplicitInitializeCall>;
9102 def warn_direct_super_initialize_call : Warning<
9103   "explicit call to [super initialize] should only be in implementation "
9104   "of +initialize">,
9105    InGroup<ExplicitInitializeCall>;
9106 def err_ivar_use_in_class_method : Error<
9107   "instance variable %0 accessed in class method">;
9108 def err_private_ivar_access : Error<"instance variable %0 is private">,
9109   AccessControl;
9110 def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9111   AccessControl;
9112 def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9113 def ext_typecheck_base_super : Warning<
9114   "method parameter type "
9115   "%diff{$ does not match super class method parameter type $|"
9116   "does not match super class method parameter type}0,1">,
9117    InGroup<SuperSubClassMismatch>, DefaultIgnore;
9118 def warn_missing_method_return_type : Warning<
9119   "method has no return type specified; defaults to 'id'">,
9120   InGroup<MissingMethodReturnType>, DefaultIgnore;
9121 def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9122   "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9123
9124 // Spell-checking diagnostics
9125 def err_unknown_typename : Error<
9126   "unknown type name %0">;
9127 def err_unknown_type_or_class_name_suggest : Error<
9128   "unknown %select{type|class}1 name %0; did you mean %2?">;
9129 def err_unknown_typename_suggest : Error<
9130   "unknown type name %0; did you mean %1?">;
9131 def err_unknown_nested_typename_suggest : Error<
9132   "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9133 def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9134 def err_undeclared_use_suggest : Error<
9135   "use of undeclared %0; did you mean %1?">;
9136 def err_undeclared_var_use_suggest : Error<
9137   "use of undeclared identifier %0; did you mean %1?">;
9138 def err_no_template : Error<"no template named %0">;
9139 def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
9140 def err_no_member_template : Error<"no template named %0 in %1">;
9141 def err_no_member_template_suggest : Error<
9142   "no template named %0 in %1; did you mean %select{|simply }2%3?">;
9143 def err_non_template_in_template_id : Error<
9144   "%0 does not name a template but is followed by template arguments">;
9145 def err_non_template_in_template_id_suggest : Error<
9146   "%0 does not name a template but is followed by template arguments; "
9147   "did you mean %1?">;
9148 def err_non_template_in_member_template_id_suggest : Error<
9149   "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
9150 def note_non_template_in_template_id_found : Note<
9151   "non-template declaration found by name lookup">;
9152 def err_mem_init_not_member_or_class_suggest : Error<
9153   "initializer %0 does not name a non-static data member or base "
9154   "class; did you mean the %select{base class|member}1 %2?">;
9155 def err_field_designator_unknown_suggest : Error<
9156   "field designator %0 does not refer to any field in type %1; did you mean "
9157   "%2?">;
9158 def err_typecheck_member_reference_ivar_suggest : Error<
9159   "%0 does not have a member named %1; did you mean %2?">;
9160 def err_property_not_found_suggest : Error<
9161   "property %0 not found on object of type %1; did you mean %2?">;
9162 def err_class_property_found : Error<
9163   "property %0 is a class property; did you mean to access it with class '%1'?">;
9164 def err_ivar_access_using_property_syntax_suggest : Error<
9165   "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
9166 def warn_property_access_suggest : Warning<
9167 "property %0 not found on object of type %1; did you mean to access property %2?">,
9168 InGroup<PropertyAccessDotSyntax>;
9169 def err_property_found_suggest : Error<
9170   "property %0 found on object of type %1; did you mean to access "
9171   "it with the \".\" operator?">;
9172 def err_undef_interface_suggest : Error<
9173   "cannot find interface declaration for %0; did you mean %1?">;
9174 def warn_undef_interface_suggest : Warning<
9175   "cannot find interface declaration for %0; did you mean %1?">;
9176 def err_undef_superclass_suggest : Error<
9177   "cannot find interface declaration for %0, superclass of %1; did you mean "
9178   "%2?">;
9179 def err_undeclared_protocol_suggest : Error<
9180   "cannot find protocol declaration for %0; did you mean %1?">;
9181 def note_base_class_specified_here : Note<
9182   "base class %0 specified here">;
9183 def err_using_directive_suggest : Error<
9184   "no namespace named %0; did you mean %1?">;
9185 def err_using_directive_member_suggest : Error<
9186   "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
9187 def note_namespace_defined_here : Note<"namespace %0 defined here">;
9188 def err_sizeof_pack_no_pack_name_suggest : Error<
9189   "%0 does not refer to the name of a parameter pack; did you mean %1?">;
9190 def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
9191
9192 def err_uncasted_use_of_unknown_any : Error<
9193   "%0 has unknown type; cast it to its declared type to use it">;
9194 def err_uncasted_call_of_unknown_any : Error<
9195   "%0 has unknown return type; cast the call to its declared return type">;
9196 def err_uncasted_send_to_unknown_any_method : Error<
9197   "no known method %select{%objcinstance1|%objcclass1}0; cast the "
9198   "message send to the method's return type">;
9199 def err_unsupported_unknown_any_decl : Error<
9200   "%0 has unknown type, which is not supported for this kind of declaration">;
9201 def err_unsupported_unknown_any_expr : Error<
9202   "unsupported expression with unknown type">;
9203 def err_unsupported_unknown_any_call : Error<
9204   "call to unsupported expression with unknown type">;
9205 def err_unknown_any_addrof : Error<
9206   "the address of a declaration with unknown type "
9207   "can only be cast to a pointer type">;
9208 def err_unknown_any_addrof_call : Error<
9209   "address-of operator cannot be applied to a call to a function with "
9210   "unknown return type">;
9211 def err_unknown_any_var_function_type : Error<
9212   "variable %0 with unknown type cannot be given a function type">;
9213 def err_unknown_any_function : Error<
9214   "function %0 with unknown type must be given a function type">;
9215
9216 def err_filter_expression_integral : Error<
9217   "filter expression has non-integral type %0">;
9218
9219 def err_non_asm_stmt_in_naked_function : Error<
9220   "non-ASM statement in naked function is not supported">;
9221 def err_asm_naked_this_ref : Error<
9222   "'this' pointer references not allowed in naked functions">;
9223 def err_asm_naked_parm_ref : Error<
9224   "parameter references not allowed in naked functions">;
9225
9226 // OpenCL warnings and errors.
9227 def err_invalid_astype_of_different_size : Error<
9228   "invalid reinterpretation: sizes of %0 and %1 must match">;
9229 def err_static_kernel : Error<
9230   "kernel functions cannot be declared static">;
9231 def err_method_kernel : Error<
9232   "kernel functions cannot be class members">;
9233 def err_template_kernel : Error<
9234   "kernel functions cannot be used in a template declaration, instantiation or specialization">;
9235 def err_opencl_ptrptr_kernel_param : Error<
9236   "kernel parameter cannot be declared as a pointer to a pointer">;
9237 def err_kernel_arg_address_space : Error<
9238   "pointer arguments to kernel functions must reside in '__global', "
9239   "'__constant' or '__local' address space">;
9240 def err_opencl_ext_vector_component_invalid_length : Error<
9241   "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
9242 def err_opencl_function_variable : Error<
9243   "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
9244 def err_opencl_addrspace_scope : Error<
9245   "variables in the %0 address space can only be declared in the outermost "
9246   "scope of a kernel function">;
9247 def err_static_function_scope : Error<
9248   "variables in function scope cannot be declared static">;
9249 def err_opencl_bitfields : Error<
9250   "bit-fields are not supported in OpenCL">;
9251 def err_opencl_vla : Error<
9252   "variable length arrays are not supported in OpenCL">;
9253 def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
9254     "scalar operand type has greater rank than the type of the vector "
9255     "element. (%0 and %1)">;
9256 def err_bad_kernel_param_type : Error<
9257   "%0 cannot be used as the type of a kernel parameter">;
9258 def err_opencl_implicit_function_decl : Error<
9259   "implicit declaration of function %0 is invalid in OpenCL">;
9260 def err_record_with_pointers_kernel_param : Error<
9261   "%select{struct|union}0 kernel parameters may not contain pointers">;
9262 def note_within_field_of_type : Note<
9263   "within field of type %0 declared here">;
9264 def note_illegal_field_declared_here : Note<
9265   "field of illegal %select{type|pointer type}0 %1 declared here">;
9266 def err_opencl_type_struct_or_union_field : Error<
9267   "the %0 type cannot be used to declare a structure or union field">;
9268 def err_event_t_addr_space_qual : Error<
9269   "the event_t type can only be used with __private address space qualifier">;
9270 def err_expected_kernel_void_return_type : Error<
9271   "kernel must have void return type">;
9272 def err_sampler_initializer_not_integer : Error<
9273   "sampler_t initialization requires 32-bit integer, not %0">;
9274 def warn_sampler_initializer_invalid_bits : Warning<
9275   "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
9276 def err_sampler_argument_required : Error<
9277   "sampler_t variable required - got %0">;
9278 def err_wrong_sampler_addressspace: Error<
9279   "sampler type cannot be used with the __local and __global address space qualifiers">;
9280 def err_opencl_nonconst_global_sampler : Error<
9281   "global sampler requires a const or constant address space qualifier">;
9282 def err_opencl_cast_non_zero_to_event_t : Error<
9283   "cannot cast non-zero value '%0' to 'event_t'">;
9284 def err_opencl_global_invalid_addr_space : Error<
9285   "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
9286 def err_missing_actual_pipe_type : Error<
9287   "missing actual type specifier for pipe">;
9288 def err_reference_pipe_type : Error <
9289   "pipes packet types cannot be of reference type">;
9290 def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
9291 def err_opencl_kernel_attr :
9292   Error<"attribute %0 can only be applied to an OpenCL kernel function">;
9293 def err_opencl_return_value_with_address_space : Error<
9294   "return value cannot be qualified with address space">;
9295 def err_opencl_constant_no_init : Error<
9296   "variable in constant address space must be initialized">;
9297 def err_opencl_atomic_init: Error<
9298   "atomic variable can be %select{assigned|initialized}0 to a variable only "
9299   "in global address space">;
9300 def err_opencl_implicit_vector_conversion : Error<
9301   "implicit conversions between vector types (%0 and %1) are not permitted">;
9302 def err_opencl_invalid_type_array : Error<
9303   "array of %0 type is invalid in OpenCL">;
9304 def err_opencl_ternary_with_block : Error<
9305   "block type cannot be used as expression in ternary expression in OpenCL">;
9306 def err_opencl_pointer_to_type : Error<
9307   "pointer to type %0 is invalid in OpenCL">;
9308 def err_opencl_type_can_only_be_used_as_function_parameter : Error <
9309   "type %0 can only be used as a function parameter in OpenCL">;
9310 def warn_opencl_attr_deprecated_ignored : Warning <
9311   "%0 attribute is deprecated and ignored in OpenCL version %1">,
9312   InGroup<IgnoredAttributes>;
9313 def err_opencl_variadic_function : Error<
9314   "invalid prototype, variadic arguments are not allowed in OpenCL">;
9315 def err_opencl_requires_extension : Error<
9316   "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
9317 def warn_opencl_generic_address_space_arg : Warning<
9318   "passing non-generic address space pointer to %0"
9319   " may cause dynamic conversion affecting performance">,
9320   InGroup<Conversion>, DefaultIgnore;
9321
9322 // OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
9323 def err_opencl_builtin_pipe_first_arg : Error<
9324   "first argument to %0 must be a pipe type">;
9325 def err_opencl_builtin_pipe_arg_num : Error<
9326   "invalid number of arguments to function: %0">;
9327 def err_opencl_builtin_pipe_invalid_arg : Error<
9328   "invalid argument type to function %0 (expecting %1 having %2)">;
9329 def err_opencl_builtin_pipe_invalid_access_modifier : Error<
9330   "invalid pipe access modifier (expecting %0)">;
9331
9332 // OpenCL access qualifier
9333 def err_opencl_invalid_access_qualifier : Error<
9334   "access qualifier can only be used for pipe and image type">;
9335 def err_opencl_invalid_read_write : Error<
9336   "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
9337 def err_opencl_multiple_access_qualifiers : Error<
9338   "multiple access qualifiers">;
9339 def note_opencl_typedef_access_qualifier : Note<
9340   "previously declared '%0' here">;
9341
9342 // OpenCL v2.0 s6.12.5 Blocks restrictions
9343 def err_opencl_block_storage_type : Error<
9344   "the __block storage type is not permitted">;
9345 def err_opencl_invalid_block_declaration : Error<
9346   "invalid block variable declaration - must be %select{const qualified|initialized}0">;
9347 def err_opencl_extern_block_declaration : Error<
9348   "invalid block variable declaration - using 'extern' storage class is disallowed">;
9349 def err_opencl_block_ref_block : Error<
9350   "cannot refer to a block inside block">;
9351
9352 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
9353 def err_opencl_builtin_to_addr_arg_num : Error<
9354   "invalid number of arguments to function: %0">;
9355 def err_opencl_builtin_to_addr_invalid_arg : Error<
9356   "invalid argument %0 to function: %1, expecting a generic pointer argument">;
9357
9358 // OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
9359 def err_opencl_enqueue_kernel_incorrect_args : Error<
9360   "illegal call to enqueue_kernel, incorrect argument types">;
9361 def err_opencl_enqueue_kernel_local_size_args : Error<
9362   "mismatch in number of block parameters and local size arguments passed">;
9363 def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
9364   "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
9365 def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
9366   "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
9367 def err_opencl_enqueue_kernel_blocks_no_args : Error<
9368   "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
9369
9370 def err_opencl_builtin_expected_type : Error<
9371   "illegal call to %0, expected %1 argument type">;
9372
9373 // OpenCL v2.2 s2.1.2.3 - Vector Component Access
9374 def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
9375   "vector component name '%0' is an OpenCL version 2.2 feature">,
9376   InGroup<OpenCLUnsupportedRGBA>;
9377
9378 def err_openclcxx_placement_new : Error<
9379   "use of placement new requires explicit declaration">;
9380
9381 // MIG routine annotations.
9382 def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
9383   "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
9384   InGroup<IgnoredAttributes>;
9385 } // end of sema category
9386
9387 let CategoryName = "OpenMP Issue" in {
9388 // OpenMP support.
9389 def err_omp_expected_var_arg : Error<
9390   "%0 is not a global variable, static local variable or static data member">;
9391 def err_omp_expected_var_arg_suggest : Error<
9392   "%0 is not a global variable, static local variable or static data member; "
9393   "did you mean %1">;
9394 def err_omp_global_var_arg : Error<
9395   "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
9396 def err_omp_ref_type_arg : Error<
9397   "arguments of '#pragma omp %0' cannot be of reference type %1">;
9398 def err_omp_region_not_file_context : Error<
9399   "directive must be at file or namespace scope">;
9400 def err_omp_var_scope : Error<
9401   "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
9402 def err_omp_var_used : Error<
9403   "'#pragma omp %0' must precede all references to variable %q1">;
9404 def err_omp_var_thread_local : Error<
9405   "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
9406 def err_omp_private_incomplete_type : Error<
9407   "a private variable with incomplete type %0">;
9408 def err_omp_firstprivate_incomplete_type : Error<
9409   "a firstprivate variable with incomplete type %0">;
9410 def err_omp_lastprivate_incomplete_type : Error<
9411   "a lastprivate variable with incomplete type %0">;
9412 def err_omp_reduction_incomplete_type : Error<
9413   "a reduction list item with incomplete type %0">;
9414 def err_omp_unexpected_clause_value : Error<
9415   "expected %0 in OpenMP clause '%1'">;
9416 def err_omp_expected_var_name_member_expr : Error<
9417   "expected variable name%select{| or data member of current class}0">;
9418 def err_omp_expected_var_name_member_expr_or_array_item : Error<
9419   "expected variable name%select{|, data member of current class}0, array element or array section">;
9420 def err_omp_expected_addressable_lvalue_or_array_item : Error<
9421   "expected addressable lvalue expression, array element or array section">;
9422 def err_omp_expected_named_var_member_or_array_expression: Error<
9423   "expected expression containing only member accesses and/or array sections based on named variables">;
9424 def err_omp_bit_fields_forbidden_in_clause : Error<
9425   "bit fields cannot be used to specify storage in a '%0' clause">;
9426 def err_array_section_does_not_specify_contiguous_storage : Error<
9427   "array section does not specify contiguous storage">;
9428 def err_omp_union_type_not_allowed : Error<
9429   "mapping of union members is not allowed">;
9430 def err_omp_expected_access_to_data_field : Error<
9431   "expected access to data field">;
9432 def err_omp_multiple_array_items_in_map_clause : Error<
9433   "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
9434 def err_omp_duplicate_map_type_modifier : Error<
9435   "same map type modifier has been specified more than once">;
9436 def err_omp_pointer_mapped_along_with_derived_section : Error<
9437   "pointer cannot be mapped along with a section derived from itself">;
9438 def err_omp_original_storage_is_shared_and_does_not_contain : Error<
9439   "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
9440 def err_omp_same_pointer_dereferenced : Error<
9441   "same pointer dereferenced in multiple different ways in map clause expressions">;
9442 def note_omp_task_predetermined_firstprivate_here : Note<
9443   "predetermined as a firstprivate in a task construct here">;
9444 def err_omp_threadprivate_incomplete_type : Error<
9445   "threadprivate variable with incomplete type %0">;
9446 def err_omp_no_dsa_for_variable : Error<
9447   "variable %0 must have explicitly specified data sharing attributes">;
9448 def err_omp_defaultmap_no_attr_for_variable : Error<
9449   "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
9450 def note_omp_default_dsa_none : Note<
9451   "explicit data sharing attribute requested here">;
9452 def note_omp_defaultmap_attr_none : Note<
9453   "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
9454 def err_omp_wrong_dsa : Error<
9455   "%0 variable cannot be %1">;
9456 def err_omp_variably_modified_type_not_supported : Error<
9457   "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
9458 def note_omp_explicit_dsa : Note<
9459   "defined as %0">;
9460 def note_omp_predetermined_dsa : Note<
9461   "%select{static data member is predetermined as shared|"
9462   "variable with static storage duration is predetermined as shared|"
9463   "loop iteration variable is predetermined as private|"
9464   "loop iteration variable is predetermined as linear|"
9465   "loop iteration variable is predetermined as lastprivate|"
9466   "constant variable is predetermined as shared|"
9467   "global variable is predetermined as shared|"
9468   "non-shared variable in a task construct is predetermined as firstprivate|"
9469   "variable with automatic storage duration is predetermined as private}0"
9470   "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
9471 def note_omp_implicit_dsa : Note<
9472   "implicitly determined as %0">;
9473 def err_omp_loop_var_dsa : Error<
9474   "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
9475 def err_omp_not_for : Error<
9476   "%select{statement after '#pragma omp %1' must be a for loop|"
9477   "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
9478 def note_omp_collapse_ordered_expr : Note<
9479   "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
9480 def err_omp_negative_expression_in_clause : Error<
9481   "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
9482 def err_omp_not_integral : Error<
9483   "expression must have integral or unscoped enumeration "
9484   "type, not %0">;
9485 def err_omp_threadprivate_in_target : Error<
9486   "threadprivate variables cannot be used in target constructs">;
9487 def err_omp_incomplete_type : Error<
9488   "expression has incomplete class type %0">;
9489 def err_omp_explicit_conversion : Error<
9490   "expression requires explicit conversion from %0 to %1">;
9491 def note_omp_conversion_here : Note<
9492   "conversion to %select{integral|enumeration}0 type %1 declared here">;
9493 def err_omp_ambiguous_conversion : Error<
9494   "ambiguous conversion from type %0 to an integral or unscoped "
9495   "enumeration type">;
9496 def err_omp_required_access : Error<
9497   "%0 variable must be %1">;
9498 def err_omp_const_variable : Error<
9499   "const-qualified variable cannot be %0">;
9500 def err_omp_const_not_mutable_variable : Error<
9501   "const-qualified variable without mutable fields cannot be %0">;
9502 def err_omp_const_list_item : Error<
9503   "const-qualified list item cannot be %0">;
9504 def err_omp_linear_incomplete_type : Error<
9505   "a linear variable with incomplete type %0">;
9506 def err_omp_linear_expected_int_or_ptr : Error<
9507   "argument of a linear clause should be of integral or pointer "
9508   "type, not %0">;
9509 def warn_omp_linear_step_zero : Warning<
9510   "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
9511   InGroup<OpenMPClauses>;
9512 def warn_omp_alignment_not_power_of_two : Warning<
9513   "aligned clause will be ignored because the requested alignment is not a power of 2">,
9514   InGroup<OpenMPClauses>;
9515 def err_omp_invalid_target_decl : Error<
9516   "%0 used in declare target directive is not a variable or a function name">;
9517 def err_omp_declare_target_multiple : Error<
9518   "%0 appears multiple times in clauses on the same declare target directive">;
9519 def err_omp_declare_target_to_and_link : Error<
9520   "%0 must not appear in both clauses 'to' and 'link'">;
9521 def warn_omp_not_in_target_context : Warning<
9522   "declaration is not declared in any declare target region">,
9523   InGroup<OpenMPTarget>;
9524 def err_omp_function_in_link_clause : Error<
9525   "function name is not allowed in 'link' clause">;
9526 def err_omp_aligned_expected_array_or_ptr : Error<
9527   "argument of aligned clause should be array"
9528   "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
9529   ", not %0">;
9530 def err_omp_used_in_clause_twice : Error<
9531   "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
9532 def err_omp_local_var_in_threadprivate_init : Error<
9533   "variable with local storage in initial value of threadprivate variable">;
9534 def err_omp_loop_not_canonical_init : Error<
9535   "initialization clause of OpenMP for loop is not in canonical form "
9536   "('var = init' or 'T var = init')">;
9537 def ext_omp_loop_not_canonical_init : ExtWarn<
9538   "initialization clause of OpenMP for loop is not in canonical form "
9539   "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
9540 def err_omp_loop_not_canonical_cond : Error<
9541   "condition of OpenMP for loop must be a relational comparison "
9542   "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
9543 def err_omp_loop_not_canonical_incr : Error<
9544   "increment clause of OpenMP for loop must perform simple addition "
9545   "or subtraction on loop variable %0">;
9546 def err_omp_loop_variable_type : Error<
9547   "variable must be of integer or %select{pointer|random access iterator}0 type">;
9548 def err_omp_loop_incr_not_compatible : Error<
9549   "increment expression must cause %0 to %select{decrease|increase}1 "
9550   "on each iteration of OpenMP for loop">;
9551 def note_omp_loop_cond_requres_compatible_incr : Note<
9552   "loop step is expected to be %select{negative|positive}0 due to this condition">;
9553 def err_omp_loop_diff_cxx : Error<
9554   "could not calculate number of iterations calling 'operator-' with "
9555   "upper and lower loop bounds">;
9556 def err_omp_loop_cannot_use_stmt : Error<
9557   "'%0' statement cannot be used in OpenMP for loop">;
9558 def err_omp_simd_region_cannot_use_stmt : Error<
9559   "'%0' statement cannot be used in OpenMP simd region">;
9560 def warn_omp_loop_64_bit_var : Warning<
9561   "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
9562   InGroup<OpenMPLoopForm>;
9563 def err_omp_unknown_reduction_identifier : Error<
9564   "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
9565   "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
9566 def err_omp_not_resolved_reduction_identifier : Error<
9567   "unable to resolve declare reduction construct for type %0">;
9568 def err_omp_reduction_ref_type_arg : Error<
9569   "argument of OpenMP clause '%0' must reference the same object in all threads">;
9570 def err_omp_clause_not_arithmetic_type_arg : Error<
9571   "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
9572 def err_omp_clause_floating_type_arg : Error<
9573   "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
9574 def err_omp_once_referenced : Error<
9575   "variable can appear only once in OpenMP '%0' clause">;
9576 def err_omp_once_referenced_in_target_update : Error<
9577   "variable can appear only once in OpenMP 'target update' construct">;
9578 def note_omp_referenced : Note<
9579   "previously referenced here">;
9580 def err_omp_reduction_in_task : Error<
9581   "reduction variables may not be accessed in an explicit task">;
9582 def err_omp_reduction_id_not_compatible : Error<
9583   "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
9584 def err_omp_in_reduction_not_task_reduction : Error<
9585   "in_reduction variable must appear in a task_reduction clause">;
9586 def err_omp_reduction_identifier_mismatch : Error<
9587   "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
9588 def note_omp_previous_reduction_identifier : Note<
9589   "previously marked as task_reduction with different reduction operation">;
9590 def err_omp_prohibited_region : Error<
9591   "region cannot be%select{| closely}0 nested inside '%1' region"
9592   "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
9593   "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
9594   "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
9595   "; perhaps you forget to enclose 'omp %3' directive into a teams region?}2">;
9596 def err_omp_prohibited_region_simd : Error<
9597   "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd or atomic directive}0">;
9598 def err_omp_prohibited_region_atomic : Error<
9599   "OpenMP constructs may not be nested inside an atomic region">;
9600 def err_omp_prohibited_region_critical_same_name : Error<
9601   "cannot nest 'critical' regions having the same name %0">;
9602 def note_omp_previous_critical_region : Note<
9603   "previous 'critical' region starts here">;
9604 def err_omp_sections_not_compound_stmt : Error<
9605   "the statement for '#pragma omp sections' must be a compound statement">;
9606 def err_omp_parallel_sections_not_compound_stmt : Error<
9607   "the statement for '#pragma omp parallel sections' must be a compound statement">;
9608 def err_omp_orphaned_section_directive : Error<
9609   "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
9610   " must be closely nested to a sections region%select{|, not a %1 region}0">;
9611 def err_omp_sections_substmt_not_section : Error<
9612   "statement in 'omp sections' directive must be enclosed into a section region">;
9613 def err_omp_parallel_sections_substmt_not_section : Error<
9614   "statement in 'omp parallel sections' directive must be enclosed into a section region">;
9615 def err_omp_parallel_reduction_in_task_firstprivate : Error<
9616   "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
9617 def err_omp_atomic_read_not_expression_statement : Error<
9618   "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
9619   " where v and x are both lvalue expressions with scalar type">;
9620 def note_omp_atomic_read_write: Note<
9621   "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
9622 def err_omp_atomic_write_not_expression_statement : Error<
9623   "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
9624   " where x is a lvalue expression with scalar type">;
9625 def err_omp_atomic_update_not_expression_statement : Error<
9626   "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',"
9627   " where x is an l-value expression with scalar type">;
9628 def err_omp_atomic_not_expression_statement : Error<
9629   "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',"
9630   " where x is an l-value expression with scalar type">;
9631 def note_omp_atomic_update: Note<
9632   "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
9633   "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
9634   "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
9635 def err_omp_atomic_capture_not_expression_statement : Error<
9636   "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',"
9637   " where x and v are both l-value expressions with scalar type">;
9638 def err_omp_atomic_capture_not_compound_statement : Error<
9639   "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
9640   " '{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;}',"
9641   " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
9642   " where x is an l-value expression with scalar type">;
9643 def note_omp_atomic_capture: Note<
9644   "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
9645 def err_omp_atomic_several_clauses : Error<
9646   "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
9647 def note_omp_atomic_previous_clause : Note<
9648   "'%0' clause used here">;
9649 def err_omp_target_contains_not_only_teams : Error<
9650   "target construct with nested teams region contains statements outside of the teams construct">;
9651 def note_omp_nested_teams_construct_here : Note<
9652   "nested teams construct here">;
9653 def note_omp_nested_statement_here : Note<
9654   "%select{statement|directive}0 outside teams construct here">;
9655 def err_omp_single_copyprivate_with_nowait : Error<
9656   "the 'copyprivate' clause must not be used with the 'nowait' clause">;
9657 def note_omp_nowait_clause_here : Note<
9658   "'nowait' clause is here">;
9659 def err_omp_single_decl_in_declare_simd_variant : Error<
9660   "single declaration is expected after 'declare %select{simd|variant}0' directive">;
9661 def err_omp_function_expected : Error<
9662   "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
9663 def err_omp_wrong_cancel_region : Error<
9664   "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
9665 def err_omp_parent_cancel_region_nowait : Error<
9666   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
9667 def err_omp_parent_cancel_region_ordered : Error<
9668   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
9669 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">;
9670 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">;
9671 def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
9672 def err_omp_mapper_wrong_type : Error<
9673   "mapper type must be of struct, union or class type">;
9674 def err_omp_declare_mapper_wrong_var : Error<
9675   "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
9676 def err_omp_declare_mapper_redefinition : Error<
9677   "redefinition of user-defined mapper for type %0 with name %1">;
9678 def err_omp_invalid_mapper: Error<
9679   "cannot find a valid user-defined mapper for type %0 with name %1">;
9680 def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
9681 def err_omp_typecheck_section_value : Error<
9682   "subscripted value is not an array or pointer">;
9683 def err_omp_typecheck_section_not_integer : Error<
9684   "array section %select{lower bound|length}0 is not an integer">;
9685 def err_omp_section_function_type : Error<
9686   "section of pointer to function type %0">;
9687 def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
9688   InGroup<CharSubscript>, DefaultIgnore;
9689 def err_omp_section_incomplete_type : Error<
9690   "section of pointer to incomplete type %0">;
9691 def err_omp_section_not_subset_of_array : Error<
9692   "array section must be a subset of the original array">;
9693 def err_omp_section_length_negative : Error<
9694   "section length is evaluated to a negative value %0">;
9695 def err_omp_section_length_undefined : Error<
9696   "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
9697 def err_omp_wrong_linear_modifier : Error<
9698   "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
9699 def err_omp_wrong_linear_modifier_non_reference : Error<
9700   "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
9701 def err_omp_wrong_simdlen_safelen_values : Error<
9702   "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
9703 def err_omp_wrong_if_directive_name_modifier : Error<
9704   "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
9705 def err_omp_no_more_if_clause : Error<
9706   "no more 'if' clause is allowed">;
9707 def err_omp_unnamed_if_clause : Error<
9708   "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
9709 def note_omp_previous_named_if_clause : Note<
9710   "previous clause with directive name modifier specified here">;
9711 def err_omp_ordered_directive_with_param : Error<
9712   "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
9713 def err_omp_ordered_directive_without_param : Error<
9714   "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
9715 def note_omp_ordered_param : Note<
9716   "'ordered' clause with specified parameter">;
9717 def err_omp_expected_base_var_name : Error<
9718   "expected variable name as a base of the array %select{subscript|section}0">;
9719 def err_omp_map_shared_storage : Error<
9720   "variable already marked as mapped in current construct">;
9721 def err_omp_invalid_map_type_for_directive : Error<
9722   "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
9723 def err_omp_no_clause_for_directive : Error<
9724   "expected at least one %0 clause for '#pragma omp %1'">;
9725 def err_omp_threadprivate_in_clause : Error<
9726   "threadprivate variables are not allowed in '%0' clause">;
9727 def err_omp_wrong_ordered_loop_count : Error<
9728   "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
9729 def note_collapse_loop_count : Note<
9730   "parameter of the 'collapse' clause">;
9731 def err_omp_grainsize_num_tasks_mutually_exclusive : Error<
9732   "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
9733 def note_omp_previous_grainsize_num_tasks : Note<
9734   "'%0' clause is specified here">;
9735 def err_omp_hint_clause_no_name : Error<
9736   "the name of the construct must be specified in presence of 'hint' clause">;
9737 def err_omp_critical_with_hint : Error<
9738   "constructs with the same name must have a 'hint' clause with the same value">;
9739 def note_omp_critical_hint_here : Note<
9740   "%select{|previous }0'hint' clause with value '%1'">;
9741 def note_omp_critical_no_hint : Note<
9742   "%select{|previous }0directive with no 'hint' clause specified">;
9743 def err_omp_depend_clause_thread_simd : Error<
9744   "'depend' clauses cannot be mixed with '%0' clause">;
9745 def err_omp_depend_sink_expected_loop_iteration : Error<
9746   "expected%select{| %1}0 loop iteration variable">;
9747 def err_omp_depend_sink_unexpected_expr : Error<
9748   "unexpected expression: number of expressions is larger than the number of associated loops">;
9749 def err_omp_depend_sink_expected_plus_minus : Error<
9750   "expected '+' or '-' operation">;
9751 def err_omp_depend_sink_source_not_allowed : Error<
9752   "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
9753 def err_omp_depend_zero_length_array_section_not_allowed : Error<
9754   "zero-length array section is not allowed in 'depend' clause">;
9755 def err_omp_linear_ordered : Error<
9756   "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
9757 def err_omp_unexpected_schedule_modifier : Error<
9758   "modifier '%0' cannot be used along with modifier '%1'">;
9759 def err_omp_schedule_nonmonotonic_static : Error<
9760   "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
9761 def err_omp_schedule_nonmonotonic_ordered : Error<
9762   "'schedule' clause with 'nonmonotonic' modifier cannot be specified if an 'ordered' clause is specified">;
9763 def err_omp_ordered_simd : Error<
9764   "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
9765 def err_omp_variable_in_given_clause_and_dsa : Error<
9766   "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
9767 def err_omp_param_or_this_in_clause : Error<
9768   "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
9769 def err_omp_expected_uniform_param : Error<
9770   "expected a reference to a parameter specified in a 'uniform' clause">;
9771 def err_omp_expected_int_param : Error<
9772   "expected a reference to an integer-typed parameter">;
9773 def err_omp_at_least_one_motion_clause_required : Error<
9774   "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
9775 def err_omp_usedeviceptr_not_a_pointer : Error<
9776   "expected pointer or reference to pointer in 'use_device_ptr' clause">;
9777 def err_omp_argument_type_isdeviceptr : Error <
9778   "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
9779 def warn_omp_nesting_simd : Warning<
9780   "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
9781   InGroup<SourceUsesOpenMP>;
9782 def err_omp_orphaned_device_directive : Error<
9783   "orphaned 'omp %0' directives are prohibited"
9784   "; perhaps you forget to enclose the directive into a %select{|||target |teams }1region?">;
9785 def err_omp_reduction_non_addressable_expression : Error<
9786   "expected addressable reduction item for the task-based directives">;
9787 def err_omp_reduction_with_nogroup : Error<
9788   "'reduction' clause cannot be used with 'nogroup' clause">;
9789 def err_omp_reduction_vla_unsupported : Error<
9790   "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
9791 def err_omp_linear_distribute_var_non_loop_iteration : Error<
9792   "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
9793 def warn_omp_non_trivial_type_mapped : Warning<
9794   "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
9795   InGroup<OpenMPMapping>;
9796 def err_omp_requires_clause_redeclaration : Error <
9797   "Only one %0 clause can appear on a requires directive in a single translation unit">;
9798 def note_omp_requires_previous_clause : Note <
9799   "%0 clause previously used here">;
9800 def err_omp_target_before_requires : Error <
9801   "target region encountered before requires directive with '%0' clause">;
9802 def note_omp_requires_encountered_target : Note <
9803   "target previously encountered here">;
9804 def err_omp_invalid_scope : Error <
9805   "'#pragma omp %0' directive must appear only in file scope">;
9806 def note_omp_invalid_length_on_this_ptr_mapping : Note <
9807   "expected length on mapping of 'this' array section expression to be '1'">;
9808 def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
9809   "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
9810 def note_omp_invalid_subscript_on_this_ptr_map : Note <
9811   "expected 'this' subscript expression on map clause to be 'this[0]'">;
9812 def err_omp_invalid_map_this_expr : Error <
9813   "invalid 'this' expression on 'map' clause">;
9814 def err_implied_omp_allocator_handle_t_not_found : Error<
9815   "omp_allocator_handle_t type not found; include <omp.h>">;
9816 def err_omp_expected_predefined_allocator : Error<
9817   "expected one of the predefined allocators for the variables with the static "
9818   "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
9819   "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
9820   "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
9821 def warn_omp_used_different_allocator : Warning<
9822   "allocate directive specifies %select{default|'%1'}0 allocator while "
9823   "previously used %select{default|'%3'}2">,
9824   InGroup<OpenMPClauses>;
9825 def note_omp_previous_allocator : Note<
9826   "previous allocator is specified here">;
9827 def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
9828   "inside of the target region; provide an 'allocator' clause or use 'requires'"
9829   " directive with the 'dynamic_allocators' clause">;
9830 def err_expected_allocator_expression : Error<"expected an allocator expression "
9831   "inside of the target region; provide an allocator expression or use 'requires'"
9832   " directive with the 'dynamic_allocators' clause">;
9833 def warn_omp_allocate_thread_on_task_target_directive : Warning<
9834   "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
9835   InGroup<OpenMPClauses>;
9836 def err_omp_expected_private_copy_for_allocate : Error<
9837   "the referenced item is not found in any private clause on the same directive">;
9838 def err_omp_stmt_depends_on_loop_counter : Error<
9839   "the loop %select{initializer|condition}0 expression depends on the current loop control variable">;
9840 def err_omp_invariant_or_linear_dependency : Error<
9841   "expected loop invariant expression or '<invariant1> * %0 + <invariant2>' kind of expression">;
9842 def err_omp_wrong_dependency_iterator_type : Error<
9843   "expected an integer or a pointer type of the outer loop counter '%0' for non-rectangular nests">;
9844 def err_omp_unsupported_type : Error <
9845   "host requires %0 bit size %1 type support, but device '%2' does not support it">;
9846 def err_omp_lambda_capture_in_declare_target_not_to : Error<
9847   "variable captured in declare target region must appear in a to clause">;
9848 def err_omp_device_type_mismatch : Error<
9849   "'device_type(%0)' does not match previously specified 'device_type(%1)' for the same declaration">;
9850 def err_omp_wrong_device_function_call : Error<
9851   "function with 'device_type(%0)' is not available on %select{device|host}1">;
9852 def note_omp_marked_device_type_here : Note<"marked as 'device_type(%0)' here">;
9853 def warn_omp_declare_target_after_first_use : Warning<
9854   "declaration marked as declare target after first use, it may lead to incorrect results">,
9855   InGroup<OpenMPTarget>;
9856 def err_omp_declare_variant_incompat_attributes : Error<
9857   "'#pragma omp declare variant' is not compatible with any target-specific attributes">;
9858 def warn_omp_declare_variant_after_used : Warning<
9859   "'#pragma omp declare variant' cannot be applied for function after first "
9860   "usage; the original function might be used">, InGroup<SourceUsesOpenMP>;
9861 def warn_omp_declare_variant_after_emitted : Warning<
9862   "'#pragma omp declare variant' cannot be applied to the function that was defined already;"
9863   " the original function might be used">, InGroup<SourceUsesOpenMP>;
9864 def err_omp_declare_variant_doesnt_support : Error<
9865   "'#pragma omp declare variant' does not "
9866   "support %select{function templates|virtual functions|"
9867   "deduced return types|constructors|destructors|deleted functions|"
9868   "defaulted functions|constexpr functions|consteval function}0">;
9869 def err_omp_declare_variant_diff : Error<
9870   "function with '#pragma omp declare variant' has a different %select{calling convention"
9871   "|return type|constexpr specification|inline specification|storage class|"
9872   "linkage}0">;
9873 def err_omp_declare_variant_incompat_types : Error<
9874   "variant in '#pragma omp declare variant' with type %0 is incompatible with type %1"
9875   >;
9876 def warn_omp_declare_variant_marked_as_declare_variant : Warning<
9877   "variant function in '#pragma omp declare variant' is itself marked as '#pragma omp declare variant'"
9878   >, InGroup<SourceUsesOpenMP>;
9879 def note_omp_marked_declare_variant_here : Note<"marked as 'declare variant' here">;
9880 def err_omp_one_defaultmap_each_category: Error<
9881   "at most one defaultmap clause for each variable-category can appear on the directive">;
9882 def err_omp_lastprivate_conditional_non_scalar : Error<
9883   "expected list item of scalar type in 'lastprivate' clause with 'conditional' modifier"
9884   >;
9885 } // end of OpenMP category
9886
9887 let CategoryName = "Related Result Type Issue" in {
9888 // Objective-C related result type compatibility
9889 def warn_related_result_type_compatibility_class : Warning<
9890   "method is expected to return an instance of its class type "
9891   "%diff{$, but is declared to return $|"
9892   ", but is declared to return different type}0,1">;
9893 def warn_related_result_type_compatibility_protocol : Warning<
9894   "protocol method is expected to return an instance of the implementing "
9895   "class, but is declared to return %0">;
9896 def note_related_result_type_family : Note<
9897   "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
9898   "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
9899   "self}1' method family%select{| and is expected to return an instance of its "
9900   "class type}0">;
9901 def note_related_result_type_overridden : Note<
9902   "overridden method returns an instance of its class type">;
9903 def note_related_result_type_inferred : Note<
9904   "%select{class|instance}0 method %1 is assumed to return an instance of "
9905   "its receiver type (%2)">;
9906 def note_related_result_type_explicit : Note<
9907   "%select{overridden|current}0 method is explicitly declared 'instancetype'"
9908   "%select{| and is expected to return an instance of its class type}0">;
9909 def err_invalid_type_for_program_scope_var : Error<
9910   "the %0 type cannot be used to declare a program scope variable">;
9911
9912 }
9913
9914 let CategoryName = "Modules Issue" in {
9915 def err_module_decl_in_module_map_module : Error<
9916   "'module' declaration found while building module from module map">;
9917 def err_module_decl_in_header_module : Error<
9918   "'module' declaration found while building header unit">;
9919 def err_module_interface_implementation_mismatch : Error<
9920   "missing 'export' specifier in module declaration while "
9921   "building module interface">;
9922 def err_current_module_name_mismatch : Error<
9923   "module name '%0' specified on command line does not match name of module">;
9924 def err_module_redefinition : Error<
9925   "redefinition of module '%0'">;
9926 def note_prev_module_definition : Note<"previously defined here">;
9927 def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
9928 def err_module_not_defined : Error<
9929   "definition of module '%0' is not available; use -fmodule-file= to specify "
9930   "path to precompiled module interface">;
9931 def err_module_redeclaration : Error<
9932   "translation unit contains multiple module declarations">;
9933 def note_prev_module_declaration : Note<"previous module declaration is here">;
9934 def err_module_declaration_missing : Error<
9935   "missing 'export module' declaration in module interface unit">;
9936 def err_module_declaration_missing_after_global_module_introducer : Error<
9937   "missing 'module' declaration at end of global module fragment "
9938   "introduced here">;
9939 def err_module_private_specialization : Error<
9940   "%select{template|partial|member}0 specialization cannot be "
9941   "declared __module_private__">;
9942 def err_module_private_local : Error<
9943   "%select{local variable|parameter|typedef}0 %1 cannot be declared "
9944   "__module_private__">;
9945 def err_module_private_local_class : Error<
9946   "local %select{struct|interface|union|class|enum}0 cannot be declared "
9947   "__module_private__">;
9948 def err_module_unimported_use : Error<
9949   "%select{declaration|definition|default argument|"
9950   "explicit specialization|partial specialization}0 of %1 must be imported "
9951   "from module '%2' before it is required">;
9952 def err_module_unimported_use_header : Error<
9953   "missing '#include %3'; "
9954   "%select{declaration|definition|default argument|"
9955   "explicit specialization|partial specialization}0 of %1 must be imported "
9956   "from module '%2' before it is required">;
9957 def err_module_unimported_use_global_module_fragment : Error<
9958   "%select{missing '#include'|missing '#include %3'}2; "
9959   "%select{||default argument of |explicit specialization of |"
9960   "partial specialization of }0%1 must be "
9961   "%select{declared|defined|defined|declared|declared}0 "
9962   "before it is used">;
9963 def err_module_unimported_use_multiple : Error<
9964   "%select{declaration|definition|default argument|"
9965   "explicit specialization|partial specialization}0 of %1 must be imported "
9966   "from one of the following modules before it is required:%2">;
9967 def ext_module_import_in_extern_c : ExtWarn<
9968   "import of C++ module '%0' appears within extern \"C\" language linkage "
9969   "specification">, DefaultError,
9970   InGroup<DiagGroup<"module-import-in-extern-c">>;
9971 def err_module_import_not_at_top_level_fatal : Error<
9972   "import of module '%0' appears within %1">, DefaultFatal;
9973 def ext_module_import_not_at_top_level_noop : ExtWarn<
9974   "redundant #include of module '%0' appears within %1">, DefaultError,
9975   InGroup<DiagGroup<"modules-import-nested-redundant">>;
9976 def note_module_import_not_at_top_level : Note<"%0 begins here">;
9977 def err_module_self_import : Error<
9978   "import of module '%0' appears within same top-level module '%1'">;
9979 def err_module_import_in_implementation : Error<
9980   "@import of module '%0' in implementation of '%1'; use #import">;
9981
9982 // C++ Modules
9983 def err_module_decl_not_at_start : Error<
9984   "module declaration must occur at the start of the translation unit">;
9985 def note_global_module_introducer_missing : Note<
9986   "add 'module;' to the start of the file to introduce a "
9987   "global module fragment">;
9988 def err_export_within_anonymous_namespace : Error<
9989   "export declaration appears within anonymous namespace">;
9990 def note_anonymous_namespace : Note<"anonymous namespace begins here">;
9991 def ext_export_no_name_block : ExtWarn<
9992   "ISO C++20 does not permit %select{an empty|a static_assert}0 declaration "
9993   "to appear in an export block">, InGroup<ExportUnnamed>;
9994 def ext_export_no_names : ExtWarn<
9995   "ISO C++20 does not permit a declaration that does not introduce any names "
9996   "to be exported">, InGroup<ExportUnnamed>;
9997 def note_export : Note<"export block begins here">;
9998 def err_export_no_name : Error<
9999   "%select{empty|static_assert|asm}0 declaration cannot be exported">;
10000 def ext_export_using_directive : ExtWarn<
10001   "ISO C++20 does not permit using directive to be exported">,
10002   InGroup<DiagGroup<"export-using-directive">>;
10003 def err_export_within_export : Error<
10004   "export declaration appears within another export declaration">;
10005 def err_export_internal : Error<
10006   "declaration of %0 with internal linkage cannot be exported">;
10007 def err_export_using_internal : Error<
10008   "using declaration referring to %0 with internal linkage cannot be exported">;
10009 def err_export_not_in_module_interface : Error<
10010   "export declaration can only be used within a module interface unit"
10011   "%select{ after the module declaration|}0">;
10012 def err_export_in_private_module_fragment : Error<
10013   "export declaration cannot be used in a private module fragment">;
10014 def note_private_module_fragment : Note<
10015   "private module fragment begins here">;
10016 def err_private_module_fragment_not_module : Error<
10017   "private module fragment declaration with no preceding module declaration">;
10018 def err_private_module_fragment_redefined : Error<
10019   "private module fragment redefined">;
10020 def err_private_module_fragment_not_module_interface : Error<
10021   "private module fragment in module implementation unit">;
10022 def note_not_module_interface_add_export : Note<
10023   "add 'export' here if this is intended to be a module interface unit">;
10024
10025 def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
10026   "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
10027   InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
10028 def note_equivalent_internal_linkage_decl : Note<
10029   "declared here%select{ in module '%1'|}0">;
10030
10031 def note_redefinition_modules_same_file : Note<
10032   "'%0' included multiple times, additional include site in header from module '%1'">;
10033 def note_redefinition_include_same_file : Note<
10034   "'%0' included multiple times, additional include site here">;
10035 }
10036
10037 let CategoryName = "Coroutines Issue" in {
10038 def err_return_in_coroutine : Error<
10039   "return statement not allowed in coroutine; did you mean 'co_return'?">;
10040 def note_declared_coroutine_here : Note<
10041   "function is a coroutine due to use of '%0' here">;
10042 def err_coroutine_objc_method : Error<
10043   "Objective-C methods as coroutines are not yet supported">;
10044 def err_coroutine_unevaluated_context : Error<
10045   "'%0' cannot be used in an unevaluated context">;
10046 def err_coroutine_within_handler : Error<
10047   "'%0' cannot be used in the handler of a try block">;
10048 def err_coroutine_outside_function : Error<
10049   "'%0' cannot be used outside a function">;
10050 def err_coroutine_invalid_func_context : Error<
10051   "'%1' cannot be used in %select{a constructor|a destructor"
10052   "|the 'main' function|a constexpr function"
10053   "|a function with a deduced return type|a varargs function"
10054   "|a consteval function}0">;
10055 def err_implied_coroutine_type_not_found : Error<
10056   "%0 type was not found; include <experimental/coroutine> before defining "
10057   "a coroutine">;
10058 def err_implicit_coroutine_std_nothrow_type_not_found : Error<
10059   "std::nothrow was not found; include <new> before defining a coroutine which "
10060   "uses get_return_object_on_allocation_failure()">;
10061 def err_malformed_std_nothrow : Error<
10062   "std::nothrow must be a valid variable declaration">;
10063 def err_malformed_std_coroutine_handle : Error<
10064   "std::experimental::coroutine_handle must be a class template">;
10065 def err_coroutine_handle_missing_member : Error<
10066   "std::experimental::coroutine_handle missing a member named '%0'">;
10067 def err_malformed_std_coroutine_traits : Error<
10068   "'std::experimental::coroutine_traits' must be a class template">;
10069 def err_implied_std_coroutine_traits_promise_type_not_found : Error<
10070   "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
10071 def err_implied_std_coroutine_traits_promise_type_not_class : Error<
10072   "this function cannot be a coroutine: %0 is not a class">;
10073 def err_coroutine_promise_type_incomplete : Error<
10074   "this function cannot be a coroutine: %0 is an incomplete type">;
10075 def err_coroutine_type_missing_specialization : Error<
10076   "this function cannot be a coroutine: missing definition of "
10077   "specialization %0">;
10078 def err_coroutine_promise_incompatible_return_functions : Error<
10079   "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
10080 def err_coroutine_promise_requires_return_function : Error<
10081   "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
10082 def note_coroutine_promise_implicit_await_transform_required_here : Note<
10083   "call to 'await_transform' implicitly required by 'co_await' here">;
10084 def note_coroutine_promise_suspend_implicitly_required : Note<
10085   "call to '%select{initial_suspend|final_suspend}0' implicitly "
10086   "required by the %select{initial suspend point|final suspend point}0">;
10087 def err_coroutine_promise_unhandled_exception_required : Error<
10088   "%0 is required to declare the member 'unhandled_exception()'">;
10089 def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
10090   "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
10091   InGroup<CoroutineMissingUnhandledException>;
10092 def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
10093   "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
10094 def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
10095   "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
10096 def err_coroutine_promise_new_requires_nothrow : Error<
10097   "%0 is required to have a non-throwing noexcept specification when the promise "
10098    "type declares 'get_return_object_on_allocation_failure()'">;
10099 def note_coroutine_promise_call_implicitly_required : Note<
10100   "call to %0 implicitly required by coroutine function here">;
10101 def err_await_suspend_invalid_return_type : Error<
10102   "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
10103 >;
10104 def note_await_ready_no_bool_conversion : Note<
10105   "return type of 'await_ready' is required to be contextually convertible to 'bool'"
10106 >;
10107 }
10108
10109 let CategoryName = "Documentation Issue" in {
10110 def warn_not_a_doxygen_trailing_member_comment : Warning<
10111   "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
10112 } // end of documentation issue category
10113
10114 let CategoryName = "Nullability Issue" in {
10115
10116 def warn_mismatched_nullability_attr : Warning<
10117   "nullability specifier %0 conflicts with existing specifier %1">,
10118   InGroup<Nullability>;
10119
10120 def warn_nullability_declspec : Warning<
10121   "nullability specifier %0 cannot be applied "
10122   "to non-pointer type %1; did you mean to apply the specifier to the "
10123   "%select{pointer|block pointer|member pointer|function pointer|"
10124   "member function pointer}2?">,
10125   InGroup<NullabilityDeclSpec>,
10126   DefaultError;
10127
10128 def note_nullability_here : Note<"%0 specified here">;
10129
10130 def err_nullability_nonpointer : Error<
10131   "nullability specifier %0 cannot be applied to non-pointer type %1">;
10132
10133 def warn_nullability_lost : Warning<
10134   "implicit conversion from nullable pointer %0 to non-nullable pointer "
10135   "type %1">,
10136   InGroup<NullableToNonNullConversion>, DefaultIgnore;
10137 def warn_zero_as_null_pointer_constant : Warning<
10138   "zero as null pointer constant">,
10139   InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
10140
10141 def err_nullability_cs_multilevel : Error<
10142   "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
10143 def note_nullability_type_specifier : Note<
10144   "use nullability type specifier %0 to affect the innermost "
10145   "pointer type of %1">;
10146
10147 def warn_null_resettable_setter : Warning<
10148   "synthesized setter %0 for null_resettable property %1 does not handle nil">,
10149   InGroup<Nullability>;
10150
10151 def warn_nullability_missing : Warning<
10152   "%select{pointer|block pointer|member pointer}0 is missing a nullability "
10153   "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
10154   InGroup<NullabilityCompleteness>;
10155 def warn_nullability_missing_array : Warning<
10156   "array parameter is missing a nullability type specifier (_Nonnull, "
10157   "_Nullable, or _Null_unspecified)">,
10158   InGroup<NullabilityCompletenessOnArrays>;
10159 def note_nullability_fix_it : Note<
10160   "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
10161   "%select{pointer|block pointer|member pointer|array parameter}1 "
10162   "%select{should never be null|may be null|should not declare nullability}0">;
10163
10164 def warn_nullability_inferred_on_nested_type : Warning<
10165   "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
10166   "deprecated">,
10167   InGroup<NullabilityInferredOnNestedType>;
10168
10169 def err_objc_type_arg_explicit_nullability : Error<
10170   "type argument %0 cannot explicitly specify nullability">;
10171
10172 def err_objc_type_param_bound_explicit_nullability : Error<
10173   "type parameter %0 bound %1 cannot explicitly specify nullability">;
10174
10175 }
10176
10177 let CategoryName = "Generics Issue" in {
10178
10179 def err_objc_type_param_bound_nonobject : Error<
10180   "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
10181
10182 def err_objc_type_param_bound_missing_pointer : Error<
10183   "missing '*' in type bound %0 for type parameter %1">;
10184 def err_objc_type_param_bound_qualified : Error<
10185   "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
10186
10187 def err_objc_type_param_redecl : Error<
10188   "redeclaration of type parameter %0">;
10189
10190 def err_objc_type_param_arity_mismatch : Error<
10191   "%select{forward class declaration|class definition|category|extension}0 has "
10192   "too %select{few|many}1 type parameters (expected %2, have %3)">;
10193
10194 def err_objc_type_param_bound_conflict : Error<
10195   "type bound %0 for type parameter %1 conflicts with "
10196   "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
10197
10198 def err_objc_type_param_variance_conflict : Error<
10199   "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
10200   "%select{in|co|contra}2variant type parameter %3">;
10201
10202 def note_objc_type_param_here : Note<"type parameter %0 declared here">;
10203
10204 def err_objc_type_param_bound_missing : Error<
10205   "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
10206
10207 def err_objc_parameterized_category_nonclass : Error<
10208   "%select{extension|category}0 of non-parameterized class %1 cannot have type "
10209   "parameters">;
10210
10211 def err_objc_parameterized_forward_class : Error<
10212   "forward declaration of non-parameterized class %0 cannot have type "
10213   "parameters">;
10214
10215 def err_objc_parameterized_forward_class_first : Error<
10216   "class %0 previously declared with type parameters">;
10217
10218 def err_objc_type_arg_missing_star : Error<
10219   "type argument %0 must be a pointer (requires a '*')">;
10220 def err_objc_type_arg_qualified : Error<
10221   "type argument %0 cannot be qualified with '%1'">;
10222
10223 def err_objc_type_arg_missing : Error<
10224   "no type or protocol named %0">;
10225
10226 def err_objc_type_args_and_protocols : Error<
10227   "angle brackets contain both a %select{type|protocol}0 (%1) and a "
10228   "%select{protocol|type}0 (%2)">;
10229
10230 def err_objc_type_args_non_class : Error<
10231   "type arguments cannot be applied to non-class type %0">;
10232
10233 def err_objc_type_args_non_parameterized_class : Error<
10234   "type arguments cannot be applied to non-parameterized class %0">;
10235
10236 def err_objc_type_args_specialized_class : Error<
10237   "type arguments cannot be applied to already-specialized class type %0">;
10238
10239 def err_objc_type_args_wrong_arity : Error<
10240   "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
10241 }
10242
10243 def err_objc_type_arg_not_id_compatible : Error<
10244   "type argument %0 is neither an Objective-C object nor a block type">;
10245
10246 def err_objc_type_arg_does_not_match_bound : Error<
10247   "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
10248
10249 def warn_objc_redundant_qualified_class_type : Warning<
10250   "parameterized class %0 already conforms to the protocols listed; did you "
10251   "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
10252
10253 def warn_block_literal_attributes_on_omitted_return_type : Warning<
10254   "attribute %0 ignored, because it cannot be applied to omitted return type">,
10255   InGroup<IgnoredAttributes>;
10256
10257 def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
10258   "'%0' qualifier on omitted return type %1 has no effect">,
10259   InGroup<IgnoredQualifiers>;
10260
10261 def warn_shadow_field : Warning<
10262   "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
10263   "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
10264 def note_shadow_field : Note<"declared here">;
10265
10266 def err_multiversion_required_in_redecl : Error<
10267   "function declaration is missing %select{'target'|'cpu_specific' or "
10268   "'cpu_dispatch'}0 attribute in a multiversioned function">;
10269 def note_multiversioning_caused_here : Note<
10270   "function multiversioning caused by this declaration">;
10271 def err_multiversion_after_used : Error<
10272   "function declaration cannot become a multiversioned function after first "
10273   "usage">;
10274 def err_bad_multiversion_option : Error<
10275   "function multiversioning doesn't support %select{feature|architecture}0 "
10276   "'%1'">;
10277 def err_multiversion_duplicate : Error<
10278   "multiversioned function redeclarations require identical target attributes">;
10279 def err_multiversion_noproto : Error<
10280   "multiversioned function must have a prototype">;
10281 def err_multiversion_no_other_attrs : Error<
10282   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
10283   " with other attributes">;
10284 def err_multiversion_diff : Error<
10285   "multiversioned function declaration has a different %select{calling convention"
10286   "|return type|constexpr specification|inline specification|storage class|"
10287   "linkage}0">;
10288 def err_multiversion_doesnt_support : Error<
10289   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
10290   "yet support %select{function templates|virtual functions|"
10291   "deduced return types|constructors|destructors|deleted functions|"
10292   "defaulted functions|constexpr functions|consteval function}1">;
10293 def err_multiversion_not_allowed_on_main : Error<
10294   "'main' cannot be a multiversioned function">;
10295 def err_multiversion_not_supported : Error<
10296  "function multiversioning is not supported on the current target">;
10297 def err_multiversion_types_mixed : Error<
10298   "multiversioning attributes cannot be combined">;
10299 def err_cpu_dispatch_mismatch : Error<
10300  "'cpu_dispatch' function redeclared with different CPUs">;
10301 def err_cpu_specific_multiple_defs : Error<
10302  "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
10303 def warn_multiversion_duplicate_entries : Warning<
10304  "CPU list contains duplicate entries; attribute ignored">,
10305   InGroup<FunctionMultiVersioning>;
10306 def warn_dispatch_body_ignored : Warning<
10307   "body of cpu_dispatch function will be ignored">,
10308   InGroup<FunctionMultiVersioning>;
10309
10310 // three-way comparison operator diagnostics
10311 def err_implied_comparison_category_type_not_found : Error<
10312   "cannot %select{use builtin operator '<=>'|default 'operator<=>'}1 "
10313   "because type '%0' was not found; include <compare>">;
10314 def err_spaceship_argument_narrowing : Error<
10315   "argument to 'operator<=>' "
10316   "%select{cannot be narrowed from type %1 to %2|"
10317   "evaluates to %1, which cannot be narrowed to type %2}0">;
10318 def err_std_compare_type_not_supported : Error<
10319   "standard library implementation of %0 is not supported; "
10320    "%select{member '%2' does not have expected form|"
10321    "member '%2' is missing|"
10322    "the type is not trivially copyable|"
10323    "the type does not have the expected form}1">;
10324 def note_rewriting_operator_as_spaceship : Note<
10325   "while rewriting comparison as call to 'operator<=>' declared here">;
10326 def err_three_way_vector_comparison : Error<
10327   "three-way comparison between vectors is not supported">;
10328
10329 // Memory Tagging Extensions (MTE) diagnostics
10330 def err_memtag_arg_null_or_pointer : Error<
10331   "%0 argument of MTE builtin function must be a null or a pointer (%1 invalid)">;
10332 def err_memtag_any2arg_pointer : Error<
10333   "at least one argument of MTE builtin function must be a pointer (%0, %1 invalid)">;
10334 def err_memtag_arg_must_be_pointer : Error<
10335   "%0 argument of MTE builtin function must be a pointer (%1 invalid)">;
10336 def err_memtag_arg_must_be_integer : Error<
10337   "%0 argument of MTE builtin function must be an integer type (%1 invalid)">;
10338
10339 def warn_dereference_of_noderef_type : Warning<
10340   "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
10341 def warn_dereference_of_noderef_type_no_decl : Warning<
10342   "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
10343 def warn_noderef_on_non_pointer_or_array : Warning<
10344   "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
10345 def warn_noderef_to_dereferenceable_pointer : Warning<
10346   "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
10347
10348 def err_builtin_launder_invalid_arg : Error<
10349   "%select{non-pointer|function pointer|void pointer}0 argument to "
10350   "'__builtin_launder' is not allowed">;
10351
10352 def err_preserve_field_info_not_field : Error<
10353   "__builtin_preserve_field_info argument %0 not a field access">;
10354 def err_preserve_field_info_not_const: Error<
10355   "__builtin_preserve_field_info argument %0 not a constant">;
10356
10357 def err_bit_cast_non_trivially_copyable : Error<
10358   "__builtin_bit_cast %select{source|destination}0 type must be trivially copyable">;
10359 def err_bit_cast_type_size_mismatch : Error<
10360   "__builtin_bit_cast source size does not equal destination size (%0 vs %1)">;
10361
10362 // SYCL-specific diagnostics
10363 def warn_sycl_kernel_num_of_template_params : Warning<
10364   "'sycl_kernel' attribute only applies to a function template with at least"
10365   " two template parameters">, InGroup<IgnoredAttributes>;
10366 def warn_sycl_kernel_invalid_template_param_type : Warning<
10367   "template parameter of a function template with the 'sycl_kernel' attribute"
10368   " cannot be a non-type template parameter">, InGroup<IgnoredAttributes>;
10369 def warn_sycl_kernel_num_of_function_params : Warning<
10370   "function template with 'sycl_kernel' attribute must have a single parameter">,
10371   InGroup<IgnoredAttributes>;
10372 def warn_sycl_kernel_return_type : Warning<
10373   "function template with 'sycl_kernel' attribute must have a 'void' return type">,
10374   InGroup<IgnoredAttributes>;
10375
10376 } // end of sema component.