]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/DiagnosticSemaKinds.td
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / DiagnosticSemaKinds.td
1 //==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 //===----------------------------------------------------------------------===//
11 // Semantic Analysis
12 //===----------------------------------------------------------------------===//
13
14 let Component = "Sema" in {
15 let CategoryName = "Semantic Issue" in {
16
17 def note_previous_decl : Note<"%0 declared here">;
18 def note_entity_declared_at : Note<"%0 declared here">;
19 def note_callee_decl : Note<"%0 declared here">;
20 def note_defined_here : Note<"%0 defined here">;
21
22 // For loop analysis
23 def warn_variables_not_in_loop_body : Warning<
24   "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
25   "used in loop condition not modified in loop body">,
26   InGroup<ForLoopAnalysis>, DefaultIgnore;
27 def warn_redundant_loop_iteration : Warning<
28   "variable %0 is %select{decremented|incremented}1 both in the loop header "
29   "and in the loop body">,
30   InGroup<ForLoopAnalysis>, DefaultIgnore;
31 def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
32
33 def warn_duplicate_enum_values : Warning<
34   "element %0 has been implicitly assigned %1 which another element has "
35   "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
36 def note_duplicate_element : Note<"element %0 also has value %1">;
37
38 // Absolute value functions
39 def warn_unsigned_abs : Warning<
40   "taking the absolute value of unsigned type %0 has no effect">,
41   InGroup<AbsoluteValue>;
42 def note_remove_abs : Note<
43   "remove the call to '%0' since unsigned values cannot be negative">;
44 def warn_abs_too_small : Warning<
45   "absolute value function %0 given an argument of type %1 but has parameter "
46   "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
47 def warn_wrong_absolute_value_type : Warning<
48   "using %select{integer|floating point|complex}1 absolute value function %0 "
49   "when argument is of %select{integer|floating point|complex}2 type">,
50   InGroup<AbsoluteValue>;
51 def note_replace_abs_function : Note<"use function '%0' instead">;
52 def warn_pointer_abs : Warning<
53   "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
54   InGroup<AbsoluteValue>;
55
56 def warn_max_unsigned_zero : Warning<
57   "taking the max of "
58   "%select{a value and unsigned zero|unsigned zero and a value}0 "
59   "is always equal to the other value">,
60   InGroup<MaxUnsignedZero>;
61 def note_remove_max_call : Note<
62   "remove call to max function and unsigned zero argument">;
63
64 def warn_infinite_recursive_function : Warning<
65   "all paths through this function will call itself">,
66   InGroup<InfiniteRecursion>, DefaultIgnore;
67
68 def warn_comma_operator : Warning<"possible misuse of comma operator here">,
69   InGroup<DiagGroup<"comma">>, DefaultIgnore;
70 def note_cast_to_void : Note<"cast expression to void to silence warning">;
71
72 // Constant expressions
73 def err_expr_not_ice : Error<
74   "expression is not an %select{integer|integral}0 constant expression">;
75 def ext_expr_not_ice : Extension<
76   "expression is not an %select{integer|integral}0 constant expression; "
77   "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
78 def err_typecheck_converted_constant_expression : Error<
79   "value of type %0 is not implicitly convertible to %1">;
80 def err_typecheck_converted_constant_expression_disallowed : Error<
81   "conversion from %0 to %1 is not allowed in a converted constant expression">;
82 def err_typecheck_converted_constant_expression_indirect : Error<
83   "conversion from %0 to %1 in converted constant expression would "
84   "bind reference to a temporary">;
85 def err_expr_not_cce : Error<
86   "%select{case value|enumerator value|non-type template argument|"
87   "array size|constexpr if condition}0 "
88   "is not a constant expression">;
89 def ext_cce_narrowing : ExtWarn<
90   "%select{case value|enumerator value|non-type template argument|"
91   "array size|constexpr if condition}0 "
92   "%select{cannot be narrowed from type %2 to %3|"
93   "evaluates to %2, which cannot be narrowed to type %3}1">,
94   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
95 def err_ice_not_integral : Error<
96   "integral constant expression must have integral or unscoped enumeration "
97   "type, not %0">;
98 def err_ice_incomplete_type : Error<
99   "integral constant expression has incomplete class type %0">;
100 def err_ice_explicit_conversion : Error<
101   "integral constant expression requires explicit conversion from %0 to %1">;
102 def note_ice_conversion_here : Note<
103   "conversion to %select{integral|enumeration}0 type %1 declared here">;
104 def err_ice_ambiguous_conversion : Error<
105   "ambiguous conversion from type %0 to an integral or unscoped "
106   "enumeration type">;
107 def err_ice_too_large : Error<
108   "integer constant expression evaluates to value %0 that cannot be "
109   "represented in a %1-bit %select{signed|unsigned}2 integer type">;
110 def err_expr_not_string_literal : Error<"expression is not a string literal">;
111
112 // Semantic analysis of constant literals.
113 def ext_predef_outside_function : Warning<
114   "predefined identifier is only valid inside function">,
115   InGroup<DiagGroup<"predefined-identifier-outside-function">>;
116 def warn_float_overflow : Warning<
117   "magnitude of floating-point constant too large for type %0; maximum is %1">,
118    InGroup<LiteralRange>;
119 def warn_float_underflow : Warning<
120   "magnitude of floating-point constant too small for type %0; minimum is %1">,
121   InGroup<LiteralRange>;
122 def warn_double_const_requires_fp64 : Warning<
123   "double precision constant requires cl_khr_fp64, casting to single precision">;
124 def err_half_const_requires_fp16 : Error<
125   "half precision constant requires cl_khr_fp16">;
126
127 // C99 variable-length arrays
128 def ext_vla : Extension<"variable length arrays are a C99 feature">,
129   InGroup<VLAExtension>;
130 def warn_vla_used : Warning<"variable length array used">,
131   InGroup<VLA>, DefaultIgnore;
132 def err_vla_in_sfinae : Error<
133   "variable length array cannot be formed during template argument deduction">;
134 def err_array_star_in_function_definition : Error<
135   "variable length array must be bound in function definition">;
136 def err_vla_decl_in_file_scope : Error<
137   "variable length array declaration not allowed at file scope">;
138 def err_vla_decl_has_static_storage : Error<
139   "variable length array declaration cannot have 'static' storage duration">;
140 def err_vla_decl_has_extern_linkage : Error<
141   "variable length array declaration cannot have 'extern' linkage">;
142 def ext_vla_folded_to_constant : Extension<
143   "variable length array folded to constant array as an extension">, InGroup<GNUFoldingConstant>;
144 def err_vla_unsupported : Error<
145   "variable length arrays are not supported for the current target">;
146 def note_vla_unsupported : Note<
147   "variable length arrays are not supported for the current target">;
148
149 // C99 variably modified types
150 def err_variably_modified_template_arg : Error<
151   "variably modified type %0 cannot be used as a template argument">;
152 def err_variably_modified_nontype_template_param : Error<
153   "non-type template parameter of variably modified type %0">;
154 def err_variably_modified_new_type : Error<
155   "'new' cannot allocate object of variably modified type %0">;
156
157 // C99 Designated Initializers
158 def ext_designated_init : Extension<
159   "designated initializers are a C99 feature">, InGroup<C99>;
160 def err_array_designator_negative : Error<
161   "array designator value '%0' is negative">;
162 def err_array_designator_empty_range : Error<
163   "array designator range [%0, %1] is empty">;
164 def err_array_designator_non_array : Error<
165   "array designator cannot initialize non-array type %0">;
166 def err_array_designator_too_large : Error<
167   "array designator index (%0) exceeds array bounds (%1)">;
168 def err_field_designator_non_aggr : Error<
169   "field designator cannot initialize a "
170   "%select{non-struct, non-union|non-class}0 type %1">;
171 def err_field_designator_unknown : Error<
172   "field designator %0 does not refer to any field in type %1">;
173 def err_field_designator_nonfield : Error<
174   "field designator %0 does not refer to a non-static data member">;
175 def note_field_designator_found : Note<"field designator refers here">;
176 def err_designator_for_scalar_init : Error<
177   "designator in initializer for scalar type %0">;
178 def warn_subobject_initializer_overrides : Warning<
179   "subobject initialization overrides initialization of other fields "
180   "within its enclosing subobject">, InGroup<InitializerOverrides>;
181 def warn_initializer_overrides : Warning<
182   "initializer overrides prior initialization of this subobject">,
183   InGroup<InitializerOverrides>;
184 def note_previous_initializer : Note<
185   "previous initialization %select{|with side effects }0is here"
186   "%select{| (side effects may 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 // Declarations.
195 def ext_plain_complex : ExtWarn<
196   "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
197 def ext_imaginary_constant : Extension<
198   "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
199 def ext_integer_complex : Extension<
200   "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
201
202 def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
203   "'_Fract' or '_Accum', not '%0'">;
204 def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
205 def err_invalid_width_spec : Error<
206   "'%select{|short|long|long long}0 %1' is invalid">;
207 def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
208
209 def ext_auto_type_specifier : ExtWarn<
210   "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
211 def warn_auto_storage_class : Warning<
212   "'auto' storage class specifier is redundant and incompatible with C++11">,
213   InGroup<CXX11Compat>, DefaultIgnore;
214
215 def warn_deprecated_register : Warning<
216   "'register' storage class specifier is deprecated "
217   "and incompatible with C++17">, InGroup<DeprecatedRegister>;
218 def ext_register_storage_class : ExtWarn<
219   "ISO C++17 does not allow 'register' storage class specifier">,
220   DefaultError, InGroup<Register>;
221
222 def err_invalid_decl_spec_combination : Error<
223   "cannot combine with previous '%0' declaration specifier">;
224 def err_invalid_vector_decl_spec_combination : Error<
225   "cannot combine with previous '%0' declaration specifier. "
226   "'__vector' must be first">;
227 def err_invalid_pixel_decl_spec_combination : Error<
228   "'__pixel' must be preceded by '__vector'.  "
229   "'%0' declaration specifier not allowed here">;
230 def err_invalid_vector_bool_decl_spec : Error<
231   "cannot use '%0' with '__vector bool'">;
232 def err_invalid_vector_long_decl_spec : Error<
233   "cannot use 'long' with '__vector'">;
234 def err_invalid_vector_float_decl_spec : Error<
235   "cannot use 'float' with '__vector'">;
236 def err_invalid_vector_double_decl_spec : Error <
237   "use of 'double' with '__vector' requires VSX support to be enabled "
238   "(available on POWER7 or later)">;
239 def err_invalid_vector_long_long_decl_spec : Error <
240   "use of 'long long' with '__vector bool' requires VSX support (available on "
241   "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
242   "to be enabled">;
243 def err_invalid_vector_long_double_decl_spec : Error<
244   "cannot use 'long double' with '__vector'">;
245 def warn_vector_long_decl_spec_combination : Warning<
246   "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
247
248 def err_redeclaration_different_type : Error<
249   "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
250 def err_bad_variable_name : Error<
251   "%0 cannot be the name of a variable or data member">;
252 def err_bad_parameter_name : Error<
253   "%0 cannot be the name of a parameter">;
254 def err_parameter_name_omitted : Error<"parameter name omitted">;
255 def err_anyx86_interrupt_attribute : Error<
256   "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
257   "have %select{a 'void' return type|"
258   "only a pointer parameter optionally followed by an integer parameter|"
259   "a pointer as the first parameter|a %2 type as the second parameter}1">;
260 def err_anyx86_interrupt_called : Error<
261   "interrupt service routine cannot be called directly">;
262 def warn_arm_interrupt_calling_convention : Warning<
263    "call to function without interrupt attribute could clobber interruptee's VFP registers">,
264    InGroup<Extra>;
265 def warn_mips_interrupt_attribute : Warning<
266    "MIPS 'interrupt' attribute only applies to functions that have "
267    "%select{no parameters|a 'void' return type}0">,
268    InGroup<IgnoredAttributes>;
269 def warn_riscv_repeated_interrupt_attribute : Warning<
270   "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
271 def note_riscv_repeated_interrupt_attribute : Note<
272   "repeated RISC-V 'interrupt' attribute is here">;
273 def warn_riscv_interrupt_attribute : Warning<
274    "RISC-V 'interrupt' attribute only applies to functions that have "
275    "%select{no parameters|a 'void' return type}0">,
276    InGroup<IgnoredAttributes>;
277 def warn_msp430_interrupt_attribute : Warning<
278    "MSP430 'interrupt' attribute only applies to functions that have "
279    "%select{no parameters|a 'void' return type}0">,
280    InGroup<IgnoredAttributes>;
281 def warn_unused_parameter : Warning<"unused parameter %0">,
282   InGroup<UnusedParameter>, DefaultIgnore;
283 def warn_unused_variable : Warning<"unused variable %0">,
284   InGroup<UnusedVariable>, DefaultIgnore;
285 def warn_unused_local_typedef : Warning<
286   "unused %select{typedef|type alias}0 %1">,
287   InGroup<UnusedLocalTypedef>, DefaultIgnore;
288 def warn_unused_property_backing_ivar :
289   Warning<"ivar %0 which backs the property is not "
290   "referenced in this property's accessor">,
291   InGroup<UnusedPropertyIvar>, DefaultIgnore;
292 def warn_unused_const_variable : Warning<"unused variable %0">,
293   InGroup<UnusedConstVariable>, DefaultIgnore;
294 def warn_unused_exception_param : Warning<"unused exception parameter %0">,
295   InGroup<UnusedExceptionParameter>, DefaultIgnore;
296 def warn_decl_in_param_list : Warning<
297   "declaration of %0 will not be visible outside of this function">,
298   InGroup<Visibility>;
299 def warn_redefinition_in_param_list : Warning<
300   "redefinition of %0 will not be visible outside of this function">,
301   InGroup<Visibility>;
302 def warn_empty_parens_are_function_decl : Warning<
303   "empty parentheses interpreted as a function declaration">,
304   InGroup<VexingParse>;
305 def warn_parens_disambiguated_as_function_declaration : Warning<
306   "parentheses were disambiguated as a function declaration">,
307   InGroup<VexingParse>;
308 def warn_parens_disambiguated_as_variable_declaration : Warning<
309   "parentheses were disambiguated as redundant parentheses around declaration "
310   "of variable named %0">, InGroup<VexingParse>;
311 def warn_redundant_parens_around_declarator : Warning<
312   "redundant parentheses surrounding declarator">,
313   InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
314 def note_additional_parens_for_variable_declaration : Note<
315   "add a pair of parentheses to declare a variable">;
316 def note_raii_guard_add_name : Note<
317   "add a variable name to declare a %0 initialized with %1">;
318 def note_function_style_cast_add_parentheses : Note<
319   "add enclosing parentheses to perform a function-style cast">;
320 def note_remove_parens_for_variable_declaration : Note<
321   "remove parentheses to silence this warning">;
322 def note_empty_parens_function_call : Note<
323   "change this ',' to a ';' to call %0">;
324 def note_empty_parens_default_ctor : Note<
325   "remove parentheses to declare a variable">;
326 def note_empty_parens_zero_initialize : Note<
327   "replace parentheses with an initializer to declare a variable">;
328 def warn_unused_function : Warning<"unused function %0">,
329   InGroup<UnusedFunction>, DefaultIgnore;
330 def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
331   InGroup<UnusedTemplate>, DefaultIgnore;
332 def warn_unused_member_function : Warning<"unused member function %0">,
333   InGroup<UnusedMemberFunction>, DefaultIgnore;
334 def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
335   InGroup<UsedButMarkedUnused>, DefaultIgnore;
336 def warn_unneeded_internal_decl : Warning<
337   "%select{function|variable}0 %1 is not needed and will not be emitted">,
338   InGroup<UnneededInternalDecl>, DefaultIgnore;
339 def warn_unneeded_static_internal_decl : Warning<
340   "'static' function %0 declared in header file "
341   "should be declared 'static inline'">,
342   InGroup<UnneededInternalDecl>, DefaultIgnore;
343 def warn_unneeded_member_function : Warning<
344   "member function %0 is not needed and will not be emitted">,
345   InGroup<UnneededMemberFunction>, DefaultIgnore;
346 def warn_unused_private_field: Warning<"private field %0 is not used">,
347   InGroup<UnusedPrivateField>, DefaultIgnore;
348 def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
349   "%select{used|required to be captured for this use}1">,
350   InGroup<UnusedLambdaCapture>, DefaultIgnore;
351
352 def warn_parameter_size: Warning<
353   "%0 is a large (%1 bytes) pass-by-value argument; "
354   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
355 def warn_return_value_size: Warning<
356   "return value of %0 is a large (%1 bytes) pass-by-value object; "
357   "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
358 def warn_return_value_udt: Warning<
359   "%0 has C-linkage specified, but returns user-defined type %1 which is "
360   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
361 def warn_return_value_udt_incomplete: Warning<
362   "%0 has C-linkage specified, but returns incomplete type %1 which could be "
363   "incompatible with C">, InGroup<ReturnTypeCLinkage>;
364 def warn_implicit_function_decl : Warning<
365   "implicit declaration of function %0">,
366   InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
367 def ext_implicit_function_decl : ExtWarn<
368   "implicit declaration of function %0 is invalid in C99">,
369   InGroup<ImplicitFunctionDeclare>;
370 def note_function_suggestion : Note<"did you mean %0?">;
371
372 def err_ellipsis_first_param : Error<
373   "ISO C requires a named parameter before '...'">;
374 def err_declarator_need_ident : Error<"declarator requires an identifier">;
375 def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
376 def err_language_linkage_spec_not_ascii : Error<
377   "string literal in language linkage specifier cannot have an "
378   "encoding-prefix">;
379 def ext_use_out_of_scope_declaration : ExtWarn<
380   "use of out-of-scope declaration of %0%select{| whose type is not "
381   "compatible with that of an implicit declaration}1">,
382   InGroup<DiagGroup<"out-of-scope-function">>;
383 def err_inline_non_function : Error<
384   "'inline' can only appear on functions%select{| and non-local variables}0">;
385 def err_noreturn_non_function : Error<
386   "'_Noreturn' can only appear on functions">;
387 def warn_qual_return_type : Warning<
388   "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
389   InGroup<IgnoredQualifiers>, DefaultIgnore;
390 def warn_deprecated_redundant_constexpr_static_def : Warning<
391   "out-of-line definition of constexpr static data member is redundant "
392   "in C++17 and is deprecated">,
393   InGroup<Deprecated>, DefaultIgnore;
394
395 def warn_decl_shadow :
396   Warning<"declaration shadows a %select{"
397           "local variable|"
398           "variable in %2|"
399           "static data member of %2|"
400           "field of %2|"
401           "typedef in %2|"
402           "type alias in %2}1">,
403   InGroup<Shadow>, DefaultIgnore;
404 def warn_decl_shadow_uncaptured_local :
405   Warning<warn_decl_shadow.Text>,
406   InGroup<ShadowUncapturedLocal>, DefaultIgnore;
407 def warn_ctor_parm_shadows_field:
408   Warning<"constructor parameter %0 shadows the field %1 of %2">,
409   InGroup<ShadowFieldInConstructor>, DefaultIgnore;
410 def warn_modifying_shadowing_decl :
411   Warning<"modifying constructor parameter %0 that shadows a "
412           "field of %1">,
413   InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
414
415 // C++ decomposition declarations
416 def err_decomp_decl_context : Error<
417   "decomposition declaration not permitted in this context">;
418 def warn_cxx14_compat_decomp_decl : Warning<
419   "decomposition declarations are incompatible with "
420   "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
421 def ext_decomp_decl : ExtWarn<
422   "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
423 def ext_decomp_decl_cond : ExtWarn<
424   "ISO C++17 does not permit structured binding declaration in a condition">,
425   InGroup<DiagGroup<"binding-in-condition">>;
426 def err_decomp_decl_spec : Error<
427   "decomposition declaration cannot be declared "
428   "%plural{1:'%1'|:with '%1' specifiers}0">;
429 def err_decomp_decl_type : Error<
430   "decomposition declaration cannot be declared with type %0; "
431   "declared type must be 'auto' or reference to 'auto'">;
432 def err_decomp_decl_parens : Error<
433   "decomposition declaration cannot be declared with parentheses">;
434 def err_decomp_decl_template : Error<
435   "decomposition declaration template not supported">;
436 def err_decomp_decl_not_alone : Error<
437   "decomposition declaration must be the only declaration in its group">;
438 def err_decomp_decl_requires_init : Error<
439   "decomposition declaration %0 requires an initializer">;
440 def err_decomp_decl_wrong_number_bindings : Error<
441   "type %0 decomposes into %2 elements, but %select{only |}3%1 "
442   "names were provided">;
443 def err_decomp_decl_unbindable_type : Error<
444   "cannot decompose %select{union|non-class, non-array}1 type %2">;
445 def err_decomp_decl_multiple_bases_with_members : Error<
446   "cannot decompose class type %1: "
447   "%select{its base classes %2 and|both it and its base class}0 %3 "
448   "have non-static data members">;
449 def err_decomp_decl_ambiguous_base : Error<
450   "cannot decompose members of ambiguous base class %1 of %0:%2">;
451 def err_decomp_decl_inaccessible_base : Error<
452   "cannot decompose members of inaccessible base class %1 of %0">,
453   AccessControl;
454 def err_decomp_decl_inaccessible_field : Error<
455   "cannot decompose %select{private|protected}0 member %1 of %3">,
456   AccessControl;
457 def err_decomp_decl_anon_union_member : Error<
458   "cannot decompose class type %0 because it has an anonymous "
459   "%select{struct|union}1 member">;
460 def err_decomp_decl_std_tuple_element_not_specialized : Error<
461   "cannot decompose this type; 'std::tuple_element<%0>::type' "
462   "does not name a type">;
463 def err_decomp_decl_std_tuple_size_not_constant : Error<
464   "cannot decompose this type; 'std::tuple_size<%0>::value' "
465   "is not a valid integral constant expression">;
466 def note_in_binding_decl_init : Note<
467   "in implicit initialization of binding declaration %0">;
468
469 def err_std_type_trait_not_class_template : Error<
470   "unsupported standard library implementation: "
471   "'std::%0' is not a class template">;
472
473 // C++ using declarations
474 def err_using_requires_qualname : Error<
475   "using declaration requires a qualified name">;
476 def err_using_typename_non_type : Error<
477   "'typename' keyword used on a non-type">;
478 def err_using_dependent_value_is_type : Error<
479   "dependent using declaration resolved to type without 'typename'">;
480 def err_using_decl_nested_name_specifier_is_not_class : Error<
481   "using declaration in class refers into '%0', which is not a class">;
482 def err_using_decl_nested_name_specifier_is_current_class : Error<
483   "using declaration refers to its own class">;
484 def err_using_decl_nested_name_specifier_is_not_base_class : Error<
485   "using declaration refers into '%0', which is not a base class of %1">;
486 def err_using_decl_constructor_not_in_direct_base : Error<
487   "%0 is not a direct base of %1, cannot inherit constructors">;
488 def err_using_decl_can_not_refer_to_class_member : Error<
489   "using declaration cannot refer to class member">;
490 def err_ambiguous_inherited_constructor : Error<
491   "constructor of %0 inherited from multiple base class subobjects">;
492 def note_ambiguous_inherited_constructor_using : Note<
493   "inherited from base class %0 here">;
494 def note_using_decl_class_member_workaround : Note<
495   "use %select{an alias declaration|a typedef declaration|a reference|"
496   "a const variable|a constexpr variable}0 instead">;
497 def err_using_decl_can_not_refer_to_namespace : Error<
498   "using declaration cannot refer to a namespace">;
499 def err_using_decl_can_not_refer_to_scoped_enum : Error<
500   "using declaration cannot refer to a scoped enumerator">;
501 def err_using_decl_constructor : Error<
502   "using declaration cannot refer to a constructor">;
503 def warn_cxx98_compat_using_decl_constructor : Warning<
504   "inheriting constructors are incompatible with C++98">,
505   InGroup<CXX98Compat>, DefaultIgnore;
506 def err_using_decl_destructor : Error<
507   "using declaration cannot refer to a destructor">;
508 def err_using_decl_template_id : Error<
509   "using declaration cannot refer to a template specialization">;
510 def note_using_decl_target : Note<"target of using declaration">;
511 def note_using_decl_conflict : Note<"conflicting declaration">;
512 def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
513 def err_using_decl_conflict : Error<
514   "target of using declaration conflicts with declaration already in scope">;
515 def err_using_decl_conflict_reverse : Error<
516   "declaration conflicts with target of using declaration already in scope">;
517 def note_using_decl : Note<"%select{|previous }0using declaration">;
518 def err_using_decl_redeclaration_expansion : Error<
519   "using declaration pack expansion at block scope produces multiple values">;
520
521 def warn_access_decl_deprecated : Warning<
522   "access declarations are deprecated; use using declarations instead">,
523   InGroup<Deprecated>;
524 def err_access_decl : Error<
525   "ISO C++11 does not allow access declarations; "
526   "use using declarations instead">;
527 def warn_deprecated_copy_operation : Warning<
528   "definition of implicit copy %select{constructor|assignment operator}1 "
529   "for %0 is deprecated because it has a user-declared "
530   "%select{copy %select{assignment operator|constructor}1|destructor}2">,
531   InGroup<Deprecated>, DefaultIgnore;
532 def warn_cxx17_compat_exception_spec_in_signature : Warning<
533   "mangled name of %0 will change in C++17 due to non-throwing exception "
534   "specification in function signature">, InGroup<CXX17CompatMangling>;
535
536 def warn_global_constructor : Warning<
537   "declaration requires a global constructor">,
538   InGroup<GlobalConstructors>, DefaultIgnore;
539 def warn_global_destructor : Warning<
540   "declaration requires a global destructor">,
541    InGroup<GlobalConstructors>, DefaultIgnore;
542 def warn_exit_time_destructor : Warning<
543   "declaration requires an exit-time destructor">,
544   InGroup<ExitTimeDestructors>, DefaultIgnore;
545
546 def err_invalid_thread : Error<
547   "'%0' is only allowed on variable declarations">;
548 def err_thread_non_global : Error<
549   "'%0' variables must have global storage">;
550 def err_thread_unsupported : Error<
551   "thread-local storage is not supported for the current target">;
552
553 def warn_maybe_falloff_nonvoid_function : Warning<
554   "control may reach end of non-void function">,
555   InGroup<ReturnType>;
556 def warn_falloff_nonvoid_function : Warning<
557   "control reaches end of non-void function">,
558   InGroup<ReturnType>;
559 def err_maybe_falloff_nonvoid_block : Error<
560   "control may reach end of non-void block">;
561 def err_falloff_nonvoid_block : Error<
562   "control reaches end of non-void block">;
563 def warn_maybe_falloff_nonvoid_coroutine : Warning<
564   "control may reach end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
565   InGroup<ReturnType>;
566 def warn_falloff_nonvoid_coroutine : Warning<
567   "control reaches end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
568   InGroup<ReturnType>;
569 def warn_suggest_noreturn_function : Warning<
570   "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
571   InGroup<MissingNoreturn>, DefaultIgnore;
572 def warn_suggest_noreturn_block : Warning<
573   "block could be declared with attribute 'noreturn'">,
574   InGroup<MissingNoreturn>, DefaultIgnore;
575
576 // Unreachable code.
577 def warn_unreachable : Warning<
578   "code will never be executed">,
579   InGroup<UnreachableCode>, DefaultIgnore;
580 def warn_unreachable_break : Warning<
581   "'break' will never be executed">,
582   InGroup<UnreachableCodeBreak>, DefaultIgnore;
583 def warn_unreachable_return : Warning<
584   "'return' will never be executed">,
585   InGroup<UnreachableCodeReturn>, DefaultIgnore;
586 def warn_unreachable_loop_increment : Warning<
587   "loop will run at most once (loop increment never executed)">,
588   InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
589 def note_unreachable_silence : Note<
590   "silence by adding parentheses to mark code as explicitly dead">;
591
592 /// Built-in functions.
593 def ext_implicit_lib_function_decl : ExtWarn<
594   "implicitly declaring library function '%0' with type %1">,
595   InGroup<ImplicitFunctionDeclare>;
596 def note_include_header_or_declare : Note<
597   "include the header <%0> or explicitly provide a declaration for '%1'">;
598 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
599 def warn_implicit_decl_requires_sysheader : Warning<
600   "declaration of built-in function '%1' requires inclusion of the header <%0>">,
601   InGroup<BuiltinRequiresHeader>;
602 def warn_redecl_library_builtin : Warning<
603   "incompatible redeclaration of library function %0">,
604   InGroup<DiagGroup<"incompatible-library-redeclaration">>;
605 def err_builtin_definition : Error<"definition of builtin function %0">;
606 def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
607 def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
608 def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
609 def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
610 def err_invalid_cpu_specific_dispatch_value : Error<
611 "invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
612 def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
613   InGroup<ImplicitFunctionDeclare>, DefaultError;
614 def warn_cstruct_memaccess : Warning<
615   "%select{destination for|source of|first operand of|second operand of}0 this "
616   "%1 call is a pointer to record %2 that is not trivial to "
617   "%select{primitive-default-initialize|primitive-copy}3">,
618   InGroup<NonTrivialMemaccess>;
619 def note_nontrivial_field : Note<
620   "field is non-trivial to %select{copy|default-initialize}0">;
621 def warn_dyn_class_memaccess : Warning<
622   "%select{destination for|source of|first operand of|second operand of}0 this "
623   "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
624   "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
625   InGroup<DynamicClassMemaccess>;
626 def note_bad_memaccess_silence : Note<
627   "explicitly cast the pointer to silence this warning">;
628 def warn_sizeof_pointer_expr_memaccess : Warning<
629   "'%0' call operates on objects of type %1 while the size is based on a "
630   "different type %2">,
631   InGroup<SizeofPointerMemaccess>;
632 def warn_sizeof_pointer_expr_memaccess_note : Note<
633   "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
634   "it by the number of elements)|remove the addressof in the argument to "
635   "'sizeof' (and multiply it by the number of elements)|provide an explicit "
636   "length}0?">;
637 def warn_sizeof_pointer_type_memaccess : Warning<
638   "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
639   "%select{destination|source}2; expected %3 or an explicit length">,
640   InGroup<SizeofPointerMemaccess>;
641 def warn_strlcpycat_wrong_size : Warning<
642   "size argument in %0 call appears to be size of the source; "
643   "expected the size of the destination">,
644   InGroup<DiagGroup<"strlcpy-strlcat-size">>;
645 def note_strlcpycat_wrong_size : Note<
646   "change size argument to be the size of the destination">;
647 def warn_memsize_comparison : Warning<
648   "size argument in %0 call is a comparison">,
649   InGroup<DiagGroup<"memsize-comparison">>;
650 def note_memsize_comparison_paren : Note<
651   "did you mean to compare the result of %0 instead?">;
652 def note_memsize_comparison_cast_silence : Note<
653   "explicitly cast the argument to size_t to silence this warning">;
654 def warn_suspicious_sizeof_memset : Warning<
655   "%select{'size' argument to memset is '0'|"
656   "setting buffer to a 'sizeof' expression}0"
657   "; did you mean to transpose the last two arguments?">,
658   InGroup<MemsetTransposedArgs>;
659 def note_suspicious_sizeof_memset_silence : Note<
660   "%select{parenthesize the third argument|"
661   "cast the second argument to 'int'}0 to silence">;
662 def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
663   InGroup<SuspiciousBzero>;
664 def note_suspicious_bzero_size_silence : Note<
665   "parenthesize the second argument to silence">;
666
667 def warn_strncat_large_size : Warning<
668   "the value of the size argument in 'strncat' is too large, might lead to a "
669   "buffer overflow">, InGroup<StrncatSize>;
670 def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
671   "to be size of the source">, InGroup<StrncatSize>;
672 def warn_strncat_wrong_size : Warning<
673   "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
674 def note_strncat_wrong_size : Note<
675   "change the argument to be the free space in the destination buffer minus "
676   "the terminating null byte">;
677
678 def warn_assume_side_effects : Warning<
679   "the argument to %0 has side effects that will be discarded">,
680   InGroup<DiagGroup<"assume">>;
681
682 def warn_memcpy_chk_overflow : Warning<
683   "'%0' will always overflow; destination buffer has size %1,"
684   " but size argument is %2">,
685   InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
686
687 /// main()
688 // static main() is not an error in C, just in C++.
689 def warn_static_main : Warning<"'main' should not be declared static">,
690     InGroup<Main>;
691 def err_static_main : Error<"'main' is not allowed to be declared static">;
692 def err_inline_main : Error<"'main' is not allowed to be declared inline">;
693 def ext_variadic_main : ExtWarn<
694   "'main' is not allowed to be declared variadic">, InGroup<Main>;
695 def ext_noreturn_main : ExtWarn<
696   "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
697 def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
698 def err_constexpr_main : Error<
699   "'main' is not allowed to be declared constexpr">;
700 def err_deleted_main : Error<"'main' is not allowed to be deleted">;
701 def err_mainlike_template_decl : Error<"%0 cannot be a template">;
702 def err_main_returns_nonint : Error<"'main' must return 'int'">;
703 def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
704     InGroup<MainReturnType>;
705 def note_main_change_return_type : Note<"change return type to 'int'">;
706 def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
707     "must be 0, 2, or 3">;
708 def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
709     InGroup<Main>;
710 def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
711     "parameter of 'main' (%select{argument count|argument array|environment|"
712     "platform-specific data}0) must be of type %1">;
713 def warn_main_returns_bool_literal : Warning<"bool literal returned from "
714     "'main'">, InGroup<Main>;
715 def err_main_global_variable :
716     Error<"main cannot be declared as global variable">;
717 def warn_main_redefined : Warning<"variable named 'main' with external linkage "
718     "has undefined behavior">, InGroup<Main>;
719 def ext_main_used : Extension<
720   "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
721
722 /// parser diagnostics
723 def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
724   InGroup<MissingDeclarations>;
725 def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
726   InGroup<MissingDeclarations>;
727 def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
728 def err_typedef_changes_linkage : Error<"unsupported: typedef changes linkage"
729   " of anonymous type, but linkage was already computed">;
730 def note_typedef_changes_linkage : Note<"use a tag name here to establish "
731   "linkage prior to definition">;
732 def err_statically_allocated_object : Error<
733   "interface type cannot be statically allocated">;
734 def err_object_cannot_be_passed_returned_by_value : Error<
735   "interface type %1 cannot be %select{returned|passed}0 by value"
736   "; did you forget * in %1?">;
737 def err_parameters_retval_cannot_have_fp16_type : Error<
738   "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
739 def err_opencl_half_load_store : Error<
740   "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
741   "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
742 def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
743 def err_opencl_half_declaration : Error<
744   "declaring variable of type %0 is not allowed">;
745 def err_opencl_half_param : Error<
746   "declaring function parameter of type %0 is not allowed; did you forget * ?">;
747 def err_opencl_invalid_return : Error<
748   "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
749 def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
750 def warn_pragma_options_align_reset_failed : Warning<
751   "#pragma options align=reset failed: %0">,
752   InGroup<IgnoredPragmas>;
753 def err_pragma_options_align_mac68k_target_unsupported : Error<
754   "mac68k alignment pragma is not supported on this target">;
755 def warn_pragma_pack_invalid_alignment : Warning<
756   "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
757   InGroup<IgnoredPragmas>;
758 def warn_pragma_pack_non_default_at_include : Warning<
759   "non-default #pragma pack value changes the alignment of struct or union "
760   "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
761   DefaultIgnore;
762 def warn_pragma_pack_modified_after_include : Warning<
763   "the current #pragma pack alignment value is modified in the included "
764   "file">, InGroup<PragmaPack>;
765 def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
766   "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
767 def note_pragma_pack_here : Note<
768   "previous '#pragma pack' directive that modifies alignment is here">;
769 def note_pragma_pack_pop_instead_reset : Note<
770   "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
771 // Follow the Microsoft implementation.
772 def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
773 def warn_pragma_pack_pop_identifier_and_alignment : Warning<
774   "specifying both a name and alignment to 'pop' is undefined">;
775 def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
776   InGroup<IgnoredPragmas>;
777 def warn_cxx_ms_struct :
778   Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
779           "with base classes or virtual functions">,
780   DefaultError, InGroup<IncompatibleMSStruct>;
781 def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
782 def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
783 def err_invalid_super_scope : Error<"invalid use of '__super', "
784   "this keyword can only be used inside class or member function scope">;
785 def err_super_in_lambda_unsupported : Error<
786   "use of '__super' inside a lambda is unsupported">;
787
788 def warn_pragma_unused_undeclared_var : Warning<
789   "undeclared variable %0 used as an argument for '#pragma unused'">,
790   InGroup<IgnoredPragmas>;
791 def warn_atl_uuid_deprecated : Warning<
792   "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
793   InGroup<DeprecatedDeclarations>;
794 def warn_pragma_unused_expected_var_arg : Warning<
795   "only variables can be arguments to '#pragma unused'">,
796   InGroup<IgnoredPragmas>;
797 def err_pragma_push_visibility_mismatch : Error<
798   "#pragma visibility push with no matching #pragma visibility pop">;
799 def note_surrounding_namespace_ends_here : Note<
800   "surrounding namespace with visibility attribute ends here">;
801 def err_pragma_pop_visibility_mismatch : Error<
802   "#pragma visibility pop with no matching #pragma visibility push">;
803 def note_surrounding_namespace_starts_here : Note<
804   "surrounding namespace with visibility attribute starts here">;
805 def err_pragma_loop_invalid_argument_type : Error<
806   "invalid argument of type %0; expected an integer type">;
807 def err_pragma_loop_invalid_argument_value : Error<
808   "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
809 def err_pragma_loop_compatibility : Error<
810   "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
811 def err_pragma_loop_precedes_nonloop : Error<
812   "expected a for, while, or do-while loop to follow '%0'">;
813
814 def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
815   "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
816   "those declarations">;
817 def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
818   "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
819 def err_pragma_attribute_invalid_matchers : Error<
820   "attribute %0 can't be applied to %1">;
821 def err_pragma_attribute_stack_mismatch : Error<
822   "'#pragma clang attribute %select{%1.|}0pop' with no matching"
823   " '#pragma clang attribute %select{%1.|}0push'">;
824 def warn_pragma_attribute_unused : Warning<
825   "unused attribute %0 in '#pragma clang attribute push' region">,
826   InGroup<PragmaClangAttribute>;
827 def note_pragma_attribute_region_ends_here : Note<
828   "'#pragma clang attribute push' regions ends here">;
829 def err_pragma_attribute_no_pop_eof : Error<"unterminated "
830   "'#pragma clang attribute push' at end of file">;
831 def note_pragma_attribute_applied_decl_here : Note<
832   "when applied to this declaration">;
833 def err_pragma_attr_attr_no_push : Error<
834   "'#pragma clang attribute' attribute with no matching "
835   "'#pragma clang attribute push'">;
836
837 /// Objective-C parser diagnostics
838 def err_duplicate_class_def : Error<
839   "duplicate interface definition for class %0">;
840 def err_undef_superclass : Error<
841   "cannot find interface declaration for %0, superclass of %1">;
842 def err_forward_superclass : Error<
843   "attempting to use the forward class %0 as superclass of %1">;
844 def err_no_nsconstant_string_class : Error<
845   "cannot find interface declaration for %0">;
846 def err_recursive_superclass : Error<
847   "trying to recursively use %0 as superclass of %1">;
848 def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
849 def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
850 def warn_duplicate_protocol_def : Warning<
851   "duplicate protocol definition of %0 is ignored">,
852   InGroup<DiagGroup<"duplicate-protocol">>;
853 def err_protocol_has_circular_dependency : Error<
854   "protocol has circular dependency">;
855 def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
856 def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
857 def err_atprotocol_protocol : Error<
858   "@protocol is using a forward protocol declaration of %0">;
859 def warn_readonly_property : Warning<
860   "attribute 'readonly' of property %0 restricts attribute "
861   "'readwrite' of property inherited from %1">,
862   InGroup<PropertyAttr>;
863
864 def warn_property_attribute : Warning<
865   "'%1' attribute on property %0 does not match the property inherited from %2">,
866   InGroup<PropertyAttr>;
867 def warn_property_types_are_incompatible : Warning<
868   "property type %0 is incompatible with type %1 inherited from %2">,
869   InGroup<DiagGroup<"incompatible-property-type">>;
870 def warn_protocol_property_mismatch : Warning<
871   "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
872   "getter %1|with setter %1}0 was selected for synthesis">,
873   InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
874 def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
875 def err_undef_interface : Error<"cannot find interface declaration for %0">;
876 def err_category_forward_interface : Error<
877   "cannot define %select{category|class extension}0 for undefined class %1">;
878 def err_class_extension_after_impl : Error<
879   "cannot declare class extension for %0 after class implementation">;
880 def note_implementation_declared : Note<
881   "class implementation is declared here">;
882 def note_while_in_implementation : Note<
883   "detected while default synthesizing properties in class implementation">;
884 def note_class_declared : Note<
885   "class is declared here">;
886 def note_receiver_class_declared : Note<
887   "receiver is instance of class declared here">;
888 def note_receiver_expr_here : Note<
889   "receiver expression is here">;
890 def note_receiver_is_id : Note<
891   "receiver is treated with 'id' type for purpose of method lookup">;
892 def note_suppressed_class_declare : Note<
893   "class with specified objc_requires_property_definitions attribute is declared here">;
894 def err_objc_root_class_subclass : Error<
895   "objc_root_class attribute may only be specified on a root class declaration">;
896 def err_restricted_superclass_mismatch : Error<
897   "cannot subclass a class that was declared with the "
898   "'objc_subclassing_restricted' attribute">;
899 def warn_objc_root_class_missing : Warning<
900   "class %0 defined without specifying a base class">,
901   InGroup<ObjCRootClass>;
902 def err_objc_runtime_visible_category : Error<
903   "cannot implement a category for class %0 that is only visible via the "
904   "Objective-C runtime">;
905 def err_objc_runtime_visible_subclass : Error<
906   "cannot implement subclass %0 of a superclass %1 that is only visible via the "
907   "Objective-C runtime">;
908 def note_objc_needs_superclass : Note<
909   "add a super class to fix this problem">;
910 def err_conflicting_super_class : Error<"conflicting super class name %0">;
911 def err_dup_implementation_class : Error<"reimplementation of class %0">;
912 def err_dup_implementation_category : Error<
913   "reimplementation of category %1 for class %0">;
914 def err_conflicting_ivar_type : Error<
915   "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
916 def err_duplicate_ivar_declaration : Error<
917   "instance variable is already declared">;
918 def warn_on_superclass_use : Warning<
919   "class implementation may not have super class">;
920 def err_conflicting_ivar_bitwidth : Error<
921   "instance variable %0 has conflicting bit-field width">;
922 def err_conflicting_ivar_name : Error<
923   "conflicting instance variable names: %0 vs %1">;
924 def err_inconsistent_ivar_count : Error<
925   "inconsistent number of instance variables specified">;
926 def warn_undef_method_impl : Warning<"method definition for %0 not found">,
927   InGroup<DiagGroup<"incomplete-implementation">>;
928
929 def warn_conflicting_overriding_ret_types : Warning<
930   "conflicting return type in "
931   "declaration of %0%diff{: $ vs $|}1,2">,
932   InGroup<OverridingMethodMismatch>, DefaultIgnore;
933
934 def warn_conflicting_ret_types : Warning<
935   "conflicting return type in "
936   "implementation of %0%diff{: $ vs $|}1,2">,
937   InGroup<MismatchedReturnTypes>;
938
939 def warn_conflicting_overriding_ret_type_modifiers : Warning<
940   "conflicting distributed object modifiers on return type "
941   "in declaration of %0">,
942   InGroup<OverridingMethodMismatch>, DefaultIgnore;
943
944 def warn_conflicting_ret_type_modifiers : Warning<
945   "conflicting distributed object modifiers on return type "
946   "in implementation of %0">,
947   InGroup<DistributedObjectModifiers>;
948
949 def warn_non_covariant_overriding_ret_types : Warning<
950   "conflicting return type in "
951   "declaration of %0: %1 vs %2">,
952   InGroup<OverridingMethodMismatch>, DefaultIgnore;
953
954 def warn_non_covariant_ret_types : Warning<
955   "conflicting return type in "
956   "implementation of %0: %1 vs %2">,
957   InGroup<MethodSignatures>, DefaultIgnore;
958
959 def warn_conflicting_overriding_param_types : Warning<
960   "conflicting parameter types in "
961   "declaration of %0%diff{: $ vs $|}1,2">,
962   InGroup<OverridingMethodMismatch>, DefaultIgnore;
963
964 def warn_conflicting_param_types : Warning<
965   "conflicting parameter types in "
966   "implementation of %0%diff{: $ vs $|}1,2">,
967   InGroup<MismatchedParameterTypes>;
968
969 def warn_conflicting_param_modifiers : Warning<
970   "conflicting distributed object modifiers on parameter type "
971   "in implementation of %0">,
972   InGroup<DistributedObjectModifiers>;
973
974 def warn_conflicting_overriding_param_modifiers : Warning<
975   "conflicting distributed object modifiers on parameter type "
976   "in declaration of %0">,
977   InGroup<OverridingMethodMismatch>, DefaultIgnore;
978
979 def warn_non_contravariant_overriding_param_types : Warning<
980   "conflicting parameter types in "
981   "declaration of %0: %1 vs %2">,
982   InGroup<OverridingMethodMismatch>, DefaultIgnore;
983
984 def warn_non_contravariant_param_types : Warning<
985   "conflicting parameter types in "
986   "implementation of %0: %1 vs %2">,
987   InGroup<MethodSignatures>, DefaultIgnore;
988
989 def warn_conflicting_overriding_variadic :Warning<
990   "conflicting variadic declaration of method and its "
991   "implementation">,
992   InGroup<OverridingMethodMismatch>, DefaultIgnore;
993
994 def warn_conflicting_variadic :Warning<
995   "conflicting variadic declaration of method and its "
996   "implementation">;
997
998 def warn_category_method_impl_match:Warning<
999   "category is implementing a method which will also be implemented"
1000   " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1001
1002 def warn_implements_nscopying : Warning<
1003 "default assign attribute on property %0 which implements "
1004 "NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1005
1006 def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1007   InGroup<ObjCMultipleMethodNames>;
1008 def warn_strict_multiple_method_decl : Warning<
1009   "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1010 def warn_accessor_property_type_mismatch : Warning<
1011   "type of property %0 does not match type of accessor %1">;
1012 def note_conv_function_declared_at : Note<"type conversion function declared here">;
1013 def note_method_declared_at : Note<"method %0 declared here">;
1014 def note_property_attribute : Note<"property %0 is declared "
1015   "%select{deprecated|unavailable|partial}1 here">;
1016 def err_setter_type_void : Error<"type of setter must be void">;
1017 def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1018 def warn_duplicate_method_decl :
1019   Warning<"multiple declarations of method %0 found and ignored">,
1020   InGroup<MethodDuplicate>, DefaultIgnore;
1021 def warn_objc_cdirective_format_string :
1022   Warning<"using %0 directive in %select{NSString|CFString}1 "
1023           "which is being passed as a formatting argument to the formatting "
1024           "%select{method|CFfunction}2">,
1025   InGroup<ObjCCStringFormat>, DefaultIgnore;
1026 def err_objc_var_decl_inclass :
1027     Error<"cannot declare variable inside @interface or @protocol">;
1028 def err_missing_method_context : Error<
1029   "missing context for method declaration">;
1030 def err_objc_property_attr_mutually_exclusive : Error<
1031   "property attributes '%0' and '%1' are mutually exclusive">;
1032 def err_objc_property_requires_object : Error<
1033   "property with '%0' attribute must be of object type">;
1034 def warn_objc_property_assign_on_object : Warning<
1035   "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1036   InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1037 def warn_objc_property_no_assignment_attribute : Warning<
1038   "no 'assign', 'retain', or 'copy' attribute is specified - "
1039   "'assign' is assumed">,
1040   InGroup<ObjCPropertyNoAttribute>;
1041 def warn_objc_isa_use : Warning<
1042   "direct access to Objective-C's isa is deprecated in favor of "
1043   "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1044 def warn_objc_isa_assign : Warning<
1045   "assignment to Objective-C's isa is deprecated in favor of "
1046   "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1047 def warn_objc_pointer_masking : Warning<
1048   "bitmasking for introspection of Objective-C object pointers is strongly "
1049   "discouraged">,
1050   InGroup<ObjCPointerIntrospect>;
1051 def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1052   InGroup<ObjCPointerIntrospectPerformSelector>;
1053 def warn_objc_property_default_assign_on_object : Warning<
1054   "default property attribute 'assign' not appropriate for object">,
1055   InGroup<ObjCPropertyNoAttribute>;
1056 def warn_property_attr_mismatch : Warning<
1057   "property attribute in class extension does not match the primary class">,
1058   InGroup<PropertyAttr>;
1059 def warn_property_implicitly_mismatched : Warning <
1060   "primary property declaration is implicitly strong while redeclaration "
1061   "in class extension is weak">,
1062   InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1063 def warn_objc_property_copy_missing_on_block : Warning<
1064     "'copy' attribute must be specified for the block property "
1065     "when -fobjc-gc-only is specified">;
1066 def warn_objc_property_retain_of_block : Warning<
1067     "retain'ed block property does not copy the block "
1068     "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1069 def warn_objc_readonly_property_has_setter : Warning<
1070     "setter cannot be specified for a readonly property">,
1071     InGroup<ObjCReadonlyPropertyHasSetter>;
1072 def warn_atomic_property_rule : Warning<
1073   "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1074   "with a user defined %select{getter|setter}2">,
1075   InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1076 def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1077   "synthesized, or both be user defined,or the property must be nonatomic">;
1078 def err_atomic_property_nontrivial_assign_op : Error<
1079   "atomic property of reference type %0 cannot have non-trivial assignment"
1080   " operator">;
1081 def warn_cocoa_naming_owned_rule : Warning<
1082   "property follows Cocoa naming"
1083   " convention for returning 'owned' objects">,
1084   InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1085 def err_cocoa_naming_owned_rule : Error<
1086   "property follows Cocoa naming"
1087   " convention for returning 'owned' objects">;
1088 def note_cocoa_naming_declare_family : Note<
1089   "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1090   "object">;
1091 def warn_auto_synthesizing_protocol_property :Warning<
1092   "auto property synthesis will not synthesize property %0"
1093   " declared in protocol %1">,
1094   InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1095 def note_add_synthesize_directive : Note<
1096   "add a '@synthesize' directive">;
1097 def warn_no_autosynthesis_shared_ivar_property : Warning <
1098   "auto property synthesis will not synthesize property "
1099   "%0 because it cannot share an ivar with another synthesized property">,
1100   InGroup<ObjCNoPropertyAutoSynthesis>;
1101 def warn_no_autosynthesis_property : Warning<
1102   "auto property synthesis will not synthesize property "
1103   "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1104   "via another property">,
1105   InGroup<ObjCNoPropertyAutoSynthesis>;
1106 def warn_autosynthesis_property_in_superclass : Warning<
1107   "auto property synthesis will not synthesize property "
1108   "%0; it will be implemented by its superclass, use @dynamic to "
1109   "acknowledge intention">,
1110   InGroup<ObjCNoPropertyAutoSynthesis>;
1111 def warn_autosynthesis_property_ivar_match :Warning<
1112   "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1113   "%2, not existing instance variable %3">,
1114   InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1115 def warn_missing_explicit_synthesis : Warning <
1116   "auto property synthesis is synthesizing property not explicitly synthesized">,
1117   InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1118 def warn_property_getter_owning_mismatch : Warning<
1119   "property declared as returning non-retained objects"
1120   "; getter returning retained objects">;
1121 def warn_property_redecl_getter_mismatch : Warning<
1122   "getter name mismatch between property redeclaration (%1) and its original "
1123   "declaration (%0)">, InGroup<PropertyAttr>;
1124 def err_property_setter_ambiguous_use : Error<
1125   "synthesized properties %0 and %1 both claim setter %2 -"
1126   " use of this setter will cause unexpected behavior">;
1127 def warn_default_atomic_custom_getter_setter : Warning<
1128   "atomic by default property %0 has a user defined %select{getter|setter}1 "
1129   "(property should be marked 'atomic' if this is intended)">,
1130   InGroup<CustomAtomic>, DefaultIgnore;
1131 def err_use_continuation_class : Error<
1132   "illegal redeclaration of property in class extension %0"
1133   " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1134 def err_type_mismatch_continuation_class : Error<
1135   "type of property %0 in class extension does not match "
1136   "property type in primary class">;
1137 def err_use_continuation_class_redeclaration_readwrite : Error<
1138   "illegal redeclaration of 'readwrite' property in class extension %0"
1139   " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1140   "'readonly' public property?)">;
1141 def err_continuation_class : Error<"class extension has no primary class">;
1142 def err_property_type : Error<"property cannot have array or function type %0">;
1143 def err_missing_property_context : Error<
1144   "missing context for property implementation declaration">;
1145 def err_bad_property_decl : Error<
1146   "property implementation must have its declaration in interface %0 or one of "
1147   "its extensions">;
1148 def err_category_property : Error<
1149   "property declared in category %0 cannot be implemented in "
1150   "class implementation">;
1151 def note_property_declare : Note<
1152   "property declared here">;
1153 def note_protocol_property_declare : Note<
1154   "it could also be property "
1155   "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1156   "%1|with setter %1}0 declared here">;
1157 def note_property_synthesize : Note<
1158   "property synthesized here">;
1159 def err_synthesize_category_decl : Error<
1160   "@synthesize not allowed in a category's implementation">;
1161 def err_synthesize_on_class_property : Error<
1162   "@synthesize not allowed on a class property %0">;
1163 def err_missing_property_interface : Error<
1164   "property implementation in a category with no category declaration">;
1165 def err_bad_category_property_decl : Error<
1166   "property implementation must have its declaration in the category %0">;
1167 def err_bad_property_context : Error<
1168   "property implementation must be in a class or category implementation">;
1169 def err_missing_property_ivar_decl : Error<
1170   "synthesized property %0 must either be named the same as a compatible"
1171   " instance variable or must explicitly name an instance variable">;
1172 def err_arc_perform_selector_retains : Error<
1173   "performSelector names a selector which retains the object">;
1174 def warn_arc_perform_selector_leaks : Warning<
1175   "performSelector may cause a leak because its selector is unknown">,
1176   InGroup<DiagGroup<"arc-performSelector-leaks">>;
1177 def warn_dealloc_in_category : Warning<
1178 "-dealloc is being overridden in a category">,
1179 InGroup<DeallocInCategory>;
1180 def err_gc_weak_property_strong_type : Error<
1181   "weak attribute declared on a __strong type property in GC mode">;
1182 def warn_arc_repeated_use_of_weak : Warning <
1183   "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1184   "accessed multiple times in this %select{function|method|block|lambda}2 "
1185   "but may be unpredictably set to nil; assign to a strong variable to keep "
1186   "the object alive">,
1187   InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1188 def warn_implicitly_retains_self : Warning <
1189   "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1190   "this is intended behavior">,
1191   InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1192 def warn_arc_possible_repeated_use_of_weak : Warning <
1193   "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1194   "be accessed multiple times in this %select{function|method|block|lambda}2 "
1195   "and may be unpredictably set to nil; assign to a strong variable to keep "
1196   "the object alive">,
1197   InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1198 def note_arc_weak_also_accessed_here : Note<
1199   "also accessed here">;
1200 def err_incomplete_synthesized_property : Error<
1201   "cannot synthesize property %0 with incomplete type %1">;
1202
1203 def err_property_ivar_type : Error<
1204   "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1205 def err_property_accessor_type : Error<
1206   "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1207 def err_ivar_in_superclass_use : Error<
1208   "property %0 attempting to use instance variable %1 declared in super class %2">;
1209 def err_weak_property : Error<
1210   "existing instance variable %1 for __weak property %0 must be __weak">;
1211 def err_strong_property : Error<
1212   "existing instance variable %1 for strong property %0 may not be __weak">;
1213 def err_dynamic_property_ivar_decl : Error<
1214   "dynamic property cannot have instance variable specification">;
1215 def err_duplicate_ivar_use : Error<
1216   "synthesized properties %0 and %1 both claim instance variable %2">;
1217 def err_property_implemented : Error<"property %0 is already implemented">;
1218 def warn_objc_missing_super_call : Warning<
1219   "method possibly missing a [super %0] call">,
1220   InGroup<ObjCMissingSuperCalls>;
1221 def err_dealloc_bad_result_type : Error<
1222   "dealloc return type must be correctly specified as 'void' under ARC, "
1223   "instead of %0">;
1224 def warn_undeclared_selector : Warning<
1225   "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1226 def warn_undeclared_selector_with_typo : Warning<
1227   "undeclared selector %0; did you mean %1?">,
1228   InGroup<UndeclaredSelector>, DefaultIgnore;
1229 def warn_implicit_atomic_property : Warning<
1230   "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1231 def note_auto_readonly_iboutlet_fixup_suggest : Note<
1232   "property should be changed to be readwrite">;
1233 def warn_auto_readonly_iboutlet_property : Warning<
1234   "readonly IBOutlet property %0 when auto-synthesized may "
1235   "not work correctly with 'nib' loader">,
1236   InGroup<DiagGroup<"readonly-iboutlet-property">>;
1237 def warn_auto_implicit_atomic_property : Warning<
1238   "property is assumed atomic when auto-synthesizing the property">,
1239   InGroup<ImplicitAtomic>, DefaultIgnore;
1240 def warn_unimplemented_selector:  Warning<
1241   "no method with selector %0 is implemented in this translation unit">,
1242   InGroup<Selector>, DefaultIgnore;
1243 def warn_unimplemented_protocol_method : Warning<
1244   "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1245 def warn_multiple_selectors: Warning<
1246   "several methods with selector %0 of mismatched types are found "
1247   "for the @selector expression">,
1248   InGroup<SelectorTypeMismatch>, DefaultIgnore;
1249
1250 def err_objc_kindof_nonobject : Error<
1251   "'__kindof' specifier cannot be applied to non-object type %0">;
1252 def err_objc_kindof_wrong_position : Error<
1253   "'__kindof' type specifier must precede the declarator">;
1254
1255 def err_objc_method_unsupported_param_ret_type : Error<
1256   "%0 %select{parameter|return}1 type is unsupported; "
1257   "support for vector types for this target is introduced in %2">;
1258
1259 def warn_messaging_unqualified_id : Warning<
1260   "messaging unqualified id">, DefaultIgnore,
1261   InGroup<DiagGroup<"objc-messaging-id">>;
1262
1263 // C++ declarations
1264 def err_static_assert_expression_is_not_constant : Error<
1265   "static_assert expression is not an integral constant expression">;
1266 def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1267 def err_static_assert_requirement_failed : Error<
1268   "static_assert failed due to requirement '%0'%select{ %2|}1">;
1269
1270 def ext_inline_variable : ExtWarn<
1271   "inline variables are a C++17 extension">, InGroup<CXX17>;
1272 def warn_cxx14_compat_inline_variable : Warning<
1273   "inline variables are incompatible with C++ standards before C++17">,
1274   DefaultIgnore, InGroup<CXXPre17Compat>;
1275
1276 def warn_inline_namespace_reopened_noninline : Warning<
1277   "inline namespace reopened as a non-inline namespace">;
1278 def err_inline_namespace_mismatch : Error<
1279   "non-inline namespace cannot be reopened as inline">;
1280
1281 def err_unexpected_friend : Error<
1282   "friends can only be classes or functions">;
1283 def ext_enum_friend : ExtWarn<
1284   "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1285 def warn_cxx98_compat_enum_friend : Warning<
1286   "befriending enumeration type %0 is incompatible with C++98">,
1287   InGroup<CXX98Compat>, DefaultIgnore;
1288 def ext_nonclass_type_friend : ExtWarn<
1289   "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1290 def warn_cxx98_compat_nonclass_type_friend : Warning<
1291   "non-class friend type %0 is incompatible with C++98">,
1292   InGroup<CXX98Compat>, DefaultIgnore;
1293 def err_friend_is_member : Error<
1294   "friends cannot be members of the declaring class">;
1295 def warn_cxx98_compat_friend_is_member : Warning<
1296   "friend declaration naming a member of the declaring class is incompatible "
1297   "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1298 def ext_unelaborated_friend_type : ExtWarn<
1299   "unelaborated friend declaration is a C++11 extension; specify "
1300   "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1301   InGroup<CXX11>;
1302 def warn_cxx98_compat_unelaborated_friend_type : Warning<
1303   "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1304   "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1305 def err_qualified_friend_no_match : Error<
1306   "friend declaration of %0 does not match any declaration in %1">;
1307 def err_introducing_special_friend : Error<
1308   "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1309   " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1310   "as a friend">;
1311 def err_tagless_friend_type_template : Error<
1312   "friend type templates must use an elaborated type">;
1313 def err_no_matching_local_friend : Error<
1314   "no matching function found in local scope">;
1315 def err_no_matching_local_friend_suggest : Error<
1316   "no matching function %0 found in local scope; did you mean %3?">;
1317 def err_partial_specialization_friend : Error<
1318   "partial specialization cannot be declared as a friend">;
1319 def err_qualified_friend_def : Error<
1320   "friend function definition cannot be qualified with '%0'">;
1321 def err_friend_def_in_local_class : Error<
1322   "friend function cannot be defined in a local class">;
1323 def err_friend_not_first_in_declaration : Error<
1324   "'friend' must appear first in a non-function declaration">;
1325 def err_using_decl_friend : Error<
1326   "cannot befriend target of using declaration">;
1327 def warn_template_qualified_friend_unsupported : Warning<
1328   "dependent nested name specifier '%0' for friend class declaration is "
1329   "not supported; turning off access control for %1">,
1330   InGroup<UnsupportedFriend>;
1331 def warn_template_qualified_friend_ignored : Warning<
1332   "dependent nested name specifier '%0' for friend template declaration is "
1333   "not supported; ignoring this friend declaration">,
1334   InGroup<UnsupportedFriend>;
1335 def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1336   "unqualified friend declaration referring to type outside of the nearest "
1337   "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1338   InGroup<MicrosoftUnqualifiedFriend>;
1339 def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1340
1341 def err_invalid_base_in_interface : Error<
1342   "interface type cannot inherit from "
1343   "%select{struct|non-public interface|class}0 %1">;
1344
1345 def err_abstract_type_in_decl : Error<
1346   "%select{return|parameter|variable|field|instance variable|"
1347   "synthesized instance variable}0 type %1 is an abstract class">;
1348 def err_allocation_of_abstract_type : Error<
1349   "allocating an object of abstract class type %0">;
1350 def err_throw_abstract_type : Error<
1351   "cannot throw an object of abstract type %0">;
1352 def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1353 def err_capture_of_abstract_type : Error<
1354   "by-copy capture of value of abstract type %0">;
1355 def err_capture_of_incomplete_type : Error<
1356   "by-copy capture of variable %0 with incomplete type %1">;
1357 def err_capture_default_non_local : Error<
1358   "non-local lambda expression cannot have a capture-default">;
1359
1360 def err_multiple_final_overriders : Error<
1361   "virtual function %q0 has more than one final overrider in %1">;
1362 def note_final_overrider : Note<"final overrider of %q0 in %1">;
1363
1364 def err_type_defined_in_type_specifier : Error<
1365   "%0 cannot be defined in a type specifier">;
1366 def err_type_defined_in_result_type : Error<
1367   "%0 cannot be defined in the result type of a function">;
1368 def err_type_defined_in_param_type : Error<
1369   "%0 cannot be defined in a parameter type">;
1370 def err_type_defined_in_alias_template : Error<
1371   "%0 cannot be defined in a type alias template">;
1372 def err_type_defined_in_condition : Error<
1373   "%0 cannot be defined in a condition">;
1374 def err_type_defined_in_enum : Error<
1375   "%0 cannot be defined in an enumeration">;
1376
1377 def note_pure_virtual_function : Note<
1378   "unimplemented pure virtual method %0 in %1">;
1379
1380 def note_pure_qualified_call_kext : Note<
1381   "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1382
1383 def err_deleted_decl_not_first : Error<
1384   "deleted definition must be first declaration">;
1385
1386 def err_deleted_override : Error<
1387   "deleted function %0 cannot override a non-deleted function">;
1388
1389 def err_non_deleted_override : Error<
1390   "non-deleted function %0 cannot override a deleted function">;
1391
1392 def warn_weak_vtable : Warning<
1393   "%0 has no out-of-line virtual method definitions; its vtable will be "
1394   "emitted in every translation unit">,
1395   InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1396 def warn_weak_template_vtable : Warning<
1397   "explicit template instantiation %0 will emit a vtable in every "
1398   "translation unit">,
1399   InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1400
1401 def ext_using_undefined_std : ExtWarn<
1402   "using directive refers to implicitly-defined namespace 'std'">;
1403
1404 // C++ exception specifications
1405 def err_exception_spec_in_typedef : Error<
1406   "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1407 def err_distant_exception_spec : Error<
1408   "exception specifications are not allowed beyond a single level "
1409   "of indirection">;
1410 def err_incomplete_in_exception_spec : Error<
1411   "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1412   "in exception specification">;
1413 def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1414   InGroup<MicrosoftExceptionSpec>;
1415 def err_rref_in_exception_spec : Error<
1416   "rvalue reference type %0 is not allowed in exception specification">;
1417 def err_mismatched_exception_spec : Error<
1418   "exception specification in declaration does not match previous declaration">;
1419 def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1420   InGroup<MicrosoftExceptionSpec>;
1421 def err_override_exception_spec : Error<
1422   "exception specification of overriding function is more lax than "
1423   "base version">;
1424 def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1425   InGroup<MicrosoftExceptionSpec>;
1426 def err_incompatible_exception_specs : Error<
1427   "target exception specification is not superset of source">;
1428 def warn_incompatible_exception_specs : Warning<
1429   err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1430 def err_deep_exception_specs_differ : Error<
1431   "exception specifications of %select{return|argument}0 types differ">;
1432 def warn_deep_exception_specs_differ : Warning<
1433   err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1434 def err_missing_exception_specification : Error<
1435   "%0 is missing exception specification '%1'">;
1436 def ext_missing_exception_specification : ExtWarn<
1437   err_missing_exception_specification.Text>,
1438   InGroup<DiagGroup<"missing-exception-spec">>;
1439 def ext_ms_missing_exception_specification : ExtWarn<
1440   err_missing_exception_specification.Text>,
1441   InGroup<MicrosoftExceptionSpec>;
1442 def err_noexcept_needs_constant_expression : Error<
1443   "argument to noexcept specifier must be a constant expression">;
1444 def err_exception_spec_not_parsed : Error<
1445   "exception specification is not available until end of class definition">;
1446 def err_exception_spec_cycle : Error<
1447   "exception specification of %0 uses itself">;
1448 def err_exception_spec_incomplete_type : Error<
1449   "exception specification needed for member of incomplete class %0">;
1450
1451 // C++ access checking
1452 def err_class_redeclared_with_different_access : Error<
1453   "%0 redeclared with '%1' access">;
1454 def err_access : Error<
1455   "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1456 def ext_ms_using_declaration_inaccessible : ExtWarn<
1457   "using declaration referring to inaccessible member '%0' (which refers "
1458   "to accessible member '%1') is a Microsoft compatibility extension">,
1459     AccessControl, InGroup<MicrosoftUsingDecl>;
1460 def err_access_ctor : Error<
1461   "calling a %select{private|protected}0 constructor of class %2">,
1462   AccessControl;
1463 def ext_rvalue_to_reference_access_ctor : Extension<
1464   "C++98 requires an accessible copy constructor for class %2 when binding "
1465   "a reference to a temporary; was %select{private|protected}0">,
1466   AccessControl, InGroup<BindToTemporaryCopy>;
1467 def err_access_base_ctor : Error<
1468   // The ERRORs represent other special members that aren't constructors, in
1469   // hopes that someone will bother noticing and reporting if they appear
1470   "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1471   "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1472   "|*ERROR*|}2constructor">, AccessControl;
1473 def err_access_field_ctor : Error<
1474   // The ERRORs represent other special members that aren't constructors, in
1475   // hopes that someone will bother noticing and reporting if they appear
1476   "field of type %0 has %select{private|protected}2 "
1477   "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1478   AccessControl;
1479 def err_access_friend_function : Error<
1480   "friend function %1 is a %select{private|protected}0 member of %3">,
1481   AccessControl;
1482
1483 def err_access_dtor : Error<
1484   "calling a %select{private|protected}1 destructor of class %0">,
1485   AccessControl;
1486 def err_access_dtor_base :
1487     Error<"base class %0 has %select{private|protected}1 destructor">,
1488     AccessControl;
1489 def err_access_dtor_vbase :
1490     Error<"inherited virtual base class %1 has "
1491     "%select{private|protected}2 destructor">,
1492     AccessControl;
1493 def err_access_dtor_temp :
1494     Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1495     AccessControl;
1496 def err_access_dtor_exception :
1497     Error<"exception object of type %0 has %select{private|protected}1 "
1498           "destructor">, AccessControl;
1499 def err_access_dtor_field :
1500     Error<"field of type %1 has %select{private|protected}2 destructor">,
1501     AccessControl;
1502 def err_access_dtor_var :
1503     Error<"variable of type %1 has %select{private|protected}2 destructor">,
1504     AccessControl;
1505 def err_access_dtor_ivar :
1506     Error<"instance variable of type %0 has %select{private|protected}1 "
1507           "destructor">,
1508     AccessControl;
1509 def note_previous_access_declaration : Note<
1510   "previously declared '%1' here">;
1511 def note_access_natural : Note<
1512   "%select{|implicitly }1declared %select{private|protected}0 here">;
1513 def note_access_constrained_by_path : Note<
1514   "constrained by %select{|implicitly }1%select{private|protected}0"
1515   " inheritance here">;
1516 def note_access_protected_restricted_noobject : Note<
1517   "must name member using the type of the current context %0">;
1518 def note_access_protected_restricted_ctordtor : Note<
1519   "protected %select{constructor|destructor}0 can only be used to "
1520   "%select{construct|destroy}0 a base class subobject">;
1521 def note_access_protected_restricted_object : Note<
1522   "can only access this member on an object of type %0">;
1523 def warn_cxx98_compat_sfinae_access_control : Warning<
1524   "substitution failure due to access control is incompatible with C++98">,
1525   InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1526
1527 // C++ name lookup
1528 def err_incomplete_nested_name_spec : Error<
1529   "incomplete type %0 named in nested name specifier">;
1530 def err_dependent_nested_name_spec : Error<
1531   "nested name specifier for a declaration cannot depend on a template "
1532   "parameter">;
1533 def err_nested_name_member_ref_lookup_ambiguous : Error<
1534   "lookup of %0 in member access expression is ambiguous">;
1535 def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1536   "lookup of %0 in member access expression is ambiguous; using member of %1">,
1537   InGroup<AmbigMemberTemplate>;
1538 def note_ambig_member_ref_object_type : Note<
1539   "lookup in the object type %0 refers here">;
1540 def note_ambig_member_ref_scope : Note<
1541   "lookup from the current scope refers here">;
1542 def err_qualified_member_nonclass : Error<
1543   "qualified member access refers to a member in %0">;
1544 def err_incomplete_member_access : Error<
1545   "member access into incomplete type %0">;
1546 def err_incomplete_type : Error<
1547   "incomplete type %0 where a complete type is required">;
1548 def warn_cxx98_compat_enum_nested_name_spec : Warning<
1549   "enumeration type in nested name specifier is incompatible with C++98">,
1550   InGroup<CXX98Compat>, DefaultIgnore;
1551 def err_nested_name_spec_is_not_class : Error<
1552   "%0 cannot appear before '::' because it is not a class"
1553   "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1554 def ext_nested_name_spec_is_enum : ExtWarn<
1555   "use of enumeration in a nested name specifier is a C++11 extension">,
1556   InGroup<CXX11>;
1557 def err_out_of_line_qualified_id_type_names_constructor : Error<
1558   "qualified reference to %0 is a constructor name rather than a "
1559   "%select{template name|type}1 in this context">;
1560 def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1561   "ISO C++ specifies that "
1562   "qualified reference to %0 is a constructor name rather than a "
1563   "%select{template name|type}1 in this context, despite preceding "
1564   "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1565   InGroup<DiagGroup<"injected-class-name">>;
1566
1567 // C++ class members
1568 def err_storageclass_invalid_for_member : Error<
1569   "storage class specified for a member declaration">;
1570 def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1571 def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1572 def ext_mutable_reference : ExtWarn<
1573   "'mutable' on a reference type is a Microsoft extension">,
1574   InGroup<MicrosoftMutableReference>;
1575 def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1576 def err_mutable_nonmember : Error<
1577   "'mutable' can only be applied to member variables">;
1578 def err_virtual_in_union : Error<
1579   "unions cannot have virtual functions">;
1580 def err_virtual_non_function : Error<
1581   "'virtual' can only appear on non-static member functions">;
1582 def err_virtual_out_of_class : Error<
1583   "'virtual' can only be specified inside the class definition">;
1584 def err_virtual_member_function_template : Error<
1585   "'virtual' cannot be specified on member function templates">;
1586 def err_static_overrides_virtual : Error<
1587   "'static' member function %0 overrides a virtual function in a base class">;
1588 def err_explicit_non_function : Error<
1589   "'explicit' can only appear on non-static member functions">;
1590 def err_explicit_out_of_class : Error<
1591   "'explicit' can only be specified inside the class definition">;
1592 def err_explicit_non_ctor_or_conv_function : Error<
1593   "'explicit' can only be applied to a constructor or conversion function">;
1594 def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1595 def err_static_out_of_line : Error<
1596   "'static' can only be specified inside the class definition">;
1597 def err_storage_class_for_static_member : Error<
1598   "static data member definition cannot specify a storage class">;
1599 def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1600 def err_not_integral_type_bitfield : Error<
1601   "bit-field %0 has non-integral type %1">;
1602 def err_not_integral_type_anon_bitfield : Error<
1603   "anonymous bit-field has non-integral type %0">;
1604 def err_anon_bitfield_qualifiers : Error<
1605   "anonymous bit-field cannot have qualifiers">;
1606 def err_member_function_initialization : Error<
1607   "initializer on function does not look like a pure-specifier">;
1608 def err_non_virtual_pure : Error<
1609   "%0 is not virtual and cannot be declared pure">;
1610 def ext_pure_function_definition : ExtWarn<
1611   "function definition with pure-specifier is a Microsoft extension">,
1612   InGroup<MicrosoftPureDefinition>;
1613 def err_qualified_member_of_unrelated : Error<
1614   "%q0 is not a member of class %1">;
1615
1616 def err_member_function_call_bad_cvr : Error<
1617   "'this' argument to member function %0 has type %1, but function is not marked "
1618   "%select{const|restrict|const or restrict|volatile|const or volatile|"
1619   "volatile or restrict|const, volatile, or restrict}2">;
1620 def err_member_function_call_bad_ref : Error<
1621   "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1622   "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1623 def err_member_function_call_bad_type : Error<
1624   "cannot initialize object parameter of type %0 with an expression "
1625   "of type %1">;
1626
1627 def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1628   "call to pure virtual member function %0 has undefined behavior; "
1629   "overrides of %0 in subclasses are not available in the "
1630   "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1631
1632 def select_special_member_kind : TextSubstitution<
1633   "%select{default constructor|copy constructor|move constructor|"
1634   "copy assignment operator|move assignment operator|destructor}0">;
1635
1636 def note_member_declared_at : Note<"member is declared here">;
1637 def note_ivar_decl : Note<"instance variable is declared here">;
1638 def note_bitfield_decl : Note<"bit-field is declared here">;
1639 def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1640 def note_member_synthesized_at : Note<
1641   "in implicit %sub{select_special_member_kind}0 for %1 "
1642   "first required here">;
1643 def err_missing_default_ctor : Error<
1644   "%select{constructor for %1 must explicitly initialize the|"
1645   "implicit default constructor for %1 must explicitly initialize the|"
1646   "cannot use constructor inherited from base class %4;}0 "
1647   "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1648   "does not have a default constructor">;
1649 def note_due_to_dllexported_class : Note<
1650   "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1651
1652 def err_illegal_union_or_anon_struct_member : Error<
1653   "%select{anonymous struct|union}0 member %1 has a non-trivial "
1654   "%sub{select_special_member_kind}2">;
1655 def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1656   "%select{anonymous struct|union}0 member %1 with a non-trivial "
1657   "%sub{select_special_member_kind}2 is incompatible with C++98">,
1658   InGroup<CXX98Compat>, DefaultIgnore;
1659
1660 def note_nontrivial_virtual_dtor : Note<
1661   "destructor for %0 is not trivial because it is virtual">;
1662 def note_nontrivial_has_virtual : Note<
1663   "because type %0 has a virtual %select{member function|base class}1">;
1664 def note_nontrivial_no_def_ctor : Note<
1665   "because %select{base class of |field of |}0type %1 has no "
1666   "default constructor">;
1667 def note_user_declared_ctor : Note<
1668   "implicit default constructor suppressed by user-declared constructor">;
1669 def note_nontrivial_no_copy : Note<
1670   "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1671   "assignment operator|<<ERROR>>}2 can be used to "
1672   "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1673   "%select{base class|field|an object}0 of type %3">;
1674 def note_nontrivial_user_provided : Note<
1675   "because %select{base class of |field of |}0type %1 has a user-provided "
1676   "%sub{select_special_member_kind}2">;
1677 def note_nontrivial_in_class_init : Note<
1678   "because field %0 has an initializer">;
1679 def note_nontrivial_param_type : Note<
1680   "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1681 def note_nontrivial_default_arg : Note<"because it has a default argument">;
1682 def note_nontrivial_variadic : Note<"because it is a variadic function">;
1683 def note_nontrivial_subobject : Note<
1684   "because the function selected to %select{construct|copy|move|copy|move|"
1685   "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1686 def note_nontrivial_objc_ownership : Note<
1687   "because type %0 has a member with %select{no|no|__strong|__weak|"
1688   "__autoreleasing}1 ownership">;
1689
1690 def err_static_data_member_not_allowed_in_anon_struct : Error<
1691   "static data member %0 not allowed in anonymous struct">;
1692 def ext_static_data_member_in_union : ExtWarn<
1693   "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1694 def warn_cxx98_compat_static_data_member_in_union : Warning<
1695   "static data member %0 in union is incompatible with C++98">,
1696   InGroup<CXX98Compat>, DefaultIgnore;
1697 def ext_union_member_of_reference_type : ExtWarn<
1698   "union member %0 has reference type %1, which is a Microsoft extension">,
1699   InGroup<MicrosoftUnionMemberReference>;
1700 def err_union_member_of_reference_type : Error<
1701   "union member %0 has reference type %1">;
1702 def ext_anonymous_struct_union_qualified : Extension<
1703   "anonymous %select{struct|union}0 cannot be '%1'">;
1704 def err_different_return_type_for_overriding_virtual_function : Error<
1705   "virtual function %0 has a different return type "
1706   "%diff{($) than the function it overrides (which has return type $)|"
1707   "than the function it overrides}1,2">;
1708 def note_overridden_virtual_function : Note<
1709   "overridden virtual function is here">;
1710 def err_conflicting_overriding_cc_attributes : Error<
1711   "virtual function %0 has different calling convention attributes "
1712   "%diff{($) than the function it overrides (which has calling convention $)|"
1713   "than the function it overrides}1,2">;
1714 def warn_overriding_method_missing_noescape : Warning<
1715   "parameter of overriding method should be annotated with "
1716   "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1717 def note_overridden_marked_noescape : Note<
1718   "parameter of overridden method is annotated with __attribute__((noescape))">;
1719 def note_cat_conform_to_noescape_prot : Note<
1720   "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1721
1722 def err_covariant_return_inaccessible_base : Error<
1723   "invalid covariant return for virtual function: %1 is a "
1724   "%select{private|protected}2 base class of %0">, AccessControl;
1725 def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1726   "return type of virtual function %3 is not covariant with the return type of "
1727   "the function it overrides (ambiguous conversion from derived class "
1728   "%0 to base class %1:%2)">;
1729 def err_covariant_return_not_derived : Error<
1730   "return type of virtual function %0 is not covariant with the return type of "
1731   "the function it overrides (%1 is not derived from %2)">;
1732 def err_covariant_return_incomplete : Error<
1733   "return type of virtual function %0 is not covariant with the return type of "
1734   "the function it overrides (%1 is incomplete)">;
1735 def err_covariant_return_type_different_qualifications : Error<
1736   "return type of virtual function %0 is not covariant with the return type of "
1737   "the function it overrides (%1 has different qualifiers than %2)">;
1738 def err_covariant_return_type_class_type_more_qualified : Error<
1739   "return type of virtual function %0 is not covariant with the return type of "
1740   "the function it overrides (class type %1 is more qualified than class "
1741   "type %2">;
1742
1743 // C++ implicit special member functions
1744 def note_in_declaration_of_implicit_special_member : Note<
1745   "while declaring the implicit %sub{select_special_member_kind}1"
1746   " for %0">;
1747
1748 // C++ constructors
1749 def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1750 def err_invalid_qualified_constructor : Error<
1751   "'%0' qualifier is not allowed on a constructor">;
1752 def err_ref_qualifier_constructor : Error<
1753   "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1754
1755 def err_constructor_return_type : Error<
1756   "constructor cannot have a return type">;
1757 def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1758 def err_constructor_byvalue_arg : Error<
1759   "copy constructor must pass its first argument by reference">;
1760 def warn_no_constructor_for_refconst : Warning<
1761   "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1762   "constructor to initialize its non-modifiable members">;
1763 def note_refconst_member_not_initialized : Note<
1764   "%select{const|reference}0 member %1 will never be initialized">;
1765 def ext_ms_explicit_constructor_call : ExtWarn<
1766   "explicit constructor calls are a Microsoft extension">,
1767   InGroup<MicrosoftExplicitConstructorCall>;
1768
1769 // C++ destructors
1770 def err_destructor_not_member : Error<
1771   "destructor must be a non-static member function">;
1772 def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1773 def err_invalid_qualified_destructor : Error<
1774   "'%0' qualifier is not allowed on a destructor">;
1775 def err_ref_qualifier_destructor : Error<
1776   "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1777 def err_destructor_return_type : Error<"destructor cannot have a return type">;
1778 def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1779 def err_destructor_with_params : Error<"destructor cannot have any parameters">;
1780 def err_destructor_variadic : Error<"destructor cannot be variadic">;
1781 def err_destructor_typedef_name : Error<
1782   "destructor cannot be declared using a %select{typedef|type alias}1 %0 of the class name">;
1783 def err_destructor_name : Error<
1784   "expected the class name after '~' to name the enclosing class">;
1785 def err_destructor_class_name : Error<
1786   "expected the class name after '~' to name a destructor">;
1787 def err_ident_in_dtor_not_a_type : Error<
1788   "identifier %0 in object destruction expression does not name a type">;
1789 def err_destructor_expr_type_mismatch : Error<
1790   "destructor type %0 in object destruction expression does not match the "
1791   "type %1 of the object being destroyed">;
1792 def note_destructor_type_here : Note<
1793   "type %0 is declared here">;
1794
1795 def err_destroy_attr_on_non_static_var : Error<
1796   "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
1797   " variable with static or thread storage duration">;
1798
1799 def err_destructor_template : Error<
1800   "destructor cannot be declared as a template">;
1801
1802 // C++ initialization
1803 def err_init_conversion_failed : Error<
1804   "cannot initialize %select{a variable|a parameter|return object|"
1805   "statement expression result|an "
1806   "exception object|a member subobject|an array element|a new value|a value|a "
1807   "base class|a constructor delegation|a vector element|a block element|a "
1808   "block element|a complex element|a lambda capture|a compound literal "
1809   "initializer|a related result|a parameter of CF audited function}0 "
1810   "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
1811   "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
1812   "%select{|: different classes%diff{ ($ vs $)|}5,6"
1813   "|: different number of parameters (%5 vs %6)"
1814   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
1815   "|: different return type%diff{ ($ vs $)|}5,6"
1816   "|: different qualifiers (%5 vs %6)"
1817   "|: different exception specifications}4">;
1818
1819 def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
1820   "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
1821 def err_lvalue_reference_bind_to_initlist : Error<
1822   "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
1823   "initializer list temporary">;
1824 def err_lvalue_reference_bind_to_temporary : Error<
1825   "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
1826   "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
1827 def err_lvalue_reference_bind_to_unrelated : Error<
1828   "%select{non-const|volatile}0 lvalue reference "
1829   "%diff{to type $ cannot bind to a value of unrelated type $|"
1830   "cannot bind to a value of unrelated type}1,2">;
1831 def err_reference_bind_drops_quals : Error<
1832   "binding value %diff{of type $ to reference to type $|to reference}0,1 "
1833   "drops %select{<<ERROR>>|'const'|'restrict'|'const' and 'restrict'|"
1834   "'volatile'|'const' and 'volatile'|'restrict' and 'volatile'|"
1835   "'const', 'restrict', and 'volatile'}2 qualifier%plural{1:|2:|4:|:s}2">;
1836 def err_reference_bind_failed : Error<
1837   "reference %diff{to type $ could not bind to an %select{rvalue|lvalue}1 of "
1838   "type $|could not bind to %select{rvalue|lvalue}1 of incompatible type}0,2">;
1839 def err_reference_bind_init_list : Error<
1840   "reference to type %0 cannot bind to an initializer list">;
1841 def err_init_list_bad_dest_type : Error<
1842   "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
1843   "list">;
1844 def warn_cxx2a_compat_aggregate_init_with_ctors : Warning<
1845   "aggregate initialization of type %0 with user-declared constructors "
1846   "is incompatible with C++2a">, DefaultIgnore, InGroup<CXX2aCompat>;
1847
1848 def err_reference_bind_to_bitfield : Error<
1849   "%select{non-const|volatile}0 reference cannot bind to "
1850   "bit-field%select{| %1}2">;
1851 def err_reference_bind_to_vector_element : Error<
1852   "%select{non-const|volatile}0 reference cannot bind to vector element">;
1853 def err_reference_var_requires_init : Error<
1854   "declaration of reference variable %0 requires an initializer">;
1855 def err_reference_without_init : Error<
1856   "reference to type %0 requires an initializer">;
1857 def note_value_initialization_here : Note<
1858   "in value-initialization of type %0 here">;
1859 def err_reference_has_multiple_inits : Error<
1860   "reference cannot be initialized with multiple values">;
1861 def err_init_non_aggr_init_list : Error<
1862   "initialization of non-aggregate type %0 with an initializer list">;
1863 def err_init_reference_member_uninitialized : Error<
1864   "reference member of type %0 uninitialized">;
1865 def note_uninit_reference_member : Note<
1866   "uninitialized reference member is here">;
1867 def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
1868   InGroup<Uninitialized>;
1869 def warn_base_class_is_uninit : Warning<
1870   "base class %0 is uninitialized when used here to access %q1">,
1871   InGroup<Uninitialized>;
1872 def warn_reference_field_is_uninit : Warning<
1873   "reference %0 is not yet bound to a value when used here">,
1874   InGroup<Uninitialized>;
1875 def note_uninit_in_this_constructor : Note<
1876   "during field initialization in %select{this|the implicit default}0 "
1877   "constructor">;
1878 def warn_static_self_reference_in_init : Warning<
1879   "static variable %0 is suspiciously used within its own initialization">,
1880   InGroup<UninitializedStaticSelfInit>;
1881 def warn_uninit_self_reference_in_init : Warning<
1882   "variable %0 is uninitialized when used within its own initialization">,
1883   InGroup<Uninitialized>;
1884 def warn_uninit_self_reference_in_reference_init : Warning<
1885   "reference %0 is not yet bound to a value when used within its own"
1886   " initialization">,
1887   InGroup<Uninitialized>;
1888 def warn_uninit_var : Warning<
1889   "variable %0 is uninitialized when %select{used here|captured by block}1">,
1890   InGroup<Uninitialized>, DefaultIgnore;
1891 def warn_sometimes_uninit_var : Warning<
1892   "variable %0 is %select{used|captured}1 uninitialized whenever "
1893   "%select{'%3' condition is %select{true|false}4|"
1894   "'%3' loop %select{is entered|exits because its condition is false}4|"
1895   "'%3' loop %select{condition is true|exits because its condition is false}4|"
1896   "switch %3 is taken|"
1897   "its declaration is reached|"
1898   "%3 is called}2">,
1899   InGroup<UninitializedSometimes>, DefaultIgnore;
1900 def warn_maybe_uninit_var : Warning<
1901   "variable %0 may be uninitialized when "
1902   "%select{used here|captured by block}1">,
1903   InGroup<UninitializedMaybe>, DefaultIgnore;
1904 def note_var_declared_here : Note<"variable %0 is declared here">;
1905 def note_uninit_var_use : Note<
1906   "%select{uninitialized use occurs|variable is captured by block}0 here">;
1907 def warn_uninit_byref_blockvar_captured_by_block : Warning<
1908   "block pointer variable %0 is uninitialized when captured by block">,
1909   InGroup<Uninitialized>, DefaultIgnore;
1910 def note_block_var_fixit_add_initialization : Note<
1911   "did you mean to use __block %0?">;
1912 def note_in_omitted_aggregate_initializer : Note<
1913   "in implicit initialization of %select{"
1914   "array element %1 with omitted initializer|"
1915   "field %1 with omitted initializer|"
1916   "trailing array elements in runtime-sized array new}0">;
1917 def note_in_reference_temporary_list_initializer : Note<
1918   "in initialization of temporary of type %0 created to "
1919   "list-initialize this reference">;
1920 def note_var_fixit_add_initialization : Note<
1921   "initialize the variable %0 to silence this warning">;
1922 def note_uninit_fixit_remove_cond : Note<
1923   "remove the %select{'%1' if its condition|condition if it}0 "
1924   "is always %select{false|true}2">;
1925 def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
1926 def err_list_init_in_parens : Error<
1927   "cannot initialize %select{non-class|reference}0 type %1 with a "
1928   "parenthesized initializer list">;
1929
1930 def warn_unsequenced_mod_mod : Warning<
1931   "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
1932 def warn_unsequenced_mod_use : Warning<
1933   "unsequenced modification and access to %0">, InGroup<Unsequenced>;
1934
1935 def select_initialized_entity_kind : TextSubstitution<
1936   "%select{copying variable|copying parameter|"
1937   "returning object|initializing statement expression result|"
1938   "throwing object|copying member subobject|copying array element|"
1939   "allocating object|copying temporary|initializing base subobject|"
1940   "initializing vector element|capturing value}0">;
1941
1942 def err_temp_copy_no_viable : Error<
1943   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
1944 def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
1945   "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
1946   "C++98 requires a copy constructor when binding a reference to a temporary">,
1947   InGroup<BindToTemporaryCopy>;
1948 def err_temp_copy_ambiguous : Error<
1949   "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
1950   "of type %1">;
1951 def err_temp_copy_deleted : Error<
1952   "%sub{select_initialized_entity_kind}0 of type %1 "
1953   "invokes deleted constructor">;
1954 def err_temp_copy_incomplete : Error<
1955   "copying a temporary object of incomplete type %0">;
1956 def warn_cxx98_compat_temp_copy : Warning<
1957   "%sub{select_initialized_entity_kind}1 "
1958   "of type %2 when binding a reference to a temporary would %select{invoke "
1959   "an inaccessible constructor|find no viable constructor|find ambiguous "
1960   "constructors|invoke a deleted constructor}0 in C++98">,
1961   InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
1962 def err_selected_explicit_constructor : Error<
1963   "chosen constructor is explicit in copy-initialization">;
1964 def note_explicit_ctor_deduction_guide_here : Note<
1965   "explicit %select{constructor|deduction guide}0 declared here">;
1966
1967 // C++11 decltype
1968 def err_decltype_in_declarator : Error<
1969     "'decltype' cannot be used to name a declaration">;
1970
1971 // C++11 auto
1972 def warn_cxx98_compat_auto_type_specifier : Warning<
1973   "'auto' type specifier is incompatible with C++98">,
1974   InGroup<CXX98Compat>, DefaultIgnore;
1975 def err_auto_variable_cannot_appear_in_own_initializer : Error<
1976   "variable %0 declared with deduced type %1 "
1977   "cannot appear in its own initializer">;
1978 def err_binding_cannot_appear_in_own_initializer : Error<
1979   "binding %0 cannot appear in the initializer of its own "
1980   "decomposition declaration">;
1981 def err_illegal_decl_array_of_auto : Error<
1982   "'%0' declared as array of %1">;
1983 def err_new_array_of_auto : Error<
1984   "cannot allocate array of 'auto'">;
1985 def err_auto_not_allowed : Error<
1986   "%select{'auto'|'decltype(auto)'|'__auto_type'|"
1987   "use of "
1988   "%select{class template|function template|variable template|alias template|"
1989   "template template parameter|template}2 %3 requires template arguments; "
1990   "argument deduction}0 not allowed "
1991   "%select{in function prototype"
1992   "|in non-static struct member|in struct member"
1993   "|in non-static union member|in union member"
1994   "|in non-static class member|in interface member"
1995   "|in exception declaration|in template parameter until C++17|in block literal"
1996   "|in template argument|in typedef|in type alias|in function return type"
1997   "|in conversion function type|here|in lambda parameter"
1998   "|in type allocated by 'new'|in K&R-style function parameter"
1999   "|in template parameter|in friend declaration}1">;
2000 def err_dependent_deduced_tst : Error<
2001   "typename specifier refers to "
2002   "%select{class template|function template|variable template|alias template|"
2003   "template template parameter|template}0 member in %1; "
2004   "argument deduction not allowed here">;
2005 def err_auto_not_allowed_var_inst : Error<
2006   "'auto' variable template instantiation is not allowed">;
2007 def err_auto_var_requires_init : Error<
2008   "declaration of variable %0 with deduced type %1 requires an initializer">;
2009 def err_auto_new_requires_ctor_arg : Error<
2010   "new expression for type %0 requires a constructor argument">;
2011 def ext_auto_new_list_init : Extension<
2012   "ISO C++ standards before C++17 do not allow new expression for "
2013   "type %0 to use list-initialization">, InGroup<CXX17>;
2014 def err_auto_var_init_no_expression : Error<
2015   "initializer for variable %0 with type %1 is empty">;
2016 def err_auto_var_init_multiple_expressions : Error<
2017   "initializer for variable %0 with type %1 contains multiple expressions">;
2018 def err_auto_var_init_paren_braces : Error<
2019   "cannot deduce type for variable %1 with type %2 from "
2020   "%select{parenthesized|nested}0 initializer list">;
2021 def err_auto_new_ctor_multiple_expressions : Error<
2022   "new expression for type %0 contains multiple constructor arguments">;
2023 def err_auto_missing_trailing_return : Error<
2024   "'auto' return without trailing return type; deduced return types are a "
2025   "C++14 extension">;
2026 def err_deduced_return_type : Error<
2027   "deduced return types are a C++14 extension">;
2028 def err_trailing_return_without_auto : Error<
2029   "function with trailing return type must specify return type 'auto', not %0">;
2030 def err_trailing_return_in_parens : Error<
2031   "trailing return type may not be nested within parentheses">;
2032 def err_auto_var_deduction_failure : Error<
2033   "variable %0 with type %1 has incompatible initializer of type %2">;
2034 def err_auto_var_deduction_failure_from_init_list : Error<
2035   "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2036 def err_auto_new_deduction_failure : Error<
2037   "new expression for type %0 has incompatible constructor argument of type %1">;
2038 def err_auto_inconsistent_deduction : Error<
2039   "deduced conflicting types %diff{($ vs $) |}0,1"
2040   "for initializer list element type">;
2041 def err_auto_different_deductions : Error<
2042   "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2043   "deduced as %1 in declaration of %2 and "
2044   "deduced as %3 in declaration of %4">;
2045 def err_auto_non_deduced_not_alone : Error<
2046   "%select{function with deduced return type|"
2047   "declaration with trailing return type}0 "
2048   "must be the only declaration in its group">;
2049 def err_implied_std_initializer_list_not_found : Error<
2050   "cannot deduce type of initializer list because std::initializer_list was "
2051   "not found; include <initializer_list>">;
2052 def err_malformed_std_initializer_list : Error<
2053   "std::initializer_list must be a class template with a single type parameter">;
2054 def err_auto_init_list_from_c : Error<
2055   "cannot use __auto_type with initializer list in C">;
2056 def err_auto_bitfield : Error<
2057   "cannot pass bit-field as __auto_type initializer in C">;
2058
2059 // C++1y decltype(auto) type
2060 def err_decltype_auto_invalid : Error<
2061   "'decltype(auto)' not allowed here">;
2062 def err_decltype_auto_cannot_be_combined : Error<
2063   "'decltype(auto)' cannot be combined with other type specifiers">;
2064 def err_decltype_auto_function_declarator_not_declaration : Error<
2065   "'decltype(auto)' can only be used as a return type "
2066   "in a function declaration">;
2067 def err_decltype_auto_compound_type : Error<
2068   "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2069 def err_decltype_auto_initializer_list : Error<
2070   "cannot deduce 'decltype(auto)' from initializer list">;
2071
2072 // C++17 deduced class template specialization types
2073 def err_deduced_class_template_compound_type : Error<
2074   "cannot %select{form pointer to|form reference to|form array of|"
2075   "form function returning|use parentheses when declaring variable with}0 "
2076   "deduced class template specialization type">;
2077 def err_deduced_non_class_template_specialization_type : Error<
2078   "%select{<error>|function template|variable template|alias template|"
2079   "template template parameter|template}0 %1 requires template arguments; "
2080   "argument deduction only allowed for class templates">;
2081 def err_deduced_class_template_ctor_ambiguous : Error<
2082   "ambiguous deduction for template arguments of %0">;
2083 def err_deduced_class_template_ctor_no_viable : Error<
2084   "no viable constructor or deduction guide for deduction of "
2085   "template arguments of %0">;
2086 def err_deduced_class_template_incomplete : Error<
2087   "template %0 has no definition and no %select{|viable }1deduction guides "
2088   "for deduction of template arguments">;
2089 def err_deduced_class_template_deleted : Error<
2090   "class template argument deduction for %0 selected a deleted constructor">;
2091 def err_deduced_class_template_explicit : Error<
2092   "class template argument deduction for %0 selected an explicit "
2093   "%select{constructor|deduction guide}1 for copy-list-initialization">;
2094 def err_deduction_guide_no_trailing_return_type : Error<
2095   "deduction guide declaration without trailing return type">;
2096 def err_deduction_guide_bad_trailing_return_type : Error<
2097   "deduced type %1 of deduction guide is not %select{|written as }2"
2098   "a specialization of template %0">;
2099 def err_deduction_guide_with_complex_decl : Error<
2100   "cannot specify any part of a return type in the "
2101   "declaration of a deduction guide">;
2102 def err_deduction_guide_invalid_specifier : Error<
2103   "deduction guide cannot be declared '%0'">;
2104 def err_deduction_guide_name_not_class_template : Error<
2105   "cannot specify deduction guide for "
2106   "%select{<error>|function template|variable template|alias template|"
2107   "template template parameter|dependent template name}0 %1">;
2108 def err_deduction_guide_wrong_scope : Error<
2109   "deduction guide must be declared in the same scope as template %q0">;
2110 def err_deduction_guide_defines_function : Error<
2111   "deduction guide cannot have a function definition">;
2112 def err_deduction_guide_explicit_mismatch : Error<
2113   "deduction guide is %select{not |}0declared 'explicit' but "
2114   "previous declaration was%select{ not|}0">;
2115 def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2116   "%select{explicitly instantiated|explicitly specialized}0">;
2117 def err_deduction_guide_template_not_deducible : Error<
2118   "deduction guide template contains "
2119   "%select{a template parameter|template parameters}0 that cannot be "
2120   "deduced">;
2121 def err_deduction_guide_wrong_access : Error<
2122   "deduction guide has different access from the corresponding "
2123   "member template">;
2124 def note_deduction_guide_template_access : Note<
2125   "member template declared %0 here">;
2126 def note_deduction_guide_access : Note<
2127   "deduction guide declared %0 by intervening access specifier">;
2128 def warn_cxx14_compat_class_template_argument_deduction : Warning<
2129   "class template argument deduction is incompatible with C++ standards "
2130   "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2131   InGroup<CXXPre17Compat>, DefaultIgnore;
2132
2133 // C++14 deduced return types
2134 def err_auto_fn_deduction_failure : Error<
2135   "cannot deduce return type %0 from returned value of type %1">;
2136 def err_auto_fn_different_deductions : Error<
2137   "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2138   "deduced as %2 in earlier return statement">;
2139 def err_auto_fn_used_before_defined : Error<
2140   "function %0 with deduced return type cannot be used before it is defined">;
2141 def err_auto_fn_no_return_but_not_auto : Error<
2142   "cannot deduce return type %0 for function with no return statements">;
2143 def err_auto_fn_return_void_but_not_auto : Error<
2144   "cannot deduce return type %0 from omitted return expression">;
2145 def err_auto_fn_return_init_list : Error<
2146   "cannot deduce return type from initializer list">;
2147 def err_auto_fn_virtual : Error<
2148   "function with deduced return type cannot be virtual">;
2149 def warn_cxx11_compat_deduced_return_type : Warning<
2150   "return type deduction is incompatible with C++ standards before C++14">,
2151   InGroup<CXXPre14Compat>, DefaultIgnore;
2152
2153 // C++11 override control
2154 def override_keyword_only_allowed_on_virtual_member_functions : Error<
2155   "only virtual member functions can be marked '%0'">;
2156 def override_keyword_hides_virtual_member_function : Error<
2157   "non-virtual member function marked '%0' hides virtual member "
2158   "%select{function|functions}1">;
2159 def err_function_marked_override_not_overriding : Error<
2160   "%0 marked 'override' but does not override any member functions">;
2161 def warn_destructor_marked_not_override_overriding : Warning <
2162   "%0 overrides a destructor but is not marked 'override'">,
2163   InGroup<CXX11WarnOverrideDestructor>, DefaultIgnore;
2164 def warn_function_marked_not_override_overriding : Warning <
2165   "%0 overrides a member function but is not marked 'override'">,
2166   InGroup<CXX11WarnOverrideMethod>;
2167 def err_class_marked_final_used_as_base : Error<
2168   "base %0 is marked '%select{final|sealed}1'">;
2169 def warn_abstract_final_class : Warning<
2170   "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2171
2172 // C++11 attributes
2173 def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2174
2175 // C++11 final
2176 def err_final_function_overridden : Error<
2177   "declaration of %0 overrides a '%select{final|sealed}1' function">;
2178
2179 // C++11 scoped enumerations
2180 def err_enum_invalid_underlying : Error<
2181   "non-integral type %0 is an invalid underlying type">;
2182 def err_enumerator_too_large : Error<
2183   "enumerator value is not representable in the underlying type %0">;
2184 def ext_enumerator_too_large : Extension<
2185   "enumerator value is not representable in the underlying type %0">,
2186   InGroup<MicrosoftEnumValue>;
2187 def err_enumerator_wrapped : Error<
2188   "enumerator value %0 is not representable in the underlying type %1">;
2189 def err_enum_redeclare_type_mismatch : Error<
2190   "enumeration redeclared with different underlying type %0 (was %1)">;
2191 def err_enum_redeclare_fixed_mismatch : Error<
2192   "enumeration previously declared with %select{non|}0fixed underlying type">;
2193 def err_enum_redeclare_scoped_mismatch : Error<
2194   "enumeration previously declared as %select{un|}0scoped">;
2195 def err_enum_class_reference : Error<
2196   "reference to %select{|scoped }0enumeration must use 'enum' "
2197   "not 'enum class'">;
2198 def err_only_enums_have_underlying_types : Error<
2199   "only enumeration types have underlying types">;
2200 def err_underlying_type_of_incomplete_enum : Error<
2201   "cannot determine underlying type of incomplete enumeration type %0">;
2202
2203 // C++11 delegating constructors
2204 def err_delegating_ctor : Error<
2205   "delegating constructors are permitted only in C++11">;
2206 def warn_cxx98_compat_delegating_ctor : Warning<
2207   "delegating constructors are incompatible with C++98">,
2208   InGroup<CXX98Compat>, DefaultIgnore;
2209 def err_delegating_initializer_alone : Error<
2210   "an initializer for a delegating constructor must appear alone">;
2211 def warn_delegating_ctor_cycle : Warning<
2212   "constructor for %0 creates a delegation cycle">, DefaultError,
2213   InGroup<DelegatingCtorCycles>;
2214 def note_it_delegates_to : Note<"it delegates to">;
2215 def note_which_delegates_to : Note<"which delegates to">;
2216
2217 // C++11 range-based for loop
2218 def err_for_range_decl_must_be_var : Error<
2219   "for range declaration must declare a variable">;
2220 def err_for_range_storage_class : Error<
2221   "loop variable %0 may not be declared %select{'extern'|'static'|"
2222   "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
2223 def err_type_defined_in_for_range : Error<
2224   "types may not be defined in a for range declaration">;
2225 def err_for_range_deduction_failure : Error<
2226   "cannot use type %0 as a range">;
2227 def err_for_range_incomplete_type : Error<
2228   "cannot use incomplete type %0 as a range">;
2229 def err_for_range_iter_deduction_failure : Error<
2230   "cannot use type %0 as an iterator">;
2231 def ext_for_range_begin_end_types_differ : ExtWarn<
2232   "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2233   InGroup<CXX17>;
2234 def warn_for_range_begin_end_types_differ : Warning<
2235   "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2236   "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2237 def note_in_for_range: Note<
2238   "when looking up '%select{begin|end}0' function for range expression "
2239   "of type %1">;
2240 def err_for_range_invalid: Error<
2241   "invalid range expression of type %0; no viable '%select{begin|end}1' "
2242   "function available">;
2243 def note_for_range_member_begin_end_ignored : Note<
2244   "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2245 def err_range_on_array_parameter : Error<
2246   "cannot build range expression with array function parameter %0 since "
2247   "parameter with array type %1 is treated as pointer type %2">;
2248 def err_for_range_dereference : Error<
2249   "invalid range expression of type %0; did you mean to dereference it "
2250   "with '*'?">;
2251 def note_for_range_invalid_iterator : Note <
2252   "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2253 def note_for_range_begin_end : Note<
2254   "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2255 def warn_for_range_const_reference_copy : Warning<
2256   "loop variable %0 "
2257   "%diff{has type $ but is initialized with type $"
2258   "| is initialized with a value of a different type}1,2 resulting in a copy">,
2259   InGroup<RangeLoopAnalysis>, DefaultIgnore;
2260 def note_use_type_or_non_reference : Note<
2261   "use non-reference type %0 to keep the copy or type %1 to prevent copying">;
2262 def warn_for_range_variable_always_copy : Warning<
2263   "loop variable %0 is always a copy because the range of type %1 does not "
2264   "return a reference">,
2265   InGroup<RangeLoopAnalysis>, DefaultIgnore;
2266 def note_use_non_reference_type : Note<"use non-reference type %0">;
2267 def warn_for_range_copy : Warning<
2268   "loop variable %0 of type %1 creates a copy from type %2">,
2269   InGroup<RangeLoopAnalysis>, DefaultIgnore;
2270 def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2271 def err_objc_for_range_init_stmt : Error<
2272   "initialization statement is not supported when iterating over Objective-C "
2273   "collection">;
2274
2275 // C++11 constexpr
2276 def warn_cxx98_compat_constexpr : Warning<
2277   "'constexpr' specifier is incompatible with C++98">,
2278   InGroup<CXX98Compat>, DefaultIgnore;
2279 // FIXME: Maybe this should also go in -Wc++14-compat?
2280 def warn_cxx14_compat_constexpr_not_const : Warning<
2281   "'constexpr' non-static member function will not be implicitly 'const' "
2282   "in C++14; add 'const' to avoid a change in behavior">,
2283   InGroup<DiagGroup<"constexpr-not-const">>;
2284 def err_invalid_constexpr : Error<
2285   "%select{function parameter|typedef|non-static data member}0 "
2286   "cannot be constexpr">;
2287 def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2288   "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2289 def err_constexpr_tag : Error<
2290   "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">;
2291 def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">;
2292 def err_constexpr_no_declarators : Error<
2293   "constexpr can only be used in variable and function declarations">;
2294 def err_invalid_constexpr_var_decl : Error<
2295   "constexpr variable declaration must be a definition">;
2296 def err_constexpr_static_mem_var_requires_init : Error<
2297   "declaration of constexpr static data member %0 requires an initializer">;
2298 def err_constexpr_var_non_literal : Error<
2299   "constexpr variable cannot have non-literal type %0">;
2300 def err_constexpr_var_requires_const_init : Error<
2301   "constexpr variable %0 must be initialized by a constant expression">;
2302 def err_constexpr_redecl_mismatch : Error<
2303   "%select{non-constexpr declaration of %0 follows constexpr declaration"
2304   "|constexpr declaration of %0 follows non-constexpr declaration}1">;
2305 def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2306 def err_constexpr_virtual_base : Error<
2307   "constexpr %select{member function|constructor}0 not allowed in "
2308   "%select{struct|interface|class}1 with virtual base "
2309   "%plural{1:class|:classes}2">;
2310 def note_non_literal_incomplete : Note<
2311   "incomplete type %0 is not a literal type">;
2312 def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2313   "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2314 def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2315 def err_constexpr_non_literal_return : Error<
2316   "constexpr function's return type %0 is not a literal type">;
2317 def err_constexpr_non_literal_param : Error<
2318   "constexpr %select{function|constructor}1's %ordinal0 parameter type %2 is "
2319   "not a literal type">;
2320 def err_constexpr_body_invalid_stmt : Error<
2321   "statement not allowed in constexpr %select{function|constructor}0">;
2322 def ext_constexpr_body_invalid_stmt : ExtWarn<
2323   "use of this statement in a constexpr %select{function|constructor}0 "
2324   "is a C++14 extension">, InGroup<CXX14>;
2325 def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2326   "use of this statement in a constexpr %select{function|constructor}0 "
2327   "is incompatible with C++ standards before C++14">,
2328   InGroup<CXXPre14Compat>, DefaultIgnore;
2329 def ext_constexpr_body_invalid_stmt_cxx2a : ExtWarn<
2330   "use of this statement in a constexpr %select{function|constructor}0 "
2331   "is a C++2a extension">, InGroup<CXX2a>;
2332 def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2333   "use of this statement in a constexpr %select{function|constructor}0 "
2334   "is incompatible with C++ standards before C++2a">,
2335   InGroup<CXXPre2aCompat>, DefaultIgnore;
2336 def ext_constexpr_type_definition : ExtWarn<
2337   "type definition in a constexpr %select{function|constructor}0 "
2338   "is a C++14 extension">, InGroup<CXX14>;
2339 def warn_cxx11_compat_constexpr_type_definition : Warning<
2340   "type definition in a constexpr %select{function|constructor}0 "
2341   "is incompatible with C++ standards before C++14">,
2342   InGroup<CXXPre14Compat>, DefaultIgnore;
2343 def err_constexpr_vla : Error<
2344   "variably-modified type %0 cannot be used in a constexpr "
2345   "%select{function|constructor}1">;
2346 def ext_constexpr_local_var : ExtWarn<
2347   "variable declaration in a constexpr %select{function|constructor}0 "
2348   "is a C++14 extension">, InGroup<CXX14>;
2349 def warn_cxx11_compat_constexpr_local_var : Warning<
2350   "variable declaration in a constexpr %select{function|constructor}0 "
2351   "is incompatible with C++ standards before C++14">,
2352   InGroup<CXXPre14Compat>, DefaultIgnore;
2353 def err_constexpr_local_var_static : Error<
2354   "%select{static|thread_local}1 variable not permitted in a constexpr "
2355   "%select{function|constructor}0">;
2356 def err_constexpr_local_var_non_literal_type : Error<
2357   "variable of non-literal type %1 cannot be defined in a constexpr "
2358   "%select{function|constructor}0">;
2359 def err_constexpr_local_var_no_init : Error<
2360   "variables defined in a constexpr %select{function|constructor}0 must be "
2361   "initialized">;
2362 def ext_constexpr_function_never_constant_expr : ExtWarn<
2363   "constexpr %select{function|constructor}0 never produces a "
2364   "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2365 def err_attr_cond_never_constant_expr : Error<
2366   "%0 attribute expression never produces a constant expression">;
2367 def err_diagnose_if_invalid_diagnostic_type : Error<
2368   "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2369   "instead">;
2370 def err_constexpr_body_no_return : Error<
2371   "no return statement in constexpr function">;
2372 def err_constexpr_return_missing_expr : Error<
2373   "non-void constexpr function %0 should return a value">;
2374 def warn_cxx11_compat_constexpr_body_no_return : Warning<
2375   "constexpr function with no return statements is incompatible with C++ "
2376   "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2377 def ext_constexpr_body_multiple_return : ExtWarn<
2378   "multiple return statements in constexpr function is a C++14 extension">,
2379   InGroup<CXX14>;
2380 def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2381   "multiple return statements in constexpr function "
2382   "is incompatible with C++ standards before C++14">,
2383   InGroup<CXXPre14Compat>, DefaultIgnore;
2384 def note_constexpr_body_previous_return : Note<
2385   "previous return statement is here">;
2386 def err_constexpr_function_try_block : Error<
2387   "function try block not allowed in constexpr %select{function|constructor}0">;
2388
2389 // c++2a function try blocks in constexpr
2390 def ext_constexpr_function_try_block_cxx2a : ExtWarn<
2391   "function try block in constexpr %select{function|constructor}0 is "
2392   "a C++2a extension">, InGroup<CXX2a>;
2393 def warn_cxx17_compat_constexpr_function_try_block : Warning<
2394   "function try block in constexpr %select{function|constructor}0 is "
2395   "incompatible with C++ standards before C++2a">,
2396   InGroup<CXXPre2aCompat>, DefaultIgnore;
2397
2398 def err_constexpr_union_ctor_no_init : Error<
2399   "constexpr union constructor does not initialize any member">;
2400 def err_constexpr_ctor_missing_init : Error<
2401   "constexpr constructor must initialize all members">;
2402 def note_constexpr_ctor_missing_init : Note<
2403   "member not initialized by constructor">;
2404 def note_non_literal_no_constexpr_ctors : Note<
2405   "%0 is not literal because it is not an aggregate and has no constexpr "
2406   "constructors other than copy or move constructors">;
2407 def note_non_literal_base_class : Note<
2408   "%0 is not literal because it has base class %1 of non-literal type">;
2409 def note_non_literal_field : Note<
2410   "%0 is not literal because it has data member %1 of "
2411   "%select{non-literal|volatile}3 type %2">;
2412 def note_non_literal_user_provided_dtor : Note<
2413   "%0 is not literal because it has a user-provided destructor">;
2414 def note_non_literal_nontrivial_dtor : Note<
2415   "%0 is not literal because it has a non-trivial destructor">;
2416 def note_non_literal_lambda : Note<
2417   "lambda closure types are non-literal types before C++17">;
2418 def warn_private_extern : Warning<
2419   "use of __private_extern__ on a declaration may not produce external symbol "
2420   "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2421 def note_private_extern : Note<
2422   "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2423
2424 // C++ Concepts TS
2425 def err_concept_wrong_decl_kind : Error<
2426   "'concept' can only appear on the definition of a function template or variable template">;
2427 def err_concept_decls_may_only_appear_in_namespace_scope : Error<
2428   "concept declarations may only appear in namespace scope">;
2429 def err_function_concept_not_defined : Error<
2430   "function concept declaration must be a definition">;
2431 def err_var_concept_not_initialized : Error<
2432   "variable concept declaration must be initialized">;
2433 def err_function_concept_exception_spec : Error<
2434   "function concept cannot have exception specification">;
2435 def err_concept_decl_invalid_specifiers : Error<
2436   "%select{variable|function}0 concept cannot be declared "
2437   "'%select{thread_local|inline|friend|constexpr}1'">;
2438 def err_function_concept_with_params : Error<
2439   "function concept cannot have any parameters">;
2440 def err_function_concept_bool_ret : Error<
2441   "declared return type of function concept must be 'bool'">;
2442 def err_variable_concept_bool_decl : Error<
2443   "declared type of variable concept must be 'bool'">;
2444 def err_concept_specified_specialization : Error<
2445   "'concept' cannot be applied on an "
2446   "%select{explicit instantiation|explicit specialization|partial specialization}0">;
2447 def err_concept_specialized : Error<
2448   "%select{function|variable}0 concept cannot be "
2449   "%select{explicitly instantiated|explicitly specialized|partially specialized}1">;
2450
2451 def err_template_different_associated_constraints : Error<
2452   "associated constraints differ in template redeclaration">;
2453
2454 // C++11 char16_t/char32_t
2455 def warn_cxx98_compat_unicode_type : Warning<
2456   "'%0' type specifier is incompatible with C++98">,
2457   InGroup<CXX98Compat>, DefaultIgnore;
2458 def warn_cxx17_compat_unicode_type : Warning<
2459   "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2460   InGroup<CXXPre2aCompat>, DefaultIgnore;
2461
2462 // __make_integer_seq
2463 def err_integer_sequence_negative_length : Error<
2464   "integer sequences must have non-negative sequence length">;
2465 def err_integer_sequence_integral_element_type : Error<
2466   "integer sequences must have integral element type">;
2467
2468 // __type_pack_element
2469 def err_type_pack_element_out_of_bounds : Error<
2470   "a parameter pack may not be accessed at an out of bounds index">;
2471
2472 // Objective-C++
2473 def err_objc_decls_may_only_appear_in_global_scope : Error<
2474   "Objective-C declarations may only appear in global scope">;
2475 def warn_auto_var_is_id : Warning<
2476   "'auto' deduced as 'id' in declaration of %0">,
2477   InGroup<DiagGroup<"auto-var-id">>;
2478
2479 // Attributes
2480 def err_nsobject_attribute : Error<
2481   "'NSObject' attribute is for pointer types only">;
2482 def err_attributes_are_not_compatible : Error<
2483   "%0 and %1 attributes are not compatible">;
2484 def err_attribute_wrong_number_arguments : Error<
2485   "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2486   ":requires exactly %1 arguments}1">;
2487 def err_attribute_too_many_arguments : Error<
2488   "%0 attribute takes no more than %1 argument%s1">;
2489 def err_attribute_too_few_arguments : Error<
2490   "%0 attribute takes at least %1 argument%s1">;
2491 def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2492 def err_attribute_bad_neon_vector_size : Error<
2493   "Neon vector size must be 64 or 128 bits">;
2494 def err_attribute_requires_positive_integer : Error<
2495   "%0 attribute requires a %select{positive|non-negative}1 "
2496   "integral compile time constant expression">;
2497 def err_attribute_requires_opencl_version : Error<
2498   "%0 attribute requires OpenCL version %1%select{| or above}2">;
2499 def warn_unsupported_target_attribute
2500     : Warning<"%select{unsupported|duplicate}0%select{| architecture}1 '%2' in"
2501               " the 'target' attribute string; 'target' attribute ignored">,
2502       InGroup<IgnoredAttributes>;
2503 def err_attribute_unsupported
2504     : Error<"%0 attribute is not supported for this target">;
2505 // The err_*_attribute_argument_not_int are separate because they're used by
2506 // VerifyIntegerConstantExpression.
2507 def err_aligned_attribute_argument_not_int : Error<
2508   "'aligned' attribute requires integer constant">;
2509 def err_align_value_attribute_argument_not_int : Error<
2510   "'align_value' attribute requires integer constant">;
2511 def err_alignas_attribute_wrong_decl_type : Error<
2512   "%0 attribute cannot be applied to a %select{function parameter|"
2513   "variable with 'register' storage class|'catch' variable|bit-field}1">;
2514 def err_alignas_missing_on_definition : Error<
2515   "%0 must be specified on definition if it is specified on any declaration">;
2516 def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2517 def err_alignas_mismatch : Error<
2518   "redeclaration has different alignment requirement (%1 vs %0)">;
2519 def err_alignas_underaligned : Error<
2520   "requested alignment is less than minimum alignment of %1 for type %0">;
2521 def err_attribute_argument_n_type : Error<
2522   "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2523   "constant|a string|an identifier}2">;
2524 def err_attribute_argument_type : Error<
2525   "%0 attribute requires %select{int or bool|an integer "
2526   "constant|a string|an identifier}1">;
2527 def err_attribute_argument_outof_range : Error<
2528   "%0 attribute requires integer constant between %1 and %2 inclusive">;
2529 def err_init_priority_object_attr : Error<
2530   "can only use 'init_priority' attribute on file-scope definitions "
2531   "of objects of class type">;
2532 def err_attribute_argument_vec_type_hint : Error<
2533   "invalid attribute argument %0 - expecting a vector or vectorizable scalar type">;
2534 def err_attribute_argument_out_of_bounds : Error<
2535   "%0 attribute parameter %1 is out of bounds">;
2536 def err_attribute_only_once_per_parameter : Error<
2537   "%0 attribute can only be applied once per parameter">;
2538 def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2539 def note_previous_uuid : Note<"previous uuid specified here">;
2540 def warn_attribute_pointers_only : Warning<
2541   "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2542   InGroup<IgnoredAttributes>;
2543 def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2544 def err_attribute_integers_only : Error<
2545   "%0 attribute argument may only refer to a function parameter of integer "
2546   "type">;
2547 def warn_attribute_return_pointers_only : Warning<
2548   "%0 attribute only applies to return values that are pointers">,
2549   InGroup<IgnoredAttributes>;
2550 def warn_attribute_return_pointers_refs_only : Warning<
2551   "%0 attribute only applies to return values that are pointers or references">,
2552   InGroup<IgnoredAttributes>;
2553 def warn_attribute_pointer_or_reference_only : Warning<
2554   "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2555   InGroup<IgnoredAttributes>;
2556 def err_attribute_no_member_pointers : Error<
2557   "%0 attribute cannot be used with pointers to members">;
2558 def err_attribute_invalid_implicit_this_argument : Error<
2559   "%0 attribute is invalid for the implicit this argument">;
2560 def err_ownership_type : Error<
2561   "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2562 def err_ownership_returns_index_mismatch : Error<
2563   "'ownership_returns' attribute index does not match; here it is %0">;
2564 def note_ownership_returns_index_mismatch : Note<
2565   "declared with index %0 here">;
2566 def err_format_strftime_third_parameter : Error<
2567   "strftime format attribute requires 3rd parameter to be 0">;
2568 def err_format_attribute_requires_variadic : Error<
2569   "format attribute requires variadic function">;
2570 def err_format_attribute_not : Error<"format argument not %0">;
2571 def err_format_attribute_result_not : Error<"function does not return %0">;
2572 def err_format_attribute_implicit_this_format_string : Error<
2573   "format attribute cannot specify the implicit this argument as the format "
2574   "string">;
2575 def err_init_method_bad_return_type : Error<
2576   "init methods must return an object pointer type, not %0">;
2577 def err_attribute_invalid_size : Error<
2578   "vector size not an integral multiple of component size">;
2579 def err_attribute_zero_size : Error<"zero vector size">;
2580 def err_attribute_size_too_large : Error<"vector size too large">;
2581 def err_typecheck_vector_not_convertable_implict_truncation : Error<
2582    "cannot convert between %select{scalar|vector}0 type %1 and vector type"
2583    " %2 as implicit conversion would cause truncation">;
2584 def err_typecheck_vector_not_convertable : Error<
2585   "cannot convert between vector values of different size (%0 and %1)">;
2586 def err_typecheck_vector_not_convertable_non_scalar : Error<
2587   "cannot convert between vector and non-scalar values (%0 and %1)">;
2588 def err_typecheck_vector_lengths_not_equal : Error<
2589   "vector operands do not have the same number of elements (%0 and %1)">;
2590 def warn_typecheck_vector_element_sizes_not_equal : Warning<
2591   "vector operands do not have the same elements sizes (%0 and %1)">,
2592   InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
2593 def err_ext_vector_component_exceeds_length : Error<
2594   "vector component access exceeds type %0">;
2595 def err_ext_vector_component_name_illegal : Error<
2596   "illegal vector component name '%0'">;
2597 def err_attribute_address_space_negative : Error<
2598   "address space is negative">;
2599 def err_attribute_address_space_too_high : Error<
2600   "address space is larger than the maximum supported (%0)">;
2601 def err_attribute_address_multiple_qualifiers : Error<
2602   "multiple address spaces specified for type">;
2603 def warn_attribute_address_multiple_identical_qualifiers : Warning<
2604   "multiple identical address spaces specified for type">,
2605   InGroup<DuplicateDeclSpecifier>;
2606 def err_attribute_address_function_type : Error<
2607   "function type may not be qualified with an address space">;
2608 def err_as_qualified_auto_decl : Error<
2609   "automatic variable qualified with an%select{| invalid}0 address space">;
2610 def err_arg_with_address_space : Error<
2611   "parameter may not be qualified with an address space">;
2612 def err_field_with_address_space : Error<
2613   "field may not be qualified with an address space">;
2614 def err_compound_literal_with_address_space : Error<
2615   "compound literal in function scope may not be qualified with an address space">;
2616 def err_address_space_mismatch_templ_inst : Error<
2617   "conflicting address space qualifiers are provided between types %0 and %1">;
2618 def err_attr_objc_ownership_redundant : Error<
2619   "the type %0 is already explicitly ownership-qualified">;
2620 def err_invalid_nsnumber_type : Error<
2621   "%0 is not a valid literal type for NSNumber">;
2622 def err_objc_illegal_boxed_expression_type : Error<
2623   "illegal type %0 used in a boxed expression">;
2624 def err_objc_non_trivially_copyable_boxed_expression_type : Error<
2625   "non-trivially copyable type %0 cannot be used in a boxed expression">;
2626 def err_objc_incomplete_boxed_expression_type : Error<
2627   "incomplete type %0 used in a boxed expression">;
2628 def err_undeclared_objc_literal_class : Error<
2629   "definition of class %0 must be available to use Objective-C "
2630   "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
2631   "string literals}1">;
2632 def err_undeclared_boxing_method : Error<
2633   "declaration of %0 is missing in %1 class">;
2634 def err_objc_literal_method_sig : Error<
2635   "literal construction method %0 has incompatible signature">;
2636 def note_objc_literal_method_param : Note<
2637   "%select{first|second|third}0 parameter has unexpected type %1 "
2638   "(should be %2)">;
2639 def note_objc_literal_method_return : Note<
2640   "method returns unexpected type %0 (should be an object type)">;
2641 def err_invalid_collection_element : Error<
2642   "collection element of type %0 is not an Objective-C object">;
2643 def err_box_literal_collection : Error<
2644   "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
2645   "in a collection">;
2646 def warn_objc_literal_comparison : Warning<
2647   "direct comparison of %select{an array literal|a dictionary literal|"
2648   "a numeric literal|a boxed expression|}0 has undefined behavior">,
2649   InGroup<ObjCLiteralComparison>;
2650 def err_missing_atsign_prefix : Error<
2651   "string literal must be prefixed by '@' ">;
2652 def warn_objc_string_literal_comparison : Warning<
2653   "direct comparison of a string literal has undefined behavior">,
2654   InGroup<ObjCStringComparison>;
2655 def warn_concatenated_nsarray_literal : Warning<
2656   "concatenated NSString literal for an NSArray expression - "
2657   "possibly missing a comma">,
2658   InGroup<ObjCStringConcatenation>;
2659 def note_objc_literal_comparison_isequal : Note<
2660   "use 'isEqual:' instead">;
2661 def warn_objc_collection_literal_element : Warning<
2662   "object of type %0 is not compatible with "
2663   "%select{array element type|dictionary key type|dictionary value type}1 %2">,
2664   InGroup<ObjCLiteralConversion>;
2665 def err_swift_param_attr_not_swiftcall : Error<
2666   "'%0' parameter can only be used with swiftcall calling convention">;
2667 def err_swift_indirect_result_not_first : Error<
2668   "'swift_indirect_result' parameters must be first parameters of function">;
2669 def err_swift_error_result_not_after_swift_context : Error<
2670   "'swift_error_result' parameter must follow 'swift_context' parameter">;
2671 def err_swift_abi_parameter_wrong_type : Error<
2672   "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
2673   "type here is %2">;
2674
2675 def err_attribute_argument_invalid : Error<
2676   "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
2677   "min must not be greater than max}1">;
2678 def err_attribute_argument_is_zero : Error<
2679   "%0 attribute must be greater than 0">;
2680 def warn_attribute_argument_n_negative : Warning<
2681   "%0 attribute parameter %1 is negative and will be ignored">,
2682   InGroup<CudaCompat>;
2683 def err_property_function_in_objc_container : Error<
2684   "use of Objective-C property in function nested in Objective-C "
2685   "container not supported, move function outside its container">;
2686
2687 let CategoryName = "Cocoa API Issue" in {
2688 def warn_objc_redundant_literal_use : Warning<
2689   "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
2690 }
2691
2692 def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
2693   "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
2694
2695 def err_tls_var_aligned_over_maximum : Error<
2696   "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
2697   "alignment (%2) for a thread-local variable on this target">;
2698
2699 def err_only_annotate_after_access_spec : Error<
2700   "access specifier can only have annotation attributes">;
2701
2702 def err_attribute_section_invalid_for_target : Error<
2703   "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
2704 def warn_mismatched_section : Warning<
2705   "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
2706 def warn_attribute_section_on_redeclaration : Warning<
2707   "section attribute is specified on redeclared variable">, InGroup<Section>;
2708 def err_mismatched_code_seg_base : Error<
2709   "derived class must specify the same code segment as its base classes">;
2710 def err_mismatched_code_seg_override : Error<
2711   "overriding virtual function must specify the same code segment as its overridden function">;
2712 def err_conflicting_codeseg_attribute : Error<
2713   "conflicting code segment specifiers">;
2714 def warn_duplicate_codeseg_attribute : Warning<
2715   "duplicate code segment specifiers">, InGroup<Section>;
2716
2717 def err_anonymous_property: Error<
2718   "anonymous property is not supported">;
2719 def err_property_is_variably_modified : Error<
2720   "property %0 has a variably modified type">;
2721 def err_no_accessor_for_property : Error<
2722   "no %select{getter|setter}0 defined for property %1">;
2723 def err_cannot_find_suitable_accessor : Error<
2724   "cannot find suitable %select{getter|setter}0 for property %1">;
2725
2726 def warn_alloca_align_alignof : Warning<
2727   "second argument to __builtin_alloca_with_align is supposed to be in bits">,
2728   InGroup<DiagGroup<"alloca-with-align-alignof">>;
2729
2730 def err_alignment_too_small : Error<
2731   "requested alignment must be %0 or greater">;
2732 def err_alignment_too_big : Error<
2733   "requested alignment must be %0 or smaller">;
2734 def err_alignment_not_power_of_two : Error<
2735   "requested alignment is not a power of 2">;
2736 def err_alignment_dependent_typedef_name : Error<
2737   "requested alignment is dependent but declaration is not dependent">;
2738
2739 def err_attribute_aligned_too_great : Error<
2740   "requested alignment must be %0 bytes or smaller">;
2741 def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
2742   "%q0 redeclared without %1 attribute: previous %1 ignored">,
2743   InGroup<MicrosoftInconsistentDllImport>;
2744 def warn_redeclaration_without_import_attribute : Warning<
2745   "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
2746   InGroup<MicrosoftInconsistentDllImport>;
2747 def warn_dllimport_dropped_from_inline_function : Warning<
2748   "%q0 redeclared inline; %1 attribute ignored">,
2749   InGroup<IgnoredAttributes>;
2750 def warn_attribute_ignored : Warning<"%0 attribute ignored">,
2751   InGroup<IgnoredAttributes>;
2752 def warn_attribute_ignored_on_inline :
2753   Warning<"%0 attribute ignored on inline function">,
2754   InGroup<IgnoredAttributes>;
2755 def warn_nocf_check_attribute_ignored :
2756   Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
2757   InGroup<IgnoredAttributes>;
2758 def warn_attribute_after_definition_ignored : Warning<
2759   "attribute %0 after definition is ignored">,
2760    InGroup<IgnoredAttributes>;
2761 def warn_cxx11_gnu_attribute_on_type : Warning<
2762   "attribute %0 ignored, because it cannot be applied to a type">,
2763   InGroup<IgnoredAttributes>;
2764 def warn_unhandled_ms_attribute_ignored : Warning<
2765   "__declspec attribute %0 is not supported">,
2766   InGroup<IgnoredAttributes>;
2767 def err_decl_attribute_invalid_on_stmt : Error<
2768   "%0 attribute cannot be applied to a statement">;
2769 def err_stmt_attribute_invalid_on_decl : Error<
2770   "%0 attribute cannot be applied to a declaration">;
2771 def warn_declspec_attribute_ignored : Warning<
2772   "attribute %0 is ignored, place it after "
2773   "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
2774   "type declaration">, InGroup<IgnoredAttributes>;
2775 def warn_attribute_precede_definition : Warning<
2776   "attribute declaration must precede definition">,
2777   InGroup<IgnoredAttributes>;
2778 def warn_attribute_void_function_method : Warning<
2779   "attribute %0 cannot be applied to "
2780   "%select{functions|Objective-C method}1 without return value">,
2781   InGroup<IgnoredAttributes>;
2782 def warn_attribute_weak_on_field : Warning<
2783   "__weak attribute cannot be specified on a field declaration">,
2784   InGroup<IgnoredAttributes>;
2785 def warn_gc_attribute_weak_on_local : Warning<
2786   "Objective-C GC does not allow weak variables on the stack">,
2787   InGroup<IgnoredAttributes>;
2788 def warn_nsobject_attribute : Warning<
2789   "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
2790   InGroup<NSobjectAttribute>;
2791 def warn_independentclass_attribute : Warning<
2792   "'objc_independent_class' attribute may be put on a typedef only; "
2793   "attribute is ignored">,
2794   InGroup<IndependentClassAttribute>;
2795 def warn_ptr_independentclass_attribute : Warning<
2796   "'objc_independent_class' attribute may be put on Objective-C object "
2797   "pointer type only; attribute is ignored">,
2798   InGroup<IndependentClassAttribute>;
2799 def warn_attribute_weak_on_local : Warning<
2800   "__weak attribute cannot be specified on an automatic variable when ARC "
2801   "is not enabled">,
2802   InGroup<IgnoredAttributes>;
2803 def warn_weak_identifier_undeclared : Warning<
2804   "weak identifier %0 never declared">;
2805 def err_attribute_weak_static : Error<
2806   "weak declaration cannot have internal linkage">;
2807 def err_attribute_selectany_non_extern_data : Error<
2808   "'selectany' can only be applied to data items with external linkage">;
2809 def err_declspec_thread_on_thread_variable : Error<
2810   "'__declspec(thread)' applied to variable that already has a "
2811   "thread-local storage specifier">;
2812 def err_attribute_dll_not_extern : Error<
2813   "%q0 must have external linkage when declared %q1">;
2814 def err_attribute_dll_thread_local : Error<
2815   "%q0 cannot be thread local when declared %q1">;
2816 def err_attribute_dll_lambda : Error<
2817   "lambda cannot be declared %0">;
2818 def warn_attribute_invalid_on_definition : Warning<
2819   "'%0' attribute cannot be specified on a definition">,
2820   InGroup<IgnoredAttributes>;
2821 def err_attribute_dll_redeclaration : Error<
2822   "redeclaration of %q0 cannot add %q1 attribute">;
2823 def warn_attribute_dll_redeclaration : Warning<
2824   "redeclaration of %q0 should not add %q1 attribute">,
2825   InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
2826 def err_attribute_dllimport_function_definition : Error<
2827   "dllimport cannot be applied to non-inline function definition">;
2828 def err_attribute_dll_deleted : Error<
2829   "attribute %q0 cannot be applied to a deleted function">;
2830 def err_attribute_dllimport_data_definition : Error<
2831   "definition of dllimport data">;
2832 def err_attribute_dllimport_static_field_definition : Error<
2833   "definition of dllimport static field not allowed">;
2834 def warn_attribute_dllimport_static_field_definition : Warning<
2835   "definition of dllimport static field">,
2836   InGroup<DiagGroup<"dllimport-static-field-def">>;
2837 def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
2838   "explicit instantiation declaration should not be 'dllexport'">,
2839   InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
2840 def warn_invalid_initializer_from_system_header : Warning<
2841   "invalid constructor form class in system header, should not be explicit">,
2842   InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
2843 def note_used_in_initialization_here : Note<"used in initialization here">;
2844 def err_attribute_dll_member_of_dll_class : Error<
2845   "attribute %q0 cannot be applied to member of %q1 class">;
2846 def warn_attribute_dll_instantiated_base_class : Warning<
2847   "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
2848   "base class template without dll attribute is not supported">,
2849   InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
2850 def err_attribute_dll_ambiguous_default_ctor : Error<
2851   "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
2852 def err_attribute_weakref_not_static : Error<
2853   "weakref declaration must have internal linkage">;
2854 def err_attribute_weakref_not_global_context : Error<
2855   "weakref declaration of %0 must be in a global context">;
2856 def err_attribute_weakref_without_alias : Error<
2857   "weakref declaration of %0 must also have an alias attribute">;
2858 def err_alias_not_supported_on_darwin : Error <
2859   "aliases are not supported on darwin">;
2860 def warn_attribute_wrong_decl_type_str : Warning<
2861   "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
2862 def err_attribute_wrong_decl_type_str : Error<
2863   warn_attribute_wrong_decl_type_str.Text>;
2864 def warn_attribute_wrong_decl_type : Warning<
2865   "%0 attribute only applies to %select{"
2866   "functions"
2867   "|unions"
2868   "|variables and functions"
2869   "|functions and methods"
2870   "|functions, methods and blocks"
2871   "|functions, methods, and parameters"
2872   "|variables"
2873   "|variables and fields"
2874   "|variables, data members and tag types"
2875   "|types and namespaces"
2876   "|variables, functions and classes"
2877   "|kernel functions"
2878   "|non-K&R-style functions}1">,
2879   InGroup<IgnoredAttributes>;
2880 def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
2881 def warn_type_attribute_wrong_type : Warning<
2882   "'%0' only applies to %select{function|pointer|"
2883   "Objective-C object or block pointer}1 types; type here is %2">,
2884   InGroup<IgnoredAttributes>;
2885 def warn_incomplete_encoded_type : Warning<
2886   "encoding of %0 type is incomplete because %1 component has unknown encoding">,
2887   InGroup<DiagGroup<"encode-type">>;
2888 def warn_gnu_inline_attribute_requires_inline : Warning<
2889   "'gnu_inline' attribute requires function to be marked 'inline',"
2890   " attribute ignored">,
2891   InGroup<IgnoredAttributes>;
2892 def err_attribute_vecreturn_only_vector_member : Error<
2893   "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
2894 def err_attribute_vecreturn_only_pod_record : Error<
2895   "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
2896 def err_cconv_change : Error<
2897   "function declared '%0' here was previously declared "
2898   "%select{'%2'|without calling convention}1">;
2899 def warn_cconv_ignored : Warning<
2900   "calling convention %0 ignored for this target">, InGroup<IgnoredAttributes>;
2901 def err_cconv_knr : Error<
2902   "function with no prototype cannot use the %0 calling convention">;
2903 def warn_cconv_knr : Warning<
2904   err_cconv_knr.Text>,
2905   InGroup<DiagGroup<"missing-prototype-for-cc">>;
2906 def err_cconv_varargs : Error<
2907   "variadic function cannot use %0 calling convention">;
2908 def warn_cconv_varargs : Warning<
2909   "%0 calling convention ignored on variadic function">,
2910   InGroup<IgnoredAttributes>;
2911 def warn_cconv_structors : Warning<
2912   "%0 calling convention ignored on constructor/destructor">,
2913   InGroup<IgnoredAttributes>;
2914 def err_regparm_mismatch : Error<"function declared with regparm(%0) "
2915   "attribute was previously declared "
2916   "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
2917 def err_function_attribute_mismatch : Error<
2918   "function declared with %0 attribute "
2919   "was previously declared without the %0 attribute">;
2920 def err_objc_precise_lifetime_bad_type : Error<
2921   "objc_precise_lifetime only applies to retainable types; type here is %0">;
2922 def warn_objc_precise_lifetime_meaningless : Error<
2923   "objc_precise_lifetime is not meaningful for "
2924   "%select{__unsafe_unretained|__autoreleasing}0 objects">;
2925 def err_invalid_pcs : Error<"invalid PCS type">;
2926 def warn_attribute_not_on_decl : Warning<
2927   "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
2928 def err_base_specifier_attribute : Error<
2929   "%0 attribute cannot be applied to a base specifier">;
2930 def err_invalid_attribute_on_virtual_function : Error<
2931   "%0 attribute cannot be applied to virtual functions">;
2932
2933 def ext_cannot_use_trivial_abi : ExtWarn<
2934   "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
2935
2936 // Availability attribute
2937 def warn_availability_unknown_platform : Warning<
2938   "unknown platform %0 in availability macro">, InGroup<Availability>;
2939 def warn_availability_version_ordering : Warning<
2940   "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
2941   "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
2942   "attribute ignored">, InGroup<Availability>;
2943 def warn_mismatched_availability: Warning<
2944   "availability does not match previous declaration">, InGroup<Availability>;
2945 def warn_mismatched_availability_override : Warning<
2946   "%select{|overriding }4method %select{introduced after|"
2947   "deprecated before|obsoleted before}0 "
2948   "%select{the protocol method it implements|overridden method}4 "
2949   "on %1 (%2 vs. %3)">, InGroup<Availability>;
2950 def warn_mismatched_availability_override_unavail : Warning<
2951   "%select{|overriding }1method cannot be unavailable on %0 when "
2952   "%select{the protocol method it implements|its overridden method}1 is "
2953   "available">,
2954   InGroup<Availability>;
2955 def warn_availability_on_static_initializer : Warning<
2956   "ignoring availability attribute %select{on '+load' method|"
2957   "with constructor attribute|with destructor attribute}0">,
2958   InGroup<Availability>;
2959 def note_overridden_method : Note<
2960   "overridden method is here">;
2961 def warn_availability_swift_unavailable_deprecated_only : Warning<
2962   "only 'unavailable' and 'deprecated' are supported for Swift availability">,
2963   InGroup<Availability>;
2964 def note_protocol_method : Note<
2965   "protocol method is here">;
2966
2967 def warn_unguarded_availability :
2968   Warning<"%0 is only available on %1 %2 or newer">,
2969   InGroup<UnguardedAvailability>, DefaultIgnore;
2970 def warn_unguarded_availability_new :
2971   Warning<warn_unguarded_availability.Text>,
2972   InGroup<UnguardedAvailabilityNew>;
2973 def note_decl_unguarded_availability_silence : Note<
2974   "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
2975 def note_unguarded_available_silence : Note<
2976   "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
2977   " this warning">;
2978 def warn_at_available_unchecked_use : Warning<
2979   "%select{@available|__builtin_available}0 does not guard availability here; "
2980   "use if (%select{@available|__builtin_available}0) instead">,
2981   InGroup<DiagGroup<"unsupported-availability-guard">>;
2982
2983 // Thread Safety Attributes
2984 def warn_invalid_capability_name : Warning<
2985   "invalid capability name '%0'; capability name must be 'mutex' or 'role'">,
2986   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
2987 def warn_thread_attribute_ignored : Warning<
2988   "ignoring %0 attribute because its argument is invalid">,
2989   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
2990 def warn_thread_attribute_not_on_non_static_member : Warning<
2991   "%0 attribute without capability arguments can only be applied to non-static "
2992   "methods of a class">,
2993   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
2994 def warn_thread_attribute_not_on_capability_member : Warning<
2995   "%0 attribute without capability arguments refers to 'this', but %1 isn't "
2996   "annotated with 'capability' or 'scoped_lockable' attribute">,
2997   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
2998 def warn_thread_attribute_argument_not_lockable : Warning<
2999   "%0 attribute requires arguments whose type is annotated "
3000   "with 'capability' attribute; type here is %1">,
3001   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3002 def warn_thread_attribute_decl_not_lockable : Warning<
3003   "%0 attribute can only be applied in a context annotated "
3004   "with 'capability(\"mutex\")' attribute">,
3005   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3006 def warn_thread_attribute_decl_not_pointer : Warning<
3007   "%0 only applies to pointer types; type here is %1">,
3008   InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3009 def err_attribute_argument_out_of_range : Error<
3010   "%0 attribute parameter %1 is out of bounds: "
3011   "%plural{0:no parameters to index into|"
3012   "1:can only be 1, since there is one parameter|"
3013   ":must be between 1 and %2}2">;
3014
3015 // Thread Safety Analysis
3016 def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3017   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3018 def warn_unlock_kind_mismatch : Warning<
3019   "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3020   "%select{shared|exclusive}3 access">,
3021   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3022 def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3023   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3024 def warn_no_unlock : Warning<
3025   "%0 '%1' is still held at the end of function">,
3026   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3027 def warn_expecting_locked : Warning<
3028   "expecting %0 '%1' to be held at the end of function">,
3029   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3030 // FIXME: improve the error message about locks not in scope
3031 def warn_lock_some_predecessors : Warning<
3032   "%0 '%1' is not held on every path through here">,
3033   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3034 def warn_expecting_lock_held_on_loop : Warning<
3035   "expecting %0 '%1' to be held at start of each loop">,
3036   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3037 def note_locked_here : Note<"%0 acquired here">;
3038 def warn_lock_exclusive_and_shared : Warning<
3039   "%0 '%1' is acquired exclusively and shared in the same scope">,
3040   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3041 def note_lock_exclusive_and_shared : Note<
3042   "the other acquisition of %0 '%1' is here">;
3043 def warn_variable_requires_any_lock : Warning<
3044   "%select{reading|writing}1 variable %0 requires holding "
3045   "%select{any mutex|any mutex exclusively}1">,
3046   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3047 def warn_var_deref_requires_any_lock : Warning<
3048   "%select{reading|writing}1 the value pointed to by %0 requires holding "
3049   "%select{any mutex|any mutex exclusively}1">,
3050   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3051 def warn_fun_excludes_mutex : Warning<
3052   "cannot call function '%1' while %0 '%2' is held">,
3053   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3054 def warn_cannot_resolve_lock : Warning<
3055   "cannot resolve lock expression">,
3056   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3057 def warn_acquired_before : Warning<
3058   "%0 '%1' must be acquired before '%2'">,
3059   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3060 def warn_acquired_before_after_cycle : Warning<
3061   "Cycle in acquired_before/after dependencies, starting with '%0'">,
3062   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3063
3064
3065 // Thread safety warnings negative capabilities
3066 def warn_acquire_requires_negative_cap : Warning<
3067   "acquiring %0 '%1' requires negative capability '%2'">,
3068   InGroup<ThreadSafetyNegative>, DefaultIgnore;
3069
3070 // Thread safety warnings on pass by reference
3071 def warn_guarded_pass_by_reference : Warning<
3072   "passing variable %1 by reference requires holding %0 "
3073   "%select{'%2'|'%2' exclusively}3">,
3074   InGroup<ThreadSafetyReference>, DefaultIgnore;
3075 def warn_pt_guarded_pass_by_reference : Warning<
3076   "passing the value that %1 points to by reference requires holding %0 "
3077   "%select{'%2'|'%2' exclusively}3">,
3078   InGroup<ThreadSafetyReference>, DefaultIgnore;
3079
3080 // Imprecise thread safety warnings
3081 def warn_variable_requires_lock : Warning<
3082   "%select{reading|writing}3 variable %1 requires holding %0 "
3083   "%select{'%2'|'%2' exclusively}3">,
3084   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3085 def warn_var_deref_requires_lock : Warning<
3086   "%select{reading|writing}3 the value pointed to by %1 requires "
3087   "holding %0 %select{'%2'|'%2' exclusively}3">,
3088   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3089 def warn_fun_requires_lock : Warning<
3090   "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3091   InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3092
3093 // Precise thread safety warnings
3094 def warn_variable_requires_lock_precise :
3095   Warning<warn_variable_requires_lock.Text>,
3096   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3097 def warn_var_deref_requires_lock_precise :
3098   Warning<warn_var_deref_requires_lock.Text>,
3099   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3100 def warn_fun_requires_lock_precise :
3101   Warning<warn_fun_requires_lock.Text>,
3102   InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3103 def note_found_mutex_near_match : Note<"found near match '%0'">;
3104
3105 // Verbose thread safety warnings
3106 def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3107   InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3108 def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3109 def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3110
3111 // Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3112 def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3113   InGroup<ThreadSafetyBeta>, DefaultIgnore;
3114
3115 // Consumed warnings
3116 def warn_use_in_invalid_state : Warning<
3117   "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3118   "state">, InGroup<Consumed>, DefaultIgnore;
3119 def warn_use_of_temp_in_invalid_state : Warning<
3120   "invalid invocation of method '%0' on a temporary object while it is in the "
3121   "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3122 def warn_attr_on_unconsumable_class : Warning<
3123   "consumed analysis attribute is attached to member of class '%0' which isn't "
3124   "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3125 def warn_return_typestate_for_unconsumable_type : Warning<
3126   "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3127   DefaultIgnore;
3128 def warn_return_typestate_mismatch : Warning<
3129   "return value not in expected state; expected '%0', observed '%1'">,
3130   InGroup<Consumed>, DefaultIgnore;
3131 def warn_loop_state_mismatch : Warning<
3132   "state of variable '%0' must match at the entry and exit of loop">,
3133   InGroup<Consumed>, DefaultIgnore;
3134 def warn_param_return_typestate_mismatch : Warning<
3135   "parameter '%0' not in expected state when the function returns: expected "
3136   "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3137 def warn_param_typestate_mismatch : Warning<
3138   "argument not in expected state; expected '%0', observed '%1'">,
3139   InGroup<Consumed>, DefaultIgnore;
3140
3141 // no_sanitize attribute
3142 def warn_unknown_sanitizer_ignored : Warning<
3143   "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3144
3145 def warn_impcast_vector_scalar : Warning<
3146   "implicit conversion turns vector to scalar: %0 to %1">,
3147   InGroup<Conversion>, DefaultIgnore;
3148 def warn_impcast_complex_scalar : Warning<
3149   "implicit conversion discards imaginary component: %0 to %1">,
3150   InGroup<Conversion>, DefaultIgnore;
3151 def err_impcast_complex_scalar : Error<
3152   "implicit conversion from %0 to %1 is not permitted in C++">;
3153 def warn_impcast_float_precision : Warning<
3154   "implicit conversion loses floating-point precision: %0 to %1">,
3155   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3156 def warn_impcast_float_result_precision : Warning<
3157   "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3158   InGroup<ImplicitFloatConversion>, DefaultIgnore;
3159 def warn_impcast_double_promotion : Warning<
3160   "implicit conversion increases floating-point precision: %0 to %1">,
3161   InGroup<DoublePromotion>, DefaultIgnore;
3162 def warn_impcast_integer_sign : Warning<
3163   "implicit conversion changes signedness: %0 to %1">,
3164   InGroup<SignConversion>, DefaultIgnore;
3165 def warn_impcast_integer_sign_conditional : Warning<
3166   "operand of ? changes signedness: %0 to %1">,
3167   InGroup<SignConversion>, DefaultIgnore;
3168 def warn_impcast_integer_precision : Warning<
3169   "implicit conversion loses integer precision: %0 to %1">,
3170   InGroup<ImplicitIntConversion>, DefaultIgnore;
3171 def warn_impcast_high_order_zero_bits : Warning<
3172   "higher order bits are zeroes after implicit conversion">,
3173   InGroup<ImplicitIntConversion>, DefaultIgnore;
3174 def warn_impcast_nonnegative_result : Warning<
3175   "the resulting value is always non-negative after implicit conversion">,
3176   InGroup<SignConversion>, DefaultIgnore;
3177 def warn_impcast_integer_64_32 : Warning<
3178   "implicit conversion loses integer precision: %0 to %1">,
3179   InGroup<Shorten64To32>, DefaultIgnore;
3180 def warn_impcast_integer_precision_constant : Warning<
3181   "implicit conversion from %2 to %3 changes value from %0 to %1">,
3182   InGroup<ConstantConversion>;
3183 def warn_impcast_bitfield_precision_constant : Warning<
3184   "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3185   InGroup<BitFieldConstantConversion>;
3186
3187 def warn_impcast_literal_float_to_integer : Warning<
3188   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3189   InGroup<LiteralConversion>;
3190 def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3191   "implicit conversion of out of range value from %0 to %1 is undefined">,
3192   InGroup<LiteralConversion>;
3193 def warn_impcast_float_integer : Warning<
3194   "implicit conversion turns floating-point number into integer: %0 to %1">,
3195   InGroup<FloatConversion>, DefaultIgnore;
3196
3197 def warn_impcast_float_to_integer : Warning<
3198   "implicit conversion from %0 to %1 changes value from %2 to %3">,
3199   InGroup<FloatOverflowConversion>, DefaultIgnore;
3200 def warn_impcast_float_to_integer_out_of_range : Warning<
3201   "implicit conversion of out of range value from %0 to %1 is undefined">,
3202   InGroup<FloatOverflowConversion>, DefaultIgnore;
3203 def warn_impcast_float_to_integer_zero : Warning<
3204   "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3205   InGroup<FloatZeroConversion>, DefaultIgnore;
3206
3207 def warn_impcast_string_literal_to_bool : Warning<
3208   "implicit conversion turns string literal into bool: %0 to %1">,
3209   InGroup<StringConversion>, DefaultIgnore;
3210 def warn_impcast_different_enum_types : Warning<
3211   "implicit conversion from enumeration type %0 to different enumeration type "
3212   "%1">, InGroup<EnumConversion>;
3213 def warn_impcast_bool_to_null_pointer : Warning<
3214     "initialization of pointer of type %0 to null from a constant boolean "
3215     "expression">, InGroup<BoolConversion>;
3216 def warn_non_literal_null_pointer : Warning<
3217     "expression which evaluates to zero treated as a null pointer constant of "
3218     "type %0">, InGroup<NonLiteralNullConversion>;
3219 def warn_impcast_null_pointer_to_integer : Warning<
3220     "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3221     InGroup<NullConversion>;
3222 def warn_impcast_floating_point_to_bool : Warning<
3223     "implicit conversion turns floating-point number into bool: %0 to %1">,
3224     InGroup<ImplicitConversionFloatingPointToBool>;
3225 def ext_ms_impcast_fn_obj : ExtWarn<
3226   "implicit conversion between pointer-to-function and pointer-to-object is a "
3227   "Microsoft extension">, InGroup<MicrosoftCast>;
3228
3229 def warn_impcast_pointer_to_bool : Warning<
3230     "address of%select{| function| array}0 '%1' will always evaluate to "
3231     "'true'">,
3232     InGroup<PointerBoolConversion>;
3233 def warn_cast_nonnull_to_bool : Warning<
3234     "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3235     "'true' on first encounter">,
3236     InGroup<PointerBoolConversion>;
3237 def warn_this_bool_conversion : Warning<
3238   "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3239   "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3240 def warn_address_of_reference_bool_conversion : Warning<
3241   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3242   "code; pointer may be assumed to always convert to true">,
3243   InGroup<UndefinedBoolConversion>;
3244
3245 def warn_null_pointer_compare : Warning<
3246     "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3247     "equal to a null pointer is always %select{true|false}2">,
3248     InGroup<TautologicalPointerCompare>;
3249 def warn_nonnull_expr_compare : Warning<
3250     "comparison of nonnull %select{function call|parameter}0 '%1' "
3251     "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3252     "encounter">,
3253     InGroup<TautologicalPointerCompare>;
3254 def warn_this_null_compare : Warning<
3255   "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3256   "assumed to always evaluate to %select{true|false}0">,
3257   InGroup<TautologicalUndefinedCompare>;
3258 def warn_address_of_reference_null_compare : Warning<
3259   "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3260   "code; comparison may be assumed to always evaluate to "
3261   "%select{true|false}0">,
3262   InGroup<TautologicalUndefinedCompare>;
3263 def note_reference_is_return_value : Note<"%0 returns a reference">;
3264
3265 def warn_division_sizeof_ptr : Warning<
3266   "'%0' will return the size of the pointer, not the array itself">,
3267   InGroup<DiagGroup<"sizeof-pointer-div">>;
3268
3269 def note_function_warning_silence : Note<
3270     "prefix with the address-of operator to silence this warning">;
3271 def note_function_to_function_call : Note<
3272     "suffix with parentheses to turn this into a function call">;
3273 def warn_impcast_objective_c_literal_to_bool : Warning<
3274     "implicit boolean conversion of Objective-C object literal always "
3275     "evaluates to true">,
3276     InGroup<ObjCLiteralConversion>;
3277
3278 def warn_cast_align : Warning<
3279   "cast from %0 to %1 increases required alignment from %2 to %3">,
3280   InGroup<CastAlign>, DefaultIgnore;
3281 def warn_old_style_cast : Warning<
3282   "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3283
3284 // Separate between casts to void* and non-void* pointers.
3285 // Some APIs use (abuse) void* for something like a user context,
3286 // and often that value is an integer even if it isn't a pointer itself.
3287 // Having a separate warning flag allows users to control the warning
3288 // for their workflow.
3289 def warn_int_to_pointer_cast : Warning<
3290   "cast to %1 from smaller integer type %0">,
3291   InGroup<IntToPointerCast>;
3292 def warn_int_to_void_pointer_cast : Warning<
3293   "cast to %1 from smaller integer type %0">,
3294   InGroup<IntToVoidPointerCast>;
3295
3296 def warn_attribute_ignored_for_field_of_type : Warning<
3297   "%0 attribute ignored for field of type %1">,
3298   InGroup<IgnoredAttributes>;
3299 def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3300   "enums in the Microsoft ABI are signed integers by default; consider giving "
3301   "the enum %0 an unsigned underlying type to make this code portable">,
3302   InGroup<SignedEnumBitfield>, DefaultIgnore;
3303 def warn_attribute_packed_for_bitfield : Warning<
3304   "'packed' attribute was ignored on bit-fields with single-byte alignment "
3305   "in older versions of GCC and Clang">,
3306   InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3307 def warn_transparent_union_attribute_field_size_align : Warning<
3308   "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3309   "%select{alignment|size}0 of the first field in transparent union; "
3310   "transparent_union attribute ignored">,
3311   InGroup<IgnoredAttributes>;
3312 def note_transparent_union_first_field_size_align : Note<
3313   "%select{alignment|size}0 of first field is %1 bits">;
3314 def warn_transparent_union_attribute_not_definition : Warning<
3315   "transparent_union attribute can only be applied to a union definition; "
3316   "attribute ignored">,
3317   InGroup<IgnoredAttributes>;
3318 def warn_transparent_union_attribute_floating : Warning<
3319   "first field of a transparent union cannot have %select{floating point|"
3320   "vector}0 type %1; transparent_union attribute ignored">,
3321   InGroup<IgnoredAttributes>;
3322 def warn_transparent_union_attribute_zero_fields : Warning<
3323   "transparent union definition must contain at least one field; "
3324   "transparent_union attribute ignored">,
3325   InGroup<IgnoredAttributes>;
3326 def warn_attribute_type_not_supported : Warning<
3327   "%0 attribute argument not supported: %1">,
3328   InGroup<IgnoredAttributes>;
3329 def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3330   InGroup<IgnoredAttributes>;
3331 def warn_attribute_protected_visibility :
3332   Warning<"target does not support 'protected' visibility; using 'default'">,
3333   InGroup<DiagGroup<"unsupported-visibility">>;
3334 def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3335 def note_previous_attribute : Note<"previous attribute is here">;
3336 def note_conflicting_attribute : Note<"conflicting attribute is here">;
3337 def note_attribute : Note<"attribute is here">;
3338 def err_mismatched_ms_inheritance : Error<
3339   "inheritance model does not match %select{definition|previous declaration}0">;
3340 def warn_ignored_ms_inheritance : Warning<
3341   "inheritance model ignored on %select{primary template|partial specialization}0">,
3342   InGroup<IgnoredAttributes>;
3343 def note_previous_ms_inheritance : Note<
3344   "previous inheritance model specified here">;
3345 def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3346 def err_mode_not_primitive : Error<
3347   "mode attribute only supported for integer and floating-point types">;
3348 def err_mode_wrong_type : Error<
3349   "type of machine mode does not match type of base type">;
3350 def warn_vector_mode_deprecated : Warning<
3351   "specifying vector types with the 'mode' attribute is deprecated; "
3352   "use the 'vector_size' attribute instead">,
3353   InGroup<DeprecatedAttributes>;
3354 def err_complex_mode_vector_type : Error<
3355   "type of machine mode does not support base vector types">;
3356 def err_enum_mode_vector_type : Error<
3357   "mode %0 is not supported for enumeration types">;
3358 def warn_attribute_nonnull_no_pointers : Warning<
3359   "'nonnull' attribute applied to function with no pointer arguments">,
3360   InGroup<IgnoredAttributes>;
3361 def warn_attribute_nonnull_parm_no_args : Warning<
3362   "'nonnull' attribute when used on parameters takes no arguments">,
3363   InGroup<IgnoredAttributes>;
3364 def note_declared_nonnull : Note<
3365   "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3366 def warn_attribute_sentinel_named_arguments : Warning<
3367   "'sentinel' attribute requires named arguments">,
3368   InGroup<IgnoredAttributes>;
3369 def warn_attribute_sentinel_not_variadic : Warning<
3370   "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3371   InGroup<IgnoredAttributes>;
3372 def err_attribute_sentinel_less_than_zero : Error<
3373   "'sentinel' parameter 1 less than zero">;
3374 def err_attribute_sentinel_not_zero_or_one : Error<
3375   "'sentinel' parameter 2 not 0 or 1">;
3376 def warn_cleanup_ext : Warning<
3377   "GCC does not allow the 'cleanup' attribute argument to be anything other "
3378   "than a simple identifier">,
3379   InGroup<GccCompat>;
3380 def err_attribute_cleanup_arg_not_function : Error<
3381   "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3382 def err_attribute_cleanup_func_must_take_one_arg : Error<
3383   "'cleanup' function %0 must take 1 parameter">;
3384 def err_attribute_cleanup_func_arg_incompatible_type : Error<
3385   "'cleanup' function %0 parameter has "
3386   "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3387 def err_attribute_regparm_wrong_platform : Error<
3388   "'regparm' is not valid on this platform">;
3389 def err_attribute_regparm_invalid_number : Error<
3390   "'regparm' parameter must be between 0 and %0 inclusive">;
3391 def err_attribute_not_supported_in_lang : Error<
3392   "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3393 def err_attribute_not_supported_on_arch
3394     : Error<"%0 attribute is not supported on '%1'">;
3395 def warn_gcc_ignores_type_attr : Warning<
3396   "GCC does not allow the %0 attribute to be written on a type">,
3397   InGroup<GccCompat>;
3398
3399 // Clang-Specific Attributes
3400 def warn_attribute_iboutlet : Warning<
3401   "%0 attribute can only be applied to instance variables or properties">,
3402   InGroup<IgnoredAttributes>;
3403 def err_iboutletcollection_type : Error<
3404   "invalid type %0 as argument of iboutletcollection attribute">;
3405 def err_iboutletcollection_builtintype : Error<
3406   "type argument of iboutletcollection attribute cannot be a builtin type">;
3407 def warn_iboutlet_object_type : Warning<
3408   "%select{instance variable|property}2 with %0 attribute must "
3409   "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3410 def warn_iboutletcollection_property_assign : Warning<
3411   "IBOutletCollection properties should be copy/strong and not assign">,
3412   InGroup<ObjCInvalidIBOutletProperty>;
3413
3414 def err_attribute_overloadable_mismatch : Error<
3415   "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
3416 def note_attribute_overloadable_prev_overload : Note<
3417   "previous %select{unmarked |}0overload of function is here">;
3418 def err_attribute_overloadable_no_prototype : Error<
3419   "'overloadable' function %0 must have a prototype">;
3420 def err_attribute_overloadable_multiple_unmarked_overloads : Error<
3421   "at most one overload for a given name may lack the 'overloadable' "
3422   "attribute">;
3423 def warn_ns_attribute_wrong_return_type : Warning<
3424   "%0 attribute only applies to %select{functions|methods|properties}1 that "
3425   "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
3426   InGroup<IgnoredAttributes>;
3427 def err_ns_attribute_wrong_parameter_type : Error<
3428   "%0 attribute only applies to "
3429   "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
3430 def warn_ns_attribute_wrong_parameter_type : Warning<
3431   "%0 attribute only applies to "
3432   "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
3433   InGroup<IgnoredAttributes>;
3434 def warn_objc_requires_super_protocol : Warning<
3435   "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
3436   InGroup<DiagGroup<"requires-super-attribute">>;
3437 def note_protocol_decl : Note<
3438   "protocol is declared here">;
3439 def note_protocol_decl_undefined : Note<
3440   "protocol %0 has no definition">;
3441
3442 // objc_designated_initializer attribute diagnostics.
3443 def warn_objc_designated_init_missing_super_call : Warning<
3444   "designated initializer missing a 'super' call to a designated initializer of the super class">,
3445   InGroup<ObjCDesignatedInit>;
3446 def note_objc_designated_init_marked_here : Note<
3447   "method marked as designated initializer of the class here">;
3448 def warn_objc_designated_init_non_super_designated_init_call : Warning<
3449   "designated initializer should only invoke a designated initializer on 'super'">,
3450   InGroup<ObjCDesignatedInit>;
3451 def warn_objc_designated_init_non_designated_init_call : Warning<
3452   "designated initializer invoked a non-designated initializer">,
3453   InGroup<ObjCDesignatedInit>;
3454 def warn_objc_secondary_init_super_init_call : Warning<
3455   "convenience initializer should not invoke an initializer on 'super'">,
3456   InGroup<ObjCDesignatedInit>;
3457 def warn_objc_secondary_init_missing_init_call : Warning<
3458   "convenience initializer missing a 'self' call to another initializer">,
3459   InGroup<ObjCDesignatedInit>;
3460 def warn_objc_implementation_missing_designated_init_override : Warning<
3461   "method override for the designated initializer of the superclass %objcinstance0 not found">,
3462   InGroup<ObjCDesignatedInit>;
3463 def err_designated_init_attr_non_init : Error<
3464   "'objc_designated_initializer' attribute only applies to init methods "
3465   "of interface or class extension declarations">;
3466
3467 // objc_bridge attribute diagnostics.
3468 def err_objc_attr_not_id : Error<
3469   "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
3470 def err_objc_attr_typedef_not_id : Error<
3471   "parameter of %0 attribute must be 'id' when used on a typedef">;
3472 def err_objc_attr_typedef_not_void_pointer : Error<
3473   "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
3474 def err_objc_cf_bridged_not_interface : Error<
3475   "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
3476 def err_objc_ns_bridged_invalid_cfobject : Error<
3477   "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
3478 def warn_objc_invalid_bridge : Warning<
3479   "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
3480 def warn_objc_invalid_bridge_to_cf : Warning<
3481   "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
3482
3483 // objc_bridge_related attribute diagnostics.
3484 def err_objc_bridged_related_invalid_class : Error<
3485   "could not find Objective-C class %0 to convert %1 to %2">;
3486 def err_objc_bridged_related_invalid_class_name : Error<
3487   "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
3488 def err_objc_bridged_related_known_method : Error<
3489  "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
3490  "method for this conversion">;
3491
3492 def err_objc_attr_protocol_requires_definition : Error<
3493   "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
3494
3495 def warn_ignored_objc_externally_retained : Warning<
3496   "'objc_externally_retained' can only be applied to local variables "
3497   "%select{of retainable type|with strong ownership}0">,
3498   InGroup<IgnoredAttributes>;
3499
3500 // Function Parameter Semantic Analysis.
3501 def err_param_with_void_type : Error<"argument may not have 'void' type">;
3502 def err_void_only_param : Error<
3503   "'void' must be the first and only parameter if specified">;
3504 def err_void_param_qualified : Error<
3505   "'void' as parameter must not have type qualifiers">;
3506 def err_ident_list_in_fn_declaration : Error<
3507   "a parameter list without types is only allowed in a function definition">;
3508 def ext_param_not_declared : Extension<
3509   "parameter %0 was not declared, defaulting to type 'int'">;
3510 def err_param_default_argument : Error<
3511   "C does not support default arguments">;
3512 def err_param_default_argument_redefinition : Error<
3513   "redefinition of default argument">;
3514 def ext_param_default_argument_redefinition : ExtWarn<
3515   err_param_default_argument_redefinition.Text>,
3516   InGroup<MicrosoftDefaultArgRedefinition>;
3517 def err_param_default_argument_missing : Error<
3518   "missing default argument on parameter">;
3519 def err_param_default_argument_missing_name : Error<
3520   "missing default argument on parameter %0">;
3521 def err_param_default_argument_references_param : Error<
3522   "default argument references parameter %0">;
3523 def err_param_default_argument_references_local : Error<
3524   "default argument references local variable %0 of enclosing function">;
3525 def err_param_default_argument_references_this : Error<
3526   "default argument references 'this'">;
3527 def err_param_default_argument_nonfunc : Error<
3528   "default arguments can only be specified for parameters in a function "
3529   "declaration">;
3530 def err_param_default_argument_template_redecl : Error<
3531   "default arguments cannot be added to a function template that has already "
3532   "been declared">;
3533 def err_param_default_argument_member_template_redecl : Error<
3534   "default arguments cannot be added to an out-of-line definition of a member "
3535   "of a %select{class template|class template partial specialization|nested "
3536   "class in a template}0">;
3537 def err_param_default_argument_on_parameter_pack : Error<
3538   "parameter pack cannot have a default argument">;
3539 def err_uninitialized_member_for_assign : Error<
3540   "cannot define the implicit copy assignment operator for %0, because "
3541   "non-static %select{reference|const}1 member %2 cannot use copy "
3542   "assignment operator">;
3543 def err_uninitialized_member_in_ctor : Error<
3544   "%select{constructor for %1|"
3545   "implicit default constructor for %1|"
3546   "cannot use constructor inherited from %1:}0 must explicitly "
3547   "initialize the %select{reference|const}2 member %3">;
3548 def err_default_arg_makes_ctor_special : Error<
3549   "addition of default argument on redeclaration makes this constructor a "
3550   "%select{default|copy|move}0 constructor">;
3551
3552 def err_use_of_default_argument_to_function_declared_later : Error<
3553   "use of default argument to function %0 that is declared later in class %1">;
3554 def note_default_argument_declared_here : Note<
3555   "default argument declared here">;
3556 def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
3557
3558 def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
3559   "%diff{promoted type $ of K&R function parameter is not compatible with the "
3560   "parameter type $|promoted type of K&R function parameter is not compatible "
3561   "with parameter type}0,1 declared in a previous prototype">,
3562   InGroup<KNRPromotedParameter>;
3563
3564
3565 // C++ Overloading Semantic Analysis.
3566 def err_ovl_diff_return_type : Error<
3567   "functions that differ only in their return type cannot be overloaded">;
3568 def err_ovl_static_nonstatic_member : Error<
3569   "static and non-static member functions with the same parameter types "
3570   "cannot be overloaded">;
3571
3572 def err_ovl_no_viable_function_in_call : Error<
3573   "no matching function for call to %0">;
3574 def err_ovl_no_viable_member_function_in_call : Error<
3575   "no matching member function for call to %0">;
3576 def err_ovl_ambiguous_call : Error<
3577   "call to %0 is ambiguous">;
3578 def err_ovl_deleted_call : Error<
3579   "call to %select{unavailable|deleted}0 function %1%2">;
3580 def err_ovl_ambiguous_member_call : Error<
3581   "call to member function %0 is ambiguous">;
3582 def err_ovl_deleted_member_call : Error<
3583   "call to %select{unavailable|deleted}0 member function %1%2">;
3584 def note_ovl_too_many_candidates : Note<
3585     "remaining %0 candidate%s0 omitted; "
3586     "pass -fshow-overloads=all to show them">;
3587
3588 def select_ovl_candidate_kind : TextSubstitution<
3589   "%select{function|function|constructor|"
3590     "constructor (the implicit default constructor)|"
3591     "constructor (the implicit copy constructor)|"
3592     "constructor (the implicit move constructor)|"
3593     "function (the implicit copy assignment operator)|"
3594     "function (the implicit move assignment operator)|"
3595     "inherited constructor}0%select{| template| %2}1">;
3596
3597 def note_ovl_candidate : Note<
3598     "candidate %sub{select_ovl_candidate_kind}0,1,3"
3599     "%select{| has different class%diff{ (expected $ but has $)|}5,6"
3600     "| has different number of parameters (expected %5 but has %6)"
3601     "| has type mismatch at %ordinal5 parameter"
3602     "%diff{ (expected $ but has $)|}6,7"
3603     "| has different return type%diff{ ($ expected but has $)|}5,6"
3604     "| has different qualifiers (expected %5 but found %6)"
3605     "| has different exception specification}4">;
3606
3607 def note_ovl_candidate_inherited_constructor : Note<
3608     "constructor from base class %0 inherited here">;
3609 def note_ovl_candidate_inherited_constructor_slice : Note<
3610     "candidate %select{constructor|template}0 ignored: "
3611     "inherited constructor cannot be used to %select{copy|move}1 object">;
3612 def note_ovl_candidate_illegal_constructor : Note<
3613     "candidate %select{constructor|template}0 ignored: "
3614     "instantiation %select{takes|would take}0 its own class type by value">;
3615 def note_ovl_candidate_bad_deduction : Note<
3616     "candidate template ignored: failed template argument deduction">;
3617 def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
3618     "couldn't infer template argument %0">;
3619 def note_ovl_candidate_incomplete_deduction_pack : Note<"candidate template ignored: "
3620     "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
3621     "expanded parameter in deduced argument pack %2">;
3622 def note_ovl_candidate_inconsistent_deduction : Note<
3623     "candidate template ignored: deduced conflicting %select{types|values|"
3624     "templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">;
3625 def note_ovl_candidate_inconsistent_deduction_types : Note<
3626     "candidate template ignored: deduced values %diff{"
3627     "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
3628     "%1 and %3 of conflicting types for parameter %0}2,4">;
3629 def note_ovl_candidate_explicit_arg_mismatch_named : Note<
3630     "candidate template ignored: invalid explicitly-specified argument "
3631     "for template parameter %0">;
3632 def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
3633     "candidate template ignored: invalid explicitly-specified argument "
3634     "for %ordinal0 template parameter">;
3635 def note_ovl_candidate_instantiation_depth : Note<
3636     "candidate template ignored: substitution exceeded maximum template "
3637     "instantiation depth">;
3638 def note_ovl_candidate_underqualified : Note<
3639     "candidate template ignored: cannot deduce a type for %0 that would "
3640     "make %2 equal %1">;
3641 def note_ovl_candidate_substitution_failure : Note<
3642     "candidate template ignored: substitution failure%0%1">;
3643 def note_ovl_candidate_disabled_by_enable_if : Note<
3644     "candidate template ignored: disabled by %0%1">;
3645 def note_ovl_candidate_disabled_by_requirement : Note<
3646     "candidate template ignored: requirement '%0' was not satisfied%1">;
3647 def note_ovl_candidate_has_pass_object_size_params: Note<
3648     "candidate address cannot be taken because parameter %0 has "
3649     "pass_object_size attribute">;
3650 def err_diagnose_if_succeeded : Error<"%0">;
3651 def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
3652     ShowInSystemHeader;
3653 def note_ovl_candidate_disabled_by_function_cond_attr : Note<
3654     "candidate disabled: %0">;
3655 def note_ovl_candidate_disabled_by_extension : Note<
3656     "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
3657 def err_addrof_function_disabled_by_enable_if_attr : Error<
3658     "cannot take address of function %0 because it has one or more "
3659     "non-tautological enable_if conditions">;
3660 def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
3661     "candidate function made ineligible by enable_if">;
3662 def note_ovl_candidate_deduced_mismatch : Note<
3663     "candidate template ignored: deduced type "
3664     "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
3665     "adjusted type $ of %select{|element of }4argument"
3666     "|of %select{|element of }4%ordinal0 parameter does not match "
3667     "adjusted type of %select{|element of }4argument}1,2%3">;
3668 def note_ovl_candidate_non_deduced_mismatch : Note<
3669     "candidate template ignored: could not match %diff{$ against $|types}0,1">;
3670 // This note is needed because the above note would sometimes print two
3671 // different types with the same name.  Remove this note when the above note
3672 // can handle that case properly.
3673 def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
3674     "candidate template ignored: could not match %q0 against %q1">;
3675
3676 // Note that we don't treat templates differently for this diagnostic.
3677 def note_ovl_candidate_arity : Note<"candidate "
3678     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
3679     "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
3680     "%plural{1:was|:were}5 provided">;
3681
3682 def note_ovl_candidate_arity_one : Note<"candidate "
3683     "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
3684     "%select{requires at least|allows at most single|requires single}3 "
3685     "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
3686
3687 def note_ovl_candidate_deleted : Note<
3688     "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
3689     "%select{explicitly made unavailable|explicitly deleted|"
3690     "implicitly deleted}3">;
3691
3692 // Giving the index of the bad argument really clutters this message, and
3693 // it's relatively unimportant because 1) it's generally obvious which
3694 // argument(s) are of the given object type and 2) the fix is usually
3695 // to complete the type, which doesn't involve changes to the call line
3696 // anyway.  If people complain, we can change it.
3697 def note_ovl_candidate_bad_conv_incomplete : Note<
3698     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3699     "cannot convert argument of incomplete type "
3700     "%diff{$ to $|to parameter type}3,4 for "
3701     "%select{%ordinal6 argument|object argument}5"
3702     "%select{|; dereference the argument with *|"
3703     "; take the address of the argument with &|"
3704     "; remove *|"
3705     "; remove &}7">;
3706 def note_ovl_candidate_bad_list_argument : Note<
3707     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3708     "cannot convert initializer list argument to %4">;
3709 def note_ovl_candidate_bad_overload : Note<
3710     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3711     "no overload of %4 matching %3 for %ordinal5 argument">;
3712 def note_ovl_candidate_bad_conv : Note<
3713     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3714     "no known conversion "
3715     "%diff{from $ to $|from argument type to parameter type}3,4 for "
3716     "%select{%ordinal6 argument|object argument}5"
3717     "%select{|; dereference the argument with *|"
3718     "; take the address of the argument with &|"
3719     "; remove *|"
3720     "; remove &}7">;
3721 def note_ovl_candidate_bad_arc_conv : Note<
3722     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3723     "cannot implicitly convert argument "
3724     "%diff{of type $ to $|type to parameter type}3,4 for "
3725     "%select{%ordinal6 argument|object argument}5 under ARC">;
3726 def note_ovl_candidate_bad_lvalue : Note<
3727     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3728     "expects an l-value for "
3729     "%select{%ordinal4 argument|object argument}3">;
3730 def note_ovl_candidate_bad_addrspace : Note<
3731     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3732     "address space mismatch in %select{%ordinal6|'this'}5 argument (%3), "
3733     "parameter type must be %4">;
3734 def note_ovl_candidate_bad_gc : Note<
3735     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3736     "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
3737     "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
3738 def note_ovl_candidate_bad_ownership : Note<
3739     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3740     "%select{%ordinal7|'this'}6 argument (%3) has "
3741     "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
3742     " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
3743     "__autoreleasing}5 ownership">;
3744 def note_ovl_candidate_bad_cvr_this : Note<
3745     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3746     "'this' argument has type %3, but method is not marked "
3747     "%select{const|restrict|const or restrict|volatile|const or volatile|"
3748     "volatile or restrict|const, volatile, or restrict}4">;
3749 def note_ovl_candidate_bad_cvr : Note<
3750     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3751     "%ordinal5 argument (%3) would lose "
3752     "%select{const|restrict|const and restrict|volatile|const and volatile|"
3753     "volatile and restrict|const, volatile, and restrict}4 qualifier"
3754     "%select{||s||s|s|s}4">;
3755 def note_ovl_candidate_bad_unaligned : Note<
3756     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3757     "%ordinal5 argument (%3) would lose __unaligned qualifier">;
3758 def note_ovl_candidate_bad_base_to_derived_conv : Note<
3759     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3760     "cannot %select{convert from|convert from|bind}3 "
3761     "%select{base class pointer|superclass|base class object of type}3 %4 to "
3762     "%select{derived class pointer|subclass|derived class reference}3 %5 for "
3763     "%ordinal6 argument">;
3764 def note_ovl_candidate_bad_target : Note<
3765     "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3766     "call to "
3767     "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
3768     " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
3769 def note_implicit_member_target_infer_collision : Note<
3770     "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
3771     "%select{__device__|__global__|__host__|__host__ __device__}1 and "
3772     "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
3773
3774 def note_ambiguous_type_conversion: Note<
3775     "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
3776 def note_ovl_builtin_binary_candidate : Note<
3777     "built-in candidate %0">;
3778 def note_ovl_builtin_unary_candidate : Note<
3779     "built-in candidate %0">;
3780 def err_ovl_no_viable_function_in_init : Error<
3781   "no matching constructor for initialization of %0">;
3782 def err_ovl_no_conversion_in_cast : Error<
3783   "cannot convert %1 to %2 without a conversion operator">;
3784 def err_ovl_no_viable_conversion_in_cast : Error<
3785   "no matching conversion for %select{|static_cast|reinterpret_cast|"
3786   "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
3787 def err_ovl_ambiguous_conversion_in_cast : Error<
3788   "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
3789   "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
3790 def err_ovl_deleted_conversion_in_cast : Error<
3791   "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
3792   "functional-style cast}0 from %1 to %2 uses deleted function">;
3793 def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
3794 def err_ref_init_ambiguous : Error<
3795   "reference initialization of type %0 with initializer of type %1 is ambiguous">;
3796 def err_ovl_deleted_init : Error<
3797   "call to %select{unavailable|deleted}0 constructor of %1">;
3798 def err_ovl_deleted_special_init : Error<
3799   "call to implicitly-deleted %select{default constructor|copy constructor|"
3800   "move constructor|copy assignment operator|move assignment operator|"
3801   "destructor|function}0 of %1">;
3802 def err_ovl_ambiguous_oper_unary : Error<
3803   "use of overloaded operator '%0' is ambiguous (operand type %1)">;
3804 def err_ovl_ambiguous_oper_binary : Error<
3805   "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
3806 def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
3807 def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
3808 def err_ovl_deleted_oper : Error<
3809   "overload resolution selected %select{unavailable|deleted}0 operator '%1'%2">;
3810 def err_ovl_deleted_special_oper : Error<
3811   "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
3812   "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is implicitly deleted">;
3813 def err_ovl_no_viable_subscript :
3814     Error<"no viable overloaded operator[] for type %0">;
3815 def err_ovl_no_oper :
3816     Error<"type %0 does not provide a %select{subscript|call}1 operator">;
3817 def err_ovl_unresolvable : Error<
3818   "reference to %select{overloaded|multiversioned}1 function could not be "
3819   "resolved; did you mean to call it%select{| with no arguments}0?">;
3820 def err_bound_member_function : Error<
3821   "reference to non-static member function must be called"
3822   "%select{|; did you mean to call it with no arguments?}0">;
3823 def note_possible_target_of_call : Note<"possible target for call">;
3824
3825 def err_ovl_no_viable_object_call : Error<
3826   "no matching function for call to object of type %0">;
3827 def err_ovl_ambiguous_object_call : Error<
3828   "call to object of type %0 is ambiguous">;
3829 def err_ovl_deleted_object_call : Error<
3830   "call to %select{unavailable|deleted}0 function call operator in type %1%2">;
3831 def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
3832 def err_member_call_without_object : Error<
3833   "call to non-static member function without an object argument">;
3834
3835 // C++ Address of Overloaded Function
3836 def err_addr_ovl_no_viable : Error<
3837   "address of overloaded function %0 does not match required type %1">;
3838 def err_addr_ovl_ambiguous : Error<
3839   "address of overloaded function %0 is ambiguous">;
3840 def err_addr_ovl_not_func_ptrref : Error<
3841   "address of overloaded function %0 cannot be converted to type %1">;
3842 def err_addr_ovl_no_qualifier : Error<
3843   "cannot form member pointer of type %0 without '&' and class name">;
3844
3845 // C++11 Literal Operators
3846 def err_ovl_no_viable_literal_operator : Error<
3847   "no matching literal operator for call to %0"
3848   "%select{| with argument of type %2| with arguments of types %2 and %3}1"
3849   "%select{| or 'const char *'}4"
3850   "%select{|, and no matching literal operator template}5">;
3851
3852 // C++ Template Declarations
3853 def err_template_param_shadow : Error<
3854   "declaration of %0 shadows template parameter">;
3855 def note_template_param_here : Note<"template parameter is declared here">;
3856 def warn_template_export_unsupported : Warning<
3857   "exported templates are unsupported">;
3858 def err_template_outside_namespace_or_class_scope : Error<
3859   "templates can only be declared in namespace or class scope">;
3860 def err_template_inside_local_class : Error<
3861   "templates cannot be declared inside of a local class">;
3862 def err_template_linkage : Error<"templates must have C++ linkage">;
3863 def err_template_typedef : Error<"a typedef cannot be a template">;
3864 def err_template_unnamed_class : Error<
3865   "cannot declare a class template with no name">;
3866 def err_template_param_list_different_arity : Error<
3867   "%select{too few|too many}0 template parameters in template "
3868   "%select{|template parameter }1redeclaration">;
3869 def note_template_param_list_different_arity : Note<
3870   "%select{too few|too many}0 template parameters in template template "
3871   "argument">;
3872 def note_template_prev_declaration : Note<
3873   "previous template %select{declaration|template parameter}0 is here">;
3874 def err_template_param_different_kind : Error<
3875   "template parameter has a different kind in template "
3876   "%select{|template parameter }0redeclaration">;
3877 def note_template_param_different_kind : Note<
3878   "template parameter has a different kind in template argument">;
3879
3880 def err_invalid_decl_specifier_in_nontype_parm : Error<
3881   "invalid declaration specifier in template non-type parameter">;
3882
3883 def err_template_nontype_parm_different_type : Error<
3884   "template non-type parameter has a different type %0 in template "
3885   "%select{|template parameter }1redeclaration">;
3886
3887 def note_template_nontype_parm_different_type : Note<
3888   "template non-type parameter has a different type %0 in template argument">;
3889 def note_template_nontype_parm_prev_declaration : Note<
3890   "previous non-type template parameter with type %0 is here">;
3891 def err_template_nontype_parm_bad_type : Error<
3892   "a non-type template parameter cannot have type %0">;
3893 def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
3894   "non-type template parameters declared with %0 are incompatible with C++ "
3895   "standards before C++17">,
3896   DefaultIgnore, InGroup<CXXPre17Compat>;
3897 def err_template_param_default_arg_redefinition : Error<
3898   "template parameter redefines default argument">;
3899 def note_template_param_prev_default_arg : Note<
3900   "previous default template argument defined here">;
3901 def err_template_param_default_arg_missing : Error<
3902   "template parameter missing a default argument">;
3903 def ext_template_parameter_default_in_function_template : ExtWarn<
3904   "default template arguments for a function template are a C++11 extension">,
3905   InGroup<CXX11>;
3906 def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
3907   "default template arguments for a function template are incompatible with C++98">,
3908   InGroup<CXX98Compat>, DefaultIgnore;
3909 def err_template_parameter_default_template_member : Error<
3910   "cannot add a default template argument to the definition of a member of a "
3911   "class template">;
3912 def err_template_parameter_default_friend_template : Error<
3913   "default template argument not permitted on a friend template">;
3914 def err_template_template_parm_no_parms : Error<
3915   "template template parameter must have its own template parameters">;
3916
3917 def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
3918   InGroup<CXX14>;
3919 def warn_cxx11_compat_variable_template : Warning<
3920   "variable templates are incompatible with C++ standards before C++14">,
3921   InGroup<CXXPre14Compat>, DefaultIgnore;
3922 def err_template_variable_noparams : Error<
3923   "extraneous 'template<>' in declaration of variable %0">;
3924 def err_template_member : Error<"member %0 declared as a template">;
3925 def err_template_member_noparams : Error<
3926   "extraneous 'template<>' in declaration of member %0">;
3927 def err_template_tag_noparams : Error<
3928   "extraneous 'template<>' in declaration of %0 %1">;
3929
3930 // C++ Template Argument Lists
3931 def err_template_missing_args : Error<
3932   "use of "
3933   "%select{class template|function template|variable template|alias template|"
3934   "template template parameter|template}0 %1 requires template arguments">;
3935 def err_template_arg_list_different_arity : Error<
3936   "%select{too few|too many}0 template arguments for "
3937   "%select{class template|function template|variable template|alias template|"
3938   "template template parameter|template}1 %2">;
3939 def note_template_decl_here : Note<"template is declared here">;
3940 def err_template_arg_must_be_type : Error<
3941   "template argument for template type parameter must be a type">;
3942 def err_template_arg_must_be_type_suggest : Error<
3943   "template argument for template type parameter must be a type; "
3944   "did you forget 'typename'?">;
3945 def ext_ms_template_type_arg_missing_typename : ExtWarn<
3946   "template argument for template type parameter must be a type; "
3947   "omitted 'typename' is a Microsoft extension">,
3948   InGroup<MicrosoftTemplate>;
3949 def err_template_arg_must_be_expr : Error<
3950   "template argument for non-type template parameter must be an expression">;
3951 def err_template_arg_nontype_ambig : Error<
3952   "template argument for non-type template parameter is treated as function type %0">;
3953 def err_template_arg_must_be_template : Error<
3954   "template argument for template template parameter must be a class template%select{| or type alias template}0">;
3955 def ext_template_arg_local_type : ExtWarn<
3956   "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
3957 def ext_template_arg_unnamed_type : ExtWarn<
3958   "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
3959 def warn_cxx98_compat_template_arg_local_type : Warning<
3960   "local type %0 as template argument is incompatible with C++98">,
3961   InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
3962 def warn_cxx98_compat_template_arg_unnamed_type : Warning<
3963   "unnamed type as template argument is incompatible with C++98">,
3964   InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
3965 def note_template_unnamed_type_here : Note<
3966   "unnamed type used in template argument was declared here">;
3967 def err_template_arg_overload_type : Error<
3968   "template argument is the type of an unresolved overloaded function">;
3969 def err_template_arg_not_valid_template : Error<
3970   "template argument does not refer to a class or alias template, or template "
3971   "template parameter">;
3972 def note_template_arg_refers_here_func : Note<
3973   "template argument refers to function template %0, here">;
3974 def err_template_arg_template_params_mismatch : Error<
3975   "template template argument has different template parameters than its "
3976   "corresponding template template parameter">;
3977 def err_template_arg_not_integral_or_enumeral : Error<
3978   "non-type template argument of type %0 must have an integral or enumeration"
3979   " type">;
3980 def err_template_arg_not_ice : Error<
3981   "non-type template argument of type %0 is not an integral constant "
3982   "expression">;
3983 def err_template_arg_not_address_constant : Error<
3984   "non-type template argument of type %0 is not a constant expression">;
3985 def warn_cxx98_compat_template_arg_null : Warning<
3986   "use of null pointer as non-type template argument is incompatible with "
3987   "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
3988 def err_template_arg_untyped_null_constant : Error<
3989   "null non-type template argument must be cast to template parameter type %0">;
3990 def err_template_arg_wrongtype_null_constant : Error<
3991   "null non-type template argument of type %0 does not match template parameter "
3992   "of type %1">;
3993 def err_non_type_template_parm_type_deduction_failure : Error<
3994   "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
3995 def err_deduced_non_type_template_arg_type_mismatch : Error<
3996   "deduced non-type template argument does not have the same type as the "
3997   "corresponding template parameter%diff{ ($ vs $)|}0,1">;
3998 def err_non_type_template_arg_subobject : Error<
3999   "non-type template argument refers to subobject '%0'">;
4000 def err_non_type_template_arg_addr_label_diff : Error<
4001   "template argument / label address difference / what did you expect?">;
4002 def err_template_arg_not_convertible : Error<
4003   "non-type template argument of type %0 cannot be converted to a value "
4004   "of type %1">;
4005 def warn_template_arg_negative : Warning<
4006   "non-type template argument with value '%0' converted to '%1' for unsigned "
4007   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4008 def warn_template_arg_too_large : Warning<
4009   "non-type template argument value '%0' truncated to '%1' for "
4010   "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4011 def err_template_arg_no_ref_bind : Error<
4012   "non-type template parameter of reference type "
4013   "%diff{$ cannot bind to template argument of type $"
4014   "|cannot bind to template of incompatible argument type}0,1">;
4015 def err_template_arg_ref_bind_ignores_quals : Error<
4016   "reference binding of non-type template parameter "
4017   "%diff{of type $ to template argument of type $|to template argument}0,1 "
4018   "ignores qualifiers">;
4019 def err_template_arg_not_decl_ref : Error<
4020   "non-type template argument does not refer to any declaration">;
4021 def err_template_arg_not_address_of : Error<
4022   "non-type template argument for template parameter of pointer type %0 must "
4023   "have its address taken">;
4024 def err_template_arg_address_of_non_pointer : Error<
4025   "address taken in non-type template argument for template parameter of "
4026   "reference type %0">;
4027 def err_template_arg_reference_var : Error<
4028   "non-type template argument of reference type %0 is not an object">;
4029 def err_template_arg_field : Error<
4030   "non-type template argument refers to non-static data member %0">;
4031 def err_template_arg_method : Error<
4032   "non-type template argument refers to non-static member function %0">;
4033 def err_template_arg_object_no_linkage : Error<
4034   "non-type template argument refers to %select{function|object}0 %1 that "
4035   "does not have linkage">;
4036 def warn_cxx98_compat_template_arg_object_internal : Warning<
4037   "non-type template argument referring to %select{function|object}0 %1 with "
4038   "internal linkage is incompatible with C++98">,
4039   InGroup<CXX98Compat>, DefaultIgnore;
4040 def ext_template_arg_object_internal : ExtWarn<
4041   "non-type template argument referring to %select{function|object}0 %1 with "
4042   "internal linkage is a C++11 extension">, InGroup<CXX11>;
4043 def err_template_arg_thread_local : Error<
4044   "non-type template argument refers to thread-local object">;
4045 def note_template_arg_internal_object : Note<
4046   "non-type template argument refers to %select{function|object}0 here">;
4047 def note_template_arg_refers_here : Note<
4048   "non-type template argument refers here">;
4049 def err_template_arg_not_object_or_func : Error<
4050   "non-type template argument does not refer to an object or function">;
4051 def err_template_arg_not_pointer_to_member_form : Error<
4052   "non-type template argument is not a pointer to member constant">;
4053 def err_template_arg_member_ptr_base_derived_not_supported : Error<
4054   "sorry, non-type template argument of pointer-to-member type %1 that refers "
4055   "to member %q0 of a different class is not supported yet">;
4056 def ext_template_arg_extra_parens : ExtWarn<
4057   "address non-type template argument cannot be surrounded by parentheses">;
4058 def warn_cxx98_compat_template_arg_extra_parens : Warning<
4059   "redundant parentheses surrounding address non-type template argument are "
4060   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4061 def err_pointer_to_member_type : Error<
4062   "invalid use of pointer to member type after %select{.*|->*}0">;
4063 def err_pointer_to_member_call_drops_quals : Error<
4064   "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4065 def err_pointer_to_member_oper_value_classify: Error<
4066   "pointer-to-member function type %0 can only be called on an "
4067   "%select{rvalue|lvalue}1">;
4068 def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4069   "invoking a pointer to a 'const &' member function on an rvalue is a C++2a extension">,
4070   InGroup<CXX2a>, SFINAEFailure;
4071 def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4072   "invoking a pointer to a 'const &' member function on an rvalue is "
4073   "incompatible with C++ standards before C++2a">,
4074   InGroup<CXXPre2aCompatPedantic>, DefaultIgnore;
4075 def ext_ms_deref_template_argument: ExtWarn<
4076   "non-type template argument containing a dereference operation is a "
4077   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4078 def ext_ms_delayed_template_argument: ExtWarn<
4079   "using the undeclared type %0 as a default template argument is a "
4080   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4081 def err_template_arg_deduced_incomplete_pack : Error<
4082   "deduced incomplete pack %0 for template parameter %1">;
4083
4084 // C++ template specialization
4085 def err_template_spec_unknown_kind : Error<
4086   "can only provide an explicit specialization for a class template, function "
4087   "template, variable template, or a member function, static data member, "
4088   "%select{or member class|member class, or member enumeration}0 of a "
4089   "class template">;
4090 def note_specialized_entity : Note<
4091   "explicitly specialized declaration is here">;
4092 def note_explicit_specialization_declared_here : Note<
4093   "explicit specialization declared here">;
4094 def err_template_spec_decl_function_scope : Error<
4095   "explicit specialization of %0 in function scope">;
4096 def err_template_spec_decl_friend : Error<
4097   "cannot declare an explicit specialization in a friend">;
4098 def err_template_spec_redecl_out_of_scope : Error<
4099   "%select{class template|class template partial|variable template|"
4100   "variable template partial|function template|member "
4101   "function|static data member|member class|member enumeration}0 "
4102   "specialization of %1 not in %select{a namespace enclosing %2|"
4103   "class %2 or an enclosing namespace}3">;
4104 def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4105   "%select{class template|class template partial|variable template|"
4106   "variable template partial|function template|member "
4107   "function|static data member|member class|member enumeration}0 "
4108   "specialization of %1 not in %select{a namespace enclosing %2|"
4109   "class %2 or an enclosing namespace}3 "
4110   "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4111 def err_template_spec_redecl_global_scope : Error<
4112   "%select{class template|class template partial|variable template|"
4113   "variable template partial|function template|member "
4114   "function|static data member|member class|member enumeration}0 "
4115   "specialization of %1 must occur at global scope">;
4116 def err_spec_member_not_instantiated : Error<
4117   "specialization of member %q0 does not specialize an instantiated member">;
4118 def note_specialized_decl : Note<"attempt to specialize declaration here">;
4119 def err_specialization_after_instantiation : Error<
4120   "explicit specialization of %0 after instantiation">;
4121 def note_instantiation_required_here : Note<
4122   "%select{implicit|explicit}0 instantiation first required here">;
4123 def err_template_spec_friend : Error<
4124   "template specialization declaration cannot be a friend">;
4125 def err_template_spec_default_arg : Error<
4126   "default argument not permitted on an explicit "
4127   "%select{instantiation|specialization}0 of function %1">;
4128 def err_not_class_template_specialization : Error<
4129   "cannot specialize a %select{dependent template|template template "
4130   "parameter}0">;
4131 def ext_explicit_specialization_storage_class : ExtWarn<
4132   "explicit specialization cannot have a storage class">;
4133 def err_explicit_specialization_inconsistent_storage_class : Error<
4134   "explicit specialization has extraneous, inconsistent storage class "
4135   "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4136 def err_dependent_function_template_spec_no_match : Error<
4137   "no candidate function template was found for dependent"
4138   " friend function template specialization">;
4139 def note_dependent_function_template_spec_discard_reason : Note<
4140   "candidate ignored: %select{not a function template"
4141   "|not a member of the enclosing namespace;"
4142   " did you mean to explicitly qualify the specialization?}0">;
4143
4144 // C++ class template specializations and out-of-line definitions
4145 def err_template_spec_needs_header : Error<
4146   "template specialization requires 'template<>'">;
4147 def err_template_spec_needs_template_parameters : Error<
4148   "template specialization or definition requires a template parameter list "
4149   "corresponding to the nested type %0">;
4150 def err_template_param_list_matches_nontemplate : Error<
4151   "template parameter list matching the non-templated nested type %0 should "
4152   "be empty ('template<>')">;
4153 def err_alias_template_extra_headers : Error<
4154   "extraneous template parameter list in alias template declaration">;
4155 def err_template_spec_extra_headers : Error<
4156   "extraneous template parameter list in template specialization or "
4157   "out-of-line template definition">;
4158 def warn_template_spec_extra_headers : Warning<
4159   "extraneous template parameter list in template specialization">;
4160 def note_explicit_template_spec_does_not_need_header : Note<
4161   "'template<>' header not required for explicitly-specialized class %0 "
4162   "declared here">;
4163 def err_template_qualified_declarator_no_match : Error<
4164   "nested name specifier '%0' for declaration does not refer into a class, "
4165   "class template or class template partial specialization">;
4166 def err_specialize_member_of_template : Error<
4167   "cannot specialize %select{|(with 'template<>') }0a member of an "
4168   "unspecialized template">;
4169
4170 // C++ Class Template Partial Specialization
4171 def err_default_arg_in_partial_spec : Error<
4172     "default template argument in a class template partial specialization">;
4173 def err_dependent_non_type_arg_in_partial_spec : Error<
4174     "type of specialized non-type template argument depends on a template "
4175     "parameter of the partial specialization">;
4176 def note_dependent_non_type_default_arg_in_partial_spec : Note<
4177     "template parameter is used in default argument declared here">;
4178 def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4179     "non-type template argument specializes a template parameter with "
4180     "dependent type %0">;
4181 def err_partial_spec_args_match_primary_template : Error<
4182     "%select{class|variable}0 template partial specialization does not "
4183     "specialize any template argument; to %select{declare|define}1 the "
4184     "primary template, remove the template argument list">;
4185 def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4186     "%select{class|variable}0 template partial specialization is not "
4187     "more specialized than the primary template">, DefaultError,
4188     InGroup<DiagGroup<"invalid-partial-specialization">>;
4189 def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4190 def ext_partial_specs_not_deducible : ExtWarn<
4191     "%select{class|variable}0 template partial specialization contains "
4192     "%select{a template parameter|template parameters}1 that cannot be "
4193     "deduced; this partial specialization will never be used">,
4194     DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4195 def note_non_deducible_parameter : Note<
4196     "non-deducible template parameter %0">;
4197 def err_partial_spec_ordering_ambiguous : Error<
4198     "ambiguous partial specializations of %0">;
4199 def note_partial_spec_match : Note<"partial specialization matches %0">;
4200 def err_partial_spec_redeclared : Error<
4201   "class template partial specialization %0 cannot be redeclared">;
4202 def note_partial_specialization_declared_here : Note<
4203   "explicit specialization declared here">;
4204 def note_prev_partial_spec_here : Note<
4205   "previous declaration of class template partial specialization %0 is here">;
4206 def err_partial_spec_fully_specialized : Error<
4207   "partial specialization of %0 does not use any of its template parameters">;
4208
4209 // C++ Variable Template Partial Specialization
4210 def err_var_partial_spec_redeclared : Error<
4211   "variable template partial specialization %0 cannot be redefined">;
4212 def note_var_prev_partial_spec_here : Note<
4213   "previous declaration of variable template partial specialization is here">;
4214 def err_var_spec_no_template : Error<
4215   "no variable template matches%select{| partial}0 specialization">;
4216 def err_var_spec_no_template_but_method : Error<
4217   "no variable template matches specialization; "
4218   "did you mean to use %0 as function template instead?">;
4219
4220 // C++ Function template specializations
4221 def err_function_template_spec_no_match : Error<
4222     "no function template matches function template specialization %0">;
4223 def err_function_template_spec_ambiguous : Error<
4224     "function template specialization %0 ambiguously refers to more than one "
4225     "function template; explicitly specify%select{| additional}1 template "
4226     "arguments to identify a particular function template">;
4227 def note_function_template_spec_matched : Note<
4228     "function template %q0 matches specialization %1">;
4229 def err_function_template_partial_spec : Error<
4230     "function template partial specialization is not allowed">;
4231
4232 // C++ Template Instantiation
4233 def err_template_recursion_depth_exceeded : Error<
4234   "recursive template instantiation exceeded maximum depth of %0">,
4235   DefaultFatal, NoSFINAE;
4236 def note_template_recursion_depth : Note<
4237   "use -ftemplate-depth=N to increase recursive template instantiation depth">;
4238
4239 def err_template_instantiate_within_definition : Error<
4240   "%select{implicit|explicit}0 instantiation of template %1 within its"
4241   " own definition">;
4242 def err_template_instantiate_undefined : Error<
4243   "%select{implicit|explicit}0 instantiation of undefined template %1">;
4244 def err_implicit_instantiate_member_undefined : Error<
4245   "implicit instantiation of undefined member %0">;
4246 def note_template_class_instantiation_was_here : Note<
4247   "class template %0 was instantiated here">;
4248 def note_template_class_explicit_specialization_was_here : Note<
4249   "class template %0 was explicitly specialized here">;
4250 def note_template_class_instantiation_here : Note<
4251   "in instantiation of template class %q0 requested here">;
4252 def note_template_member_class_here : Note<
4253   "in instantiation of member class %q0 requested here">;
4254 def note_template_member_function_here : Note<
4255   "in instantiation of member function %q0 requested here">;
4256 def note_function_template_spec_here : Note<
4257   "in instantiation of function template specialization %q0 requested here">;
4258 def note_template_static_data_member_def_here : Note<
4259   "in instantiation of static data member %q0 requested here">;
4260 def note_template_variable_def_here : Note<
4261   "in instantiation of variable template specialization %q0 requested here">;
4262 def note_template_enum_def_here : Note<
4263   "in instantiation of enumeration %q0 requested here">;
4264 def note_template_nsdmi_here : Note<
4265   "in instantiation of default member initializer %q0 requested here">;
4266 def note_template_type_alias_instantiation_here : Note<
4267   "in instantiation of template type alias %0 requested here">;
4268 def note_template_exception_spec_instantiation_here : Note<
4269   "in instantiation of exception specification for %0 requested here">;
4270 def warn_var_template_missing : Warning<"instantiation of variable %q0 "
4271   "required here, but no definition is available">,
4272   InGroup<UndefinedVarTemplate>;
4273 def warn_func_template_missing : Warning<"instantiation of function %q0 "
4274   "required here, but no definition is available">,
4275   InGroup<UndefinedFuncTemplate>, DefaultIgnore;
4276 def note_forward_template_decl : Note<
4277   "forward declaration of template entity is here">;
4278 def note_inst_declaration_hint : Note<"add an explicit instantiation "
4279   "declaration to suppress this warning if %q0 is explicitly instantiated in "
4280   "another translation unit">;
4281 def note_evaluating_exception_spec_here : Note<
4282   "in evaluation of exception specification for %q0 needed here">;
4283
4284 def note_default_arg_instantiation_here : Note<
4285   "in instantiation of default argument for '%0' required here">;
4286 def note_default_function_arg_instantiation_here : Note<
4287   "in instantiation of default function argument expression "
4288   "for '%0' required here">;
4289 def note_explicit_template_arg_substitution_here : Note<
4290   "while substituting explicitly-specified template arguments into function "
4291   "template %0 %1">;
4292 def note_function_template_deduction_instantiation_here : Note<
4293   "while substituting deduced template arguments into function template %0 "
4294   "%1">;
4295 def note_deduced_template_arg_substitution_here : Note<
4296   "during template argument deduction for %select{class|variable}0 template "
4297   "%select{partial specialization |}1%2 %3">;
4298 def note_prior_template_arg_substitution : Note<
4299   "while substituting prior template arguments into %select{non-type|template}0"
4300   " template parameter%1 %2">;
4301 def note_template_default_arg_checking : Note<
4302   "while checking a default template argument used here">;
4303 def note_instantiation_contexts_suppressed : Note<
4304   "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
4305   "see all)">;
4306
4307 def err_field_instantiates_to_function : Error<
4308   "data member instantiated with function type %0">;
4309 def err_variable_instantiates_to_function : Error<
4310   "%select{variable|static data member}0 instantiated with function type %1">;
4311 def err_nested_name_spec_non_tag : Error<
4312   "type %0 cannot be used prior to '::' because it has no members">;
4313
4314 def err_using_pack_expansion_empty : Error<
4315   "%select{|member}0 using declaration %1 instantiates to an empty pack">;
4316
4317 // C++ Explicit Instantiation
4318 def err_explicit_instantiation_duplicate : Error<
4319     "duplicate explicit instantiation of %0">;
4320 def ext_explicit_instantiation_duplicate : ExtWarn<
4321     "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
4322     InGroup<MicrosoftTemplate>;
4323 def note_previous_explicit_instantiation : Note<
4324     "previous explicit instantiation is here">;
4325 def warn_explicit_instantiation_after_specialization : Warning<
4326   "explicit instantiation of %0 that occurs after an explicit "
4327   "specialization has no effect">,
4328   InGroup<DiagGroup<"instantiation-after-specialization">>;
4329 def note_previous_template_specialization : Note<
4330     "previous template specialization is here">;
4331 def err_explicit_instantiation_nontemplate_type : Error<
4332     "explicit instantiation of non-templated type %0">;
4333 def note_nontemplate_decl_here : Note<
4334     "non-templated declaration is here">;
4335 def err_explicit_instantiation_in_class : Error<
4336   "explicit instantiation of %0 in class scope">;
4337 def err_explicit_instantiation_out_of_scope : Error<
4338   "explicit instantiation of %0 not in a namespace enclosing %1">;
4339 def err_explicit_instantiation_must_be_global : Error<
4340   "explicit instantiation of %0 must occur at global scope">;
4341 def warn_explicit_instantiation_out_of_scope_0x : Warning<
4342   "explicit instantiation of %0 not in a namespace enclosing %1">,
4343   InGroup<CXX11Compat>, DefaultIgnore;
4344 def warn_explicit_instantiation_must_be_global_0x : Warning<
4345   "explicit instantiation of %0 must occur at global scope">,
4346   InGroup<CXX11Compat>, DefaultIgnore;
4347
4348 def err_explicit_instantiation_requires_name : Error<
4349   "explicit instantiation declaration requires a name">;
4350 def err_explicit_instantiation_of_typedef : Error<
4351   "explicit instantiation of typedef %0">;
4352 def err_explicit_instantiation_storage_class : Error<
4353   "explicit instantiation cannot have a storage class">;
4354 def err_explicit_instantiation_not_known : Error<
4355   "explicit instantiation of %0 does not refer to a function template, "
4356   "variable template, member function, member class, or static data member">;
4357 def note_explicit_instantiation_here : Note<
4358   "explicit instantiation refers here">;
4359 def err_explicit_instantiation_data_member_not_instantiated : Error<
4360   "explicit instantiation refers to static data member %q0 that is not an "
4361   "instantiation">;
4362 def err_explicit_instantiation_member_function_not_instantiated : Error<
4363   "explicit instantiation refers to member function %q0 that is not an "
4364   "instantiation">;
4365 def err_explicit_instantiation_ambiguous : Error<
4366   "partial ordering for explicit instantiation of %0 is ambiguous">;
4367 def note_explicit_instantiation_candidate : Note<
4368   "explicit instantiation candidate function %q0 template here %1">;
4369 def err_explicit_instantiation_inline : Error<
4370   "explicit instantiation cannot be 'inline'">;
4371 def warn_explicit_instantiation_inline_0x : Warning<
4372   "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
4373   DefaultIgnore;
4374 def err_explicit_instantiation_constexpr : Error<
4375   "explicit instantiation cannot be 'constexpr'">;
4376 def ext_explicit_instantiation_without_qualified_id : Extension<
4377   "qualifier in explicit instantiation of %q0 requires a template-id "
4378   "(a typedef is not permitted)">;
4379 def err_explicit_instantiation_without_template_id : Error<
4380   "explicit instantiation of %q0 must specify a template argument list">;
4381 def err_explicit_instantiation_unqualified_wrong_namespace : Error<
4382   "explicit instantiation of %q0 must occur in namespace %1">;
4383 def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
4384   "explicit instantiation of %q0 must occur in namespace %1">,
4385   InGroup<CXX11Compat>, DefaultIgnore;
4386 def err_explicit_instantiation_undefined_member : Error<
4387   "explicit instantiation of undefined %select{member class|member function|"
4388   "static data member}0 %1 of class template %2">;
4389 def err_explicit_instantiation_undefined_func_template : Error<
4390   "explicit instantiation of undefined function template %0">;
4391 def err_explicit_instantiation_undefined_var_template : Error<
4392   "explicit instantiation of undefined variable template %q0">;
4393 def err_explicit_instantiation_declaration_after_definition : Error<
4394   "explicit instantiation declaration (with 'extern') follows explicit "
4395   "instantiation definition (without 'extern')">;
4396 def note_explicit_instantiation_definition_here : Note<
4397   "explicit instantiation definition is here">;
4398 def err_invalid_var_template_spec_type : Error<"type %2 "
4399   "of %select{explicit instantiation|explicit specialization|"
4400   "partial specialization|redeclaration}0 of %1 does not match"
4401   " expected type %3">;
4402 def err_mismatched_exception_spec_explicit_instantiation : Error<
4403   "exception specification in explicit instantiation does not match "
4404   "instantiated one">;
4405 def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
4406   err_mismatched_exception_spec_explicit_instantiation.Text>,
4407   InGroup<MicrosoftExceptionSpec>;
4408
4409 // C++ typename-specifiers
4410 def err_typename_nested_not_found : Error<"no type named %0 in %1">;
4411 def err_typename_nested_not_found_enable_if : Error<
4412   "no type named 'type' in %0; 'enable_if' cannot be used to disable "
4413   "this declaration">;
4414 def err_typename_nested_not_found_requirement : Error<
4415   "failed requirement '%0'; 'enable_if' cannot be used to disable this "
4416   "declaration">;
4417 def err_typename_nested_not_type : Error<
4418     "typename specifier refers to non-type member %0 in %1">;
4419 def note_typename_refers_here : Note<
4420     "referenced member %0 is declared here">;
4421 def err_typename_missing : Error<
4422   "missing 'typename' prior to dependent type name '%0%1'">;
4423 def err_typename_missing_template : Error<
4424   "missing 'typename' prior to dependent type template name '%0%1'">;
4425 def ext_typename_missing : ExtWarn<
4426   "missing 'typename' prior to dependent type name '%0%1'">,
4427   InGroup<DiagGroup<"typename-missing">>;
4428 def ext_typename_outside_of_template : ExtWarn<
4429   "'typename' occurs outside of a template">, InGroup<CXX11>;
4430 def warn_cxx98_compat_typename_outside_of_template : Warning<
4431   "use of 'typename' outside of a template is incompatible with C++98">,
4432   InGroup<CXX98Compat>, DefaultIgnore;
4433 def err_typename_refers_to_using_value_decl : Error<
4434   "typename specifier refers to a dependent using declaration for a value "
4435   "%0 in %1">;
4436 def note_using_value_decl_missing_typename : Note<
4437   "add 'typename' to treat this using declaration as a type">;
4438
4439 def err_template_kw_refers_to_non_template : Error<
4440   "%0 following the 'template' keyword does not refer to a template">;
4441 def note_template_kw_refers_to_non_template : Note<
4442   "declared as a non-template here">;
4443 def err_template_kw_refers_to_class_template : Error<
4444   "'%0%1' instantiated to a class template, not a function template">;
4445 def note_referenced_class_template : Note<
4446   "class template declared here">;
4447 def err_template_kw_missing : Error<
4448   "missing 'template' keyword prior to dependent template name '%0%1'">;
4449 def ext_template_outside_of_template : ExtWarn<
4450   "'template' keyword outside of a template">, InGroup<CXX11>;
4451 def warn_cxx98_compat_template_outside_of_template : Warning<
4452   "use of 'template' keyword outside of a template is incompatible with C++98">,
4453   InGroup<CXX98Compat>, DefaultIgnore;
4454
4455 def err_non_type_template_in_nested_name_specifier : Error<
4456   "qualified name refers into a specialization of %select{function|variable}0 "
4457   "template %1">;
4458 def err_template_id_not_a_type : Error<
4459   "template name refers to non-type template %0">;
4460 def note_template_declared_here : Note<
4461   "%select{function template|class template|variable template"
4462   "|type alias template|template template parameter}0 "
4463   "%1 declared here">;
4464 def err_alias_template_expansion_into_fixed_list : Error<
4465   "pack expansion used as argument for non-pack parameter of alias template">;
4466 def note_parameter_type : Note<
4467   "parameter of type %0 is declared here">;
4468
4469 // C++11 Variadic Templates
4470 def err_template_param_pack_default_arg : Error<
4471   "template parameter pack cannot have a default argument">;
4472 def err_template_param_pack_must_be_last_template_parameter : Error<
4473   "template parameter pack must be the last template parameter">;
4474
4475 def err_template_parameter_pack_non_pack : Error<
4476   "%select{template type|non-type template|template template}0 parameter"
4477   "%select{| pack}1 conflicts with previous %select{template type|"
4478   "non-type template|template template}0 parameter%select{ pack|}1">;
4479 def note_template_parameter_pack_non_pack : Note<
4480   "%select{template type|non-type template|template template}0 parameter"
4481   "%select{| pack}1 does not match %select{template type|non-type template"
4482   "|template template}0 parameter%select{ pack|}1 in template argument">;
4483 def note_template_parameter_pack_here : Note<
4484   "previous %select{template type|non-type template|template template}0 "
4485   "parameter%select{| pack}1 declared here">;
4486
4487 def err_unexpanded_parameter_pack : Error<
4488   "%select{expression|base type|declaration type|data member type|bit-field "
4489   "size|static assertion|fixed underlying type|enumerator value|"
4490   "using declaration|friend declaration|qualifier|initializer|default argument|"
4491   "non-type template parameter type|exception type|partial specialization|"
4492   "__if_exists name|__if_not_exists name|lambda|block}0 contains"
4493   "%plural{0: an|:}1 unexpanded parameter pack"
4494   "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
4495
4496 def err_pack_expansion_without_parameter_packs : Error<
4497   "pack expansion does not contain any unexpanded parameter packs">;
4498 def err_pack_expansion_length_conflict : Error<
4499   "pack expansion contains parameter packs %0 and %1 that have different "
4500   "lengths (%2 vs. %3)">;
4501 def err_pack_expansion_length_conflict_multilevel : Error<
4502   "pack expansion contains parameter pack %0 that has a different "
4503   "length (%1 vs. %2) from outer parameter packs">;
4504 def err_pack_expansion_length_conflict_partial : Error<
4505   "pack expansion contains parameter pack %0 that has a different "
4506   "length (at least %1 vs. %2) from outer parameter packs">;
4507 def err_pack_expansion_member_init : Error<
4508   "pack expansion for initialization of member %0">;
4509
4510 def err_function_parameter_pack_without_parameter_packs : Error<
4511   "type %0 of function parameter pack does not contain any unexpanded "
4512   "parameter packs">;
4513 def err_ellipsis_in_declarator_not_parameter : Error<
4514   "only function and template parameters can be parameter packs">;
4515
4516 def err_sizeof_pack_no_pack_name : Error<
4517   "%0 does not refer to the name of a parameter pack">;
4518
4519 def err_fold_expression_packs_both_sides : Error<
4520   "binary fold expression has unexpanded parameter packs in both operands">;
4521 def err_fold_expression_empty : Error<
4522   "unary fold expression has empty expansion for operator '%0' "
4523   "with no fallback value">;
4524 def err_fold_expression_bad_operand : Error<
4525   "expression not permitted as operand of fold expression">;
4526
4527 def err_unexpected_typedef : Error<
4528   "unexpected type name %0: expected expression">;
4529 def err_unexpected_namespace : Error<
4530   "unexpected namespace name %0: expected expression">;
4531 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
4532 def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
4533   "use of undeclared identifier %0; "
4534   "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
4535   InGroup<MicrosoftTemplate>;
4536 def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
4537   "found via unqualified lookup into dependent bases of class templates is a "
4538   "Microsoft extension">, InGroup<MicrosoftTemplate>;
4539 def note_dependent_var_use : Note<"must qualify identifier to find this "
4540     "declaration in dependent base class">;
4541 def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
4542     "visible in the template definition nor found by argument-dependent lookup">;
4543 def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
4544     "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
4545 def err_undeclared_use : Error<"use of undeclared %0">;
4546 def warn_deprecated : Warning<"%0 is deprecated">,
4547     InGroup<DeprecatedDeclarations>;
4548 def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
4549 def warn_property_method_deprecated :
4550     Warning<"property access is using %0 method which is deprecated">,
4551     InGroup<DeprecatedDeclarations>;
4552 def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
4553     InGroup<DeprecatedDeclarations>;
4554 def warn_deprecated_anonymous_namespace : Warning<
4555   "'deprecated' attribute on anonymous namespace ignored">,
4556   InGroup<IgnoredAttributes>;
4557 def warn_deprecated_fwdclass_message : Warning<
4558     "%0 may be deprecated because the receiver type is unknown">,
4559     InGroup<DeprecatedDeclarations>;
4560 def warn_deprecated_def : Warning<
4561   "implementing deprecated %select{method|class|category}0">,
4562   InGroup<DeprecatedImplementations>, DefaultIgnore;
4563 def warn_unavailable_def : Warning<
4564   "implementing unavailable method">,
4565   InGroup<DeprecatedImplementations>, DefaultIgnore;
4566 def err_unavailable : Error<"%0 is unavailable">;
4567 def err_property_method_unavailable :
4568     Error<"property access is using %0 method which is unavailable">;
4569 def err_unavailable_message : Error<"%0 is unavailable: %1">;
4570 def warn_unavailable_fwdclass_message : Warning<
4571     "%0 may be unavailable because the receiver type is unknown">,
4572     InGroup<UnavailableDeclarations>;
4573 def note_availability_specified_here : Note<
4574   "%0 has been explicitly marked "
4575   "%select{unavailable|deleted|deprecated}1 here">;
4576 def note_partial_availability_specified_here : Note<
4577   "%0 has been marked as being introduced in %1 %2 here, "
4578   "but the deployment target is %1 %3">;
4579 def note_implicitly_deleted : Note<
4580   "explicitly defaulted function was implicitly deleted here">;
4581 def warn_not_enough_argument : Warning<
4582   "not enough variable arguments in %0 declaration to fit a sentinel">,
4583   InGroup<Sentinel>;
4584 def warn_missing_sentinel : Warning <
4585   "missing sentinel in %select{function call|method dispatch|block call}0">,
4586   InGroup<Sentinel>;
4587 def note_sentinel_here : Note<
4588   "%select{function|method|block}0 has been explicitly marked sentinel here">;
4589 def warn_missing_prototype : Warning<
4590   "no previous prototype for function %0">,
4591   InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
4592 def note_declaration_not_a_prototype : Note<
4593   "this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function">;
4594 def warn_strict_prototypes : Warning<
4595   "this %select{function declaration is not|block declaration is not|"
4596   "old-style function definition is not preceded by}0 a prototype">,
4597   InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
4598 def warn_missing_variable_declarations : Warning<
4599   "no previous extern declaration for non-static variable %0">,
4600   InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
4601 def err_static_data_member_reinitialization :
4602   Error<"static data member %0 already has an initializer">;
4603 def err_redefinition : Error<"redefinition of %0">;
4604 def err_alias_after_tentative :
4605   Error<"alias definition of %0 after tentative definition">;
4606 def err_alias_is_definition :
4607   Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
4608 def err_definition_of_implicitly_declared_member : Error<
4609   "definition of implicitly declared %select{default constructor|copy "
4610   "constructor|move constructor|copy assignment operator|move assignment "
4611   "operator|destructor|function}1">;
4612 def err_definition_of_explicitly_defaulted_member : Error<
4613   "definition of explicitly defaulted %select{default constructor|copy "
4614   "constructor|move constructor|copy assignment operator|move assignment "
4615   "operator|destructor|function}0">;
4616 def err_redefinition_extern_inline : Error<
4617   "redefinition of a 'extern inline' function %0 is not supported in "
4618   "%select{C99 mode|C++}1">;
4619 def warn_attr_abi_tag_namespace : Warning<
4620   "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
4621   InGroup<IgnoredAttributes>;
4622 def err_abi_tag_on_redeclaration : Error<
4623   "cannot add 'abi_tag' attribute in a redeclaration">;
4624 def err_new_abi_tag_on_redeclaration : Error<
4625   "'abi_tag' %0 missing in original declaration">;
4626 def note_use_ifdef_guards : Note<
4627   "unguarded header; consider using #ifdef guards or #pragma once">;
4628
4629 def note_deleted_dtor_no_operator_delete : Note<
4630   "virtual destructor requires an unambiguous, accessible 'operator delete'">;
4631 def note_deleted_special_member_class_subobject : Note<
4632   "%select{default constructor of|copy constructor of|move constructor of|"
4633   "copy assignment operator of|move assignment operator of|destructor of|"
4634   "constructor inherited by}0 "
4635   "%1 is implicitly deleted because "
4636   "%select{base class %3|%select{||||variant }4field %3}2 has "
4637   "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
4638   "%select{%select{default constructor|copy constructor|move constructor|copy "
4639   "assignment operator|move assignment operator|destructor|"
4640   "%select{default|corresponding|default|default|default}4 constructor}0|"
4641   "destructor}5"
4642   "%select{||s||}4">;
4643 def note_deleted_default_ctor_uninit_field : Note<
4644   "%select{default constructor of|constructor inherited by}0 "
4645   "%1 is implicitly deleted because field %2 of "
4646   "%select{reference|const-qualified}4 type %3 would not be initialized">;
4647 def note_deleted_default_ctor_all_const : Note<
4648   "%select{default constructor of|constructor inherited by}0 "
4649   "%1 is implicitly deleted because all "
4650   "%select{data members|data members of an anonymous union member}2"
4651   " are const-qualified">;
4652 def note_deleted_copy_ctor_rvalue_reference : Note<
4653   "copy constructor of %0 is implicitly deleted because field %1 is of "
4654   "rvalue reference type %2">;
4655 def note_deleted_copy_user_declared_move : Note<
4656   "copy %select{constructor|assignment operator}0 is implicitly deleted because"
4657   " %1 has a user-declared move %select{constructor|assignment operator}2">;
4658 def note_deleted_assign_field : Note<
4659   "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
4660   "because field %2 is of %select{reference|const-qualified}4 type %3">;
4661
4662 // These should be errors.
4663 def warn_undefined_internal : Warning<
4664   "%select{function|variable}0 %q1 has internal linkage but is not defined">,
4665   InGroup<DiagGroup<"undefined-internal">>;
4666 def err_undefined_internal_type : Error<
4667   "%select{function|variable}0 %q1 is used but not defined in this "
4668   "translation unit, and cannot be defined in any other translation unit "
4669   "because its type does not have linkage">;
4670 def ext_undefined_internal_type : Extension<
4671   "ISO C++ requires a definition in this translation unit for "
4672   "%select{function|variable}0 %q1 because its type does not have linkage">,
4673   InGroup<DiagGroup<"undefined-internal-type">>;
4674 def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
4675   InGroup<DiagGroup<"undefined-inline">>;
4676 def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
4677 def note_used_here : Note<"used here">;
4678
4679 def err_internal_linkage_redeclaration : Error<
4680   "'internal_linkage' attribute does not appear on the first declaration of %0">;
4681 def warn_internal_linkage_local_storage : Warning<
4682   "'internal_linkage' attribute on a non-static local variable is ignored">,
4683   InGroup<IgnoredAttributes>;
4684
4685 def ext_internal_in_extern_inline : ExtWarn<
4686   "static %select{function|variable}0 %1 is used in an inline function with "
4687   "external linkage">, InGroup<StaticInInline>;
4688 def ext_internal_in_extern_inline_quiet : Extension<
4689   "static %select{function|variable}0 %1 is used in an inline function with "
4690   "external linkage">, InGroup<StaticInInline>;
4691 def warn_static_local_in_extern_inline : Warning<
4692   "non-constant static local variable in inline function may be different "
4693   "in different files">, InGroup<StaticLocalInInline>;
4694 def note_convert_inline_to_static : Note<
4695   "use 'static' to give inline function %0 internal linkage">;
4696
4697 def ext_redefinition_of_typedef : ExtWarn<
4698   "redefinition of typedef %0 is a C11 feature">,
4699   InGroup<DiagGroup<"typedef-redefinition"> >;
4700 def err_redefinition_variably_modified_typedef : Error<
4701   "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
4702
4703 def err_inline_decl_follows_def : Error<
4704   "inline declaration of %0 follows non-inline definition">;
4705 def err_inline_declaration_block_scope : Error<
4706   "inline declaration of %0 not allowed in block scope">;
4707 def err_static_non_static : Error<
4708   "static declaration of %0 follows non-static declaration">;
4709 def err_different_language_linkage : Error<
4710   "declaration of %0 has a different language linkage">;
4711 def ext_retained_language_linkage : Extension<
4712   "friend function %0 retaining previous language linkage is an extension">,
4713   InGroup<DiagGroup<"retained-language-linkage">>;
4714 def err_extern_c_global_conflict : Error<
4715   "declaration of %1 %select{with C language linkage|in global scope}0 "
4716   "conflicts with declaration %select{in global scope|with C language linkage}0">;
4717 def note_extern_c_global_conflict : Note<
4718   "declared %select{in global scope|with C language linkage}0 here">;
4719 def note_extern_c_begins_here : Note<
4720   "extern \"C\" language linkage specification begins here">;
4721 def warn_weak_import : Warning <
4722   "an already-declared variable is made a weak_import declaration %0">;
4723 def ext_static_non_static : Extension<
4724   "redeclaring non-static %0 as static is a Microsoft extension">,
4725   InGroup<MicrosoftRedeclareStatic>;
4726 def err_non_static_static : Error<
4727   "non-static declaration of %0 follows static declaration">;
4728 def err_extern_non_extern : Error<
4729   "extern declaration of %0 follows non-extern declaration">;
4730 def err_non_extern_extern : Error<
4731   "non-extern declaration of %0 follows extern declaration">;
4732 def err_non_thread_thread : Error<
4733   "non-thread-local declaration of %0 follows thread-local declaration">;
4734 def err_thread_non_thread : Error<
4735   "thread-local declaration of %0 follows non-thread-local declaration">;
4736 def err_thread_thread_different_kind : Error<
4737   "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
4738   "follows declaration with %select{dynamic|static}1 initialization">;
4739 def err_mismatched_owning_module : Error<
4740   "declaration of %0 in %select{the global module|module %2}1 follows "
4741   "declaration in %select{the global module|module %4}3">;
4742 def err_redefinition_different_type : Error<
4743   "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
4744 def err_redefinition_different_kind : Error<
4745   "redefinition of %0 as different kind of symbol">;
4746 def err_redefinition_different_namespace_alias : Error<
4747   "redefinition of %0 as an alias for a different namespace">;
4748 def note_previous_namespace_alias : Note<
4749   "previously defined as an alias for %0">;
4750 def warn_forward_class_redefinition : Warning<
4751   "redefinition of forward class %0 of a typedef name of an object type is ignored">,
4752   InGroup<DiagGroup<"objc-forward-class-redefinition">>;
4753 def err_redefinition_different_typedef : Error<
4754   "%select{typedef|type alias|type alias template}0 "
4755   "redefinition with different types%diff{ ($ vs $)|}1,2">;
4756 def err_tag_reference_non_tag : Error<
4757   "%select{non-struct type|non-class type|non-union type|non-enum "
4758   "type|typedef|type alias|template|type alias template|template "
4759   "template argument}1 %0 cannot be referenced with a "
4760   "%select{struct|interface|union|class|enum}2 specifier">;
4761 def err_tag_reference_conflict : Error<
4762   "implicit declaration introduced by elaborated type conflicts with a "
4763   "%select{non-struct type|non-class type|non-union type|non-enum "
4764   "type|typedef|type alias|template|type alias template|template "
4765   "template argument}0 of the same name">;
4766 def err_dependent_tag_decl : Error<
4767   "%select{declaration|definition}0 of "
4768   "%select{struct|interface|union|class|enum}1 in a dependent scope">;
4769 def err_tag_definition_of_typedef : Error<
4770   "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
4771 def err_conflicting_types : Error<"conflicting types for %0">;
4772 def err_different_pass_object_size_params : Error<
4773   "conflicting pass_object_size attributes on parameters">;
4774 def err_late_asm_label_name : Error<
4775   "cannot apply asm label to %select{variable|function}0 after its first use">;
4776 def err_different_asm_label : Error<"conflicting asm label">;
4777 def err_nested_redefinition : Error<"nested redefinition of %0">;
4778 def err_use_with_wrong_tag : Error<
4779   "use of %0 with tag type that does not match previous declaration">;
4780 def warn_struct_class_tag_mismatch : Warning<
4781   "%select{struct|interface|class}0%select{| template}1 %2 was previously "
4782   "declared as a %select{struct|interface|class}3%select{| template}1; "
4783   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
4784   InGroup<MismatchedTags>, DefaultIgnore;
4785 def warn_struct_class_previous_tag_mismatch : Warning<
4786   "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
4787   "here but previously declared as "
4788   "%select{a struct|an interface|a class}3%select{| template}1; "
4789   "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
4790   InGroup<MismatchedTags>, DefaultIgnore;
4791 def note_struct_class_suggestion : Note<
4792   "did you mean %select{struct|interface|class}0 here?">;
4793 def ext_forward_ref_enum : Extension<
4794   "ISO C forbids forward references to 'enum' types">;
4795 def err_forward_ref_enum : Error<
4796   "ISO C++ forbids forward references to 'enum' types">;
4797 def ext_ms_forward_ref_enum : ExtWarn<
4798   "forward references to 'enum' types are a Microsoft extension">,
4799   InGroup<MicrosoftEnumForwardReference>;
4800 def ext_forward_ref_enum_def : Extension<
4801   "redeclaration of already-defined enum %0 is a GNU extension">,
4802   InGroup<GNURedeclaredEnum>;
4803
4804 def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
4805 def err_duplicate_member : Error<"duplicate member %0">;
4806 def err_misplaced_ivar : Error<
4807   "instance variables may not be placed in %select{categories|class extension}0">;
4808 def warn_ivars_in_interface : Warning<
4809   "declaration of instance variables in the interface is deprecated">,
4810   InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
4811 def ext_enum_value_not_int : Extension<
4812   "ISO C restricts enumerator values to range of 'int' (%0 is too "
4813   "%select{small|large}1)">;
4814 def ext_enum_too_large : ExtWarn<
4815   "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
4816 def ext_enumerator_increment_too_large : ExtWarn<
4817   "incremented enumerator value %0 is not representable in the "
4818   "largest integer type">, InGroup<EnumTooLarge>;
4819 def warn_flag_enum_constant_out_of_range : Warning<
4820   "enumeration value %0 is out of range of flags in enumeration type %1">,
4821   InGroup<FlagEnum>;
4822
4823 def warn_illegal_constant_array_size : Extension<
4824   "size of static array must be an integer constant expression">;
4825 def err_vm_decl_in_file_scope : Error<
4826   "variably modified type declaration not allowed at file scope">;
4827 def err_vm_decl_has_extern_linkage : Error<
4828   "variably modified type declaration cannot have 'extern' linkage">;
4829 def err_typecheck_field_variable_size : Error<
4830   "fields must have a constant size: 'variable length array in structure' "
4831   "extension will never be supported">;
4832 def err_vm_func_decl : Error<
4833   "function declaration cannot have variably modified type">;
4834 def err_array_too_large : Error<
4835   "array is too large (%0 elements)">;
4836
4837 def err_typecheck_negative_array_size : Error<"array size is negative">;
4838 def warn_typecheck_function_qualifiers_ignored : Warning<
4839   "'%0' qualifier on function type %1 has no effect">,
4840   InGroup<IgnoredQualifiers>;
4841 def warn_typecheck_function_qualifiers_unspecified : Warning<
4842   "'%0' qualifier on function type %1 has unspecified behavior">;
4843 def warn_typecheck_reference_qualifiers : Warning<
4844   "'%0' qualifier on reference type %1 has no effect">,
4845   InGroup<IgnoredQualifiers>;
4846 def err_typecheck_invalid_restrict_not_pointer : Error<
4847   "restrict requires a pointer or reference (%0 is invalid)">;
4848 def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
4849   "restrict requires a pointer or reference">;
4850 def err_typecheck_invalid_restrict_invalid_pointee : Error<
4851   "pointer to function type %0 may not be 'restrict' qualified">;
4852 def ext_typecheck_zero_array_size : Extension<
4853   "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
4854 def err_typecheck_zero_array_size : Error<
4855   "zero-length arrays are not permitted in C++">;
4856 def warn_typecheck_zero_static_array_size : Warning<
4857   "'static' has no effect on zero-length arrays">,
4858   InGroup<ArrayBounds>;
4859 def err_array_size_non_int : Error<"size of array has non-integer type %0">;
4860 def err_init_element_not_constant : Error<
4861   "initializer element is not a compile-time constant">;
4862 def ext_aggregate_init_not_constant : Extension<
4863   "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
4864 def err_local_cant_init : Error<
4865   "'__local' variable cannot have an initializer">;
4866 def err_block_extern_cant_init : Error<
4867   "'extern' variable cannot have an initializer">;
4868 def warn_extern_init : Warning<"'extern' variable has an initializer">,
4869   InGroup<DiagGroup<"extern-initializer">>;
4870 def err_variable_object_no_init : Error<
4871   "variable-sized object may not be initialized">;
4872 def err_excess_initializers : Error<
4873   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
4874 def ext_excess_initializers : ExtWarn<
4875   "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
4876 def err_excess_initializers_in_char_array_initializer : Error<
4877   "excess elements in char array initializer">;
4878 def ext_excess_initializers_in_char_array_initializer : ExtWarn<
4879   "excess elements in char array initializer">;
4880 def err_initializer_string_for_char_array_too_long : Error<
4881   "initializer-string for char array is too long">;
4882 def ext_initializer_string_for_char_array_too_long : ExtWarn<
4883   "initializer-string for char array is too long">;
4884 def warn_missing_field_initializers : Warning<
4885   "missing field %0 initializer">,
4886   InGroup<MissingFieldInitializers>, DefaultIgnore;
4887 def warn_braces_around_scalar_init : Warning<
4888   "braces around scalar initializer">, InGroup<DiagGroup<"braced-scalar-init">>;
4889 def ext_many_braces_around_scalar_init : ExtWarn<
4890   "too many braces around scalar initializer">,
4891   InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
4892 def ext_complex_component_init : Extension<
4893   "complex initialization specifying real and imaginary components "
4894   "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
4895 def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
4896 def warn_cxx98_compat_empty_scalar_initializer : Warning<
4897   "scalar initialized from empty initializer list is incompatible with C++98">,
4898   InGroup<CXX98Compat>, DefaultIgnore;
4899 def warn_cxx98_compat_reference_list_init : Warning<
4900   "reference initialized from initializer list is incompatible with C++98">,
4901   InGroup<CXX98Compat>, DefaultIgnore;
4902 def warn_cxx98_compat_initializer_list_init : Warning<
4903   "initialization of initializer_list object is incompatible with C++98">,
4904   InGroup<CXX98Compat>, DefaultIgnore;
4905 def warn_cxx98_compat_ctor_list_init : Warning<
4906   "constructor call from initializer list is incompatible with C++98">,
4907   InGroup<CXX98Compat>, DefaultIgnore;
4908 def err_illegal_initializer : Error<
4909   "illegal initializer (only variables can be initialized)">;
4910 def err_illegal_initializer_type : Error<"illegal initializer type %0">;
4911 def ext_init_list_type_narrowing : ExtWarn<
4912   "type %0 cannot be narrowed to %1 in initializer list">,
4913   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4914 def ext_init_list_variable_narrowing : ExtWarn<
4915   "non-constant-expression cannot be narrowed from type %0 to %1 in "
4916   "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4917 def ext_init_list_constant_narrowing : ExtWarn<
4918   "constant expression evaluates to %0 which cannot be narrowed to type %1">,
4919   InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4920 def warn_init_list_type_narrowing : Warning<
4921   "type %0 cannot be narrowed to %1 in initializer list in C++11">,
4922   InGroup<CXX11Narrowing>, DefaultIgnore;
4923 def warn_init_list_variable_narrowing : Warning<
4924   "non-constant-expression cannot be narrowed from type %0 to %1 in "
4925   "initializer list in C++11">,
4926   InGroup<CXX11Narrowing>, DefaultIgnore;
4927 def warn_init_list_constant_narrowing : Warning<
4928   "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
4929   "C++11">,
4930   InGroup<CXX11Narrowing>, DefaultIgnore;
4931 def note_init_list_narrowing_silence : Note<
4932   "insert an explicit cast to silence this issue">;
4933 def err_init_objc_class : Error<
4934   "cannot initialize Objective-C class type %0">;
4935 def err_implicit_empty_initializer : Error<
4936   "initializer for aggregate with no elements requires explicit braces">;
4937 def err_bitfield_has_negative_width : Error<
4938   "bit-field %0 has negative width (%1)">;
4939 def err_anon_bitfield_has_negative_width : Error<
4940   "anonymous bit-field has negative width (%0)">;
4941 def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
4942 def err_bitfield_width_exceeds_type_width : Error<
4943   "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
4944   "of its type (%3 bit%s3)">;
4945 def err_anon_bitfield_width_exceeds_type_width : Error<
4946   "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
4947   "of its type (%2 bit%s2)">;
4948 def err_incorrect_number_of_vector_initializers : Error<
4949   "number of elements must be either one or match the size of the vector">;
4950
4951 // Used by C++ which allows bit-fields that are wider than the type.
4952 def warn_bitfield_width_exceeds_type_width: Warning<
4953   "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
4954   "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
4955 def warn_anon_bitfield_width_exceeds_type_width : Warning<
4956   "width of anonymous bit-field (%0 bits) exceeds width of its type; value "
4957   "will be truncated to %1 bit%s1">, InGroup<BitFieldWidth>;
4958 def warn_bitfield_too_small_for_enum : Warning<
4959   "bit-field %0 is not wide enough to store all enumerators of %1">,
4960   InGroup<BitFieldEnumConversion>, DefaultIgnore;
4961 def note_widen_bitfield : Note<
4962   "widen this field to %0 bits to store all values of %1">;
4963 def warn_unsigned_bitfield_assigned_signed_enum : Warning<
4964   "assigning value of signed enum type %1 to unsigned bit-field %0; "
4965   "negative enumerators of enum %1 will be converted to positive values">,
4966   InGroup<BitFieldEnumConversion>, DefaultIgnore;
4967 def warn_signed_bitfield_enum_conversion : Warning<
4968   "signed bit-field %0 needs an extra bit to represent the largest positive "
4969   "enumerators of %1">,
4970   InGroup<BitFieldEnumConversion>, DefaultIgnore;
4971 def note_change_bitfield_sign : Note<
4972   "consider making the bitfield type %select{unsigned|signed}0">;
4973
4974 def warn_missing_braces : Warning<
4975   "suggest braces around initialization of subobject">,
4976   InGroup<MissingBraces>, DefaultIgnore;
4977
4978 def err_redefinition_of_label : Error<"redefinition of label %0">;
4979 def err_undeclared_label_use : Error<"use of undeclared label %0">;
4980 def err_goto_ms_asm_label : Error<
4981   "cannot jump from this goto statement to label %0 inside an inline assembly block">;
4982 def note_goto_ms_asm_label : Note<
4983   "inline assembly label %0 declared here">;
4984 def warn_unused_label : Warning<"unused label %0">,
4985   InGroup<UnusedLabel>, DefaultIgnore;
4986
4987 def err_goto_into_protected_scope : Error<
4988   "cannot jump from this goto statement to its label">;
4989 def ext_goto_into_protected_scope : ExtWarn<
4990   "jump from this goto statement to its label is a Microsoft extension">,
4991   InGroup<MicrosoftGoto>;
4992 def warn_cxx98_compat_goto_into_protected_scope : Warning<
4993   "jump from this goto statement to its label is incompatible with C++98">,
4994   InGroup<CXX98Compat>, DefaultIgnore;
4995 def err_switch_into_protected_scope : Error<
4996   "cannot jump from switch statement to this case label">;
4997 def warn_cxx98_compat_switch_into_protected_scope : Warning<
4998   "jump from switch statement to this case label is incompatible with C++98">,
4999   InGroup<CXX98Compat>, DefaultIgnore;
5000 def err_indirect_goto_without_addrlabel : Error<
5001   "indirect goto in function with no address-of-label expressions">;
5002 def err_indirect_goto_in_protected_scope : Error<
5003   "cannot jump from this indirect goto statement to one of its possible targets">;
5004 def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5005   "jump from this indirect goto statement to one of its possible targets "
5006   "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5007 def note_indirect_goto_target : Note<
5008   "possible target of indirect goto statement">;
5009 def note_protected_by_variable_init : Note<
5010   "jump bypasses variable initialization">;
5011 def note_protected_by_variable_nontriv_destructor : Note<
5012   "jump bypasses variable with a non-trivial destructor">;
5013 def note_protected_by_variable_non_pod : Note<
5014   "jump bypasses initialization of non-POD variable">;
5015 def note_protected_by_cleanup : Note<
5016   "jump bypasses initialization of variable with __attribute__((cleanup))">;
5017 def note_protected_by_vla_typedef : Note<
5018   "jump bypasses initialization of VLA typedef">;
5019 def note_protected_by_vla_type_alias : Note<
5020   "jump bypasses initialization of VLA type alias">;
5021 def note_protected_by_constexpr_if : Note<
5022   "jump enters controlled statement of constexpr if">;
5023 def note_protected_by_if_available : Note<
5024   "jump enters controlled statement of if available">;
5025 def note_protected_by_vla : Note<
5026   "jump bypasses initialization of variable length array">;
5027 def note_protected_by_objc_fast_enumeration : Note<
5028   "jump enters Objective-C fast enumeration loop">;
5029 def note_protected_by_objc_try : Note<
5030   "jump bypasses initialization of @try block">;
5031 def note_protected_by_objc_catch : Note<
5032   "jump bypasses initialization of @catch block">;
5033 def note_protected_by_objc_finally : Note<
5034   "jump bypasses initialization of @finally block">;
5035 def note_protected_by_objc_synchronized : Note<
5036   "jump bypasses initialization of @synchronized block">;
5037 def note_protected_by_objc_autoreleasepool : Note<
5038   "jump bypasses auto release push of @autoreleasepool block">;
5039 def note_protected_by_cxx_try : Note<
5040   "jump bypasses initialization of try block">;
5041 def note_protected_by_cxx_catch : Note<
5042   "jump bypasses initialization of catch block">;
5043 def note_protected_by_seh_try : Note<
5044   "jump bypasses initialization of __try block">;
5045 def note_protected_by_seh_except : Note<
5046   "jump bypasses initialization of __except block">;
5047 def note_protected_by_seh_finally : Note<
5048   "jump bypasses initialization of __finally block">;
5049 def note_protected_by___block : Note<
5050   "jump bypasses setup of __block variable">;
5051 def note_protected_by_objc_strong_init : Note<
5052   "jump bypasses initialization of __strong variable">;
5053 def note_protected_by_objc_weak_init : Note<
5054   "jump bypasses initialization of __weak variable">;
5055 def note_protected_by_non_trivial_c_struct_init : Note<
5056   "jump bypasses initialization of variable of non-trivial C struct type">;
5057 def note_enters_block_captures_cxx_obj : Note<
5058   "jump enters lifetime of block which captures a destructible C++ object">;
5059 def note_enters_block_captures_strong : Note<
5060   "jump enters lifetime of block which strongly captures a variable">;
5061 def note_enters_block_captures_weak : Note<
5062   "jump enters lifetime of block which weakly captures a variable">;
5063 def note_enters_block_captures_non_trivial_c_struct : Note<
5064   "jump enters lifetime of block which captures a C struct that is non-trivial "
5065   "to destroy">;
5066
5067 def note_exits_cleanup : Note<
5068   "jump exits scope of variable with __attribute__((cleanup))">;
5069 def note_exits_dtor : Note<
5070   "jump exits scope of variable with non-trivial destructor">;
5071 def note_exits_temporary_dtor : Note<
5072   "jump exits scope of lifetime-extended temporary with non-trivial "
5073   "destructor">;
5074 def note_exits___block : Note<
5075   "jump exits scope of __block variable">;
5076 def note_exits_objc_try : Note<
5077   "jump exits @try block">;
5078 def note_exits_objc_catch : Note<
5079   "jump exits @catch block">;
5080 def note_exits_objc_finally : Note<
5081   "jump exits @finally block">;
5082 def note_exits_objc_synchronized : Note<
5083   "jump exits @synchronized block">;
5084 def note_exits_cxx_try : Note<
5085   "jump exits try block">;
5086 def note_exits_cxx_catch : Note<
5087   "jump exits catch block">;
5088 def note_exits_seh_try : Note<
5089   "jump exits __try block">;
5090 def note_exits_seh_except : Note<
5091   "jump exits __except block">;
5092 def note_exits_seh_finally : Note<
5093   "jump exits __finally block">;
5094 def note_exits_objc_autoreleasepool : Note<
5095   "jump exits autoreleasepool block">;
5096 def note_exits_objc_strong : Note<
5097   "jump exits scope of __strong variable">;
5098 def note_exits_objc_weak : Note<
5099   "jump exits scope of __weak variable">;
5100 def note_exits_block_captures_cxx_obj : Note<
5101   "jump exits lifetime of block which captures a destructible C++ object">;
5102 def note_exits_block_captures_strong : Note<
5103   "jump exits lifetime of block which strongly captures a variable">;
5104 def note_exits_block_captures_weak : Note<
5105   "jump exits lifetime of block which weakly captures a variable">;
5106 def note_exits_block_captures_non_trivial_c_struct : Note<
5107   "jump exits lifetime of block which captures a C struct that is non-trivial "
5108   "to destroy">;
5109
5110 def err_func_returning_qualified_void : ExtWarn<
5111   "function cannot return qualified void type %0">,
5112   InGroup<DiagGroup<"qualified-void-return-type">>;
5113 def err_func_returning_array_function : Error<
5114   "function cannot return %select{array|function}0 type %1">;
5115 def err_field_declared_as_function : Error<"field %0 declared as a function">;
5116 def err_field_incomplete : Error<"field has incomplete type %0">;
5117 def ext_variable_sized_type_in_struct : ExtWarn<
5118   "field %0 with variable sized type %1 not at the end of a struct or class is"
5119   " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5120
5121 def ext_c99_flexible_array_member : Extension<
5122   "flexible array members are a C99 feature">, InGroup<C99>;
5123 def err_flexible_array_virtual_base : Error<
5124   "flexible array member %0 not allowed in "
5125   "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5126 def err_flexible_array_empty_aggregate : Error<
5127   "flexible array member %0 not allowed in otherwise empty "
5128   "%select{struct|interface|union|class|enum}1">;
5129 def err_flexible_array_has_nontrivial_dtor : Error<
5130   "flexible array member %0 of type %1 with non-trivial destruction">;
5131 def ext_flexible_array_in_struct : Extension<
5132   "%0 may not be nested in a struct due to flexible array member">,
5133   InGroup<FlexibleArrayExtensions>;
5134 def ext_flexible_array_in_array : Extension<
5135   "%0 may not be used as an array element due to flexible array member">,
5136   InGroup<FlexibleArrayExtensions>;
5137 def err_flexible_array_init : Error<
5138   "initialization of flexible array member is not allowed">;
5139 def ext_flexible_array_empty_aggregate_ms : Extension<
5140   "flexible array member %0 in otherwise empty "
5141   "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
5142   InGroup<MicrosoftFlexibleArray>;
5143 def err_flexible_array_union : Error<
5144   "flexible array member %0 in a union is not allowed">;
5145 def ext_flexible_array_union_ms : Extension<
5146   "flexible array member %0 in a union is a Microsoft extension">,
5147   InGroup<MicrosoftFlexibleArray>;
5148 def ext_flexible_array_empty_aggregate_gnu : Extension<
5149   "flexible array member %0 in otherwise empty "
5150   "%select{struct|interface|union|class|enum}1 is a GNU extension">,
5151   InGroup<GNUEmptyStruct>;
5152 def ext_flexible_array_union_gnu : Extension<
5153   "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
5154
5155 def err_flexible_array_not_at_end : Error<
5156   "flexible array member %0 with type %1 is not at the end of"
5157   " %select{struct|interface|union|class|enum}2">;
5158 def err_objc_variable_sized_type_not_at_end : Error<
5159   "field %0 with variable sized type %1 is not at the end of class">;
5160 def note_next_field_declaration : Note<
5161   "next field declaration is here">;
5162 def note_next_ivar_declaration : Note<
5163   "next %select{instance variable declaration|synthesized instance variable}0"
5164   " is here">;
5165 def err_synthesize_variable_sized_ivar : Error<
5166   "synthesized property with variable size type %0"
5167   " requires an existing instance variable">;
5168 def err_flexible_array_arc_retainable : Error<
5169   "ARC forbids flexible array members with retainable object type">;
5170 def warn_variable_sized_ivar_visibility : Warning<
5171   "field %0 with variable sized type %1 is not visible to subclasses and"
5172   " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
5173 def warn_superclass_variable_sized_type_not_at_end : Warning<
5174   "field %0 can overwrite instance variable %1 with variable sized type %2"
5175   " in superclass %3">, InGroup<ObjCFlexibleArray>;
5176
5177 let CategoryName = "ARC Semantic Issue" in {
5178
5179 // ARC-mode diagnostics.
5180
5181 let CategoryName = "ARC Weak References" in {
5182
5183 def err_arc_weak_no_runtime : Error<
5184   "cannot create __weak reference because the current deployment target "
5185   "does not support weak references">;
5186 def err_arc_weak_disabled : Error<
5187   "cannot create __weak reference in file using manual reference counting">;
5188 def err_synthesizing_arc_weak_property_disabled : Error<
5189   "cannot synthesize weak property in file using manual reference counting">;
5190 def err_synthesizing_arc_weak_property_no_runtime : Error<
5191   "cannot synthesize weak property because the current deployment target "
5192   "does not support weak references">;
5193 def err_arc_unsupported_weak_class : Error<
5194   "class is incompatible with __weak references">;
5195 def err_arc_weak_unavailable_assign : Error<
5196   "assignment of a weak-unavailable object to a __weak object">;
5197 def err_arc_weak_unavailable_property : Error<
5198   "synthesizing __weak instance variable of type %0, which does not "
5199   "support weak references">;
5200 def note_implemented_by_class : Note<
5201   "when implemented by class %0">;
5202 def err_arc_convesion_of_weak_unavailable : Error<
5203   "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
5204   " a __weak object of type %2">;
5205
5206 } // end "ARC Weak References" category
5207
5208 let CategoryName = "ARC Restrictions" in {
5209
5210 def err_unavailable_in_arc : Error<
5211   "%0 is unavailable in ARC">;
5212 def note_arc_forbidden_type : Note<
5213   "declaration uses type that is ill-formed in ARC">;
5214 def note_performs_forbidden_arc_conversion : Note<
5215   "inline function performs a conversion which is forbidden in ARC">;
5216 def note_arc_init_returns_unrelated : Note<
5217   "init method must return a type related to its receiver type">;
5218 def note_arc_weak_disabled : Note<
5219   "declaration uses __weak, but ARC is disabled">;
5220 def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
5221   "the current deployment target does not support">;
5222 def note_arc_field_with_ownership : Note<
5223   "field has non-trivial ownership qualification">;
5224
5225 def err_arc_illegal_explicit_message : Error<
5226   "ARC forbids explicit message send of %0">;
5227 def err_arc_unused_init_message : Error<
5228   "the result of a delegate init call must be immediately returned "
5229   "or assigned to 'self'">;
5230 def err_arc_mismatched_cast : Error<
5231   "%select{implicit conversion|cast}0 of "
5232   "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
5233   "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
5234   " to %3 is disallowed with ARC">;
5235 def err_arc_nolifetime_behavior : Error<
5236   "explicit ownership qualifier on cast result has no effect">;
5237 def err_arc_objc_object_in_tag : Error<
5238   "ARC forbids %select{Objective-C objects|blocks}0 in "
5239   "%select{struct|interface|union|<<ERROR>>|enum}1">;
5240 def err_arc_objc_property_default_assign_on_object : Error<
5241   "ARC forbids synthesizing a property of an Objective-C object "
5242   "with unspecified ownership or storage attribute">;
5243 def err_arc_illegal_selector : Error<
5244   "ARC forbids use of %0 in a @selector">;
5245 def err_arc_illegal_method_def : Error<
5246   "ARC forbids %select{implementation|synthesis}0 of %1">;
5247 def warn_arc_strong_pointer_objc_pointer : Warning<
5248   "method parameter of type %0 with no explicit ownership">,
5249   InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
5250
5251 } // end "ARC Restrictions" category
5252
5253 def err_arc_lost_method_convention : Error<
5254   "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
5255   "method, but its implementation doesn't match because %select{"
5256   "its result type is not an object pointer|"
5257   "its result type is unrelated to its receiver type}1">;
5258 def note_arc_lost_method_convention : Note<"declaration in interface">;
5259 def err_arc_gained_method_convention : Error<
5260   "method implementation does not match its declaration">;
5261 def note_arc_gained_method_convention : Note<
5262   "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
5263   "family because %select{its result type is not an object pointer|"
5264   "its result type is unrelated to its receiver type}1">;
5265 def err_typecheck_arc_assign_self : Error<
5266   "cannot assign to 'self' outside of a method in the init family">;
5267 def err_typecheck_arc_assign_self_class_method : Error<
5268   "cannot assign to 'self' in a class method">;
5269 def err_typecheck_arr_assign_enumeration : Error<
5270   "fast enumeration variables cannot be modified in ARC by default; "
5271   "declare the variable __strong to allow this">;
5272 def err_typecheck_arc_assign_externally_retained : Error<
5273   "variable declared with 'objc_externally_retained' "
5274   "cannot be modified in ARC">;
5275 def warn_arc_retained_assign : Warning<
5276   "assigning retained object to %select{weak|unsafe_unretained}0 "
5277   "%select{property|variable}1"
5278   "; object will be released after assignment">,
5279   InGroup<ARCUnsafeRetainedAssign>;
5280 def warn_arc_retained_property_assign : Warning<
5281   "assigning retained object to unsafe property"
5282   "; object will be released after assignment">,
5283   InGroup<ARCUnsafeRetainedAssign>;
5284 def warn_arc_literal_assign : Warning<
5285   "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
5286   " to a weak %select{property|variable}1"
5287   "; object will be released after assignment">,
5288   InGroup<ARCUnsafeRetainedAssign>;
5289 def err_arc_new_array_without_ownership : Error<
5290   "'new' cannot allocate an array of %0 with no explicit ownership">;
5291 def err_arc_autoreleasing_var : Error<
5292   "%select{__block variables|global variables|fields|instance variables}0 cannot have "
5293   "__autoreleasing ownership">;
5294 def err_arc_autoreleasing_capture : Error<
5295   "cannot capture __autoreleasing variable in a "
5296   "%select{block|lambda by copy}0">;
5297 def err_arc_thread_ownership : Error<
5298   "thread-local variable has non-trivial ownership: type is %0">;
5299 def err_arc_indirect_no_ownership : Error<
5300   "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
5301 def err_arc_array_param_no_ownership : Error<
5302   "must explicitly describe intended ownership of an object array parameter">;
5303 def err_arc_pseudo_dtor_inconstant_quals : Error<
5304   "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
5305   "type %1">;
5306 def err_arc_init_method_unrelated_result_type : Error<
5307   "init methods must return a type related to the receiver type">;
5308 def err_arc_nonlocal_writeback : Error<
5309   "passing address of %select{non-local|non-scalar}0 object to "
5310   "__autoreleasing parameter for write-back">;
5311 def err_arc_method_not_found : Error<
5312   "no known %select{instance|class}1 method for selector %0">;
5313 def err_arc_receiver_forward_class : Error<
5314   "receiver %0 for class message is a forward declaration">;
5315 def err_arc_may_not_respond : Error<
5316   "no visible @interface for %0 declares the selector %1">;
5317 def err_arc_receiver_forward_instance : Error<
5318   "receiver type %0 for instance message is a forward declaration">;
5319 def warn_receiver_forward_instance : Warning<
5320   "receiver type %0 for instance message is a forward declaration">,
5321   InGroup<ForwardClassReceiver>, DefaultIgnore;
5322 def err_arc_collection_forward : Error<
5323   "collection expression type %0 is a forward declaration">;
5324 def err_arc_multiple_method_decl : Error<
5325   "multiple methods named %0 found with mismatched result, "
5326   "parameter type or attributes">;
5327 def warn_arc_lifetime_result_type : Warning<
5328   "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
5329   "lifetime qualifier on return type is ignored">,
5330   InGroup<IgnoredQualifiers>;
5331
5332 let CategoryName = "ARC Retain Cycle" in {
5333
5334 def warn_arc_retain_cycle : Warning<
5335   "capturing %0 strongly in this block is likely to lead to a retain cycle">,
5336   InGroup<ARCRetainCycles>;
5337 def note_arc_retain_cycle_owner : Note<
5338   "block will be retained by %select{the captured object|an object strongly "
5339   "retained by the captured object}0">;
5340
5341 } // end "ARC Retain Cycle" category
5342
5343 def warn_arc_object_memaccess : Warning<
5344   "%select{destination for|source of}0 this %1 call is a pointer to "
5345   "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
5346
5347 let CategoryName = "ARC and @properties" in {
5348
5349 def err_arc_strong_property_ownership : Error<
5350   "existing instance variable %1 for strong property %0 may not be "
5351   "%select{|__unsafe_unretained||__weak}2">;
5352 def err_arc_assign_property_ownership : Error<
5353   "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
5354   "attribute must be __unsafe_unretained">;
5355 def err_arc_inconsistent_property_ownership : Error<
5356   "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
5357   "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
5358
5359 } // end "ARC and @properties" category
5360
5361 def warn_block_capture_autoreleasing : Warning<
5362   "block captures an autoreleasing out-parameter, which may result in "
5363   "use-after-free bugs">,
5364   InGroup<BlockCaptureAutoReleasing>;
5365 def note_declare_parameter_strong : Note<
5366   "declare the parameter __strong or capture a __block __strong variable to "
5367   "keep values alive across autorelease pools">;
5368
5369 def err_arc_atomic_ownership : Error<
5370   "cannot perform atomic operation on a pointer to type %0: type has "
5371   "non-trivial ownership">;
5372
5373 let CategoryName = "ARC Casting Rules" in {
5374
5375 def err_arc_bridge_cast_incompatible : Error<
5376   "incompatible types casting %0 to %1 with a %select{__bridge|"
5377   "__bridge_transfer|__bridge_retained}2 cast">;
5378 def err_arc_bridge_cast_wrong_kind : Error<
5379   "cast of %select{Objective-C|block|C}0 pointer type %1 to "
5380   "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
5381   "__bridge_transfer|__bridge_retained}4">;
5382 def err_arc_cast_requires_bridge : Error<
5383   "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
5384   "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
5385   "requires a bridged cast">;
5386 def note_arc_bridge : Note<
5387   "use __bridge to convert directly (no change in ownership)">;
5388 def note_arc_cstyle_bridge : Note<
5389   "use __bridge with C-style cast to convert directly (no change in ownership)">;
5390 def note_arc_bridge_transfer : Note<
5391   "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
5392   "ownership of a +1 %0 into ARC">;
5393 def note_arc_cstyle_bridge_transfer : Note<
5394   "use __bridge_transfer with C-style cast to transfer "
5395   "ownership of a +1 %0 into ARC">;
5396 def note_arc_bridge_retained : Note<
5397   "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
5398   "ARC object available as a +1 %0">;
5399 def note_arc_cstyle_bridge_retained : Note<
5400   "use __bridge_retained with C-style cast to make an "
5401   "ARC object available as a +1 %0">;
5402
5403 } // ARC Casting category
5404
5405 } // ARC category name
5406
5407 def err_flexible_array_init_needs_braces : Error<
5408   "flexible array requires brace-enclosed initializer">;
5409 def err_illegal_decl_array_of_functions : Error<
5410   "'%0' declared as array of functions of type %1">;
5411 def err_illegal_decl_array_incomplete_type : Error<
5412   "array has incomplete element type %0">;
5413 def err_illegal_message_expr_incomplete_type : Error<
5414   "Objective-C message has incomplete result type %0">;
5415 def err_illegal_decl_array_of_references : Error<
5416   "'%0' declared as array of references of type %1">;
5417 def err_decl_negative_array_size : Error<
5418   "'%0' declared as an array with a negative size">;
5419 def err_array_static_outside_prototype : Error<
5420   "%0 used in array declarator outside of function prototype">;
5421 def err_array_static_not_outermost : Error<
5422   "%0 used in non-outermost array type derivation">;
5423 def err_array_star_outside_prototype : Error<
5424   "star modifier used outside of function prototype">;
5425 def err_illegal_decl_pointer_to_reference : Error<
5426   "'%0' declared as a pointer to a reference of type %1">;
5427 def err_illegal_decl_mempointer_to_reference : Error<
5428   "'%0' declared as a member pointer to a reference of type %1">;
5429 def err_illegal_decl_mempointer_to_void : Error<
5430   "'%0' declared as a member pointer to void">;
5431 def err_illegal_decl_mempointer_in_nonclass : Error<
5432   "'%0' does not point into a class">;
5433 def err_mempointer_in_nonclass_type : Error<
5434   "member pointer refers into non-class type %0">;
5435 def err_reference_to_void : Error<"cannot form a reference to 'void'">;
5436 def err_nonfunction_block_type : Error<
5437   "block pointer to non-function type is invalid">;
5438 def err_return_block_has_expr : Error<"void block should not return a value">;
5439 def err_block_return_missing_expr : Error<
5440   "non-void block should return a value">;
5441 def err_func_def_incomplete_result : Error<
5442   "incomplete result type %0 in function definition">;
5443 def err_atomic_specifier_bad_type : Error<
5444   "_Atomic cannot be applied to "
5445   "%select{incomplete |array |function |reference |atomic |qualified |}0type "
5446   "%1 %select{||||||which is not trivially copyable}0">;
5447
5448 // Expressions.
5449 def select_unary_expr_or_type_trait_kind : TextSubstitution<
5450   "%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align|"
5451   "__alignof}0">;
5452 def ext_sizeof_alignof_function_type : Extension<
5453   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5454   "to a function type">, InGroup<PointerArith>;
5455 def ext_sizeof_alignof_void_type : Extension<
5456   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5457   "to a void type">, InGroup<PointerArith>;
5458 def err_opencl_sizeof_alignof_type : Error<
5459   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5460   "to a void type">;
5461 def err_sizeof_alignof_incomplete_type : Error<
5462   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5463   "to an incomplete type %1">;
5464 def err_sizeof_alignof_function_type : Error<
5465   "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5466   "to a function type">;
5467 def err_openmp_default_simd_align_expr : Error<
5468   "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
5469 def err_sizeof_alignof_typeof_bitfield : Error<
5470   "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
5471 def err_alignof_member_of_incomplete_type : Error<
5472   "invalid application of 'alignof' to a field of a class still being defined">;
5473 def err_vecstep_non_scalar_vector_type : Error<
5474   "'vec_step' requires built-in scalar or vector type, %0 invalid">;
5475 def err_offsetof_incomplete_type : Error<
5476   "offsetof of incomplete type %0">;
5477 def err_offsetof_record_type : Error<
5478   "offsetof requires struct, union, or class type, %0 invalid">;
5479 def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
5480 def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
5481   InGroup<InvalidOffsetof>;
5482 def ext_offsetof_non_standardlayout_type : ExtWarn<
5483   "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
5484 def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
5485 def err_offsetof_field_of_virtual_base : Error<
5486   "invalid application of 'offsetof' to a field of a virtual base">;
5487 def warn_sub_ptr_zero_size_types : Warning<
5488   "subtraction of pointers to type %0 of zero size has undefined behavior">,
5489   InGroup<PointerArith>;
5490 def warn_pointer_arith_null_ptr : Warning<
5491   "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
5492   InGroup<NullPointerArithmetic>, DefaultIgnore;
5493 def warn_gnu_null_ptr_arith : Warning<
5494   "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
5495   InGroup<NullPointerArithmetic>, DefaultIgnore;
5496
5497 def warn_floatingpoint_eq : Warning<
5498   "comparing floating point with == or != is unsafe">,
5499   InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
5500
5501 def warn_remainder_division_by_zero : Warning<
5502   "%select{remainder|division}0 by zero is undefined">,
5503   InGroup<DivZero>;
5504 def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
5505   InGroup<DiagGroup<"shift-negative-value">>;
5506 def warn_shift_negative : Warning<"shift count is negative">,
5507   InGroup<DiagGroup<"shift-count-negative">>;
5508 def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
5509   InGroup<DiagGroup<"shift-count-overflow">>;
5510 def warn_shift_result_gt_typewidth : Warning<
5511   "signed shift result (%0) requires %1 bits to represent, but %2 only has "
5512   "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
5513 def warn_shift_result_sets_sign_bit : Warning<
5514   "signed shift result (%0) sets the sign bit of the shift expression's "
5515   "type (%1) and becomes negative">,
5516   InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
5517
5518 def warn_precedence_bitwise_rel : Warning<
5519   "%0 has lower precedence than %1; %1 will be evaluated first">,
5520   InGroup<Parentheses>;
5521 def note_precedence_bitwise_first : Note<
5522   "place parentheses around the %0 expression to evaluate it first">;
5523 def note_precedence_silence : Note<
5524   "place parentheses around the '%0' expression to silence this warning">;
5525
5526 def warn_precedence_conditional : Warning<
5527   "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
5528   InGroup<Parentheses>;
5529 def note_precedence_conditional_first : Note<
5530   "place parentheses around the '?:' expression to evaluate it first">;
5531
5532 def warn_logical_instead_of_bitwise : Warning<
5533   "use of logical '%0' with constant operand">,
5534   InGroup<DiagGroup<"constant-logical-operand">>;
5535 def note_logical_instead_of_bitwise_change_operator : Note<
5536   "use '%0' for a bitwise operation">;
5537 def note_logical_instead_of_bitwise_remove_constant : Note<
5538   "remove constant to silence this warning">;
5539
5540 def warn_bitwise_op_in_bitwise_op : Warning<
5541   "'%0' within '%1'">, InGroup<BitwiseOpParentheses>;
5542
5543 def warn_logical_and_in_logical_or : Warning<
5544   "'&&' within '||'">, InGroup<LogicalOpParentheses>;
5545
5546 def warn_overloaded_shift_in_comparison :Warning<
5547   "overloaded operator %select{>>|<<}0 has higher precedence than "
5548   "comparison operator">,
5549   InGroup<OverloadedShiftOpParentheses>;
5550 def note_evaluate_comparison_first :Note<
5551   "place parentheses around comparison expression to evaluate it first">;
5552
5553 def warn_addition_in_bitshift : Warning<
5554   "operator '%0' has lower precedence than '%1'; "
5555   "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
5556
5557 def warn_self_assignment_builtin : Warning<
5558   "explicitly assigning value of variable of type %0 to itself">,
5559   InGroup<SelfAssignment>, DefaultIgnore;
5560 def warn_self_assignment_overloaded : Warning<
5561   "explicitly assigning value of variable of type %0 to itself">,
5562   InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
5563 def warn_self_move : Warning<
5564   "explicitly moving variable of type %0 to itself">,
5565   InGroup<SelfMove>, DefaultIgnore;
5566
5567 def warn_redundant_move_on_return : Warning<
5568   "redundant move in return statement">,
5569   InGroup<RedundantMove>, DefaultIgnore;
5570 def warn_pessimizing_move_on_return : Warning<
5571   "moving a local object in a return statement prevents copy elision">,
5572   InGroup<PessimizingMove>, DefaultIgnore;
5573 def warn_pessimizing_move_on_initialization : Warning<
5574   "moving a temporary object prevents copy elision">,
5575   InGroup<PessimizingMove>, DefaultIgnore;
5576 def note_remove_move : Note<"remove std::move call here">;
5577
5578 def warn_return_std_move : Warning<
5579   "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
5580   InGroup<ReturnStdMove>, DefaultIgnore;
5581 def note_add_std_move : Note<
5582   "call 'std::move' explicitly to avoid copying">;
5583 def warn_return_std_move_in_cxx11 : Warning<
5584   "prior to the resolution of a defect report against ISO C++11, "
5585   "local variable %0 would have been copied despite being returned by name, "
5586   "due to its not matching the function return type%diff{ ($ vs $)|}1,2">,
5587   InGroup<ReturnStdMoveInCXX11>, DefaultIgnore;
5588 def note_add_std_move_in_cxx11 : Note<
5589   "call 'std::move' explicitly to avoid copying on older compilers">;
5590
5591 def warn_string_plus_int : Warning<
5592   "adding %0 to a string does not append to the string">,
5593   InGroup<StringPlusInt>;
5594 def warn_string_plus_char : Warning<
5595   "adding %0 to a string pointer does not append to the string">,
5596   InGroup<StringPlusChar>;
5597 def note_string_plus_scalar_silence : Note<
5598   "use array indexing to silence this warning">;
5599
5600 def warn_sizeof_array_param : Warning<
5601   "sizeof on array function parameter will return size of %0 instead of %1">,
5602   InGroup<SizeofArrayArgument>;
5603
5604 def warn_sizeof_array_decay : Warning<
5605   "sizeof on pointer operation will return size of %0 instead of %1">,
5606   InGroup<SizeofArrayDecay>;
5607
5608 def err_sizeof_nonfragile_interface : Error<
5609   "application of '%select{alignof|sizeof}1' to interface %0 is "
5610   "not supported on this architecture and platform">;
5611 def err_atdef_nonfragile_interface : Error<
5612   "use of @defs is not supported on this architecture and platform">;
5613 def err_subscript_nonfragile_interface : Error<
5614   "subscript requires size of interface %0, which is not constant for "
5615   "this architecture and platform">;
5616
5617 def err_arithmetic_nonfragile_interface : Error<
5618   "arithmetic on pointer to interface %0, which is not a constant size for "
5619   "this architecture and platform">;
5620
5621
5622 def ext_subscript_non_lvalue : Extension<
5623   "ISO C90 does not allow subscripting non-lvalue array">;
5624 def err_typecheck_subscript_value : Error<
5625   "subscripted value is not an array, pointer, or vector">;
5626 def err_typecheck_subscript_not_integer : Error<
5627   "array subscript is not an integer">;
5628 def err_subscript_function_type : Error<
5629   "subscript of pointer to function type %0">;
5630 def err_subscript_incomplete_type : Error<
5631   "subscript of pointer to incomplete type %0">;
5632 def err_dereference_incomplete_type : Error<
5633   "dereference of pointer to incomplete type %0">;
5634 def ext_gnu_subscript_void_type : Extension<
5635   "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
5636 def err_typecheck_member_reference_struct_union : Error<
5637   "member reference base type %0 is not a structure or union">;
5638 def err_typecheck_member_reference_ivar : Error<
5639   "%0 does not have a member named %1">;
5640 def err_arc_weak_ivar_access : Error<
5641   "dereferencing a __weak pointer is not allowed due to possible "
5642   "null value caused by race condition, assign it to strong variable first">;
5643 def err_typecheck_member_reference_arrow : Error<
5644   "member reference type %0 is not a pointer">;
5645 def err_typecheck_member_reference_suggestion : Error<
5646   "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
5647 def note_typecheck_member_reference_suggestion : Note<
5648   "did you mean to use '.' instead?">;
5649 def note_member_reference_arrow_from_operator_arrow : Note<
5650   "'->' applied to return value of the operator->() declared here">;
5651 def err_typecheck_member_reference_type : Error<
5652   "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
5653 def err_typecheck_member_reference_unknown : Error<
5654   "cannot refer to member %0 in %1 with '%select{.|->}2'">;
5655 def err_member_reference_needs_call : Error<
5656   "base of member reference is a function; perhaps you meant to call "
5657   "it%select{| with no arguments}0?">;
5658 def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
5659   InGroup<CharSubscript>, DefaultIgnore;
5660
5661 def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
5662 def err_no_member : Error<"no member named %0 in %1">;
5663 def err_no_member_overloaded_arrow : Error<
5664   "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
5665
5666 def err_member_not_yet_instantiated : Error<
5667   "no member %0 in %1; it has not yet been instantiated">;
5668 def note_non_instantiated_member_here : Note<
5669   "not-yet-instantiated member is declared here">;
5670
5671 def err_enumerator_does_not_exist : Error<
5672   "enumerator %0 does not exist in instantiation of %1">;
5673 def note_enum_specialized_here : Note<
5674   "enum %0 was explicitly specialized here">;
5675
5676 def err_specialization_not_primary_template : Error<
5677   "cannot reference member of primary template because deduced class "
5678   "template specialization %0 is %select{instantiated from a partial|"
5679   "an explicit}1 specialization">;
5680
5681 def err_member_redeclared : Error<"class member cannot be redeclared">;
5682 def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
5683   InGroup<RedeclaredClassMember>;
5684 def err_member_redeclared_in_instantiation : Error<
5685   "multiple overloads of %0 instantiate to the same signature %1">;
5686 def err_member_name_of_class : Error<"member %0 has the same name as its class">;
5687 def err_member_def_undefined_record : Error<
5688   "out-of-line definition of %0 from class %1 without definition">;
5689 def err_member_decl_does_not_match : Error<
5690   "out-of-line %select{declaration|definition}2 of %0 "
5691   "does not match any declaration in %1">;
5692 def err_friend_decl_with_def_arg_must_be_def : Error<
5693   "friend declaration specifying a default argument must be a definition">;
5694 def err_friend_decl_with_def_arg_redeclared : Error<
5695   "friend declaration specifying a default argument must be the only declaration">;
5696 def err_friend_decl_does_not_match : Error<
5697   "friend declaration of %0 does not match any declaration in %1">;
5698 def err_member_decl_does_not_match_suggest : Error<
5699   "out-of-line %select{declaration|definition}2 of %0 "
5700   "does not match any declaration in %1; did you mean %3?">;
5701 def err_member_def_does_not_match_ret_type : Error<
5702   "return type of out-of-line definition of %q0 differs from "
5703   "that in the declaration">;
5704 def err_nonstatic_member_out_of_line : Error<
5705   "non-static data member defined out-of-line">;
5706 def err_qualified_typedef_declarator : Error<
5707   "typedef declarator cannot be qualified">;
5708 def err_qualified_param_declarator : Error<
5709   "parameter declarator cannot be qualified">;
5710 def ext_out_of_line_declaration : ExtWarn<
5711   "out-of-line declaration of a member must be a definition">,
5712   InGroup<OutOfLineDeclaration>, DefaultError;
5713 def err_member_extra_qualification : Error<
5714   "extra qualification on member %0">;
5715 def warn_member_extra_qualification : Warning<
5716   err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
5717 def warn_namespace_member_extra_qualification : Warning<
5718   "extra qualification on member %0">,
5719   InGroup<DiagGroup<"extra-qualification">>;
5720 def err_member_qualification : Error<
5721   "non-friend class member %0 cannot have a qualified name">;
5722 def note_member_def_close_match : Note<"member declaration nearly matches">;
5723 def note_member_def_close_const_match : Note<
5724   "member declaration does not match because "
5725   "it %select{is|is not}0 const qualified">;
5726 def note_member_def_close_param_match : Note<
5727   "type of %ordinal0 parameter of member declaration does not match definition"
5728   "%diff{ ($ vs $)|}1,2">;
5729 def note_local_decl_close_match : Note<"local declaration nearly matches">;
5730 def note_local_decl_close_param_match : Note<
5731   "type of %ordinal0 parameter of local declaration does not match definition"
5732   "%diff{ ($ vs $)|}1,2">;
5733 def err_typecheck_ivar_variable_size : Error<
5734   "instance variables must have a constant size">;
5735 def err_ivar_reference_type : Error<
5736   "instance variables cannot be of reference type">;
5737 def err_typecheck_illegal_increment_decrement : Error<
5738   "cannot %select{decrement|increment}1 value of type %0">;
5739 def err_typecheck_expect_int : Error<
5740   "used type %0 where integer is required">;
5741 def err_typecheck_arithmetic_incomplete_type : Error<
5742   "arithmetic on a pointer to an incomplete type %0">;
5743 def err_typecheck_pointer_arith_function_type : Error<
5744   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
5745   "function type%select{|s}2 %1%select{| and %3}2">;
5746 def err_typecheck_pointer_arith_void_type : Error<
5747   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
5748 def err_typecheck_decl_incomplete_type : Error<
5749   "variable has incomplete type %0">;
5750 def ext_typecheck_decl_incomplete_type : ExtWarn<
5751   "tentative definition of variable with internal linkage has incomplete non-array type %0">,
5752   InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
5753 def err_tentative_def_incomplete_type : Error<
5754   "tentative definition has type %0 that is never completed">;
5755 def warn_tentative_incomplete_array : Warning<
5756   "tentative array definition assumed to have one element">;
5757 def err_typecheck_incomplete_array_needs_initializer : Error<
5758   "definition of variable with array type needs an explicit size "
5759   "or an initializer">;
5760 def err_array_init_not_init_list : Error<
5761   "array initializer must be an initializer "
5762   "list%select{| or string literal| or wide string literal}0">;
5763 def err_array_init_narrow_string_into_wchar : Error<
5764   "initializing wide char array with non-wide string literal">;
5765 def err_array_init_wide_string_into_char : Error<
5766   "initializing char array with wide string literal">;
5767 def err_array_init_incompat_wide_string_into_wchar : Error<
5768   "initializing wide char array with incompatible wide string literal">;
5769 def err_array_init_plain_string_into_char8_t : Error<
5770   "initializing 'char8_t' array with plain string literal">;
5771 def note_array_init_plain_string_into_char8_t : Note<
5772   "add 'u8' prefix to form a 'char8_t' string literal">;
5773 def err_array_init_utf8_string_into_char : Error<
5774   "%select{|ISO C++20 does not permit }0initialization of char array with "
5775   "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
5776 def warn_cxx2a_compat_utf8_string : Warning<
5777   "type of UTF-8 string literal will change from array of const char to "
5778   "array of const char8_t in C++2a">, InGroup<CXX2aCompat>, DefaultIgnore;
5779 def note_cxx2a_compat_utf8_string_remove_u8 : Note<
5780   "remove 'u8' prefix to avoid a change of behavior; "
5781   "Clang encodes unprefixed narrow string literals as UTF-8">;
5782 def err_array_init_different_type : Error<
5783   "cannot initialize array %diff{of type $ with array of type $|"
5784   "with different type of array}0,1">;
5785 def err_array_init_non_constant_array : Error<
5786   "cannot initialize array %diff{of type $ with non-constant array of type $|"
5787   "with different type of array}0,1">;
5788 def ext_array_init_copy : Extension<
5789   "initialization of an array "
5790   "%diff{of type $ from a compound literal of type $|"
5791   "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
5792 // This is intentionally not disabled by -Wno-gnu.
5793 def ext_array_init_parens : ExtWarn<
5794   "parenthesized initialization of a member array is a GNU extension">,
5795   InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
5796 def warn_deprecated_string_literal_conversion : Warning<
5797   "conversion from string literal to %0 is deprecated">,
5798   InGroup<CXX11CompatDeprecatedWritableStr>;
5799 def ext_deprecated_string_literal_conversion : ExtWarn<
5800   "ISO C++11 does not allow conversion from string literal to %0">,
5801   InGroup<WritableStrings>, SFINAEFailure;
5802 def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
5803 def err_typecheck_sclass_fscope : Error<
5804   "illegal storage class on file-scoped variable">;
5805 def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
5806   InGroup<MissingDeclarations>;
5807 def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
5808   "of a type">, InGroup<MissingDeclarations>;
5809 def err_standalone_class_nested_name_specifier : Error<
5810   "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
5811   "have a nested name specifier">;
5812 def err_typecheck_sclass_func : Error<"illegal storage class on function">;
5813 def err_static_block_func : Error<
5814   "function declared in block scope cannot have 'static' storage class">;
5815 def err_typecheck_address_of : Error<"address of %select{bit-field"
5816   "|vector element|property expression|register variable}0 requested">;
5817 def ext_typecheck_addrof_void : Extension<
5818   "ISO C forbids taking the address of an expression of type 'void'">;
5819 def err_unqualified_pointer_member_function : Error<
5820   "must explicitly qualify name of member function when taking its address">;
5821 def err_invalid_form_pointer_member_function : Error<
5822   "cannot create a non-constant pointer to member function">;
5823 def err_address_of_function_with_pass_object_size_params: Error<
5824   "cannot take address of function %0 because parameter %1 has "
5825   "pass_object_size attribute">;
5826 def err_parens_pointer_member_function : Error<
5827   "cannot parenthesize the name of a method when forming a member pointer">;
5828 def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
5829   "extra '&' taking address of overloaded function">;
5830 def err_typecheck_invalid_lvalue_addrof : Error<
5831   "cannot take the address of an rvalue of type %0">;
5832 def ext_typecheck_addrof_temporary : ExtWarn<
5833   "taking the address of a temporary object of type %0">,
5834   InGroup<AddressOfTemporary>, DefaultError;
5835 def err_typecheck_addrof_temporary : Error<
5836   "taking the address of a temporary object of type %0">;
5837 def err_typecheck_addrof_dtor : Error<
5838   "taking the address of a destructor">;
5839 def err_typecheck_unary_expr : Error<
5840   "invalid argument type %0 to unary expression">;
5841 def err_typecheck_indirection_requires_pointer : Error<
5842   "indirection requires pointer operand (%0 invalid)">;
5843 def ext_typecheck_indirection_through_void_pointer : ExtWarn<
5844   "ISO C++ does not allow indirection on operand of type %0">,
5845   InGroup<DiagGroup<"void-ptr-dereference">>;
5846 def warn_indirection_through_null : Warning<
5847   "indirection of non-volatile null pointer will be deleted, not trap">,
5848   InGroup<NullDereference>;
5849 def warn_binding_null_to_reference : Warning<
5850   "binding dereferenced null pointer to reference has undefined behavior">,
5851   InGroup<NullDereference>;
5852 def note_indirection_through_null : Note<
5853   "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
5854 def warn_pointer_indirection_from_incompatible_type : Warning<
5855   "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
5856   "behavior">,
5857   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
5858 def warn_taking_address_of_packed_member : Warning<
5859   "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
5860   InGroup<DiagGroup<"address-of-packed-member">>;
5861
5862 def err_objc_object_assignment : Error<
5863   "cannot assign to class object (%0 invalid)">;
5864 def err_typecheck_invalid_operands : Error<
5865   "invalid operands to binary expression (%0 and %1)">;
5866 def note_typecheck_invalid_operands_converted : Note<
5867   "%select{first|second}0 operand was implicitly converted to type %1">;
5868 def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
5869   "logical expression with vector %select{type %1 and non-vector type %2|types"
5870   " %1 and %2}0 is only supported in C++">;
5871 def err_typecheck_sub_ptr_compatible : Error<
5872   "%diff{$ and $ are not pointers to compatible types|"
5873   "pointers to incompatible types}0,1">;
5874 def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
5875   "ordered comparison between pointer and integer (%0 and %1)">;
5876 def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
5877   "ordered comparison between pointer and zero (%0 and %1) is an extension">;
5878 def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
5879   "ordered comparison between pointer and zero (%0 and %1)">;
5880 def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
5881   "ordered comparison of function pointers (%0 and %1)">,
5882   InGroup<DiagGroup<"ordered-compare-function-pointers">>;
5883 def ext_typecheck_comparison_of_fptr_to_void : Extension<
5884   "equality comparison between function pointer and void pointer (%0 and %1)">;
5885 def err_typecheck_comparison_of_fptr_to_void : Error<
5886   "equality comparison between function pointer and void pointer (%0 and %1)">;
5887 def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
5888   "comparison between pointer and integer (%0 and %1)">,
5889   InGroup<DiagGroup<"pointer-integer-compare">>;
5890 def err_typecheck_comparison_of_pointer_integer : Error<
5891   "comparison between pointer and integer (%0 and %1)">;
5892 def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
5893   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
5894   InGroup<CompareDistinctPointerType>;
5895 def ext_typecheck_cond_incompatible_operands : ExtWarn<
5896   "incompatible operand types (%0 and %1)">;
5897 def err_cond_voidptr_arc : Error <
5898   "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
5899   "in ARC mode">;
5900 def err_typecheck_comparison_of_distinct_pointers : Error<
5901   "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
5902 def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
5903   "%select{comparison between %diff{ ($ and $)|}0,1"
5904   "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
5905   "|conditional operator with the second and third operands of type "
5906   "%diff{ ($ and $)|}0,1}2"
5907   " which are pointers to non-overlapping address spaces">;
5908
5909 def err_typecheck_assign_const : Error<
5910   "%select{"
5911   "cannot assign to return value because function %1 returns a const value|"
5912   "cannot assign to variable %1 with const-qualified type %2|"
5913   "cannot assign to %select{non-|}1static data member %2 "
5914   "with const-qualified type %3|"
5915   "cannot assign to non-static data member within const member function %1|"
5916   "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
5917   "with %select{|nested }3const-qualified data member %4|"
5918   "read-only variable is not assignable}0">;
5919
5920 def note_typecheck_assign_const : Note<
5921   "%select{"
5922   "function %1 which returns const-qualified type %2 declared here|"
5923   "variable %1 declared const here|"
5924   "%select{non-|}1static data member %2 declared const here|"
5925   "member function %q1 is declared const here|"
5926   "%select{|nested }1data member %2 declared const here}0">;
5927
5928 def warn_unsigned_always_true_comparison : Warning<
5929   "result of comparison of %select{%3|unsigned expression}0 %2 "
5930   "%select{unsigned expression|%3}0 is always %4">,
5931   InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
5932 def warn_unsigned_enum_always_true_comparison : Warning<
5933   "result of comparison of %select{%3|unsigned enum expression}0 %2 "
5934   "%select{unsigned enum expression|%3}0 is always %4">,
5935   InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
5936 def warn_tautological_constant_compare : Warning<
5937   "result of comparison %select{%3|%1}0 %2 "
5938   "%select{%1|%3}0 is always %4">,
5939   InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
5940
5941 def warn_mixed_sign_comparison : Warning<
5942   "comparison of integers of different signs: %0 and %1">,
5943   InGroup<SignCompare>, DefaultIgnore;
5944 def warn_out_of_range_compare : Warning<
5945   "result of comparison of %select{constant %0|true|false}1 with "
5946   "%select{expression of type %2|boolean expression}3 is always %4">,
5947   InGroup<TautologicalOutOfRangeCompare>;
5948 def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
5949   InGroup<TautologicalConstantCompare>;
5950 def warn_comparison_of_mixed_enum_types : Warning<
5951   "comparison of two values with different enumeration types"
5952   "%diff{ ($ and $)|}0,1">,
5953   InGroup<EnumCompare>;
5954 def warn_comparison_of_mixed_enum_types_switch : Warning<
5955   "comparison of two values with different enumeration types in switch statement"
5956   "%diff{ ($ and $)|}0,1">,
5957   InGroup<EnumCompareSwitch>;
5958 def warn_null_in_arithmetic_operation : Warning<
5959   "use of NULL in arithmetic operation">,
5960   InGroup<NullArithmetic>;
5961 def warn_null_in_comparison_operation : Warning<
5962   "comparison between NULL and non-pointer "
5963   "%select{(%1 and NULL)|(NULL and %1)}0">,
5964   InGroup<NullArithmetic>;
5965 def err_shift_rhs_only_vector : Error<
5966   "requested shift is a vector of type %0 but the first operand is not a "
5967   "vector (%1)">;
5968
5969 def warn_logical_not_on_lhs_of_check : Warning<
5970   "logical not is only applied to the left hand side of this "
5971   "%select{comparison|bitwise operator}0">,
5972   InGroup<LogicalNotParentheses>;
5973 def note_logical_not_fix : Note<
5974   "add parentheses after the '!' to evaluate the "
5975   "%select{comparison|bitwise operator}0 first">;
5976 def note_logical_not_silence_with_parens : Note<
5977   "add parentheses around left hand side expression to silence this warning">;
5978
5979 def err_invalid_this_use : Error<
5980   "invalid use of 'this' outside of a non-static member function">;
5981 def err_this_static_member_func : Error<
5982   "'this' cannot be%select{| implicitly}0 used in a static member function "
5983   "declaration">;
5984 def err_invalid_member_use_in_static_method : Error<
5985   "invalid use of member %0 in static member function">;
5986 def err_invalid_qualified_function_type : Error<
5987   "%select{non-member function|static member function|deduction guide}0 "
5988   "%select{of type %2 |}1cannot have '%3' qualifier">;
5989 def err_compound_qualified_function_type : Error<
5990   "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
5991   "cannot have '%3' qualifier">;
5992
5993 def err_ref_qualifier_overload : Error<
5994   "cannot overload a member function %select{without a ref-qualifier|with "
5995   "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
5996   "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
5997
5998 def err_invalid_non_static_member_use : Error<
5999   "invalid use of non-static data member %0">;
6000 def err_nested_non_static_member_use : Error<
6001   "%select{call to non-static member function|use of non-static data member}0 "
6002   "%2 of %1 from nested type %3">;
6003 def warn_cxx98_compat_non_static_member_use : Warning<
6004   "use of non-static data member %0 in an unevaluated context is "
6005   "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6006 def err_invalid_incomplete_type_use : Error<
6007   "invalid use of incomplete type %0">;
6008 def err_builtin_func_cast_more_than_one_arg : Error<
6009   "function-style cast to a builtin type can only take one argument">;
6010 def err_value_init_for_array_type : Error<
6011   "array types cannot be value-initialized">;
6012 def err_init_for_function_type : Error<
6013   "cannot create object of function type %0">;
6014 def warn_format_nonliteral_noargs : Warning<
6015   "format string is not a string literal (potentially insecure)">,
6016   InGroup<FormatSecurity>;
6017 def warn_format_nonliteral : Warning<
6018   "format string is not a string literal">,
6019   InGroup<FormatNonLiteral>, DefaultIgnore;
6020
6021 def err_unexpected_interface : Error<
6022   "unexpected interface name %0: expected expression">;
6023 def err_ref_non_value : Error<"%0 does not refer to a value">;
6024 def err_ref_vm_type : Error<
6025   "cannot refer to declaration with a variably modified type inside block">;
6026 def err_ref_flexarray_type : Error<
6027   "cannot refer to declaration of structure variable with flexible array member "
6028   "inside block">;
6029 def err_ref_array_type : Error<
6030   "cannot refer to declaration with an array type inside block">;
6031 def err_property_not_found : Error<
6032   "property %0 not found on object of type %1">;
6033 def err_invalid_property_name : Error<
6034   "%0 is not a valid property name (accessing an object of type %1)">;
6035 def err_getter_not_found : Error<
6036   "no getter method for read from property">;
6037 def err_objc_subscript_method_not_found : Error<
6038   "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6039   "found on object of type %0">;
6040 def err_objc_subscript_index_type : Error<
6041   "method index parameter type %0 is not integral type">;
6042 def err_objc_subscript_key_type : Error<
6043   "method key parameter type %0 is not object type">;
6044 def err_objc_subscript_dic_object_type : Error<
6045   "method object parameter type %0 is not object type">;
6046 def err_objc_subscript_object_type : Error<
6047   "cannot assign to this %select{dictionary|array}1 because assigning method's "
6048   "2nd parameter of type %0 is not an Objective-C pointer type">;
6049 def err_objc_subscript_base_type : Error<
6050   "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6051 def err_objc_multiple_subscript_type_conversion : Error<
6052   "indexing expression is invalid because subscript type %0 has "
6053   "multiple type conversion functions">;
6054 def err_objc_subscript_type_conversion : Error<
6055   "indexing expression is invalid because subscript type %0 is not an integral"
6056   " or Objective-C pointer type">;
6057 def err_objc_subscript_pointer : Error<
6058   "indexing expression is invalid because subscript type %0 is not an"
6059   " Objective-C pointer">;
6060 def err_objc_indexing_method_result_type : Error<
6061   "method for accessing %select{dictionary|array}1 element must have Objective-C"
6062   " object return type instead of %0">;
6063 def err_objc_index_incomplete_class_type : Error<
6064   "Objective-C index expression has incomplete class type %0">;
6065 def err_illegal_container_subscripting_op : Error<
6066   "illegal operation on Objective-C container subscripting">;
6067 def err_property_not_found_forward_class : Error<
6068   "property %0 cannot be found in forward class object %1">;
6069 def err_property_not_as_forward_class : Error<
6070   "property %0 refers to an incomplete Objective-C class %1 "
6071   "(with no @interface available)">;
6072 def note_forward_class : Note<
6073   "forward declaration of class here">;
6074 def err_duplicate_property : Error<
6075   "property has a previous declaration">;
6076 def ext_gnu_void_ptr : Extension<
6077   "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
6078   InGroup<PointerArith>;
6079 def ext_gnu_ptr_func_arith : Extension<
6080   "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
6081   "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
6082   InGroup<PointerArith>;
6083 def err_readonly_message_assignment : Error<
6084   "assigning to 'readonly' return result of an Objective-C message not allowed">;
6085 def ext_integer_increment_complex : Extension<
6086   "ISO C does not support '++'/'--' on complex integer type %0">;
6087 def ext_integer_complement_complex : Extension<
6088   "ISO C does not support '~' for complex conjugation of %0">;
6089 def err_nosetter_property_assignment : Error<
6090   "%select{assignment to readonly property|"
6091   "no setter method %1 for assignment to property}0">;
6092 def err_nosetter_property_incdec : Error<
6093   "%select{%select{increment|decrement}1 of readonly property|"
6094   "no setter method %2 for %select{increment|decrement}1 of property}0">;
6095 def err_nogetter_property_compound_assignment : Error<
6096   "a getter method is needed to perform a compound assignment on a property">;
6097 def err_nogetter_property_incdec : Error<
6098   "no getter method %1 for %select{increment|decrement}0 of property">;
6099 def err_no_subobject_property_setting : Error<
6100   "expression is not assignable">;
6101 def err_qualified_objc_access : Error<
6102   "%select{property|instance variable}0 access cannot be qualified with '%1'">;
6103
6104 def ext_freestanding_complex : Extension<
6105   "complex numbers are an extension in a freestanding C99 implementation">;
6106
6107 // FIXME: Remove when we support imaginary.
6108 def err_imaginary_not_supported : Error<"imaginary types are not supported">;
6109
6110 // Obj-c expressions
6111 def warn_root_inst_method_not_found : Warning<
6112   "instance method %0 is being used on 'Class' which is not in the root class">,
6113   InGroup<MethodAccess>;
6114 def warn_class_method_not_found : Warning<
6115   "class method %objcclass0 not found (return type defaults to 'id')">,
6116   InGroup<MethodAccess>;
6117 def warn_instance_method_on_class_found : Warning<
6118   "instance method %0 found instead of class method %1">,
6119   InGroup<MethodAccess>;
6120 def warn_inst_method_not_found : Warning<
6121   "instance method %objcinstance0 not found (return type defaults to 'id')">,
6122   InGroup<MethodAccess>;
6123 def warn_instance_method_not_found_with_typo : Warning<
6124   "instance method %objcinstance0 not found (return type defaults to 'id')"
6125   "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
6126 def warn_class_method_not_found_with_typo : Warning<
6127   "class method %objcclass0 not found (return type defaults to 'id')"
6128   "; did you mean %objcclass2?">, InGroup<MethodAccess>;
6129 def err_method_not_found_with_typo : Error<
6130   "%select{instance|class}1 method %0 not found "
6131   "; did you mean %2?">;
6132 def err_no_super_class_message : Error<
6133   "no @interface declaration found in class messaging of %0">;
6134 def err_root_class_cannot_use_super : Error<
6135   "%0 cannot use 'super' because it is a root class">;
6136 def err_invalid_receiver_to_message_super : Error<
6137   "'super' is only valid in a method body">;
6138 def err_invalid_receiver_class_message : Error<
6139   "receiver type %0 is not an Objective-C class">;
6140 def err_missing_open_square_message_send : Error<
6141   "missing '[' at start of message send expression">;
6142 def warn_bad_receiver_type : Warning<
6143   "receiver type %0 is not 'id' or interface pointer, consider "
6144   "casting it to 'id'">,InGroup<ObjCReceiver>;
6145 def err_bad_receiver_type : Error<"bad receiver type %0">;
6146 def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
6147 def err_unknown_receiver_suggest : Error<
6148   "unknown receiver %0; did you mean %1?">;
6149 def err_objc_throw_expects_object : Error<
6150   "@throw requires an Objective-C object type (%0 invalid)">;
6151 def err_objc_synchronized_expects_object : Error<
6152   "@synchronized requires an Objective-C object type (%0 invalid)">;
6153 def err_rethrow_used_outside_catch : Error<
6154   "@throw (rethrow) used outside of a @catch block">;
6155 def err_attribute_multiple_objc_gc : Error<
6156   "multiple garbage collection attributes specified for type">;
6157 def err_catch_param_not_objc_type : Error<
6158   "@catch parameter is not a pointer to an interface type">;
6159 def err_illegal_qualifiers_on_catch_parm : Error<
6160   "illegal qualifiers on @catch parameter">;
6161 def err_storage_spec_on_catch_parm : Error<
6162   "@catch parameter cannot have storage specifier '%0'">;
6163 def warn_register_objc_catch_parm : Warning<
6164   "'register' storage specifier on @catch parameter will be ignored">;
6165 def err_qualified_objc_catch_parm : Error<
6166   "@catch parameter declarator cannot be qualified">;
6167 def warn_objc_pointer_cxx_catch_fragile : Warning<
6168   "cannot catch an exception thrown with @throw in C++ in the non-unified "
6169   "exception model">, InGroup<ObjCNonUnifiedException>;
6170 def err_objc_object_catch : Error<
6171   "cannot catch an Objective-C object by value">;
6172 def err_incomplete_type_objc_at_encode : Error<
6173   "'@encode' of incomplete type %0">;
6174 def warn_objc_circular_container : Warning<
6175   "adding %0 to %1 might cause circular dependency in container">,
6176   InGroup<DiagGroup<"objc-circular-container">>;
6177 def note_objc_circular_container_declared_here : Note<"%0 declared here">;
6178 def warn_objc_unsafe_perform_selector : Warning<
6179   "%0 is incompatible with selectors that return a "
6180   "%select{struct|union|vector}1 type">,
6181   InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
6182 def note_objc_unsafe_perform_selector_method_declared_here :  Note<
6183   "method %0 that returns %1 declared here">;
6184
6185 def warn_setter_getter_impl_required : Warning<
6186   "property %0 requires method %1 to be defined - "
6187   "use @synthesize, @dynamic or provide a method implementation "
6188   "in this class implementation">,
6189   InGroup<ObjCPropertyImpl>;
6190 def warn_setter_getter_impl_required_in_category : Warning<
6191   "property %0 requires method %1 to be defined - "
6192   "use @dynamic or provide a method implementation in this category">,
6193   InGroup<ObjCPropertyImpl>;
6194 def note_parameter_named_here : Note<
6195   "passing argument to parameter %0 here">;
6196 def note_parameter_here : Note<
6197   "passing argument to parameter here">;
6198 def note_method_return_type_change : Note<
6199   "compiler has implicitly changed method %0 return type">;
6200
6201 def warn_impl_required_for_class_property : Warning<
6202   "class property %0 requires method %1 to be defined - "
6203   "use @dynamic or provide a method implementation "
6204   "in this class implementation">,
6205   InGroup<ObjCPropertyImpl>;
6206 def warn_impl_required_in_category_for_class_property : Warning<
6207   "class property %0 requires method %1 to be defined - "
6208   "use @dynamic or provide a method implementation in this category">,
6209   InGroup<ObjCPropertyImpl>;
6210
6211 // C++ casts
6212 // These messages adhere to the TryCast pattern: %0 is an int specifying the
6213 // cast type, %1 is the source type, %2 is the destination type.
6214 def err_bad_reinterpret_cast_overload : Error<
6215   "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
6216
6217 def warn_reinterpret_different_from_static : Warning<
6218   "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
6219   "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
6220   "'static_cast'">, InGroup<ReinterpretBaseClass>;
6221 def note_reinterpret_updowncast_use_static: Note<
6222   "use 'static_cast' to adjust the pointer correctly while "
6223   "%select{upcasting|downcasting}0">;
6224
6225 def err_bad_static_cast_overload : Error<
6226   "address of overloaded function %0 cannot be static_cast to type %1">;
6227
6228 def err_bad_cstyle_cast_overload : Error<
6229   "address of overloaded function %0 cannot be cast to type %1">;
6230
6231
6232 def err_bad_cxx_cast_generic : Error<
6233   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6234   "functional-style cast}0 from %1 to %2 is not allowed">;
6235 def err_bad_cxx_cast_unrelated_class : Error<
6236   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6237   "functional-style cast}0 from %1 to %2, which are not related by "
6238   "inheritance, is not allowed">;
6239 def note_type_incomplete : Note<"%0 is incomplete">;
6240 def err_bad_cxx_cast_rvalue : Error<
6241   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6242   "functional-style cast}0 from rvalue to reference type %2">;
6243 def err_bad_cxx_cast_bitfield : Error<
6244   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6245   "functional-style cast}0 from bit-field lvalue to reference type %2">;
6246 def err_bad_cxx_cast_qualifiers_away : Error<
6247   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6248   "functional-style cast}0 from %1 to %2 casts away qualifiers">;
6249 def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
6250   "ISO C++ does not allow "
6251   "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6252   "functional-style cast}0 from %1 to %2 because it casts away qualifiers, "
6253   "even though the source and destination types are unrelated">,
6254   SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
6255 def err_bad_const_cast_dest : Error<
6256   "%select{const_cast||||C-style cast|functional-style cast}0 to %2, "
6257   "which is not a reference, pointer-to-object, or pointer-to-data-member">;
6258 def ext_cast_fn_obj : Extension<
6259   "cast between pointer-to-function and pointer-to-object is an extension">;
6260 def ext_ms_cast_fn_obj : ExtWarn<
6261   "static_cast between pointer-to-function and pointer-to-object is a "
6262   "Microsoft extension">, InGroup<MicrosoftCast>;
6263 def warn_cxx98_compat_cast_fn_obj : Warning<
6264   "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
6265   InGroup<CXX98CompatPedantic>, DefaultIgnore;
6266 def err_bad_reinterpret_cast_small_int : Error<
6267   "cast from pointer to smaller type %2 loses information">;
6268 def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
6269   "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6270   "to scalar %2 of different size">;
6271 def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
6272   "%select{||reinterpret_cast||C-style cast|}0 from scalar %1 "
6273   "to vector %2 of different size">;
6274 def err_bad_cxx_cast_vector_to_vector_different_size : Error<
6275   "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6276   "to vector %2 of different size">;
6277 def err_bad_lvalue_to_rvalue_cast : Error<
6278   "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
6279   "not compatible">;
6280 def err_bad_rvalue_to_rvalue_cast : Error<
6281   "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
6282   "not compatible">;
6283 def err_bad_static_cast_pointer_nonpointer : Error<
6284   "cannot cast from type %1 to pointer type %2">;
6285 def err_bad_static_cast_member_pointer_nonmp : Error<
6286   "cannot cast from type %1 to member pointer type %2">;
6287 def err_bad_cxx_cast_member_pointer_size : Error<
6288   "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer "
6289   "type %1 to member pointer type %2 of different size">;
6290 def err_bad_reinterpret_cast_reference : Error<
6291   "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
6292 def warn_undefined_reinterpret_cast : Warning<
6293   "reinterpret_cast from %0 to %1 has undefined behavior">,
6294   InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6295
6296 // These messages don't adhere to the pattern.
6297 // FIXME: Display the path somehow better.
6298 def err_ambiguous_base_to_derived_cast : Error<
6299   "ambiguous cast from base %0 to derived %1:%2">;
6300 def err_static_downcast_via_virtual : Error<
6301   "cannot cast %0 to %1 via virtual base %2">;
6302 def err_downcast_from_inaccessible_base : Error<
6303   "cannot cast %select{private|protected}2 base class %1 to %0">;
6304 def err_upcast_to_inaccessible_base : Error<
6305   "cannot cast %0 to its %select{private|protected}2 base class %1">;
6306 def err_bad_dynamic_cast_not_ref_or_ptr : Error<
6307   "%0 is not a reference or pointer">;
6308 def err_bad_dynamic_cast_not_class : Error<"%0 is not a class">;
6309 def err_bad_dynamic_cast_incomplete : Error<"%0 is an incomplete type">;
6310 def err_bad_dynamic_cast_not_ptr : Error<"%0 is not a pointer">;
6311 def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
6312
6313 // Other C++ expressions
6314 def err_need_header_before_typeid : Error<
6315   "you need to include <typeinfo> before using the 'typeid' operator">;
6316 def err_need_header_before_ms_uuidof : Error<
6317   "you need to include <guiddef.h> before using the '__uuidof' operator">;
6318 def err_ms___leave_not_in___try : Error<
6319   "'__leave' statement not in __try block">;
6320 def err_uuidof_without_guid : Error<
6321   "cannot call operator __uuidof on a type with no GUID">;
6322 def err_uuidof_with_multiple_guids : Error<
6323   "cannot call operator __uuidof on a type with multiple GUIDs">;
6324 def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
6325 def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
6326 def err_static_illegal_in_new : Error<
6327   "the 'static' modifier for the array size is not legal in new expressions">;
6328 def err_array_new_needs_size : Error<
6329   "array size must be specified in new expressions">;
6330 def err_bad_new_type : Error<
6331   "cannot allocate %select{function|reference}1 type %0 with new">;
6332 def err_new_incomplete_type : Error<
6333   "allocation of incomplete type %0">;
6334 def err_new_array_nonconst : Error<
6335   "only the first dimension of an allocated array may have dynamic size">;
6336 def err_new_array_init_args : Error<
6337   "array 'new' cannot have initialization arguments">;
6338 def ext_new_paren_array_nonconst : ExtWarn<
6339   "when type is in parentheses, array cannot have dynamic size">;
6340 def err_placement_new_non_placement_delete : Error<
6341   "'new' expression with placement arguments refers to non-placement "
6342   "'operator delete'">;
6343 def err_array_size_not_integral : Error<
6344   "array size expression must have integral or %select{|unscoped }0"
6345   "enumeration type, not %1">;
6346 def err_array_size_incomplete_type : Error<
6347   "array size expression has incomplete class type %0">;
6348 def err_array_size_explicit_conversion : Error<
6349   "array size expression of type %0 requires explicit conversion to type %1">;
6350 def note_array_size_conversion : Note<
6351   "conversion to %select{integral|enumeration}0 type %1 declared here">;
6352 def err_array_size_ambiguous_conversion : Error<
6353   "ambiguous conversion of array size expression of type %0 to an integral or "
6354   "enumeration type">;
6355 def ext_array_size_conversion : Extension<
6356   "implicit conversion from array size expression of type %0 to "
6357   "%select{integral|enumeration}1 type %2 is a C++11 extension">,
6358   InGroup<CXX11>;
6359 def warn_cxx98_compat_array_size_conversion : Warning<
6360   "implicit conversion from array size expression of type %0 to "
6361   "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
6362   InGroup<CXX98CompatPedantic>, DefaultIgnore;
6363 def err_address_space_qualified_new : Error<
6364   "'new' cannot allocate objects of type %0 in address space '%1'">;
6365 def err_address_space_qualified_delete : Error<
6366   "'delete' cannot delete objects of type %0 in address space '%1'">;
6367
6368 def err_default_init_const : Error<
6369   "default initialization of an object of const type %0"
6370   "%select{| without a user-provided default constructor}1">;
6371 def ext_default_init_const : ExtWarn<
6372   "default initialization of an object of const type %0"
6373   "%select{| without a user-provided default constructor}1 "
6374   "is a Microsoft extension">,
6375   InGroup<MicrosoftConstInit>;
6376 def err_delete_operand : Error<"cannot delete expression of type %0">;
6377 def ext_delete_void_ptr_operand : ExtWarn<
6378   "cannot delete expression with pointer-to-'void' type %0">,
6379   InGroup<DeleteIncomplete>;
6380 def err_ambiguous_delete_operand : Error<
6381   "ambiguous conversion of delete expression of type %0 to a pointer">;
6382 def warn_delete_incomplete : Warning<
6383   "deleting pointer to incomplete type %0 may cause undefined behavior">,
6384   InGroup<DeleteIncomplete>;
6385 def err_delete_incomplete_class_type : Error<
6386   "deleting incomplete class type %0; no conversions to pointer type">;
6387 def err_delete_explicit_conversion : Error<
6388   "converting delete expression from type %0 to type %1 invokes an explicit "
6389   "conversion function">;
6390 def note_delete_conversion : Note<"conversion to pointer type %0">;
6391 def warn_delete_array_type : Warning<
6392   "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
6393 def warn_mismatched_delete_new : Warning<
6394   "'delete%select{|[]}0' applied to a pointer that was allocated with "
6395   "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
6396   InGroup<DiagGroup<"mismatched-new-delete">>;
6397 def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
6398 def err_no_suitable_delete_member_function_found : Error<
6399   "no suitable member %0 in %1">;
6400 def err_ambiguous_suitable_delete_member_function_found : Error<
6401   "multiple suitable %0 functions in %1">;
6402 def warn_ambiguous_suitable_delete_function_found : Warning<
6403   "multiple suitable %0 functions for %1; no 'operator delete' function "
6404   "will be invoked if initialization throws an exception">,
6405   InGroup<DiagGroup<"ambiguous-delete">>;
6406 def note_member_declared_here : Note<
6407   "member %0 declared here">;
6408 def note_member_first_declared_here : Note<
6409   "member %0 first declared here">;
6410 def err_decrement_bool : Error<"cannot decrement expression of type bool">;
6411 def warn_increment_bool : Warning<
6412   "incrementing expression of type bool is deprecated and "
6413   "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
6414 def ext_increment_bool : ExtWarn<
6415   "ISO C++17 does not allow incrementing expression of type bool">,
6416   DefaultError, InGroup<IncrementBool>;
6417 def err_increment_decrement_enum : Error<
6418   "cannot %select{decrement|increment}0 expression of enum type %1">;
6419 def err_catch_incomplete_ptr : Error<
6420   "cannot catch pointer to incomplete type %0">;
6421 def err_catch_incomplete_ref : Error<
6422   "cannot catch reference to incomplete type %0">;
6423 def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
6424 def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
6425 def err_catch_variably_modified : Error<
6426   "cannot catch variably modified type %0">;
6427 def err_qualified_catch_declarator : Error<
6428   "exception declarator cannot be qualified">;
6429 def err_early_catch_all : Error<"catch-all handler must come last">;
6430 def err_bad_memptr_rhs : Error<
6431   "right hand operand to %0 has non-pointer-to-member type %1">;
6432 def err_bad_memptr_lhs : Error<
6433   "left hand operand to %0 must be a %select{|pointer to }1class "
6434   "compatible with the right hand operand, but is %2">;
6435 def err_memptr_incomplete : Error<
6436   "member pointer has incomplete base type %0">;
6437 def warn_exception_caught_by_earlier_handler : Warning<
6438   "exception of type %0 will be caught by earlier handler">,
6439   InGroup<Exceptions>;
6440 def note_previous_exception_handler : Note<"for type %0">;
6441 def err_exceptions_disabled : Error<
6442   "cannot use '%0' with exceptions disabled">;
6443 def err_objc_exceptions_disabled : Error<
6444   "cannot use '%0' with Objective-C exceptions disabled">;
6445 def warn_throw_in_noexcept_func : Warning<
6446   "%0 has a non-throwing exception specification but can still throw">,
6447   InGroup<Exceptions>;
6448 def note_throw_in_dtor : Note<
6449   "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
6450   "non-throwing}1 exception specification">;
6451 def note_throw_in_function : Note<"function declared non-throwing here">;
6452 def err_seh_try_outside_functions : Error<
6453   "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
6454 def err_mixing_cxx_try_seh_try : Error<
6455   "cannot use C++ 'try' in the same function as SEH '__try'">;
6456 def err_seh_try_unsupported : Error<
6457   "SEH '__try' is not supported on this target">;
6458 def note_conflicting_try_here : Note<
6459   "conflicting %0 here">;
6460 def warn_jump_out_of_seh_finally : Warning<
6461   "jump out of __finally block has undefined behavior">,
6462   InGroup<DiagGroup<"jump-seh-finally">>;
6463 def warn_non_virtual_dtor : Warning<
6464   "%0 has virtual functions but non-virtual destructor">,
6465   InGroup<NonVirtualDtor>, DefaultIgnore;
6466 def warn_delete_non_virtual_dtor : Warning<
6467   "%select{delete|destructor}0 called on non-final %1 that has "
6468   "virtual functions but non-virtual destructor">,
6469   InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
6470 def note_delete_non_virtual : Note<
6471   "qualify call to silence this warning">;
6472 def warn_delete_abstract_non_virtual_dtor : Warning<
6473   "%select{delete|destructor}0 called on %1 that is abstract but has "
6474   "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
6475 def warn_overloaded_virtual : Warning<
6476   "%q0 hides overloaded virtual %select{function|functions}1">,
6477   InGroup<OverloadedVirtual>, DefaultIgnore;
6478 def note_hidden_overloaded_virtual_declared_here : Note<
6479   "hidden overloaded virtual function %q0 declared here"
6480   "%select{|: different classes%diff{ ($ vs $)|}2,3"
6481   "|: different number of parameters (%2 vs %3)"
6482   "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
6483   "|: different return type%diff{ ($ vs $)|}2,3"
6484   "|: different qualifiers (%2 vs %3)"
6485   "|: different exception specifications}1">;
6486 def warn_using_directive_in_header : Warning<
6487   "using namespace directive in global context in header">,
6488   InGroup<HeaderHygiene>, DefaultIgnore;
6489 def warn_overaligned_type : Warning<
6490   "type %0 requires %1 bytes of alignment and the default allocator only "
6491   "guarantees %2 bytes">,
6492   InGroup<OveralignedType>, DefaultIgnore;
6493 def err_aligned_allocation_unavailable : Error<
6494   "aligned %select{allocation|deallocation}0 function of type '%1' is only "
6495   "available on %2 %3 or newer">;
6496 def note_silence_aligned_allocation_unavailable : Note<
6497   "if you supply your own aligned allocation functions, use "
6498   "-faligned-allocation to silence this diagnostic">;
6499
6500 def err_conditional_void_nonvoid : Error<
6501   "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
6502   "is of type %0">;
6503 def err_conditional_ambiguous : Error<
6504   "conditional expression is ambiguous; "
6505   "%diff{$ can be converted to $ and vice versa|"
6506   "types can be convert to each other}0,1">;
6507 def err_conditional_ambiguous_ovl : Error<
6508   "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
6509   "can be converted to several common types">;
6510 def err_conditional_vector_size : Error<
6511   "vector condition type %0 and result type %1 do not have the same number "
6512   "of elements">;
6513 def err_conditional_vector_element_size : Error<
6514   "vector condition type %0 and result type %1 do not have elements of the "
6515   "same size">;
6516
6517 def err_throw_incomplete : Error<
6518   "cannot throw object of incomplete type %0">;
6519 def err_throw_incomplete_ptr : Error<
6520   "cannot throw pointer to object of incomplete type %0">;
6521 def err_return_in_constructor_handler : Error<
6522   "return in the catch of a function try block of a constructor is illegal">;
6523 def warn_cdtor_function_try_handler_mem_expr : Warning<
6524   "cannot refer to a non-static member from the handler of a "
6525   "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
6526
6527 let CategoryName = "Lambda Issue" in {
6528   def err_capture_more_than_once : Error<
6529     "%0 can appear only once in a capture list">;
6530   def err_reference_capture_with_reference_default : Error<
6531     "'&' cannot precede a capture when the capture default is '&'">;
6532   def err_copy_capture_with_copy_default : Error<
6533     "'&' must precede a capture when the capture default is '='">;
6534   def err_capture_does_not_name_variable : Error<
6535     "%0 in capture list does not name a variable">;
6536   def err_capture_non_automatic_variable : Error<
6537     "%0 cannot be captured because it does not have automatic storage "
6538     "duration">;
6539   def err_this_capture : Error<
6540     "'this' cannot be %select{implicitly |}0captured in this context">;
6541   def err_lambda_capture_anonymous_var : Error<
6542     "unnamed variable cannot be implicitly captured in a lambda expression">;
6543   def err_lambda_capture_flexarray_type : Error<
6544     "variable %0 with flexible array member cannot be captured in "
6545     "a lambda expression">;
6546   def err_lambda_impcap : Error<
6547     "variable %0 cannot be implicitly captured in a lambda with no "
6548     "capture-default specified">;
6549   def note_lambda_decl : Note<"lambda expression begins here">;
6550   def err_lambda_unevaluated_operand : Error<
6551     "lambda expression in an unevaluated operand">;
6552   def err_lambda_in_constant_expression : Error<
6553     "a lambda expression may not appear inside of a constant expression">;
6554   def err_lambda_in_invalid_context : Error<
6555     "a lambda expression cannot appear in this context">;
6556   def err_lambda_return_init_list : Error<
6557     "cannot deduce lambda return type from initializer list">;
6558   def err_lambda_capture_default_arg : Error<
6559     "lambda expression in default argument cannot capture any entity">;
6560   def err_lambda_incomplete_result : Error<
6561     "incomplete result type %0 in lambda expression">;
6562   def err_noreturn_lambda_has_return_expr : Error<
6563     "lambda declared 'noreturn' should not return">;
6564   def warn_maybe_falloff_nonvoid_lambda : Warning<
6565     "control may reach end of non-void lambda">,
6566     InGroup<ReturnType>;
6567   def warn_falloff_nonvoid_lambda : Warning<
6568     "control reaches end of non-void lambda">,
6569     InGroup<ReturnType>;
6570   def err_access_lambda_capture : Error<
6571     // The ERRORs represent other special members that aren't constructors, in
6572     // hopes that someone will bother noticing and reporting if they appear
6573     "capture of variable '%0' as type %1 calls %select{private|protected}3 "
6574     "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
6575     AccessControl;
6576   def note_lambda_to_block_conv : Note<
6577     "implicit capture of lambda object due to conversion to block pointer "
6578     "here">;
6579   def note_var_explicitly_captured_here : Note<"variable %0 is"
6580     "%select{| explicitly}1 captured here">;
6581
6582   // C++14 lambda init-captures.
6583   def warn_cxx11_compat_init_capture : Warning<
6584     "initialized lambda captures are incompatible with C++ standards "
6585     "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
6586   def ext_init_capture : ExtWarn<
6587     "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
6588   def err_init_capture_no_expression : Error<
6589     "initializer missing for lambda capture %0">;
6590   def err_init_capture_multiple_expressions : Error<
6591     "initializer for lambda capture %0 contains multiple expressions">;
6592   def err_init_capture_paren_braces : Error<
6593     "cannot deduce type for lambda capture %1 from "
6594     "%select{parenthesized|nested}0 initializer list">;
6595   def err_init_capture_deduction_failure : Error<
6596     "cannot deduce type for lambda capture %0 from initializer of type %2">;
6597   def err_init_capture_deduction_failure_from_init_list : Error<
6598     "cannot deduce type for lambda capture %0 from initializer list">;
6599
6600   // C++14 generic lambdas.
6601   def warn_cxx11_compat_generic_lambda : Warning<
6602     "generic lambdas are incompatible with C++11">,
6603     InGroup<CXXPre14Compat>, DefaultIgnore;
6604
6605   // C++17 '*this' captures.
6606   def warn_cxx14_compat_star_this_lambda_capture : Warning<
6607     "by value capture of '*this' is incompatible with C++ standards before C++17">,
6608      InGroup<CXXPre17Compat>, DefaultIgnore;
6609   def ext_star_this_lambda_capture_cxx17 : ExtWarn<
6610     "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
6611
6612   // C++17 parameter shadows capture
6613   def err_parameter_shadow_capture : Error<
6614     "a lambda parameter cannot shadow an explicitly captured entity">;
6615
6616   // C++2a [=, this] captures.
6617   def warn_cxx17_compat_equals_this_lambda_capture : Warning<
6618     "explicit capture of 'this' with a capture default of '=' is incompatible "
6619     "with C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
6620   def ext_equals_this_lambda_capture_cxx2a : ExtWarn<
6621     "explicit capture of 'this' with a capture default of '=' "
6622     "is a C++2a extension">, InGroup<CXX2a>;
6623   def warn_deprecated_this_capture : Warning<
6624     "implicit capture of 'this' with a capture default of '=' is deprecated">,
6625     InGroup<DeprecatedThisCapture>, DefaultIgnore;
6626   def note_deprecated_this_capture : Note<
6627     "add an explicit capture of 'this' to capture '*this' by reference">;
6628
6629   // C++2a default constructible / assignable lambdas.
6630   def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
6631     "%select{default construction|assignment}0 of lambda is incompatible with "
6632     "C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
6633 }
6634
6635 def err_return_in_captured_stmt : Error<
6636   "cannot return from %0">;
6637 def err_capture_block_variable : Error<
6638   "__block variable %0 cannot be captured in a "
6639   "%select{lambda expression|captured statement}1">;
6640
6641 def err_operator_arrow_circular : Error<
6642   "circular pointer delegation detected">;
6643 def err_operator_arrow_depth_exceeded : Error<
6644   "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
6645   "'operator->' calls">;
6646 def note_operator_arrow_here : Note<
6647   "'operator->' declared here produces an object of type %0">;
6648 def note_operator_arrows_suppressed : Note<
6649   "(skipping %0 'operator->'%s0 in backtrace)">;
6650 def note_operator_arrow_depth : Note<
6651   "use -foperator-arrow-depth=N to increase 'operator->' limit">;
6652
6653 def err_pseudo_dtor_base_not_scalar : Error<
6654   "object expression of non-scalar type %0 cannot be used in a "
6655   "pseudo-destructor expression">;
6656 def ext_pseudo_dtor_on_void : ExtWarn<
6657   "pseudo-destructors on type void are a Microsoft extension">,
6658   InGroup<MicrosoftVoidPseudoDtor>;
6659 def err_pseudo_dtor_type_mismatch : Error<
6660   "the type of object expression "
6661   "%diff{($) does not match the type being destroyed ($)|"
6662   "does not match the type being destroyed}0,1 "
6663   "in pseudo-destructor expression">;
6664 def err_pseudo_dtor_call_with_args : Error<
6665   "call to pseudo-destructor cannot have any arguments">;
6666 def err_dtor_expr_without_call : Error<
6667   "reference to %select{destructor|pseudo-destructor}0 must be called"
6668   "%select{|; did you mean to call it with no arguments?}1">;
6669 def err_pseudo_dtor_destructor_non_type : Error<
6670   "%0 does not refer to a type name in pseudo-destructor expression; expected "
6671   "the name of type %1">;
6672 def err_invalid_use_of_function_type : Error<
6673   "a function type is not allowed here">;
6674 def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
6675 def err_typecheck_bool_condition : Error<
6676   "value of type %0 is not contextually convertible to 'bool'">;
6677 def err_typecheck_ambiguous_condition : Error<
6678   "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
6679 def err_typecheck_nonviable_condition : Error<
6680   "no viable conversion%select{%diff{ from $ to $|}1,2|"
6681   "%diff{ from returned value of type $ to function return type $|}1,2}0">;
6682 def err_typecheck_nonviable_condition_incomplete : Error<
6683   "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
6684 def err_typecheck_deleted_function : Error<
6685   "conversion function %diff{from $ to $|between types}0,1 "
6686   "invokes a deleted function">;
6687
6688 def err_expected_class_or_namespace : Error<"%0 is not a class"
6689   "%select{ or namespace|, namespace, or enumeration}1">;
6690 def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
6691   "because namespace %1 does not enclose namespace %2">;
6692 def err_invalid_declarator_global_scope : Error<
6693   "definition or redeclaration of %0 cannot name the global scope">;
6694 def err_invalid_declarator_in_function : Error<
6695   "definition or redeclaration of %0 not allowed inside a function">;
6696 def err_invalid_declarator_in_block : Error<
6697   "definition or redeclaration of %0 not allowed inside a block">;
6698 def err_not_tag_in_scope : Error<
6699   "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
6700
6701 def err_no_typeid_with_fno_rtti : Error<
6702   "use of typeid requires -frtti">;
6703 def err_no_dynamic_cast_with_fno_rtti : Error<
6704   "use of dynamic_cast requires -frtti">;
6705
6706 def err_cannot_form_pointer_to_member_of_reference_type : Error<
6707   "cannot form a pointer-to-member to member %0 of reference type %1">;
6708 def err_incomplete_object_call : Error<
6709   "incomplete type in call to object of type %0">;
6710
6711 def warn_condition_is_assignment : Warning<"using the result of an "
6712   "assignment as a condition without parentheses">,
6713   InGroup<Parentheses>;
6714 // Completely identical except off by default.
6715 def warn_condition_is_idiomatic_assignment : Warning<"using the result "
6716   "of an assignment as a condition without parentheses">,
6717   InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
6718 def note_condition_assign_to_comparison : Note<
6719   "use '==' to turn this assignment into an equality comparison">;
6720 def note_condition_or_assign_to_comparison : Note<
6721   "use '!=' to turn this compound assignment into an inequality comparison">;
6722 def note_condition_assign_silence : Note<
6723   "place parentheses around the assignment to silence this warning">;
6724
6725 def warn_equality_with_extra_parens : Warning<"equality comparison with "
6726   "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
6727 def note_equality_comparison_to_assign : Note<
6728   "use '=' to turn this equality comparison into an assignment">;
6729 def note_equality_comparison_silence : Note<
6730   "remove extraneous parentheses around the comparison to silence this warning">;
6731
6732 // assignment related diagnostics (also for argument passing, returning, etc).
6733 // In most of these diagnostics the %2 is a value from the
6734 // Sema::AssignmentAction enumeration
6735 def err_typecheck_convert_incompatible : Error<
6736   "%select{%diff{assigning to $ from incompatible type $|"
6737   "assigning to type from incompatible type}0,1"
6738   "|%diff{passing $ to parameter of incompatible type $|"
6739   "passing type to parameter of incompatible type}0,1"
6740   "|%diff{returning $ from a function with incompatible result type $|"
6741   "returning type from a function with incompatible result type}0,1"
6742   "|%diff{converting $ to incompatible type $|"
6743   "converting type to incompatible type}0,1"
6744   "|%diff{initializing $ with an expression of incompatible type $|"
6745   "initializing type with an expression of incompatible type}0,1"
6746   "|%diff{sending $ to parameter of incompatible type $|"
6747   "sending type to parameter of incompatible type}0,1"
6748   "|%diff{casting $ to incompatible type $|"
6749   "casting type to incompatible type}0,1}2"
6750   "%select{|; dereference with *|"
6751   "; take the address with &|"
6752   "; remove *|"
6753   "; remove &}3"
6754   "%select{|: different classes%diff{ ($ vs $)|}5,6"
6755   "|: different number of parameters (%5 vs %6)"
6756   "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
6757   "|: different return type%diff{ ($ vs $)|}5,6"
6758   "|: different qualifiers (%5 vs %6)"
6759   "|: different exception specifications}4">;
6760 def err_typecheck_missing_return_type_incompatible : Error<
6761   "%diff{return type $ must match previous return type $|"
6762   "return type must match previous return type}0,1 when %select{block "
6763   "literal|lambda expression}2 has unspecified explicit return type">;
6764
6765 def note_incomplete_class_and_qualified_id : Note<
6766   "conformance of forward class %0 to protocol %1 can not be confirmed">;
6767 def warn_incompatible_qualified_id : Warning<
6768   "%select{%diff{assigning to $ from incompatible type $|"
6769   "assigning to type from incompatible type}0,1"
6770   "|%diff{passing $ to parameter of incompatible type $|"
6771   "passing type to parameter of incompatible type}0,1"
6772   "|%diff{returning $ from a function with incompatible result type $|"
6773   "returning type from a function with incompatible result type}0,1"
6774   "|%diff{converting $ to incompatible type $|"
6775   "converting type to incompatible type}0,1"
6776   "|%diff{initializing $ with an expression of incompatible type $|"
6777   "initializing type with an expression of incompatible type}0,1"
6778   "|%diff{sending $ to parameter of incompatible type $|"
6779   "sending type to parameter of incompatible type}0,1"
6780   "|%diff{casting $ to incompatible type $|"
6781   "casting type to incompatible type}0,1}2">;
6782 def ext_typecheck_convert_pointer_int : ExtWarn<
6783   "incompatible pointer to integer conversion "
6784   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6785   "|%diff{passing $ to parameter of type $|"
6786   "passing to parameter of different type}0,1"
6787   "|%diff{returning $ from a function with result type $|"
6788   "returning from function with different return type}0,1"
6789   "|%diff{converting $ to type $|converting between types}0,1"
6790   "|%diff{initializing $ with an expression of type $|"
6791   "initializing with expression of different type}0,1"
6792   "|%diff{sending $ to parameter of type $|"
6793   "sending to parameter of different type}0,1"
6794   "|%diff{casting $ to type $|casting between types}0,1}2"
6795   "%select{|; dereference with *|"
6796   "; take the address with &|"
6797   "; remove *|"
6798   "; remove &}3">,
6799   InGroup<IntConversion>;
6800 def ext_typecheck_convert_int_pointer : ExtWarn<
6801   "incompatible integer to pointer conversion "
6802   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6803   "|%diff{passing $ to parameter of type $|"
6804   "passing to parameter of different type}0,1"
6805   "|%diff{returning $ from a function with result type $|"
6806   "returning from function with different return type}0,1"
6807   "|%diff{converting $ to type $|converting between types}0,1"
6808   "|%diff{initializing $ with an expression of type $|"
6809   "initializing with expression of different type}0,1"
6810   "|%diff{sending $ to parameter of type $|"
6811   "sending to parameter of different type}0,1"
6812   "|%diff{casting $ to type $|casting between types}0,1}2"
6813   "%select{|; dereference with *|"
6814   "; take the address with &|"
6815   "; remove *|"
6816   "; remove &}3">,
6817   InGroup<IntConversion>;
6818 def ext_typecheck_convert_pointer_void_func : Extension<
6819   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6820   "|%diff{passing $ to parameter of type $|"
6821   "passing to parameter of different type}0,1"
6822   "|%diff{returning $ from a function with result type $|"
6823   "returning from function with different return type}0,1"
6824   "|%diff{converting $ to type $|converting between types}0,1"
6825   "|%diff{initializing $ with an expression of type $|"
6826   "initializing with expression of different type}0,1"
6827   "|%diff{sending $ to parameter of type $|"
6828   "sending to parameter of different type}0,1"
6829   "|%diff{casting $ to type $|casting between types}0,1}2"
6830   " converts between void pointer and function pointer">;
6831 def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
6832   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6833   "|%diff{passing $ to parameter of type $|"
6834   "passing to parameter of different type}0,1"
6835   "|%diff{returning $ from a function with result type $|"
6836   "returning from function with different return type}0,1"
6837   "|%diff{converting $ to type $|converting between types}0,1"
6838   "|%diff{initializing $ with an expression of type $|"
6839   "initializing with expression of different type}0,1"
6840   "|%diff{sending $ to parameter of type $|"
6841   "sending to parameter of different type}0,1"
6842   "|%diff{casting $ to type $|casting between types}0,1}2"
6843   " converts between pointers to integer types with different sign">,
6844   InGroup<DiagGroup<"pointer-sign">>;
6845 def ext_typecheck_convert_incompatible_pointer : ExtWarn<
6846   "incompatible pointer types "
6847   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6848   "|%diff{passing $ to parameter of type $|"
6849   "passing to parameter of different type}0,1"
6850   "|%diff{returning $ from a function with result type $|"
6851   "returning from function with different return type}0,1"
6852   "|%diff{converting $ to type $|converting between types}0,1"
6853   "|%diff{initializing $ with an expression of type $|"
6854   "initializing with expression of different type}0,1"
6855   "|%diff{sending $ to parameter of type $|"
6856   "sending to parameter of different type}0,1"
6857   "|%diff{casting $ to type $|casting between types}0,1}2"
6858   "%select{|; dereference with *|"
6859   "; take the address with &|"
6860   "; remove *|"
6861   "; remove &}3">,
6862   InGroup<IncompatiblePointerTypes>;
6863 def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
6864   "incompatible function pointer types "
6865   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6866   "|%diff{passing $ to parameter of type $|"
6867   "passing to parameter of different type}0,1"
6868   "|%diff{returning $ from a function with result type $|"
6869   "returning from function with different return type}0,1"
6870   "|%diff{converting $ to type $|converting between types}0,1"
6871   "|%diff{initializing $ with an expression of type $|"
6872   "initializing with expression of different type}0,1"
6873   "|%diff{sending $ to parameter of type $|"
6874   "sending to parameter of different type}0,1"
6875   "|%diff{casting $ to type $|casting between types}0,1}2"
6876   "%select{|; dereference with *|"
6877   "; take the address with &|"
6878   "; remove *|"
6879   "; remove &}3">,
6880   InGroup<IncompatibleFunctionPointerTypes>;
6881 def ext_typecheck_convert_discards_qualifiers : ExtWarn<
6882   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6883   "|%diff{passing $ to parameter of type $|"
6884   "passing to parameter of different type}0,1"
6885   "|%diff{returning $ from a function with result type $|"
6886   "returning from function with different return type}0,1"
6887   "|%diff{converting $ to type $|converting between types}0,1"
6888   "|%diff{initializing $ with an expression of type $|"
6889   "initializing with expression of different type}0,1"
6890   "|%diff{sending $ to parameter of type $|"
6891   "sending to parameter of different type}0,1"
6892   "|%diff{casting $ to type $|casting between types}0,1}2"
6893   " discards qualifiers">,
6894   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6895 def ext_nested_pointer_qualifier_mismatch : ExtWarn<
6896   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6897   "|%diff{passing $ to parameter of type $|"
6898   "passing to parameter of different type}0,1"
6899   "|%diff{returning $ from a function with result type $|"
6900   "returning from function with different return type}0,1"
6901   "|%diff{converting $ to type $|converting between types}0,1"
6902   "|%diff{initializing $ with an expression of type $|"
6903   "initializing with expression of different type}0,1"
6904   "|%diff{sending $ to parameter of type $|"
6905   "sending to parameter of different type}0,1"
6906   "|%diff{casting $ to type $|casting between types}0,1}2"
6907   " discards qualifiers in nested pointer types">,
6908   InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6909 def warn_incompatible_vectors : Warning<
6910   "incompatible vector types "
6911   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6912   "|%diff{passing $ to parameter of type $|"
6913   "passing to parameter of different type}0,1"
6914   "|%diff{returning $ from a function with result type $|"
6915   "returning from function with different return type}0,1"
6916   "|%diff{converting $ to type $|converting between types}0,1"
6917   "|%diff{initializing $ with an expression of type $|"
6918   "initializing with expression of different type}0,1"
6919   "|%diff{sending $ to parameter of type $|"
6920   "sending to parameter of different type}0,1"
6921   "|%diff{casting $ to type $|casting between types}0,1}2">,
6922   InGroup<VectorConversion>, DefaultIgnore;
6923 def err_int_to_block_pointer : Error<
6924   "invalid block pointer conversion "
6925   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6926   "|%diff{passing $ to parameter of type $|"
6927   "passing to parameter of different type}0,1"
6928   "|%diff{returning $ from a function with result type $|"
6929   "returning from function with different return type}0,1"
6930   "|%diff{converting $ to type $|converting between types}0,1"
6931   "|%diff{initializing $ with an expression of type $|"
6932   "initializing with expression of different type}0,1"
6933   "|%diff{sending $ to parameter of type $|"
6934   "sending to parameter of different type}0,1"
6935   "|%diff{casting $ to type $|casting between types}0,1}2">;
6936 def err_typecheck_convert_incompatible_block_pointer : Error<
6937   "incompatible block pointer types "
6938   "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6939   "|%diff{passing $ to parameter of type $|"
6940   "passing to parameter of different type}0,1"
6941   "|%diff{returning $ from a function with result type $|"
6942   "returning from function with different return type}0,1"
6943   "|%diff{converting $ to type $|converting between types}0,1"
6944   "|%diff{initializing $ with an expression of type $|"
6945   "initializing with expression of different type}0,1"
6946   "|%diff{sending $ to parameter of type $|"
6947   "sending to parameter of different type}0,1"
6948   "|%diff{casting $ to type $|casting between types}0,1}2">;
6949 def err_typecheck_incompatible_address_space : Error<
6950   "%select{%diff{assigning $ to $|assigning to different types}1,0"
6951   "|%diff{passing $ to parameter of type $|"
6952   "passing to parameter of different type}0,1"
6953   "|%diff{returning $ from a function with result type $|"
6954   "returning from function with different return type}0,1"
6955   "|%diff{converting $ to type $|converting between types}0,1"
6956   "|%diff{initializing $ with an expression of type $|"
6957   "initializing with expression of different type}0,1"
6958   "|%diff{sending $ to parameter of type $|"
6959   "sending to parameter of different type}0,1"
6960   "|%diff{casting $ to type $|casting between types}0,1}2"
6961   " changes address space of pointer">;
6962 def err_typecheck_incompatible_ownership : Error<
6963   "%select{%diff{assigning $ to $|assigning to different types}1,0"
6964   "|%diff{passing $ to parameter of type $|"
6965   "passing to parameter of different type}0,1"
6966   "|%diff{returning $ from a function with result type $|"
6967   "returning from function with different return type}0,1"
6968   "|%diff{converting $ to type $|converting between types}0,1"
6969   "|%diff{initializing $ with an expression of type $|"
6970   "initializing with expression of different type}0,1"
6971   "|%diff{sending $ to parameter of type $|"
6972   "sending to parameter of different type}0,1"
6973   "|%diff{casting $ to type $|casting between types}0,1}2"
6974   " changes retain/release properties of pointer">;
6975 def err_typecheck_comparison_of_distinct_blocks : Error<
6976   "comparison of distinct block types%diff{ ($ and $)|}0,1">;
6977
6978 def err_typecheck_array_not_modifiable_lvalue : Error<
6979   "array type %0 is not assignable">;
6980 def err_typecheck_non_object_not_modifiable_lvalue : Error<
6981   "non-object type %0 is not assignable">;
6982 def err_typecheck_expression_not_modifiable_lvalue : Error<
6983   "expression is not assignable">;
6984 def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
6985   "incomplete type %0 is not assignable">;
6986 def err_typecheck_lvalue_casts_not_supported : Error<
6987   "assignment to cast is illegal, lvalue casts are not supported">;
6988
6989 def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
6990   "vector is not assignable (contains duplicate components)">;
6991 def err_block_decl_ref_not_modifiable_lvalue : Error<
6992   "variable is not assignable (missing __block type specifier)">;
6993 def err_lambda_decl_ref_not_modifiable_lvalue : Error<
6994   "cannot assign to a variable captured by copy in a non-mutable lambda">;
6995 def err_typecheck_call_not_function : Error<
6996   "called object type %0 is not a function or function pointer">;
6997 def err_call_incomplete_return : Error<
6998   "calling function with incomplete return type %0">;
6999 def err_call_function_incomplete_return : Error<
7000   "calling %0 with incomplete return type %1">;
7001 def err_call_incomplete_argument : Error<
7002   "argument type %0 is incomplete">;
7003 def err_typecheck_call_too_few_args : Error<
7004   "too few %select{|||execution configuration }0arguments to "
7005   "%select{function|block|method|kernel function}0 call, "
7006   "expected %1, have %2">;
7007 def err_typecheck_call_too_few_args_one : Error<
7008   "too few %select{|||execution configuration }0arguments to "
7009   "%select{function|block|method|kernel function}0 call, "
7010   "single argument %1 was not specified">;
7011 def err_typecheck_call_too_few_args_at_least : Error<
7012   "too few %select{|||execution configuration }0arguments to "
7013   "%select{function|block|method|kernel function}0 call, "
7014   "expected at least %1, have %2">;
7015 def err_typecheck_call_too_few_args_at_least_one : Error<
7016   "too few %select{|||execution configuration }0arguments to "
7017   "%select{function|block|method|kernel function}0 call, "
7018   "at least argument %1 must be specified">;
7019 def err_typecheck_call_too_few_args_suggest : Error<
7020   "too few %select{|||execution configuration }0arguments to "
7021   "%select{function|block|method|kernel function}0 call, "
7022   "expected %1, have %2; did you mean %3?">;
7023 def err_typecheck_call_too_few_args_at_least_suggest : Error<
7024   "too few %select{|||execution configuration }0arguments to "
7025   "%select{function|block|method|kernel function}0 call, "
7026   "expected at least %1, have %2; did you mean %3?">;
7027 def err_typecheck_call_too_many_args : Error<
7028   "too many %select{|||execution configuration }0arguments to "
7029   "%select{function|block|method|kernel function}0 call, "
7030   "expected %1, have %2">;
7031 def err_typecheck_call_too_many_args_one : Error<
7032   "too many %select{|||execution configuration }0arguments to "
7033   "%select{function|block|method|kernel function}0 call, "
7034   "expected single argument %1, have %2 arguments">;
7035 def err_typecheck_call_too_many_args_at_most : Error<
7036   "too many %select{|||execution configuration }0arguments to "
7037   "%select{function|block|method|kernel function}0 call, "
7038   "expected at most %1, have %2">;
7039 def err_typecheck_call_too_many_args_at_most_one : Error<
7040   "too many %select{|||execution configuration }0arguments to "
7041   "%select{function|block|method|kernel function}0 call, "
7042   "expected at most single argument %1, have %2 arguments">;
7043 def err_typecheck_call_too_many_args_suggest : Error<
7044   "too many %select{|||execution configuration }0arguments to "
7045   "%select{function|block|method|kernel function}0 call, "
7046   "expected %1, have %2; did you mean %3?">;
7047 def err_typecheck_call_too_many_args_at_most_suggest : Error<
7048   "too many %select{|||execution configuration }0arguments to "
7049   "%select{function|block|method|kernel function}0 call, "
7050   "expected at most %1, have %2; did you mean %3?">;
7051
7052 def err_arc_typecheck_convert_incompatible_pointer : Error<
7053   "incompatible pointer types passing retainable parameter of type %0"
7054   "to a CF function expecting %1 type">;
7055
7056 def err_builtin_fn_use : Error<"builtin functions must be directly called">;
7057
7058 def warn_call_wrong_number_of_arguments : Warning<
7059   "too %select{few|many}0 arguments in call to %1">;
7060 def err_atomic_builtin_must_be_pointer : Error<
7061   "address argument to atomic builtin must be a pointer (%0 invalid)">;
7062 def err_atomic_builtin_must_be_pointer_intptr : Error<
7063   "address argument to atomic builtin must be a pointer to integer or pointer"
7064   " (%0 invalid)">;
7065 def err_atomic_builtin_cannot_be_const : Error<
7066   "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
7067 def err_atomic_builtin_must_be_pointer_intfltptr : Error<
7068   "address argument to atomic builtin must be a pointer to integer,"
7069   " floating-point or pointer (%0 invalid)">;
7070 def err_atomic_builtin_pointer_size : Error<
7071   "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
7072   "type (%0 invalid)">;
7073 def err_atomic_exclusive_builtin_pointer_size : Error<
7074   "address argument to load or store exclusive builtin must be a pointer to"
7075   " 1,2,4 or 8 byte type (%0 invalid)">;
7076 def err_atomic_op_needs_atomic : Error<
7077   "address argument to atomic operation must be a pointer to _Atomic "
7078   "type (%0 invalid)">;
7079 def err_atomic_op_needs_non_const_atomic : Error<
7080   "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
7081   "type (%1 invalid)">;
7082 def err_atomic_op_needs_non_const_pointer : Error<
7083   "address argument to atomic operation must be a pointer to non-const "
7084   "type (%0 invalid)">;
7085 def err_atomic_op_needs_trivial_copy : Error<
7086   "address argument to atomic operation must be a pointer to a "
7087   "trivially-copyable type (%0 invalid)">;
7088 def err_atomic_op_needs_atomic_int_or_ptr : Error<
7089   "address argument to atomic operation must be a pointer to %select{|atomic }0"
7090   "integer or pointer (%1 invalid)">;
7091 def err_atomic_op_needs_int32_or_ptr : Error<
7092   "address argument to atomic operation must be a pointer to signed or unsigned 32-bit integer">;
7093 def err_atomic_op_bitwise_needs_atomic_int : Error<
7094   "address argument to bitwise atomic operation must be a pointer to "
7095   "%select{|atomic }0integer (%1 invalid)">;
7096 def warn_atomic_op_has_invalid_memory_order : Warning<
7097   "memory order argument to atomic operation is invalid">,
7098   InGroup<DiagGroup<"atomic-memory-ordering">>;
7099 def err_atomic_op_has_invalid_synch_scope : Error<
7100   "synchronization scope argument to atomic operation is invalid">;
7101 def warn_atomic_implicit_seq_cst : Warning<
7102   "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
7103   InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
7104
7105 def err_overflow_builtin_must_be_int : Error<
7106   "operand argument to overflow builtin must be an integer (%0 invalid)">;
7107 def err_overflow_builtin_must_be_ptr_int : Error<
7108   "result argument to overflow builtin must be a pointer "
7109   "to a non-const integer (%0 invalid)">;
7110
7111 def err_atomic_load_store_uses_lib : Error<
7112   "atomic %select{load|store}0 requires runtime support that is not "
7113   "available for this target">;
7114
7115 def err_nontemporal_builtin_must_be_pointer : Error<
7116   "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
7117 def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
7118   "address argument to nontemporal builtin must be a pointer to integer, float, "
7119   "pointer, or a vector of such types (%0 invalid)">;
7120
7121 def err_deleted_function_use : Error<"attempt to use a deleted function">;
7122 def err_deleted_inherited_ctor_use : Error<
7123   "constructor inherited by %0 from base class %1 is implicitly deleted">;
7124
7125 def note_called_by : Note<"called by %0">;
7126 def err_kern_type_not_void_return : Error<
7127   "kernel function type %0 must have void return type">;
7128 def err_kern_is_nonstatic_method : Error<
7129   "kernel function %0 must be a free function or static member function">;
7130 def err_config_scalar_return : Error<
7131   "CUDA special function 'cudaConfigureCall' must have scalar return type">;
7132 def err_kern_call_not_global_function : Error<
7133   "kernel call to non-global function %0">;
7134 def err_global_call_not_config : Error<
7135   "call to global function %0 not configured">;
7136 def err_ref_bad_target : Error<
7137   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7138   "function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
7139 def err_ref_bad_target_global_initializer : Error<
7140   "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7141   "function %1 in global initializer">;
7142 def warn_kern_is_method : Extension<
7143   "kernel function %0 is a member function; this may not be accepted by nvcc">,
7144   InGroup<CudaCompat>;
7145 def warn_kern_is_inline : Warning<
7146   "ignored 'inline' attribute on kernel function %0">,
7147   InGroup<CudaCompat>;
7148 def err_variadic_device_fn : Error<
7149   "CUDA device code does not support variadic functions">;
7150 def err_va_arg_in_device : Error<
7151   "CUDA device code does not support va_arg">;
7152 def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
7153 def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
7154   "constexpr function %0 without __host__ or __device__ attributes cannot "
7155   "overload __device__ function with same signature.  Add a __host__ "
7156   "attribute, or build with -fno-cuda-host-device-constexpr.">;
7157 def note_cuda_conflicting_device_function_declared_here : Note<
7158   "conflicting __device__ function declared here">;
7159 def err_cuda_device_exceptions : Error<
7160   "cannot use '%0' in "
7161   "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
7162 def err_dynamic_var_init : Error<
7163     "dynamic initialization is not supported for "
7164     "__device__, __constant__, and __shared__ variables.">;
7165 def err_shared_var_init : Error<
7166     "initialization is not supported for __shared__ variables.">;
7167 def err_device_static_local_var : Error<
7168     "within a %select{__device__|__global__|__host__|__host__ __device__}0 "
7169     "function, only __shared__ variables or const variables without device "
7170     "memory qualifier may be marked 'static'">;
7171 def err_cuda_vla : Error<
7172     "cannot use variable-length arrays in "
7173     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7174 def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
7175 def err_cuda_host_shared : Error<
7176     "__shared__ local variables not allowed in "
7177     "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7178 def err_cuda_nonglobal_constant : Error<"__constant__ variables must be global">;
7179 def err_cuda_ovl_target : Error<
7180   "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
7181   "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
7182 def note_cuda_ovl_candidate_target_mismatch : Note<
7183     "candidate template ignored: target attributes do not match">;
7184
7185 def warn_non_pod_vararg_with_format_string : Warning<
7186   "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
7187   "%select{function|block|method|constructor}2; expected type from format "
7188   "string was %3">, InGroup<NonPODVarargs>, DefaultError;
7189 // The arguments to this diagnostic should match the warning above.
7190 def err_cannot_pass_objc_interface_to_vararg_format : Error<
7191   "cannot pass object with interface type %1 by value to variadic "
7192   "%select{function|block|method|constructor}2; expected type from format "
7193   "string was %3">;
7194 def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
7195   "cannot pass non-trivial C object of type %0 by value to variadic "
7196   "%select{function|block|method|constructor}1">;
7197
7198
7199 def err_cannot_pass_objc_interface_to_vararg : Error<
7200   "cannot pass object with interface type %0 by value through variadic "
7201   "%select{function|block|method|constructor}1">;
7202 def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
7203   "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
7204   " %select{function|block|method|constructor}2; call will abort at runtime">,
7205   InGroup<NonPODVarargs>, DefaultError;
7206 def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
7207   "passing object of trivial but non-POD type %0 through variadic"
7208   " %select{function|block|method|constructor}1 is incompatible with C++98">,
7209   InGroup<CXX98Compat>, DefaultIgnore;
7210 def warn_pass_class_arg_to_vararg : Warning<
7211   "passing object of class type %0 through variadic "
7212   "%select{function|block|method|constructor}1"
7213   "%select{|; did you mean to call '%3'?}2">,
7214   InGroup<ClassVarargs>, DefaultIgnore;
7215 def err_cannot_pass_to_vararg : Error<
7216   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7217   "%select{function|block|method|constructor}2">;
7218 def err_cannot_pass_to_vararg_format : Error<
7219   "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7220   "%select{function|block|method|constructor}2; expected type from format "
7221   "string was %3">;
7222
7223 def err_typecheck_call_invalid_ordered_compare : Error<
7224   "ordered compare requires two args of floating point type"
7225   "%diff{ ($ and $)|}0,1">;
7226 def err_typecheck_call_invalid_unary_fp : Error<
7227   "floating point classification requires argument of floating point type "
7228   "(passed in %0)">;
7229 def err_typecheck_cond_expect_int_float : Error<
7230   "used type %0 where integer or floating point type is required">;
7231 def err_typecheck_cond_expect_scalar : Error<
7232   "used type %0 where arithmetic or pointer type is required">;
7233 def err_typecheck_cond_expect_nonfloat : Error<
7234   "used type %0 where floating point type is not allowed">;
7235 def ext_typecheck_cond_one_void : Extension<
7236   "C99 forbids conditional expressions with only one void side">;
7237 def err_typecheck_cast_to_incomplete : Error<
7238   "cast to incomplete type %0">;
7239 def ext_typecheck_cast_nonscalar : Extension<
7240   "C99 forbids casting nonscalar type %0 to the same type">;
7241 def ext_typecheck_cast_to_union : Extension<
7242   "cast to union type is a GNU extension">,
7243   InGroup<GNUUnionCast>;
7244 def err_typecheck_cast_to_union_no_type : Error<
7245   "cast to union type from type %0 not present in union">;
7246 def err_cast_pointer_from_non_pointer_int : Error<
7247   "operand of type %0 cannot be cast to a pointer type">;
7248 def warn_cast_pointer_from_sel : Warning<
7249   "cast of type %0 to %1 is deprecated; use sel_getName instead">,
7250   InGroup<SelTypeCast>;
7251 def warn_function_def_in_objc_container : Warning<
7252   "function definition inside an Objective-C container is deprecated">,
7253   InGroup<FunctionDefInObjCContainer>;
7254
7255 def warn_cast_calling_conv : Warning<
7256   "cast between incompatible calling conventions '%0' and '%1'; "
7257   "calls through this pointer may abort at runtime">,
7258   InGroup<DiagGroup<"cast-calling-convention">>;
7259 def note_change_calling_conv_fixit : Note<
7260   "consider defining %0 with the '%1' calling convention">;
7261 def warn_bad_function_cast : Warning<
7262   "cast from function call of type %0 to non-matching type %1">,
7263   InGroup<BadFunctionCast>, DefaultIgnore;
7264 def err_cast_pointer_to_non_pointer_int : Error<
7265   "pointer cannot be cast to type %0">;
7266 def err_typecheck_expect_scalar_operand : Error<
7267   "operand of type %0 where arithmetic or pointer type is required">;
7268 def err_typecheck_cond_incompatible_operands : Error<
7269   "incompatible operand types%diff{ ($ and $)|}0,1">;
7270 def err_cast_selector_expr : Error<
7271   "cannot type cast @selector expression">;
7272 def ext_typecheck_cond_incompatible_pointers : ExtWarn<
7273   "pointer type mismatch%diff{ ($ and $)|}0,1">,
7274   InGroup<DiagGroup<"pointer-type-mismatch">>;
7275 def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
7276   "pointer/integer type mismatch in conditional expression"
7277   "%diff{ ($ and $)|}0,1">,
7278   InGroup<DiagGroup<"conditional-type-mismatch">>;
7279 def err_typecheck_choose_expr_requires_constant : Error<
7280   "'__builtin_choose_expr' requires a constant expression">;
7281 def warn_unused_expr : Warning<"expression result unused">,
7282   InGroup<UnusedValue>;
7283 def warn_unused_voidptr : Warning<
7284   "expression result unused; should this cast be to 'void'?">,
7285   InGroup<UnusedValue>;
7286 def warn_unused_property_expr : Warning<
7287  "property access result unused - getters should not be used for side effects">,
7288   InGroup<UnusedGetterReturnValue>;
7289 def warn_unused_container_subscript_expr : Warning<
7290  "container access result unused - container access should not be used for side effects">,
7291   InGroup<UnusedValue>;
7292 def warn_unused_call : Warning<
7293   "ignoring return value of function declared with %0 attribute">,
7294   InGroup<UnusedValue>;
7295 def warn_side_effects_unevaluated_context : Warning<
7296   "expression with side effects has no effect in an unevaluated context">,
7297   InGroup<UnevaluatedExpression>;
7298 def warn_side_effects_typeid : Warning<
7299   "expression with side effects will be evaluated despite being used as an "
7300   "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
7301 def warn_unused_result : Warning<
7302   "ignoring return value of function declared with %0 attribute">,
7303   InGroup<UnusedResult>;
7304 def warn_unused_volatile : Warning<
7305   "expression result unused; assign into a variable to force a volatile load">,
7306   InGroup<DiagGroup<"unused-volatile-lvalue">>;
7307
7308 def ext_cxx14_attr : Extension<
7309   "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
7310 def ext_cxx17_attr : Extension<
7311   "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
7312
7313 def warn_unused_comparison : Warning<
7314   "%select{equality|inequality|relational|three-way}0 comparison result unused">,
7315   InGroup<UnusedComparison>;
7316 def note_inequality_comparison_to_or_assign : Note<
7317   "use '|=' to turn this inequality comparison into an or-assignment">;
7318
7319 def err_incomplete_type_used_in_type_trait_expr : Error<
7320   "incomplete type %0 used in type trait expression">;
7321
7322 def err_require_constant_init_failed : Error<
7323   "variable does not have a constant initializer">;
7324 def note_declared_required_constant_init_here : Note<
7325   "required by 'require_constant_initialization' attribute here">;
7326
7327 def err_dimension_expr_not_constant_integer : Error<
7328   "dimension expression does not evaluate to a constant unsigned int">;
7329
7330 def err_typecheck_cond_incompatible_operands_null : Error<
7331   "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
7332 def ext_empty_struct_union : Extension<
7333   "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
7334 def ext_no_named_members_in_struct_union : Extension<
7335   "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
7336 def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
7337   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7338   InGroup<CXXCompat>, DefaultIgnore;
7339 def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
7340   "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7341   InGroup<ExternCCompat>;
7342 def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
7343   "volatile qualifiers|const qualifier|volatile qualifier}2">,
7344   InGroup<CastQual>, DefaultIgnore;
7345 def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
7346   "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
7347 def warn_redefine_extname_not_applied : Warning<
7348   "#pragma redefine_extname is applicable to external C declarations only; "
7349   "not applied to %select{function|variable}0 %1">,
7350   InGroup<Pragmas>;
7351 } // End of general sema category.
7352
7353 // inline asm.
7354 let CategoryName = "Inline Assembly Issue" in {
7355   def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
7356   def err_asm_invalid_output_constraint : Error<
7357     "invalid output constraint '%0' in asm">;
7358   def err_asm_invalid_lvalue_in_input : Error<
7359     "invalid lvalue in asm input for constraint '%0'">;
7360   def err_asm_invalid_input_constraint : Error<
7361     "invalid input constraint '%0' in asm">;
7362   def err_asm_immediate_expected : Error<"constraint '%0' expects "
7363     "an integer constant expression">;
7364   def err_asm_tying_incompatible_types : Error<
7365     "unsupported inline asm: input with type "
7366     "%diff{$ matching output with type $|}0,1">;
7367   def err_asm_unexpected_constraint_alternatives : Error<
7368     "asm constraint has an unexpected number of alternatives: %0 vs %1">;
7369   def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
7370   def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
7371   def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
7372     "global register variables on this target">;
7373   def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
7374     "match variable size">;
7375   def err_asm_bad_register_type : Error<"bad type for named register variable">;
7376   def err_asm_invalid_input_size : Error<
7377     "invalid input size for constraint '%0'">;
7378   def err_asm_invalid_output_size : Error<
7379     "invalid output size for constraint '%0'">;
7380   def err_invalid_asm_cast_lvalue : Error<
7381     "invalid use of a cast in a inline asm context requiring an l-value: "
7382     "remove the cast or build with -fheinous-gnu-extensions">;
7383   def err_invalid_asm_value_for_constraint
7384       : Error <"value '%0' out of range for constraint '%1'">;
7385   def err_asm_non_addr_value_in_memory_constraint : Error <
7386     "reference to a %select{bit-field|vector element|global register variable}0"
7387     " in asm %select{input|output}1 with a memory constraint '%2'">;
7388   def err_asm_input_duplicate_match : Error<
7389     "more than one input constraint matches the same output '%0'">;
7390
7391   def warn_asm_label_on_auto_decl : Warning<
7392     "ignored asm label '%0' on automatic variable">;
7393   def warn_invalid_asm_cast_lvalue : Warning<
7394     "invalid use of a cast in an inline asm context requiring an l-value: "
7395     "accepted due to -fheinous-gnu-extensions, but clang may remove support "
7396     "for this in the future">;
7397   def warn_asm_mismatched_size_modifier : Warning<
7398     "value size does not match register size specified by the constraint "
7399     "and modifier">,
7400     InGroup<ASMOperandWidths>;
7401
7402   def note_asm_missing_constraint_modifier : Note<
7403     "use constraint modifier \"%0\"">;
7404   def note_asm_input_duplicate_first : Note<
7405     "constraint '%0' is already present here">;
7406 }
7407
7408   def error_inoutput_conflict_with_clobber : Error<
7409     "asm-specifier for input or output variable conflicts with asm"
7410     " clobber list">;
7411
7412 let CategoryName = "Semantic Issue" in {
7413
7414 def err_invalid_conversion_between_vectors : Error<
7415   "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
7416   "size">;
7417 def err_invalid_conversion_between_vector_and_integer : Error<
7418   "invalid conversion between vector type %0 and integer type %1 "
7419   "of different size">;
7420
7421 def err_opencl_function_pointer : Error<
7422   "pointers to functions are not allowed">;
7423
7424 def err_opencl_taking_address_capture : Error<
7425   "taking address of a capture is not allowed">;
7426
7427 def err_invalid_conversion_between_vector_and_scalar : Error<
7428   "invalid conversion between vector type %0 and scalar type %1">;
7429
7430 // C++ member initializers.
7431 def err_only_constructors_take_base_inits : Error<
7432   "only constructors take base initializers">;
7433
7434 def err_multiple_mem_initialization : Error <
7435   "multiple initializations given for non-static member %0">;
7436 def err_multiple_mem_union_initialization : Error <
7437   "initializing multiple members of union">;
7438 def err_multiple_base_initialization : Error <
7439   "multiple initializations given for base %0">;
7440
7441 def err_mem_init_not_member_or_class : Error<
7442   "member initializer %0 does not name a non-static data member or base "
7443   "class">;
7444
7445 def warn_initializer_out_of_order : Warning<
7446   "%select{field|base class}0 %1 will be initialized after "
7447   "%select{field|base}2 %3">,
7448   InGroup<Reorder>, DefaultIgnore;
7449 def warn_abstract_vbase_init_ignored : Warning<
7450   "initializer for virtual base class %0 of abstract class %1 "
7451   "will never be used">,
7452   InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
7453
7454 def err_base_init_does_not_name_class : Error<
7455   "constructor initializer %0 does not name a class">;
7456 def err_base_init_direct_and_virtual : Error<
7457   "base class initializer %0 names both a direct base class and an "
7458   "inherited virtual base class">;
7459 def err_not_direct_base_or_virtual : Error<
7460   "type %0 is not a direct or virtual base of %1">;
7461
7462 def err_in_class_initializer_non_const : Error<
7463   "non-const static data member must be initialized out of line">;
7464 def err_in_class_initializer_volatile : Error<
7465   "static const volatile data member must be initialized out of line">;
7466 def err_in_class_initializer_bad_type : Error<
7467   "static data member of type %0 must be initialized out of line">;
7468 def ext_in_class_initializer_float_type : ExtWarn<
7469   "in-class initializer for static data member of type %0 is a GNU extension">,
7470   InGroup<GNUStaticFloatInit>;
7471 def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
7472   "in-class initializer for static data member of type %0 requires "
7473   "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
7474 def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
7475 def err_in_class_initializer_literal_type : Error<
7476   "in-class initializer for static data member of type %0 requires "
7477   "'constexpr' specifier">;
7478 def err_in_class_initializer_non_constant : Error<
7479   "in-class initializer for static data member is not a constant expression">;
7480 def err_in_class_initializer_not_yet_parsed : Error<
7481   "default member initializer for %1 needed within definition of enclosing "
7482   "class %0 outside of member functions">;
7483 def note_in_class_initializer_not_yet_parsed : Note<
7484   "default member initializer declared here">;
7485 def err_in_class_initializer_cycle
7486     : Error<"default member initializer for %0 uses itself">;
7487
7488 def ext_in_class_initializer_non_constant : Extension<
7489   "in-class initializer for static data member is not a constant expression; "
7490   "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
7491
7492 def err_thread_dynamic_init : Error<
7493   "initializer for thread-local variable must be a constant expression">;
7494 def err_thread_nontrivial_dtor : Error<
7495   "type of thread-local variable has non-trivial destruction">;
7496 def note_use_thread_local : Note<
7497   "use 'thread_local' to allow this">;
7498
7499 // C++ anonymous unions and GNU anonymous structs/unions
7500 def ext_anonymous_union : Extension<
7501   "anonymous unions are a C11 extension">, InGroup<C11>;
7502 def ext_gnu_anonymous_struct : Extension<
7503   "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
7504 def ext_c11_anonymous_struct : Extension<
7505   "anonymous structs are a C11 extension">, InGroup<C11>;
7506 def err_anonymous_union_not_static : Error<
7507   "anonymous unions at namespace or global scope must be declared 'static'">;
7508 def err_anonymous_union_with_storage_spec : Error<
7509   "anonymous union at class scope must not have a storage specifier">;
7510 def err_anonymous_struct_not_member : Error<
7511   "anonymous %select{structs|structs and classes}0 must be "
7512   "%select{struct or union|class}0 members">;
7513 def err_anonymous_record_member_redecl : Error<
7514   "member of anonymous %select{struct|union}0 redeclares %1">;
7515 def err_anonymous_record_with_type : Error<
7516   "types cannot be declared in an anonymous %select{struct|union}0">;
7517 def ext_anonymous_record_with_type : Extension<
7518   "types declared in an anonymous %select{struct|union}0 are a Microsoft "
7519   "extension">, InGroup<MicrosoftAnonTag>;
7520 def ext_anonymous_record_with_anonymous_type : Extension<
7521   "anonymous types declared in an anonymous %select{struct|union}0 "
7522   "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
7523 def err_anonymous_record_with_function : Error<
7524   "functions cannot be declared in an anonymous %select{struct|union}0">;
7525 def err_anonymous_record_with_static : Error<
7526   "static members cannot be declared in an anonymous %select{struct|union}0">;
7527 def err_anonymous_record_bad_member : Error<
7528   "anonymous %select{struct|union}0 can only contain non-static data members">;
7529 def err_anonymous_record_nonpublic_member : Error<
7530   "anonymous %select{struct|union}0 cannot contain a "
7531   "%select{private|protected}1 data member">;
7532 def ext_ms_anonymous_record : ExtWarn<
7533   "anonymous %select{structs|unions}0 are a Microsoft extension">,
7534   InGroup<MicrosoftAnonTag>;
7535
7536 // C++ local classes
7537 def err_reference_to_local_in_enclosing_context : Error<
7538   "reference to local %select{variable|binding}1 %0 declared in enclosing "
7539   "%select{%3|block literal|lambda expression|context}2">;
7540
7541 def err_static_data_member_not_allowed_in_local_class : Error<
7542   "static data member %0 not allowed in local class %1">;
7543
7544 // C++ derived classes
7545 def err_base_clause_on_union : Error<"unions cannot have base classes">;
7546 def err_base_must_be_class : Error<"base specifier must name a class">;
7547 def err_union_as_base_class : Error<"unions cannot be base classes">;
7548 def err_circular_inheritance : Error<
7549   "circular inheritance between %0 and %1">;
7550 def err_base_class_has_flexible_array_member : Error<
7551   "base class %0 has a flexible array member">;
7552 def err_incomplete_base_class : Error<"base class has incomplete type">;
7553 def err_duplicate_base_class : Error<
7554   "base class %0 specified more than once as a direct base class">;
7555 def warn_inaccessible_base_class : Warning<
7556   "direct base %0 is inaccessible due to ambiguity:%1">,
7557   InGroup<DiagGroup<"inaccessible-base">>;
7558 // FIXME: better way to display derivation?  Pass entire thing into diagclient?
7559 def err_ambiguous_derived_to_base_conv : Error<
7560   "ambiguous conversion from derived class %0 to base class %1:%2">;
7561 def err_ambiguous_memptr_conv : Error<
7562   "ambiguous conversion from pointer to member of %select{base|derived}0 "
7563   "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
7564 def ext_ms_ambiguous_direct_base : ExtWarn<
7565   "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
7566   InGroup<MicrosoftInaccessibleBase>;
7567
7568 def err_memptr_conv_via_virtual : Error<
7569   "conversion from pointer to member of class %0 to pointer to member "
7570   "of class %1 via virtual base %2 is not allowed">;
7571
7572 // C++ member name lookup
7573 def err_ambiguous_member_multiple_subobjects : Error<
7574   "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
7575 def err_ambiguous_member_multiple_subobject_types : Error<
7576   "member %0 found in multiple base classes of different types">;
7577 def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
7578 def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
7579 def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
7580 def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
7581   "declaration in a different namespace">;
7582 def note_hidden_tag : Note<"type declaration hidden">;
7583 def note_hiding_object : Note<"declaration hides type">;
7584
7585 // C++ operator overloading
7586 def err_operator_overload_needs_class_or_enum : Error<
7587   "overloaded %0 must have at least one parameter of class "
7588   "or enumeration type">;
7589
7590 def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
7591 def err_operator_overload_static : Error<
7592   "overloaded %0 cannot be a static member function">;
7593 def err_operator_overload_default_arg : Error<
7594   "parameter of overloaded %0 cannot have a default argument">;
7595 def err_operator_overload_must_be : Error<
7596   "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
7597   "(has %1 parameter%s1)">;
7598
7599 def err_operator_overload_must_be_member : Error<
7600   "overloaded %0 must be a non-static member function">;
7601 def err_operator_overload_post_incdec_must_be_int : Error<
7602   "parameter of overloaded post-%select{increment|decrement}1 operator must "
7603   "have type 'int' (not %0)">;
7604
7605 // C++ allocation and deallocation functions.
7606 def err_operator_new_delete_declared_in_namespace : Error<
7607   "%0 cannot be declared inside a namespace">;
7608 def err_operator_new_delete_declared_static : Error<
7609   "%0 cannot be declared static in global scope">;
7610 def ext_operator_new_delete_declared_inline : ExtWarn<
7611   "replacement function %0 cannot be declared 'inline'">,
7612   InGroup<DiagGroup<"inline-new-delete">>;
7613 def err_operator_new_delete_invalid_result_type : Error<
7614   "%0 must return type %1">;
7615 def err_operator_new_delete_dependent_result_type : Error<
7616   "%0 cannot have a dependent return type; use %1 instead">;
7617 def err_operator_new_delete_too_few_parameters : Error<
7618   "%0 must have at least one parameter">;
7619 def err_operator_new_delete_template_too_few_parameters : Error<
7620   "%0 template must have at least two parameters">;
7621 def warn_operator_new_returns_null : Warning<
7622   "%0 should not return a null pointer unless it is declared 'throw()'"
7623   "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
7624
7625 def err_operator_new_dependent_param_type : Error<
7626   "%0 cannot take a dependent type as first parameter; "
7627   "use size_t (%1) instead">;
7628 def err_operator_new_param_type : Error<
7629   "%0 takes type size_t (%1) as first parameter">;
7630 def err_operator_new_default_arg: Error<
7631   "parameter of %0 cannot have a default argument">;
7632 def err_operator_delete_dependent_param_type : Error<
7633   "%0 cannot take a dependent type as first parameter; use %1 instead">;
7634 def err_operator_delete_param_type : Error<
7635   "first parameter of %0 must have type %1">;
7636 def err_destroying_operator_delete_not_usual : Error<
7637   "destroying operator delete can have only an optional size and optional "
7638   "alignment parameter">;
7639 def note_implicit_delete_this_in_destructor_here : Note<
7640   "while checking implicit 'delete this' for virtual destructor">;
7641 def err_builtin_operator_new_delete_not_usual : Error<
7642   "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
7643   "selects non-usual %select{allocation|deallocation}0 function">;
7644 def note_non_usual_function_declared_here : Note<
7645   "non-usual %0 declared here">;
7646
7647 // C++ literal operators
7648 def err_literal_operator_outside_namespace : Error<
7649   "literal operator %0 must be in a namespace or global scope">;
7650 def err_literal_operator_id_outside_namespace : Error<
7651   "non-namespace scope '%0' cannot have a literal operator member">;
7652 def err_literal_operator_default_argument : Error<
7653   "literal operator cannot have a default argument">;
7654 def err_literal_operator_bad_param_count : Error<
7655   "non-template literal operator must have one or two parameters">;
7656 def err_literal_operator_invalid_param : Error<
7657   "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
7658 def err_literal_operator_param : Error<
7659   "invalid literal operator parameter type %0, did you mean %1?">;
7660 def err_literal_operator_template_with_params : Error<
7661   "literal operator template cannot have any parameters">;
7662 def err_literal_operator_template : Error<
7663   "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
7664 def err_literal_operator_extern_c : Error<
7665   "literal operator must have C++ linkage">;
7666 def ext_string_literal_operator_template : ExtWarn<
7667   "string literal operator templates are a GNU extension">,
7668   InGroup<GNUStringLiteralOperatorTemplate>;
7669 def warn_user_literal_reserved : Warning<
7670   "user-defined literal suffixes not starting with '_' are reserved"
7671   "%select{; no literal will invoke this operator|}0">,
7672   InGroup<UserDefinedLiterals>;
7673
7674 // C++ conversion functions
7675 def err_conv_function_not_member : Error<
7676   "conversion function must be a non-static member function">;
7677 def err_conv_function_return_type : Error<
7678   "conversion function cannot have a return type">;
7679 def err_conv_function_with_params : Error<
7680   "conversion function cannot have any parameters">;
7681 def err_conv_function_variadic : Error<
7682   "conversion function cannot be variadic">;
7683 def err_conv_function_to_array : Error<
7684   "conversion function cannot convert to an array type">;
7685 def err_conv_function_to_function : Error<
7686   "conversion function cannot convert to a function type">;
7687 def err_conv_function_with_complex_decl : Error<
7688   "cannot specify any part of a return type in the "
7689   "declaration of a conversion function"
7690   "%select{"
7691   "; put the complete type after 'operator'|"
7692   "; use a typedef to declare a conversion to %1|"
7693   "; use an alias template to declare a conversion to %1|"
7694   "}0">;
7695 def err_conv_function_redeclared : Error<
7696   "conversion function cannot be redeclared">;
7697 def warn_conv_to_self_not_used : Warning<
7698   "conversion function converting %0 to itself will never be used">;
7699 def warn_conv_to_base_not_used : Warning<
7700   "conversion function converting %0 to its base class %1 will never be used">;
7701 def warn_conv_to_void_not_used : Warning<
7702   "conversion function converting %0 to %1 will never be used">;
7703
7704 def warn_not_compound_assign : Warning<
7705   "use of unary operator that may be intended as compound assignment (%0=)">;
7706
7707 // C++11 explicit conversion operators
7708 def ext_explicit_conversion_functions : ExtWarn<
7709   "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
7710 def warn_cxx98_compat_explicit_conversion_functions : Warning<
7711   "explicit conversion functions are incompatible with C++98">,
7712   InGroup<CXX98Compat>, DefaultIgnore;
7713
7714 // C++11 defaulted functions
7715 def err_defaulted_special_member_params : Error<
7716   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
7717   "have default arguments">;
7718 def err_defaulted_special_member_variadic : Error<
7719   "an explicitly-defaulted %select{|copy |move }0constructor cannot "
7720   "be variadic">;
7721 def err_defaulted_special_member_return_type : Error<
7722   "explicitly-defaulted %select{copy|move}0 assignment operator must "
7723   "return %1">;
7724 def err_defaulted_special_member_quals : Error<
7725   "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
7726   "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
7727 def err_defaulted_special_member_volatile_param : Error<
7728   "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
7729   "may not be volatile">;
7730 def err_defaulted_special_member_move_const_param : Error<
7731   "the parameter for an explicitly-defaulted move "
7732   "%select{constructor|assignment operator}0 may not be const">;
7733 def err_defaulted_special_member_copy_const_param : Error<
7734   "the parameter for this explicitly-defaulted copy "
7735   "%select{constructor|assignment operator}0 is const, but a member or base "
7736   "requires it to be non-const">;
7737 def err_defaulted_copy_assign_not_ref : Error<
7738   "the parameter for an explicitly-defaulted copy assignment operator must be an "
7739   "lvalue reference type">;
7740 def err_incorrect_defaulted_exception_spec : Error<
7741   "exception specification of explicitly defaulted "
7742   "%sub{select_special_member_kind}0 does not match the calculated one">;
7743 def err_incorrect_defaulted_constexpr : Error<
7744   "defaulted definition of %sub{select_special_member_kind}0 "
7745   "is not constexpr">;
7746 def warn_defaulted_method_deleted : Warning<
7747   "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
7748   "deleted">, InGroup<DiagGroup<"defaulted-function-deleted">>;
7749 def err_out_of_line_default_deletes : Error<
7750   "defaulting this %sub{select_special_member_kind}0 "
7751   "would delete it after its first declaration">;
7752 def note_deleted_type_mismatch : Note<
7753   "function is implicitly deleted because its declared type does not match "
7754   "the type of an implicit %sub{select_special_member_kind}0">;
7755 def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
7756   "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
7757   "different from the implicit type is incompatible with C++ standards before "
7758   "C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
7759 def warn_vbase_moved_multiple_times : Warning<
7760   "defaulted move assignment operator of %0 will move assign virtual base "
7761   "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
7762 def note_vbase_moved_here : Note<
7763   "%select{%1 is a virtual base class of base class %2 declared here|"
7764   "virtual base class %1 declared here}0">;
7765
7766 def ext_implicit_exception_spec_mismatch : ExtWarn<
7767   "function previously declared with an %select{explicit|implicit}0 exception "
7768   "specification redeclared with an %select{implicit|explicit}0 exception "
7769   "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
7770
7771 def warn_ptr_arith_precedes_bounds : Warning<
7772   "the pointer decremented by %0 refers before the beginning of the array">,
7773   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
7774 def warn_ptr_arith_exceeds_bounds : Warning<
7775   "the pointer incremented by %0 refers past the end of the array (that "
7776   "contains %1 element%s2)">,
7777   InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
7778 def warn_array_index_precedes_bounds : Warning<
7779   "array index %0 is before the beginning of the array">,
7780   InGroup<ArrayBounds>;
7781 def warn_array_index_exceeds_bounds : Warning<
7782   "array index %0 is past the end of the array (which contains %1 "
7783   "element%s2)">, InGroup<ArrayBounds>;
7784 def note_array_index_out_of_bounds : Note<
7785   "array %0 declared here">;
7786
7787 def warn_printf_insufficient_data_args : Warning<
7788   "more '%%' conversions than data arguments">, InGroup<Format>;
7789 def warn_printf_data_arg_not_used : Warning<
7790   "data argument not used by format string">, InGroup<FormatExtraArgs>;
7791 def warn_format_invalid_conversion : Warning<
7792   "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
7793 def warn_printf_incomplete_specifier : Warning<
7794   "incomplete format specifier">, InGroup<Format>;
7795 def warn_missing_format_string : Warning<
7796   "format string missing">, InGroup<Format>;
7797 def warn_scanf_nonzero_width : Warning<
7798   "zero field width in scanf format string is unused">,
7799   InGroup<Format>;
7800 def warn_format_conversion_argument_type_mismatch : Warning<
7801   "format specifies type %0 but the argument has "
7802   "%select{type|underlying type}2 %1">,
7803   InGroup<Format>;
7804 def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
7805   "format specifies type %0 but the argument has "
7806   "%select{type|underlying type}2 %1">,
7807   InGroup<FormatPedantic>;
7808 def warn_format_argument_needs_cast : Warning<
7809   "%select{values of type|enum values with underlying type}2 '%0' should not "
7810   "be used as format arguments; add an explicit cast to %1 instead">,
7811   InGroup<Format>;
7812 def warn_format_argument_needs_cast_pedantic : Warning<
7813   "%select{values of type|enum values with underlying type}2 '%0' should not "
7814   "be used as format arguments; add an explicit cast to %1 instead">,
7815   InGroup<FormatPedantic>, DefaultIgnore;
7816 def warn_printf_positional_arg_exceeds_data_args : Warning <
7817   "data argument position '%0' exceeds the number of data arguments (%1)">,
7818   InGroup<Format>;
7819 def warn_format_zero_positional_specifier : Warning<
7820   "position arguments in format strings start counting at 1 (not 0)">,
7821   InGroup<Format>;
7822 def warn_format_invalid_positional_specifier : Warning<
7823   "invalid position specified for %select{field width|field precision}0">,
7824   InGroup<Format>;
7825 def warn_format_mix_positional_nonpositional_args : Warning<
7826   "cannot mix positional and non-positional arguments in format string">,
7827   InGroup<Format>;
7828 def warn_static_array_too_small : Warning<
7829   "array argument is too small; contains %0 elements, callee requires at least %1">,
7830   InGroup<ArrayBounds>;
7831 def note_callee_static_array : Note<
7832   "callee declares array parameter as static here">;
7833 def warn_empty_format_string : Warning<
7834   "format string is empty">, InGroup<FormatZeroLength>;
7835 def warn_format_string_is_wide_literal : Warning<
7836   "format string should not be a wide string">, InGroup<Format>;
7837 def warn_printf_format_string_contains_null_char : Warning<
7838   "format string contains '\\0' within the string body">, InGroup<Format>;
7839 def warn_printf_format_string_not_null_terminated : Warning<
7840   "format string is not null-terminated">, InGroup<Format>;
7841 def warn_printf_asterisk_missing_arg : Warning<
7842   "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
7843   InGroup<Format>;
7844 def warn_printf_asterisk_wrong_type : Warning<
7845   "field %select{width|precision}0 should have type %1, but argument has type %2">,
7846   InGroup<Format>;
7847 def warn_printf_nonsensical_optional_amount: Warning<
7848   "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
7849   InGroup<Format>;
7850 def warn_printf_nonsensical_flag: Warning<
7851   "flag '%0' results in undefined behavior with '%1' conversion specifier">,
7852   InGroup<Format>;
7853 def warn_format_nonsensical_length: Warning<
7854   "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
7855   InGroup<Format>;
7856 def warn_format_non_standard_positional_arg: Warning<
7857   "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
7858 def warn_format_non_standard: Warning<
7859   "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
7860   InGroup<FormatNonStandard>, DefaultIgnore;
7861 def warn_format_non_standard_conversion_spec: Warning<
7862   "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
7863   InGroup<FormatNonStandard>, DefaultIgnore;
7864 def err_invalid_mask_type_size : Error<
7865   "mask type size must be between 1-byte and 8-bytes">;
7866 def warn_format_invalid_annotation : Warning<
7867   "using '%0' format specifier annotation outside of os_log()/os_trace()">,
7868   InGroup<Format>;
7869 def warn_format_P_no_precision : Warning<
7870   "using '%%P' format specifier without precision">,
7871   InGroup<Format>;
7872 def warn_printf_ignored_flag: Warning<
7873   "flag '%0' is ignored when flag '%1' is present">,
7874   InGroup<Format>;
7875 def warn_printf_empty_objc_flag: Warning<
7876   "missing object format flag">,
7877   InGroup<Format>;
7878 def warn_printf_ObjCflags_without_ObjCConversion: Warning<
7879   "object format flags cannot be used with '%0' conversion specifier">,
7880   InGroup<Format>;
7881 def warn_printf_invalid_objc_flag: Warning<
7882     "'%0' is not a valid object format flag">,
7883     InGroup<Format>;
7884 def warn_scanf_scanlist_incomplete : Warning<
7885   "no closing ']' for '%%[' in scanf format string">,
7886   InGroup<Format>;
7887 def note_format_string_defined : Note<"format string is defined here">;
7888 def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
7889 def note_printf_c_str: Note<"did you mean to call the %0 method?">;
7890 def note_format_security_fixit: Note<
7891   "treat the string as an argument to avoid this">;
7892
7893 def warn_null_arg : Warning<
7894   "null passed to a callee that requires a non-null argument">,
7895   InGroup<NonNull>;
7896 def warn_null_ret : Warning<
7897   "null returned from %select{function|method}0 that requires a non-null return value">,
7898   InGroup<NonNull>;
7899
7900 def err_lifetimebound_no_object_param : Error<
7901   "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
7902   "function has no implicit object parameter">;
7903 def err_lifetimebound_ctor_dtor : Error<
7904   "'lifetimebound' attribute cannot be applied to a "
7905   "%select{constructor|destructor}0">;
7906
7907 // CHECK: returning address/reference of stack memory
7908 def warn_ret_stack_addr_ref : Warning<
7909   "%select{address of|reference to}0 stack memory associated with "
7910   "%select{local variable|parameter}2 %1 returned">,
7911   InGroup<ReturnStackAddress>;
7912 def warn_ret_local_temp_addr_ref : Warning<
7913   "returning %select{address of|reference to}0 local temporary object">,
7914   InGroup<ReturnStackAddress>;
7915 def warn_ret_addr_label : Warning<
7916   "returning address of label, which is local">,
7917   InGroup<ReturnStackAddress>;
7918 def err_ret_local_block : Error<
7919   "returning block that lives on the local stack">;
7920 def note_local_var_initializer : Note<
7921   "%select{via initialization of|binding reference}0 variable "
7922   "%select{%2 |}1here">;
7923 def note_init_with_default_member_initalizer : Note<
7924   "initializing field %0 with default member initializer">;
7925
7926 // Check for initializing a member variable with the address or a reference to
7927 // a constructor parameter.
7928 def warn_bind_ref_member_to_parameter : Warning<
7929   "binding reference member %0 to stack allocated "
7930   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
7931 def warn_init_ptr_member_to_parameter_addr : Warning<
7932   "initializing pointer member %0 with the stack address of "
7933   "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
7934 def note_ref_or_ptr_member_declared_here : Note<
7935   "%select{reference|pointer}0 member declared here">;
7936
7937 def err_dangling_member : Error<
7938   "%select{reference|backing array for 'std::initializer_list'}2 "
7939   "%select{|subobject of }1member %0 "
7940   "%select{binds to|is}2 a temporary object "
7941   "whose lifetime would be shorter than the lifetime of "
7942   "the constructed object">;
7943 def warn_dangling_member : Warning<
7944   "%select{reference|backing array for 'std::initializer_list'}2 "
7945   "%select{|subobject of }1member %0 "
7946   "%select{binds to|is}2 a temporary object "
7947   "whose lifetime is shorter than the lifetime of the constructed object">,
7948   InGroup<DanglingField>;
7949 def note_lifetime_extending_member_declared_here : Note<
7950   "%select{%select{reference|'std::initializer_list'}0 member|"
7951   "member with %select{reference|'std::initializer_list'}0 subobject}1 "
7952   "declared here">;
7953 def warn_dangling_variable : Warning<
7954   "%select{temporary %select{whose address is used as value of|"
7955   "%select{|implicitly }2bound to}4 "
7956   "%select{%select{|reference }4member of local variable|"
7957   "local %select{variable|reference}4}1|"
7958   "array backing "
7959   "%select{initializer list subobject of local variable|"
7960   "local initializer list}1}0 "
7961   "%select{%3 |}2will be destroyed at the end of the full-expression">,
7962   InGroup<Dangling>;
7963 def warn_new_dangling_reference : Warning<
7964   "temporary bound to reference member of allocated object "
7965   "will be destroyed at the end of the full-expression">,
7966   InGroup<DanglingField>;
7967 def warn_new_dangling_initializer_list : Warning<
7968   "array backing "
7969   "%select{initializer list subobject of the allocated object|"
7970   "the allocated initializer list}0 "
7971   "will be destroyed at the end of the full-expression">,
7972   InGroup<DanglingInitializerList>;
7973 def warn_unsupported_lifetime_extension : Warning<
7974   "sorry, lifetime extension of "
7975   "%select{temporary|backing array of initializer list}0 created "
7976   "by aggregate initialization using default member initializer "
7977   "is not supported; lifetime of %select{temporary|backing array}0 "
7978   "will end at the end of the full-expression">, InGroup<Dangling>;
7979
7980 // For non-floating point, expressions of the form x == x or x != x
7981 // should result in a warning, since these always evaluate to a constant.
7982 // Array comparisons have similar warnings
7983 def warn_comparison_always : Warning<
7984   "%select{self-|array }0comparison always evaluates to %select{a constant|%2}1">,
7985   InGroup<TautologicalCompare>;
7986 def warn_comparison_bitwise_always : Warning<
7987   "bitwise comparison always evaluates to %select{false|true}0">,
7988   InGroup<TautologicalCompare>;
7989 def warn_tautological_overlap_comparison : Warning<
7990   "overlapping comparisons always evaluate to %select{false|true}0">,
7991   InGroup<TautologicalOverlapCompare>, DefaultIgnore;
7992
7993 def warn_stringcompare : Warning<
7994   "result of comparison against %select{a string literal|@encode}0 is "
7995   "unspecified (use strncmp instead)">,
7996   InGroup<StringCompare>;
7997
7998 def warn_identity_field_assign : Warning<
7999   "assigning %select{field|instance variable}0 to itself">,
8000   InGroup<SelfAssignmentField>;
8001
8002 // Type safety attributes
8003 def err_type_tag_for_datatype_not_ice : Error<
8004   "'type_tag_for_datatype' attribute requires the initializer to be "
8005   "an %select{integer|integral}0 constant expression">;
8006 def err_type_tag_for_datatype_too_large : Error<
8007   "'type_tag_for_datatype' attribute requires the initializer to be "
8008   "an %select{integer|integral}0 constant expression "
8009   "that can be represented by a 64 bit integer">;
8010 def err_tag_index_out_of_range : Error<
8011   "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
8012 def warn_type_tag_for_datatype_wrong_kind : Warning<
8013   "this type tag was not designed to be used with this function">,
8014   InGroup<TypeSafety>;
8015 def warn_type_safety_type_mismatch : Warning<
8016   "argument type %0 doesn't match specified %1 type tag "
8017   "%select{that requires %3|}2">, InGroup<TypeSafety>;
8018 def warn_type_safety_null_pointer_required : Warning<
8019   "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
8020
8021 // Generic selections.
8022 def err_assoc_type_incomplete : Error<
8023   "type %0 in generic association incomplete">;
8024 def err_assoc_type_nonobject : Error<
8025   "type %0 in generic association not an object type">;
8026 def err_assoc_type_variably_modified : Error<
8027   "type %0 in generic association is a variably modified type">;
8028 def err_assoc_compatible_types : Error<
8029   "type %0 in generic association compatible with previously specified type %1">;
8030 def note_compat_assoc : Note<
8031   "compatible type %0 specified here">;
8032 def err_generic_sel_no_match : Error<
8033   "controlling expression type %0 not compatible with any generic association type">;
8034 def err_generic_sel_multi_match : Error<
8035   "controlling expression type %0 compatible with %1 generic association types">;
8036
8037
8038 // Blocks
8039 def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
8040   " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
8041 def err_block_returning_array_function : Error<
8042   "block cannot return %select{array|function}0 type %1">;
8043
8044 // Builtin annotation
8045 def err_builtin_annotation_first_arg : Error<
8046   "first argument to __builtin_annotation must be an integer">;
8047 def err_builtin_annotation_second_arg : Error<
8048   "second argument to __builtin_annotation must be a non-wide string constant">;
8049 def err_msvc_annotation_wide_str : Error<
8050   "arguments to __annotation must be wide string constants">;
8051
8052 // CFString checking
8053 def err_cfstring_literal_not_string_constant : Error<
8054   "CFString literal is not a string constant">;
8055 def warn_cfstring_truncated : Warning<
8056   "input conversion stopped due to an input byte that does not "
8057   "belong to the input codeset UTF-8">,
8058   InGroup<DiagGroup<"CFString-literal">>;
8059
8060 // os_log checking
8061 // TODO: separate diagnostic for os_trace()
8062 def err_os_log_format_not_string_constant : Error<
8063   "os_log() format argument is not a string constant">;
8064 def err_os_log_argument_too_big : Error<
8065   "os_log() argument %0 is too big (%1 bytes, max %2)">;
8066 def warn_os_log_format_narg : Error<
8067  "os_log() '%%n' format specifier is not allowed">, DefaultError;
8068
8069 // Statements.
8070 def err_continue_not_in_loop : Error<
8071   "'continue' statement not in loop statement">;
8072 def err_break_not_in_loop_or_switch : Error<
8073   "'break' statement not in loop or switch statement">;
8074 def warn_loop_ctrl_binds_to_inner : Warning<
8075   "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
8076   InGroup<GccCompat>;
8077 def warn_break_binds_to_switch : Warning<
8078   "'break' is bound to loop, GCC binds it to switch">,
8079   InGroup<GccCompat>;
8080 def err_default_not_in_switch : Error<
8081   "'default' statement not in switch statement">;
8082 def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
8083 def warn_bool_switch_condition : Warning<
8084   "switch condition has boolean value">, InGroup<SwitchBool>;
8085 def warn_case_value_overflow : Warning<
8086   "overflow converting case value to switch condition type (%0 to %1)">,
8087   InGroup<Switch>;
8088 def err_duplicate_case : Error<"duplicate case value '%0'">;
8089 def err_duplicate_case_differing_expr : Error<
8090   "duplicate case value: '%0' and '%1' both equal '%2'">;
8091 def warn_case_empty_range : Warning<"empty case range specified">;
8092 def warn_missing_case_for_condition :
8093   Warning<"no case matching constant switch condition '%0'">;
8094
8095 def warn_def_missing_case : Warning<"%plural{"
8096   "1:enumeration value %1 not explicitly handled in switch|"
8097   "2:enumeration values %1 and %2 not explicitly handled in switch|"
8098   "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
8099   ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
8100   InGroup<SwitchEnum>, DefaultIgnore;
8101
8102 def warn_missing_case : Warning<"%plural{"
8103   "1:enumeration value %1 not handled in switch|"
8104   "2:enumeration values %1 and %2 not handled in switch|"
8105   "3:enumeration values %1, %2, and %3 not handled in switch|"
8106   ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
8107   InGroup<Switch>;
8108
8109 def warn_unannotated_fallthrough : Warning<
8110   "unannotated fall-through between switch labels">,
8111   InGroup<ImplicitFallthrough>, DefaultIgnore;
8112 def warn_unannotated_fallthrough_per_function : Warning<
8113   "unannotated fall-through between switch labels in partly-annotated "
8114   "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
8115 def note_insert_fallthrough_fixit : Note<
8116   "insert '%0;' to silence this warning">;
8117 def note_insert_break_fixit : Note<
8118   "insert 'break;' to avoid fall-through">;
8119 def err_fallthrough_attr_wrong_target : Error<
8120   "%0 attribute is only allowed on empty statements">;
8121 def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
8122 def err_fallthrough_attr_outside_switch : Error<
8123   "fallthrough annotation is outside switch statement">;
8124 def err_fallthrough_attr_invalid_placement : Error<
8125   "fallthrough annotation does not directly precede switch label">;
8126 def warn_fallthrough_attr_unreachable : Warning<
8127   "fallthrough annotation in unreachable code">,
8128   InGroup<ImplicitFallthrough>, DefaultIgnore;
8129
8130 def warn_unreachable_default : Warning<
8131   "default label in switch which covers all enumeration values">,
8132   InGroup<CoveredSwitchDefault>, DefaultIgnore;
8133 def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
8134   InGroup<Switch>;
8135 def warn_not_in_enum_assignment : Warning<"integer constant not in range "
8136   "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
8137 def err_typecheck_statement_requires_scalar : Error<
8138   "statement requires expression of scalar type (%0 invalid)">;
8139 def err_typecheck_statement_requires_integer : Error<
8140   "statement requires expression of integer type (%0 invalid)">;
8141 def err_multiple_default_labels_defined : Error<
8142   "multiple default labels in one switch">;
8143 def err_switch_multiple_conversions : Error<
8144   "multiple conversions from switch condition type %0 to an integral or "
8145   "enumeration type">;
8146 def note_switch_conversion : Note<
8147   "conversion to %select{integral|enumeration}0 type %1">;
8148 def err_switch_explicit_conversion : Error<
8149   "switch condition type %0 requires explicit conversion to %1">;
8150 def err_switch_incomplete_class_type : Error<
8151   "switch condition has incomplete class type %0">;
8152
8153 def warn_empty_if_body : Warning<
8154   "if statement has empty body">, InGroup<EmptyBody>;
8155 def warn_empty_for_body : Warning<
8156   "for loop has empty body">, InGroup<EmptyBody>;
8157 def warn_empty_range_based_for_body : Warning<
8158   "range-based for loop has empty body">, InGroup<EmptyBody>;
8159 def warn_empty_while_body : Warning<
8160   "while loop has empty body">, InGroup<EmptyBody>;
8161 def warn_empty_switch_body : Warning<
8162   "switch statement has empty body">, InGroup<EmptyBody>;
8163 def note_empty_body_on_separate_line : Note<
8164   "put the semicolon on a separate line to silence this warning">;
8165
8166 def err_va_start_captured_stmt : Error<
8167   "'va_start' cannot be used in a captured statement">;
8168 def err_va_start_outside_function : Error<
8169   "'va_start' cannot be used outside a function">;
8170 def err_va_start_fixed_function : Error<
8171   "'va_start' used in function with fixed args">;
8172 def err_va_start_used_in_wrong_abi_function : Error<
8173   "'va_start' used in %select{System V|Win64}0 ABI function">;
8174 def err_ms_va_start_used_in_sysv_function : Error<
8175   "'__builtin_ms_va_start' used in System V ABI function">;
8176 def warn_second_arg_of_va_start_not_last_named_param : Warning<
8177   "second argument to 'va_start' is not the last named parameter">,
8178   InGroup<Varargs>;
8179 def warn_va_start_type_is_undefined : Warning<
8180   "passing %select{an object that undergoes default argument promotion|"
8181   "an object of reference type|a parameter declared with the 'register' "
8182   "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
8183 def err_first_argument_to_va_arg_not_of_type_va_list : Error<
8184   "first argument to 'va_arg' is of type %0 and not 'va_list'">;
8185 def err_second_parameter_to_va_arg_incomplete: Error<
8186   "second argument to 'va_arg' is of incomplete type %0">;
8187 def err_second_parameter_to_va_arg_abstract: Error<
8188   "second argument to 'va_arg' is of abstract type %0">;
8189 def warn_second_parameter_to_va_arg_not_pod : Warning<
8190   "second argument to 'va_arg' is of non-POD type %0">,
8191   InGroup<NonPODVarargs>, DefaultError;
8192 def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
8193   "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
8194   InGroup<NonPODVarargs>, DefaultError;
8195 def warn_second_parameter_to_va_arg_never_compatible : Warning<
8196   "second argument to 'va_arg' is of promotable type %0; this va_arg has "
8197   "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
8198
8199 def warn_return_missing_expr : Warning<
8200   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8201   InGroup<ReturnType>;
8202 def ext_return_missing_expr : ExtWarn<
8203   "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8204   InGroup<ReturnType>;
8205 def ext_return_has_expr : ExtWarn<
8206   "%select{void function|void method|constructor|destructor}1 %0 "
8207   "should not return a value">,
8208   DefaultError, InGroup<ReturnType>;
8209 def ext_return_has_void_expr : Extension<
8210   "void %select{function|method|block}1 %0 should not return void expression">;
8211 def err_return_init_list : Error<
8212   "%select{void function|void method|constructor|destructor}1 %0 "
8213   "must not return a value">;
8214 def err_ctor_dtor_returns_void : Error<
8215   "%select{constructor|destructor}1 %0 must not return void expression">;
8216 def warn_noreturn_function_has_return_expr : Warning<
8217   "function %0 declared 'noreturn' should not return">,
8218   InGroup<InvalidNoreturn>;
8219 def warn_falloff_noreturn_function : Warning<
8220   "function declared 'noreturn' should not return">,
8221   InGroup<InvalidNoreturn>;
8222 def err_noreturn_block_has_return_expr : Error<
8223   "block declared 'noreturn' should not return">;
8224 def err_noreturn_missing_on_first_decl : Error<
8225   "function declared '[[noreturn]]' after its first declaration">;
8226 def note_noreturn_missing_first_decl : Note<
8227   "declaration missing '[[noreturn]]' attribute is here">;
8228 def err_carries_dependency_missing_on_first_decl : Error<
8229   "%select{function|parameter}0 declared '[[carries_dependency]]' "
8230   "after its first declaration">;
8231 def note_carries_dependency_missing_first_decl : Note<
8232   "declaration missing '[[carries_dependency]]' attribute is here">;
8233 def err_carries_dependency_param_not_function_decl : Error<
8234   "'[[carries_dependency]]' attribute only allowed on parameter in a function "
8235   "declaration or lambda">;
8236 def err_block_on_nonlocal : Error<
8237   "__block attribute not allowed, only allowed on local variables">;
8238 def err_block_on_vm : Error<
8239   "__block attribute not allowed on declaration with a variably modified type">;
8240
8241 def err_vec_builtin_non_vector : Error<
8242  "first two arguments to %0 must be vectors">;
8243 def err_vec_builtin_incompatible_vector : Error<
8244   "first two arguments to %0 must have the same type">;
8245 def err_vsx_builtin_nonconstant_argument : Error<
8246   "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
8247
8248 def err_shufflevector_nonconstant_argument : Error<
8249   "index for __builtin_shufflevector must be a constant integer">;
8250 def err_shufflevector_argument_too_large : Error<
8251   "index for __builtin_shufflevector must be less than the total number "
8252   "of vector elements">;
8253
8254 def err_convertvector_non_vector : Error<
8255   "first argument to __builtin_convertvector must be a vector">;
8256 def err_convertvector_non_vector_type : Error<
8257   "second argument to __builtin_convertvector must be a vector type">;
8258 def err_convertvector_incompatible_vector : Error<
8259   "first two arguments to __builtin_convertvector must have the same number of elements">;
8260
8261 def err_first_argument_to_cwsc_not_call : Error<
8262   "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
8263 def err_first_argument_to_cwsc_block_call : Error<
8264   "first argument to __builtin_call_with_static_chain must not be a block call">;
8265 def err_first_argument_to_cwsc_builtin_call : Error<
8266   "first argument to __builtin_call_with_static_chain must not be a builtin call">;
8267 def err_first_argument_to_cwsc_pdtor_call : Error<
8268   "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
8269 def err_second_argument_to_cwsc_not_pointer : Error<
8270   "second argument to __builtin_call_with_static_chain must be of pointer type">;
8271
8272 def err_vector_incorrect_num_initializers : Error<
8273   "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
8274 def err_altivec_empty_initializer : Error<"expected initializer">;
8275
8276 def err_invalid_neon_type_code : Error<
8277   "incompatible constant for this __builtin_neon function">;
8278 def err_argument_invalid_range : Error<
8279   "argument value %0 is outside the valid range [%1, %2]">;
8280 def warn_argument_invalid_range : Warning<
8281   "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
8282   InGroup<DiagGroup<"argument-outside-range">>;
8283 def err_argument_not_multiple : Error<
8284   "argument should be a multiple of %0">;
8285 def warn_neon_vector_initializer_non_portable : Warning<
8286   "vector initializers are not compatible with NEON intrinsics in big endian "
8287   "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
8288 def note_neon_vector_initializer_non_portable : Note<
8289   "consider using vld1_%0%1() to initialize a vector from memory, or "
8290   "vcreate_%0%1() to initialize from an integer constant">;
8291 def note_neon_vector_initializer_non_portable_q : Note<
8292   "consider using vld1q_%0%1() to initialize a vector from memory, or "
8293   "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
8294   "constants">;
8295 def err_systemz_invalid_tabort_code : Error<
8296   "invalid transaction abort code">;
8297 def err_64_bit_builtin_32_bit_tgt : Error<
8298   "this builtin is only available on 64-bit targets">;
8299 def err_32_bit_builtin_64_bit_tgt : Error<
8300   "this builtin is only available on 32-bit targets">;
8301 def err_builtin_x64_aarch64_only : Error<
8302   "this builtin is only available on x86-64 and aarch64 targets">;
8303 def err_ppc_builtin_only_on_pwr7 : Error<
8304   "this builtin is only valid on POWER7 or later CPUs">;
8305 def err_x86_builtin_invalid_rounding : Error<
8306   "invalid rounding argument">;
8307 def err_x86_builtin_invalid_scale : Error<
8308   "scale argument must be 1, 2, 4, or 8">;
8309 def err_hexagon_builtin_unsupported_cpu : Error<
8310   "builtin is not supported on this CPU">;
8311 def err_hexagon_builtin_requires_hvx : Error<
8312   "builtin requires HVX">;
8313 def err_hexagon_builtin_unsupported_hvx : Error<
8314   "builtin is not supported on this version of HVX">;
8315
8316 def err_builtin_target_unsupported : Error<
8317   "builtin is not supported on this target">;
8318 def err_builtin_longjmp_unsupported : Error<
8319   "__builtin_longjmp is not supported for the current target">;
8320 def err_builtin_setjmp_unsupported : Error<
8321   "__builtin_setjmp is not supported for the current target">;
8322
8323 def err_builtin_longjmp_invalid_val : Error<
8324   "argument to __builtin_longjmp must be a constant 1">;
8325 def err_builtin_requires_language : Error<"'%0' is only available in %1">;
8326
8327 def err_constant_integer_arg_type : Error<
8328   "argument to %0 must be a constant integer">;
8329
8330 def ext_mixed_decls_code : Extension<
8331   "ISO C90 forbids mixing declarations and code">,
8332   InGroup<DiagGroup<"declaration-after-statement">>;
8333
8334 def err_non_local_variable_decl_in_for : Error<
8335   "declaration of non-local variable in 'for' loop">;
8336 def err_non_variable_decl_in_for : Error<
8337   "non-variable declaration in 'for' loop">;
8338 def err_toomany_element_decls : Error<
8339   "only one element declaration is allowed">;
8340 def err_selector_element_not_lvalue : Error<
8341   "selector element is not a valid lvalue">;
8342 def err_selector_element_type : Error<
8343   "selector element type %0 is not a valid object">;
8344 def err_selector_element_const_type : Error<
8345   "selector element of type %0 cannot be a constant l-value expression">;
8346 def err_collection_expr_type : Error<
8347   "the type %0 is not a pointer to a fast-enumerable object">;
8348 def warn_collection_expr_type : Warning<
8349   "collection expression type %0 may not respond to %1">;
8350
8351 def err_invalid_conversion_between_ext_vectors : Error<
8352   "invalid conversion between ext-vector type %0 and %1">;
8353
8354 def warn_duplicate_attribute_exact : Warning<
8355   "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
8356
8357 def warn_duplicate_attribute : Warning<
8358   "attribute %0 is already applied with different parameters">,
8359   InGroup<IgnoredAttributes>;
8360
8361 def warn_sync_fetch_and_nand_semantics_change : Warning<
8362   "the semantics of this intrinsic changed with GCC "
8363   "version 4.4 - the newer semantics are provided here">,
8364   InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
8365
8366 // Type
8367 def ext_invalid_sign_spec : Extension<"'%0' cannot be signed or unsigned">;
8368 def warn_receiver_forward_class : Warning<
8369     "receiver %0 is a forward class and corresponding @interface may not exist">,
8370     InGroup<ForwardClassReceiver>;
8371 def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
8372 def ext_missing_declspec : ExtWarn<
8373   "declaration specifier missing, defaulting to 'int'">;
8374 def ext_missing_type_specifier : ExtWarn<
8375   "type specifier missing, defaults to 'int'">,
8376   InGroup<ImplicitInt>;
8377 def err_decimal_unsupported : Error<
8378   "GNU decimal type extension not supported">;
8379 def err_missing_type_specifier : Error<
8380   "C++ requires a type specifier for all declarations">;
8381 def err_objc_array_of_interfaces : Error<
8382   "array of interface %0 is invalid (probably should be an array of pointers)">;
8383 def ext_c99_array_usage : Extension<
8384   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
8385   "feature">, InGroup<C99>;
8386 def err_c99_array_usage_cxx : Error<
8387   "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
8388   "feature, not permitted in C++">;
8389 def err_type_unsupported : Error<
8390   "%0 is not supported on this target">;
8391 def err_nsconsumed_attribute_mismatch : Error<
8392   "overriding method has mismatched ns_consumed attribute on its"
8393   " parameter">;
8394 def err_nsreturns_retained_attribute_mismatch : Error<
8395   "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
8396   " attributes">;
8397 def warn_nsconsumed_attribute_mismatch : Warning<
8398   err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
8399 def warn_nsreturns_retained_attribute_mismatch : Warning<
8400   err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
8401
8402 def note_getter_unavailable : Note<
8403   "or because setter is declared here, but no getter method %0 is found">;
8404 def err_invalid_protocol_qualifiers : Error<
8405   "invalid protocol qualifiers on non-ObjC type">;
8406 def warn_ivar_use_hidden : Warning<
8407   "local declaration of %0 hides instance variable">,
8408    InGroup<ShadowIvar>;
8409 def warn_direct_initialize_call : Warning<
8410   "explicit call to +initialize results in duplicate call to +initialize">,
8411    InGroup<ExplicitInitializeCall>;
8412 def warn_direct_super_initialize_call : Warning<
8413   "explicit call to [super initialize] should only be in implementation "
8414   "of +initialize">,
8415    InGroup<ExplicitInitializeCall>;
8416 def err_ivar_use_in_class_method : Error<
8417   "instance variable %0 accessed in class method">;
8418 def err_private_ivar_access : Error<"instance variable %0 is private">,
8419   AccessControl;
8420 def err_protected_ivar_access : Error<"instance variable %0 is protected">,
8421   AccessControl;
8422 def warn_maynot_respond : Warning<"%0 may not respond to %1">;
8423 def ext_typecheck_base_super : Warning<
8424   "method parameter type "
8425   "%diff{$ does not match super class method parameter type $|"
8426   "does not match super class method parameter type}0,1">,
8427    InGroup<SuperSubClassMismatch>, DefaultIgnore;
8428 def warn_missing_method_return_type : Warning<
8429   "method has no return type specified; defaults to 'id'">,
8430   InGroup<MissingMethodReturnType>, DefaultIgnore;
8431 def warn_direct_ivar_access : Warning<"instance variable %0 is being "
8432   "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
8433
8434 // Spell-checking diagnostics
8435 def err_unknown_typename : Error<
8436   "unknown type name %0">;
8437 def err_unknown_type_or_class_name_suggest : Error<
8438   "unknown %select{type|class}1 name %0; did you mean %2?">;
8439 def err_unknown_typename_suggest : Error<
8440   "unknown type name %0; did you mean %1?">;
8441 def err_unknown_nested_typename_suggest : Error<
8442   "no type named %0 in %1; did you mean %select{|simply }2%3?">;
8443 def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
8444 def err_undeclared_use_suggest : Error<
8445   "use of undeclared %0; did you mean %1?">;
8446 def err_undeclared_var_use_suggest : Error<
8447   "use of undeclared identifier %0; did you mean %1?">;
8448 def err_no_template : Error<"no template named %0">;
8449 def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
8450 def err_no_member_template : Error<"no template named %0 in %1">;
8451 def err_no_member_template_suggest : Error<
8452   "no template named %0 in %1; did you mean %select{|simply }2%3?">;
8453 def err_non_template_in_template_id : Error<
8454   "%0 does not name a template but is followed by template arguments">;
8455 def err_non_template_in_template_id_suggest : Error<
8456   "%0 does not name a template but is followed by template arguments; "
8457   "did you mean %1?">;
8458 def err_non_template_in_member_template_id_suggest : Error<
8459   "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
8460 def note_non_template_in_template_id_found : Note<
8461   "non-template declaration found by name lookup">;
8462 def err_mem_init_not_member_or_class_suggest : Error<
8463   "initializer %0 does not name a non-static data member or base "
8464   "class; did you mean the %select{base class|member}1 %2?">;
8465 def err_field_designator_unknown_suggest : Error<
8466   "field designator %0 does not refer to any field in type %1; did you mean "
8467   "%2?">;
8468 def err_typecheck_member_reference_ivar_suggest : Error<
8469   "%0 does not have a member named %1; did you mean %2?">;
8470 def err_property_not_found_suggest : Error<
8471   "property %0 not found on object of type %1; did you mean %2?">;
8472 def err_class_property_found : Error<
8473   "property %0 is a class property; did you mean to access it with class '%1'?">;
8474 def err_ivar_access_using_property_syntax_suggest : Error<
8475   "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
8476 def warn_property_access_suggest : Warning<
8477 "property %0 not found on object of type %1; did you mean to access property %2?">,
8478 InGroup<PropertyAccessDotSyntax>;
8479 def err_property_found_suggest : Error<
8480   "property %0 found on object of type %1; did you mean to access "
8481   "it with the \".\" operator?">;
8482 def err_undef_interface_suggest : Error<
8483   "cannot find interface declaration for %0; did you mean %1?">;
8484 def warn_undef_interface_suggest : Warning<
8485   "cannot find interface declaration for %0; did you mean %1?">;
8486 def err_undef_superclass_suggest : Error<
8487   "cannot find interface declaration for %0, superclass of %1; did you mean "
8488   "%2?">;
8489 def err_undeclared_protocol_suggest : Error<
8490   "cannot find protocol declaration for %0; did you mean %1?">;
8491 def note_base_class_specified_here : Note<
8492   "base class %0 specified here">;
8493 def err_using_directive_suggest : Error<
8494   "no namespace named %0; did you mean %1?">;
8495 def err_using_directive_member_suggest : Error<
8496   "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
8497 def note_namespace_defined_here : Note<"namespace %0 defined here">;
8498 def err_sizeof_pack_no_pack_name_suggest : Error<
8499   "%0 does not refer to the name of a parameter pack; did you mean %1?">;
8500 def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
8501
8502 def err_uncasted_use_of_unknown_any : Error<
8503   "%0 has unknown type; cast it to its declared type to use it">;
8504 def err_uncasted_call_of_unknown_any : Error<
8505   "%0 has unknown return type; cast the call to its declared return type">;
8506 def err_uncasted_send_to_unknown_any_method : Error<
8507   "no known method %select{%objcinstance1|%objcclass1}0; cast the "
8508   "message send to the method's return type">;
8509 def err_unsupported_unknown_any_decl : Error<
8510   "%0 has unknown type, which is not supported for this kind of declaration">;
8511 def err_unsupported_unknown_any_expr : Error<
8512   "unsupported expression with unknown type">;
8513 def err_unsupported_unknown_any_call : Error<
8514   "call to unsupported expression with unknown type">;
8515 def err_unknown_any_addrof : Error<
8516   "the address of a declaration with unknown type "
8517   "can only be cast to a pointer type">;
8518 def err_unknown_any_addrof_call : Error<
8519   "address-of operator cannot be applied to a call to a function with "
8520   "unknown return type">;
8521 def err_unknown_any_var_function_type : Error<
8522   "variable %0 with unknown type cannot be given a function type">;
8523 def err_unknown_any_function : Error<
8524   "function %0 with unknown type must be given a function type">;
8525
8526 def err_filter_expression_integral : Error<
8527   "filter expression type should be an integral value not %0">;
8528
8529 def err_non_asm_stmt_in_naked_function : Error<
8530   "non-ASM statement in naked function is not supported">;
8531 def err_asm_naked_this_ref : Error<
8532   "'this' pointer references not allowed in naked functions">;
8533 def err_asm_naked_parm_ref : Error<
8534   "parameter references not allowed in naked functions">;
8535
8536 // OpenCL warnings and errors.
8537 def err_invalid_astype_of_different_size : Error<
8538   "invalid reinterpretation: sizes of %0 and %1 must match">;
8539 def err_static_kernel : Error<
8540   "kernel functions cannot be declared static">;
8541 def err_opencl_ptrptr_kernel_param : Error<
8542   "kernel parameter cannot be declared as a pointer to a pointer">;
8543 def err_kernel_arg_address_space : Error<
8544   "pointer arguments to kernel functions must reside in '__global', "
8545   "'__constant' or '__local' address space">;
8546 def err_opencl_ext_vector_component_invalid_length : Error<
8547   "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
8548 def err_opencl_function_variable : Error<
8549   "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
8550 def err_opencl_addrspace_scope : Error<
8551   "variables in the %0 address space can only be declared in the outermost "
8552   "scope of a kernel function">;
8553 def err_static_function_scope : Error<
8554   "variables in function scope cannot be declared static">;
8555 def err_opencl_bitfields : Error<
8556   "bit-fields are not supported in OpenCL">;
8557 def err_opencl_vla : Error<
8558   "variable length arrays are not supported in OpenCL">;
8559 def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
8560     "scalar operand type has greater rank than the type of the vector "
8561     "element. (%0 and %1)">;
8562 def err_bad_kernel_param_type : Error<
8563   "%0 cannot be used as the type of a kernel parameter">;
8564 def err_opencl_implicit_function_decl : Error<
8565   "implicit declaration of function %0 is invalid in OpenCL">;
8566 def err_record_with_pointers_kernel_param : Error<
8567   "%select{struct|union}0 kernel parameters may not contain pointers">;
8568 def note_within_field_of_type : Note<
8569   "within field of type %0 declared here">;
8570 def note_illegal_field_declared_here : Note<
8571   "field of illegal %select{type|pointer type}0 %1 declared here">;
8572 def err_opencl_type_struct_or_union_field : Error<
8573   "the %0 type cannot be used to declare a structure or union field">;
8574 def err_event_t_addr_space_qual : Error<
8575   "the event_t type can only be used with __private address space qualifier">;
8576 def err_expected_kernel_void_return_type : Error<
8577   "kernel must have void return type">;
8578 def err_sampler_initializer_not_integer : Error<
8579   "sampler_t initialization requires 32-bit integer, not %0">;
8580 def warn_sampler_initializer_invalid_bits : Warning<
8581   "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
8582 def err_sampler_argument_required : Error<
8583   "sampler_t variable required - got %0">;
8584 def err_wrong_sampler_addressspace: Error<
8585   "sampler type cannot be used with the __local and __global address space qualifiers">;
8586 def err_opencl_nonconst_global_sampler : Error<
8587   "global sampler requires a const or constant address space qualifier">;
8588 def err_opencl_cast_non_zero_to_event_t : Error<
8589   "cannot cast non-zero value '%0' to 'event_t'">;
8590 def err_opencl_global_invalid_addr_space : Error<
8591   "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
8592 def err_missing_actual_pipe_type : Error<
8593   "missing actual type specifier for pipe">;
8594 def err_reference_pipe_type : Error <
8595   "pipes packet types cannot be of reference type">;
8596 def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
8597 def err_opencl_kernel_attr :
8598   Error<"attribute %0 can only be applied to an OpenCL kernel function">;
8599 def err_opencl_return_value_with_address_space : Error<
8600   "return value cannot be qualified with address space">;
8601 def err_opencl_constant_no_init : Error<
8602   "variable in constant address space must be initialized">;
8603 def err_opencl_atomic_init: Error<
8604   "atomic variable can be %select{assigned|initialized}0 to a variable only "
8605   "in global address space">;
8606 def err_opencl_implicit_vector_conversion : Error<
8607   "implicit conversions between vector types (%0 and %1) are not permitted">;
8608 def err_opencl_invalid_type_array : Error<
8609   "array of %0 type is invalid in OpenCL">;
8610 def err_opencl_ternary_with_block : Error<
8611   "block type cannot be used as expression in ternary expression in OpenCL">;
8612 def err_opencl_pointer_to_type : Error<
8613   "pointer to type %0 is invalid in OpenCL">;
8614 def err_opencl_type_can_only_be_used_as_function_parameter : Error <
8615   "type %0 can only be used as a function parameter in OpenCL">;
8616 def warn_opencl_attr_deprecated_ignored : Warning <
8617   "%0 attribute is deprecated and ignored in OpenCL version %1">,
8618   InGroup<IgnoredAttributes>;
8619 def err_opencl_variadic_function : Error<
8620   "invalid prototype, variadic arguments are not allowed in OpenCL">;
8621 def err_opencl_requires_extension : Error<
8622   "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
8623 def warn_opencl_generic_address_space_arg : Warning<
8624   "passing non-generic address space pointer to %0"
8625   " may cause dynamic conversion affecting performance">,
8626   InGroup<Conversion>, DefaultIgnore;
8627
8628 // OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
8629 def err_opencl_builtin_pipe_first_arg : Error<
8630   "first argument to %0 must be a pipe type">;
8631 def err_opencl_builtin_pipe_arg_num : Error<
8632   "invalid number of arguments to function: %0">;
8633 def err_opencl_builtin_pipe_invalid_arg : Error<
8634   "invalid argument type to function %0 (expecting %1 having %2)">;
8635 def err_opencl_builtin_pipe_invalid_access_modifier : Error<
8636   "invalid pipe access modifier (expecting %0)">;
8637
8638 // OpenCL access qualifier
8639 def err_opencl_invalid_access_qualifier : Error<
8640   "access qualifier can only be used for pipe and image type">;
8641 def err_opencl_invalid_read_write : Error<
8642   "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
8643 def err_opencl_multiple_access_qualifiers : Error<
8644   "multiple access qualifiers">;
8645 def note_opencl_typedef_access_qualifier : Note<
8646   "previously declared '%0' here">;
8647
8648 // OpenCL v2.0 s6.12.5 Blocks restrictions
8649 def err_opencl_block_storage_type : Error<
8650   "the __block storage type is not permitted">;
8651 def err_opencl_invalid_block_declaration : Error<
8652   "invalid block variable declaration - must be %select{const qualified|initialized}0">;
8653 def err_opencl_extern_block_declaration : Error<
8654   "invalid block variable declaration - using 'extern' storage class is disallowed">;
8655 def err_opencl_block_ref_block : Error<
8656   "cannot refer to a block inside block">;
8657
8658 // OpenCL v2.0 s6.13.9 - Address space qualifier functions.
8659 def err_opencl_builtin_to_addr_arg_num : Error<
8660   "invalid number of arguments to function: %0">;
8661 def err_opencl_builtin_to_addr_invalid_arg : Error<
8662   "invalid argument %0 to function: %1, expecting a generic pointer argument">;
8663
8664 // OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
8665 def err_opencl_enqueue_kernel_incorrect_args : Error<
8666   "illegal call to enqueue_kernel, incorrect argument types">;
8667 def err_opencl_enqueue_kernel_local_size_args : Error<
8668   "mismatch in number of block parameters and local size arguments passed">;
8669 def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
8670   "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
8671 def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
8672   "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
8673 def err_opencl_enqueue_kernel_blocks_no_args : Error<
8674   "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
8675
8676 def err_opencl_builtin_expected_type : Error<
8677   "illegal call to %0, expected %1 argument type">;
8678
8679 // OpenCL v2.2 s2.1.2.3 - Vector Component Access
8680 def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
8681   "vector component name '%0' is an OpenCL version 2.2 feature">,
8682   InGroup<OpenCLUnsupportedRGBA>;
8683 } // end of sema category
8684
8685 let CategoryName = "OpenMP Issue" in {
8686 // OpenMP support.
8687 def err_omp_expected_var_arg : Error<
8688   "%0 is not a global variable, static local variable or static data member">;
8689 def err_omp_expected_var_arg_suggest : Error<
8690   "%0 is not a global variable, static local variable or static data member; "
8691   "did you mean %1">;
8692 def err_omp_global_var_arg : Error<
8693   "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
8694 def err_omp_ref_type_arg : Error<
8695   "arguments of '#pragma omp %0' cannot be of reference type %1">;
8696 def err_omp_region_not_file_context : Error<
8697   "directive must be at file or namespace scope">;
8698 def err_omp_var_scope : Error<
8699   "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
8700 def err_omp_var_used : Error<
8701   "'#pragma omp %0' must precede all references to variable %q1">;
8702 def err_omp_var_thread_local : Error<
8703   "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
8704 def err_omp_private_incomplete_type : Error<
8705   "a private variable with incomplete type %0">;
8706 def err_omp_firstprivate_incomplete_type : Error<
8707   "a firstprivate variable with incomplete type %0">;
8708 def err_omp_lastprivate_incomplete_type : Error<
8709   "a lastprivate variable with incomplete type %0">;
8710 def err_omp_reduction_incomplete_type : Error<
8711   "a reduction list item with incomplete type %0">;
8712 def err_omp_unexpected_clause_value : Error<
8713   "expected %0 in OpenMP clause '%1'">;
8714 def err_omp_expected_var_name_member_expr : Error<
8715   "expected variable name%select{| or data member of current class}0">;
8716 def err_omp_expected_var_name_member_expr_or_array_item : Error<
8717   "expected variable name%select{|, data member of current class}0, array element or array section">;
8718 def err_omp_expected_addressable_lvalue_or_array_item : Error<
8719   "expected addressable lvalue expression, array element or array section">;
8720 def err_omp_expected_named_var_member_or_array_expression: Error<
8721   "expected expression containing only member accesses and/or array sections based on named variables">;
8722 def err_omp_bit_fields_forbidden_in_clause : Error<
8723   "bit fields cannot be used to specify storage in a '%0' clause">;
8724 def err_array_section_does_not_specify_contiguous_storage : Error<
8725   "array section does not specify contiguous storage">;
8726 def err_omp_union_type_not_allowed : Error<
8727   "mapping of union members is not allowed">;
8728 def err_omp_expected_access_to_data_field : Error<
8729   "expected access to data field">;
8730 def err_omp_multiple_array_items_in_map_clause : Error<
8731   "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
8732 def err_omp_duplicate_map_type_modifier : Error<
8733   "same map type modifier has been specified more than once">;
8734 def err_omp_pointer_mapped_along_with_derived_section : Error<
8735   "pointer cannot be mapped along with a section derived from itself">;
8736 def err_omp_original_storage_is_shared_and_does_not_contain : Error<
8737   "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
8738 def err_omp_same_pointer_dereferenced : Error<
8739   "same pointer dereferenced in multiple different ways in map clause expressions">;
8740 def note_omp_task_predetermined_firstprivate_here : Note<
8741   "predetermined as a firstprivate in a task construct here">;
8742 def err_omp_threadprivate_incomplete_type : Error<
8743   "threadprivate variable with incomplete type %0">;
8744 def err_omp_no_dsa_for_variable : Error<
8745   "variable %0 must have explicitly specified data sharing attributes">;
8746 def err_omp_wrong_dsa : Error<
8747   "%0 variable cannot be %1">;
8748 def err_omp_variably_modified_type_not_supported : Error<
8749   "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
8750 def note_omp_explicit_dsa : Note<
8751   "defined as %0">;
8752 def note_omp_predetermined_dsa : Note<
8753   "%select{static data member is predetermined as shared|"
8754   "variable with static storage duration is predetermined as shared|"
8755   "loop iteration variable is predetermined as private|"
8756   "loop iteration variable is predetermined as linear|"
8757   "loop iteration variable is predetermined as lastprivate|"
8758   "constant variable is predetermined as shared|"
8759   "global variable is predetermined as shared|"
8760   "non-shared variable in a task construct is predetermined as firstprivate|"
8761   "variable with automatic storage duration is predetermined as private}0"
8762   "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
8763 def note_omp_implicit_dsa : Note<
8764   "implicitly determined as %0">;
8765 def err_omp_loop_var_dsa : Error<
8766   "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
8767 def err_omp_not_for : Error<
8768   "%select{statement after '#pragma omp %1' must be a for loop|"
8769   "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
8770 def note_omp_collapse_ordered_expr : Note<
8771   "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
8772 def err_omp_negative_expression_in_clause : Error<
8773   "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
8774 def err_omp_not_integral : Error<
8775   "expression must have integral or unscoped enumeration "
8776   "type, not %0">;
8777 def err_omp_threadprivate_in_target : Error<
8778   "threadprivate variables cannot be used in target constructs">;
8779 def err_omp_incomplete_type : Error<
8780   "expression has incomplete class type %0">;
8781 def err_omp_explicit_conversion : Error<
8782   "expression requires explicit conversion from %0 to %1">;
8783 def note_omp_conversion_here : Note<
8784   "conversion to %select{integral|enumeration}0 type %1 declared here">;
8785 def err_omp_ambiguous_conversion : Error<
8786   "ambiguous conversion from type %0 to an integral or unscoped "
8787   "enumeration type">;
8788 def err_omp_required_access : Error<
8789   "%0 variable must be %1">;
8790 def err_omp_const_variable : Error<
8791   "const-qualified variable cannot be %0">;
8792 def err_omp_const_not_mutable_variable : Error<
8793   "const-qualified variable without mutable fields cannot be %0">;
8794 def err_omp_const_list_item : Error<
8795   "const-qualified list item cannot be %0">;
8796 def err_omp_linear_incomplete_type : Error<
8797   "a linear variable with incomplete type %0">;
8798 def err_omp_linear_expected_int_or_ptr : Error<
8799   "argument of a linear clause should be of integral or pointer "
8800   "type, not %0">;
8801 def warn_omp_linear_step_zero : Warning<
8802   "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
8803   InGroup<OpenMPClauses>;
8804 def warn_omp_alignment_not_power_of_two : Warning<
8805   "aligned clause will be ignored because the requested alignment is not a power of 2">,
8806   InGroup<OpenMPClauses>;
8807 def err_omp_invalid_target_decl : Error<
8808   "%0 used in declare target directive is not a variable or a function name">;
8809 def err_omp_declare_target_multiple : Error<
8810   "%0 appears multiple times in clauses on the same declare target directive">;
8811 def err_omp_declare_target_to_and_link : Error<
8812   "%0 must not appear in both clauses 'to' and 'link'">;
8813 def warn_omp_not_in_target_context : Warning<
8814   "declaration is not declared in any declare target region">,
8815   InGroup<OpenMPTarget>;
8816 def err_omp_function_in_link_clause : Error<
8817   "function name is not allowed in 'link' clause">;
8818 def err_omp_aligned_expected_array_or_ptr : Error<
8819   "argument of aligned clause should be array"
8820   "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
8821   ", not %0">;
8822 def err_omp_aligned_twice : Error<
8823   "%select{a variable|a parameter|'this'}0 cannot appear in more than one aligned clause">;
8824 def err_omp_local_var_in_threadprivate_init : Error<
8825   "variable with local storage in initial value of threadprivate variable">;
8826 def err_omp_loop_not_canonical_init : Error<
8827   "initialization clause of OpenMP for loop is not in canonical form "
8828   "('var = init' or 'T var = init')">;
8829 def ext_omp_loop_not_canonical_init : ExtWarn<
8830   "initialization clause of OpenMP for loop is not in canonical form "
8831   "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
8832 def err_omp_loop_not_canonical_cond : Error<
8833   "condition of OpenMP for loop must be a relational comparison "
8834   "('<', '<=', '>', or '>=') of loop variable %0">;
8835 def err_omp_loop_not_canonical_incr : Error<
8836   "increment clause of OpenMP for loop must perform simple addition "
8837   "or subtraction on loop variable %0">;
8838 def err_omp_loop_variable_type : Error<
8839   "variable must be of integer or %select{pointer|random access iterator}0 type">;
8840 def err_omp_loop_incr_not_compatible : Error<
8841   "increment expression must cause %0 to %select{decrease|increase}1 "
8842   "on each iteration of OpenMP for loop">;
8843 def note_omp_loop_cond_requres_compatible_incr : Note<
8844   "loop step is expected to be %select{negative|positive}0 due to this condition">;
8845 def err_omp_loop_diff_cxx : Error<
8846   "could not calculate number of iterations calling 'operator-' with "
8847   "upper and lower loop bounds">;
8848 def err_omp_loop_cannot_use_stmt : Error<
8849   "'%0' statement cannot be used in OpenMP for loop">;
8850 def err_omp_simd_region_cannot_use_stmt : Error<
8851   "'%0' statement cannot be used in OpenMP simd region">;
8852 def warn_omp_loop_64_bit_var : Warning<
8853   "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
8854   InGroup<OpenMPLoopForm>;
8855 def err_omp_unknown_reduction_identifier : Error<
8856   "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
8857   "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
8858 def err_omp_not_resolved_reduction_identifier : Error<
8859   "unable to resolve declare reduction construct for type %0">;
8860 def err_omp_reduction_ref_type_arg : Error<
8861   "argument of OpenMP clause '%0' must reference the same object in all threads">;
8862 def err_omp_clause_not_arithmetic_type_arg : Error<
8863   "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
8864 def err_omp_clause_floating_type_arg : Error<
8865   "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
8866 def err_omp_once_referenced : Error<
8867   "variable can appear only once in OpenMP '%0' clause">;
8868 def err_omp_once_referenced_in_target_update : Error<
8869   "variable can appear only once in OpenMP 'target update' construct">;
8870 def note_omp_referenced : Note<
8871   "previously referenced here">;
8872 def err_omp_reduction_in_task : Error<
8873   "reduction variables may not be accessed in an explicit task">;
8874 def err_omp_reduction_id_not_compatible : Error<
8875   "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
8876 def err_omp_in_reduction_not_task_reduction : Error<
8877   "in_reduction variable must appear in a task_reduction clause">;
8878 def err_omp_reduction_identifier_mismatch : Error<
8879   "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
8880 def note_omp_previous_reduction_identifier : Note<
8881   "previously marked as task_reduction with different reduction operation">;
8882 def err_omp_prohibited_region : Error<
8883   "region cannot be%select{| closely}0 nested inside '%1' region"
8884   "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
8885   "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
8886   "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
8887   "; perhaps you forget to enclose 'omp %3' directive into a teams region?}2">;
8888 def err_omp_prohibited_region_simd : Error<
8889   "OpenMP constructs may not be nested inside a simd region">;
8890 def err_omp_prohibited_region_atomic : Error<
8891   "OpenMP constructs may not be nested inside an atomic region">;
8892 def err_omp_prohibited_region_critical_same_name : Error<
8893   "cannot nest 'critical' regions having the same name %0">;
8894 def note_omp_previous_critical_region : Note<
8895   "previous 'critical' region starts here">;
8896 def err_omp_sections_not_compound_stmt : Error<
8897   "the statement for '#pragma omp sections' must be a compound statement">;
8898 def err_omp_parallel_sections_not_compound_stmt : Error<
8899   "the statement for '#pragma omp parallel sections' must be a compound statement">;
8900 def err_omp_orphaned_section_directive : Error<
8901   "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
8902   " must be closely nested to a sections region%select{|, not a %1 region}0">;
8903 def err_omp_sections_substmt_not_section : Error<
8904   "statement in 'omp sections' directive must be enclosed into a section region">;
8905 def err_omp_parallel_sections_substmt_not_section : Error<
8906   "statement in 'omp parallel sections' directive must be enclosed into a section region">;
8907 def err_omp_parallel_reduction_in_task_firstprivate : Error<
8908   "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
8909 def err_omp_atomic_read_not_expression_statement : Error<
8910   "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
8911   " where v and x are both lvalue expressions with scalar type">;
8912 def note_omp_atomic_read_write: Note<
8913   "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
8914 def err_omp_atomic_write_not_expression_statement : Error<
8915   "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
8916   " where x is a lvalue expression with scalar type">;
8917 def err_omp_atomic_update_not_expression_statement : Error<
8918   "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',"
8919   " where x is an l-value expression with scalar type">;
8920 def err_omp_atomic_not_expression_statement : Error<
8921   "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',"
8922   " where x is an l-value expression with scalar type">;
8923 def note_omp_atomic_update: Note<
8924   "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
8925   "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
8926   "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
8927 def err_omp_atomic_capture_not_expression_statement : Error<
8928   "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',"
8929   " where x and v are both l-value expressions with scalar type">;
8930 def err_omp_atomic_capture_not_compound_statement : Error<
8931   "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
8932   " '{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;}',"
8933   " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
8934   " where x is an l-value expression with scalar type">;
8935 def note_omp_atomic_capture: Note<
8936   "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
8937 def err_omp_atomic_several_clauses : Error<
8938   "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
8939 def note_omp_atomic_previous_clause : Note<
8940   "'%0' clause used here">;
8941 def err_omp_target_contains_not_only_teams : Error<
8942   "target construct with nested teams region contains statements outside of the teams construct">;
8943 def note_omp_nested_teams_construct_here : Note<
8944   "nested teams construct here">;
8945 def note_omp_nested_statement_here : Note<
8946   "%select{statement|directive}0 outside teams construct here">;
8947 def err_omp_single_copyprivate_with_nowait : Error<
8948   "the 'copyprivate' clause must not be used with the 'nowait' clause">;
8949 def note_omp_nowait_clause_here : Note<
8950   "'nowait' clause is here">;
8951 def err_omp_single_decl_in_declare_simd : Error<
8952   "single declaration is expected after 'declare simd' directive">;
8953 def err_omp_function_expected : Error<
8954   "'#pragma omp declare simd' can only be applied to functions">;
8955 def err_omp_wrong_cancel_region : Error<
8956   "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
8957 def err_omp_parent_cancel_region_nowait : Error<
8958   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
8959 def err_omp_parent_cancel_region_ordered : Error<
8960   "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
8961 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">;
8962 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">;
8963 def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
8964 def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
8965 def err_omp_typecheck_section_value : Error<
8966   "subscripted value is not an array or pointer">;
8967 def err_omp_typecheck_section_not_integer : Error<
8968   "array section %select{lower bound|length}0 is not an integer">;
8969 def err_omp_section_function_type : Error<
8970   "section of pointer to function type %0">;
8971 def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
8972   InGroup<CharSubscript>, DefaultIgnore;
8973 def err_omp_section_incomplete_type : Error<
8974   "section of pointer to incomplete type %0">;
8975 def err_omp_section_not_subset_of_array : Error<
8976   "array section must be a subset of the original array">;
8977 def err_omp_section_length_negative : Error<
8978   "section length is evaluated to a negative value %0">;
8979 def err_omp_section_length_undefined : Error<
8980   "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
8981 def err_omp_wrong_linear_modifier : Error<
8982   "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
8983 def err_omp_wrong_linear_modifier_non_reference : Error<
8984   "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
8985 def err_omp_wrong_simdlen_safelen_values : Error<
8986   "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
8987 def err_omp_wrong_if_directive_name_modifier : Error<
8988   "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
8989 def err_omp_no_more_if_clause : Error<
8990   "no more 'if' clause is allowed">;
8991 def err_omp_unnamed_if_clause : Error<
8992   "expected %select{|one of}0 %1 directive name modifier%select{|s}0">;
8993 def note_omp_previous_named_if_clause : Note<
8994   "previous clause with directive name modifier specified here">;
8995 def err_omp_ordered_directive_with_param : Error<
8996   "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
8997 def err_omp_ordered_directive_without_param : Error<
8998   "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
8999 def note_omp_ordered_param : Note<
9000   "'ordered' clause with specified parameter">;
9001 def err_omp_expected_base_var_name : Error<
9002   "expected variable name as a base of the array %select{subscript|section}0">;
9003 def err_omp_map_shared_storage : Error<
9004   "variable already marked as mapped in current construct">;
9005 def err_omp_invalid_map_type_for_directive : Error<
9006   "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
9007 def err_omp_no_clause_for_directive : Error<
9008   "expected at least one %0 clause for '#pragma omp %1'">;
9009 def err_omp_threadprivate_in_clause : Error<
9010   "threadprivate variables are not allowed in '%0' clause">;
9011 def err_omp_wrong_ordered_loop_count : Error<
9012   "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
9013 def note_collapse_loop_count : Note<
9014   "parameter of the 'collapse' clause">;
9015 def err_omp_grainsize_num_tasks_mutually_exclusive : Error<
9016   "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
9017 def note_omp_previous_grainsize_num_tasks : Note<
9018   "'%0' clause is specified here">;
9019 def err_omp_hint_clause_no_name : Error<
9020   "the name of the construct must be specified in presence of 'hint' clause">;
9021 def err_omp_critical_with_hint : Error<
9022   "constructs with the same name must have a 'hint' clause with the same value">;
9023 def note_omp_critical_hint_here : Note<
9024   "%select{|previous }0'hint' clause with value '%1'">;
9025 def note_omp_critical_no_hint : Note<
9026   "%select{|previous }0directive with no 'hint' clause specified">;
9027 def err_omp_depend_clause_thread_simd : Error<
9028   "'depend' clauses cannot be mixed with '%0' clause">;
9029 def err_omp_depend_sink_expected_loop_iteration : Error<
9030   "expected%select{| %1}0 loop iteration variable">;
9031 def err_omp_depend_sink_unexpected_expr : Error<
9032   "unexpected expression: number of expressions is larger than the number of associated loops">;
9033 def err_omp_depend_sink_expected_plus_minus : Error<
9034   "expected '+' or '-' operation">;
9035 def err_omp_depend_sink_source_not_allowed : Error<
9036   "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
9037 def err_omp_linear_ordered : Error<
9038   "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
9039 def err_omp_unexpected_schedule_modifier : Error<
9040   "modifier '%0' cannot be used along with modifier '%1'">;
9041 def err_omp_schedule_nonmonotonic_static : Error<
9042   "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
9043 def err_omp_schedule_nonmonotonic_ordered : Error<
9044   "'schedule' clause with 'nonmonotonic' modifier cannot be specified if an 'ordered' clause is specified">;
9045 def err_omp_ordered_simd : Error<
9046   "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
9047 def err_omp_variable_in_given_clause_and_dsa : Error<
9048   "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
9049 def err_omp_param_or_this_in_clause : Error<
9050   "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
9051 def err_omp_expected_uniform_param : Error<
9052   "expected a reference to a parameter specified in a 'uniform' clause">;
9053 def err_omp_expected_int_param : Error<
9054   "expected a reference to an integer-typed parameter">;
9055 def err_omp_at_least_one_motion_clause_required : Error<
9056   "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
9057 def err_omp_usedeviceptr_not_a_pointer : Error<
9058   "expected pointer or reference to pointer in 'use_device_ptr' clause">;
9059 def err_omp_argument_type_isdeviceptr : Error <
9060   "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
9061 def warn_omp_nesting_simd : Warning<
9062   "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
9063   InGroup<SourceUsesOpenMP>;
9064 def err_omp_orphaned_device_directive : Error<
9065   "orphaned 'omp %0' directives are prohibited"
9066   "; perhaps you forget to enclose the directive into a %select{|||target |teams }1region?">;
9067 def err_omp_reduction_non_addressable_expression : Error<
9068   "expected addressable reduction item for the task-based directives">;
9069 def err_omp_reduction_with_nogroup : Error<
9070   "'reduction' clause cannot be used with 'nogroup' clause">;
9071 def err_omp_reduction_vla_unsupported : Error<
9072   "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
9073 def err_omp_linear_distribute_var_non_loop_iteration : Error<
9074   "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
9075 def warn_omp_non_trivial_type_mapped : Warning<
9076   "Non-trivial type %0 is mapped, only trivial types are guaranteed to be mapped correctly">,
9077   InGroup<OpenMPTarget>;
9078 def err_omp_requires_clause_redeclaration : Error <
9079   "Only one %0 clause can appear on a requires directive in a single translation unit">;
9080 def note_omp_requires_previous_clause : Note <
9081   "%0 clause previously used here">;
9082 def err_omp_invalid_scope : Error <
9083   "'#pragma omp %0' directive must appear only in file scope">;
9084 def note_omp_invalid_length_on_this_ptr_mapping : Note <
9085   "expected length on mapping of 'this' array section expression to be '1'">;
9086 def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
9087   "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
9088 def note_omp_invalid_subscript_on_this_ptr_map : Note <
9089   "expected 'this' subscript expression on map clause to be 'this[0]'">;
9090 def err_omp_invalid_map_this_expr : Error <
9091   "invalid 'this' expression on 'map' clause">;
9092 } // end of OpenMP category
9093
9094 let CategoryName = "Related Result Type Issue" in {
9095 // Objective-C related result type compatibility
9096 def warn_related_result_type_compatibility_class : Warning<
9097   "method is expected to return an instance of its class type "
9098   "%diff{$, but is declared to return $|"
9099   ", but is declared to return different type}0,1">;
9100 def warn_related_result_type_compatibility_protocol : Warning<
9101   "protocol method is expected to return an instance of the implementing "
9102   "class, but is declared to return %0">;
9103 def note_related_result_type_family : Note<
9104   "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
9105   "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
9106   "self}1' method family%select{| and is expected to return an instance of its "
9107   "class type}0">;
9108 def note_related_result_type_overridden : Note<
9109   "overridden method returns an instance of its class type">;
9110 def note_related_result_type_inferred : Note<
9111   "%select{class|instance}0 method %1 is assumed to return an instance of "
9112   "its receiver type (%2)">;
9113 def note_related_result_type_explicit : Note<
9114   "%select{overridden|current}0 method is explicitly declared 'instancetype'"
9115   "%select{| and is expected to return an instance of its class type}0">;
9116 def err_invalid_type_for_program_scope_var : Error<
9117   "the %0 type cannot be used to declare a program scope variable">;
9118
9119 }
9120
9121 let CategoryName = "Modules Issue" in {
9122 def err_module_decl_in_module_map_module : Error<
9123   "'module' declaration found while building module from module map">;
9124 def err_module_decl_in_header_module : Error<
9125   "'module' declaration found while building header module">;
9126 def err_module_interface_implementation_mismatch : Error<
9127   "missing 'export' specifier in module declaration while "
9128   "building module interface">;
9129 def err_current_module_name_mismatch : Error<
9130   "module name '%0' specified on command line does not match name of module">;
9131 def err_module_redefinition : Error<
9132   "redefinition of module '%0'">;
9133 def note_prev_module_definition : Note<"previously defined here">;
9134 def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
9135 def err_module_not_defined : Error<
9136   "definition of module '%0' is not available; use -fmodule-file= to specify "
9137   "path to precompiled module interface">;
9138 def err_module_redeclaration : Error<
9139   "translation unit contains multiple module declarations">;
9140 def note_prev_module_declaration : Note<"previous module declaration is here">;
9141 def err_module_declaration_missing : Error<
9142   "missing 'export module' declaration in module interface unit">;
9143 def err_module_private_specialization : Error<
9144   "%select{template|partial|member}0 specialization cannot be "
9145   "declared __module_private__">;
9146 def err_module_private_local : Error<
9147   "%select{local variable|parameter|typedef}0 %1 cannot be declared "
9148   "__module_private__">;
9149 def err_module_private_local_class : Error<
9150   "local %select{struct|interface|union|class|enum}0 cannot be declared "
9151   "__module_private__">;
9152 def err_module_unimported_use : Error<
9153   "%select{declaration|definition|default argument|"
9154   "explicit specialization|partial specialization}0 of %1 must be imported "
9155   "from module '%2' before it is required">;
9156 def err_module_unimported_use_header : Error<
9157   "missing '#include %3'; "
9158   "%select{declaration|definition|default argument|"
9159   "explicit specialization|partial specialization}0 of %1 must be imported "
9160   "from module '%2' before it is required">;
9161 def err_module_unimported_use_multiple : Error<
9162   "%select{declaration|definition|default argument|"
9163   "explicit specialization|partial specialization}0 of %1 must be imported "
9164   "from one of the following modules before it is required:%2">;
9165 def ext_module_import_in_extern_c : ExtWarn<
9166   "import of C++ module '%0' appears within extern \"C\" language linkage "
9167   "specification">, DefaultError,
9168   InGroup<DiagGroup<"module-import-in-extern-c">>;
9169 def err_module_import_not_at_top_level_fatal : Error<
9170   "import of module '%0' appears within %1">, DefaultFatal;
9171 def ext_module_import_not_at_top_level_noop : ExtWarn<
9172   "redundant #include of module '%0' appears within %1">, DefaultError,
9173   InGroup<DiagGroup<"modules-import-nested-redundant">>;
9174 def note_module_import_not_at_top_level : Note<"%0 begins here">;
9175 def err_module_self_import : Error<
9176   "import of module '%0' appears within same top-level module '%1'">;
9177 def err_module_import_in_implementation : Error<
9178   "@import of module '%0' in implementation of '%1'; use #import">;
9179
9180 // C++ Modules TS
9181 def err_export_within_export : Error<
9182   "export declaration appears within another export declaration">;
9183 def err_export_not_in_module_interface : Error<
9184   "export declaration can only be used within a module interface unit after "
9185   "the module declaration">;
9186
9187 def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
9188   "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
9189   InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
9190 def note_equivalent_internal_linkage_decl : Note<
9191   "declared here%select{ in module '%1'|}0">;
9192
9193 def note_redefinition_modules_same_file : Note<
9194   "'%0' included multiple times, additional include site in header from module '%1'">;
9195 def note_redefinition_include_same_file : Note<
9196   "'%0' included multiple times, additional include site here">;
9197 }
9198
9199 let CategoryName = "Coroutines Issue" in {
9200 def err_return_in_coroutine : Error<
9201   "return statement not allowed in coroutine; did you mean 'co_return'?">;
9202 def note_declared_coroutine_here : Note<
9203   "function is a coroutine due to use of '%0' here">;
9204 def err_coroutine_objc_method : Error<
9205   "Objective-C methods as coroutines are not yet supported">;
9206 def err_coroutine_unevaluated_context : Error<
9207   "'%0' cannot be used in an unevaluated context">;
9208 def err_coroutine_outside_function : Error<
9209   "'%0' cannot be used outside a function">;
9210 def err_coroutine_invalid_func_context : Error<
9211   "'%1' cannot be used in %select{a constructor|a destructor"
9212   "|a copy assignment operator|a move assignment operator|the 'main' function"
9213   "|a constexpr function|a function with a deduced return type"
9214   "|a varargs function}0">;
9215 def err_implied_coroutine_type_not_found : Error<
9216   "%0 type was not found; include <experimental/coroutine> before defining "
9217   "a coroutine">;
9218 def err_implicit_coroutine_std_nothrow_type_not_found : Error<
9219   "std::nothrow was not found; include <new> before defining a coroutine which "
9220   "uses get_return_object_on_allocation_failure()">;
9221 def err_malformed_std_nothrow : Error<
9222   "std::nothrow must be a valid variable declaration">;
9223 def err_malformed_std_coroutine_handle : Error<
9224   "std::experimental::coroutine_handle must be a class template">;
9225 def err_coroutine_handle_missing_member : Error<
9226   "std::experimental::coroutine_handle missing a member named '%0'">;
9227 def err_malformed_std_coroutine_traits : Error<
9228   "'std::experimental::coroutine_traits' must be a class template">;
9229 def err_implied_std_coroutine_traits_promise_type_not_found : Error<
9230   "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
9231 def err_implied_std_coroutine_traits_promise_type_not_class : Error<
9232   "this function cannot be a coroutine: %0 is not a class">;
9233 def err_coroutine_promise_type_incomplete : Error<
9234   "this function cannot be a coroutine: %0 is an incomplete type">;
9235 def err_coroutine_type_missing_specialization : Error<
9236   "this function cannot be a coroutine: missing definition of "
9237   "specialization %0">;
9238 def err_coroutine_promise_incompatible_return_functions : Error<
9239   "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
9240 def err_coroutine_promise_requires_return_function : Error<
9241   "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
9242 def note_coroutine_promise_implicit_await_transform_required_here : Note<
9243   "call to 'await_transform' implicitly required by 'co_await' here">;
9244 def note_coroutine_promise_suspend_implicitly_required : Note<
9245   "call to '%select{initial_suspend|final_suspend}0' implicitly "
9246   "required by the %select{initial suspend point|final suspend point}0">;
9247 def err_coroutine_promise_unhandled_exception_required : Error<
9248   "%0 is required to declare the member 'unhandled_exception()'">;
9249 def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
9250   "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
9251   InGroup<CoroutineMissingUnhandledException>;
9252 def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
9253   "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
9254 def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
9255   "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
9256 def err_coroutine_promise_new_requires_nothrow : Error<
9257   "%0 is required to have a non-throwing noexcept specification when the promise "
9258    "type declares 'get_return_object_on_allocation_failure()'">;
9259 def note_coroutine_promise_call_implicitly_required : Note<
9260   "call to %0 implicitly required by coroutine function here">;
9261 def err_await_suspend_invalid_return_type : Error<
9262   "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
9263 >;
9264 def note_await_ready_no_bool_conversion : Note<
9265   "return type of 'await_ready' is required to be contextually convertible to 'bool'"
9266 >;
9267 }
9268
9269 let CategoryName = "Documentation Issue" in {
9270 def warn_not_a_doxygen_trailing_member_comment : Warning<
9271   "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
9272 } // end of documentation issue category
9273
9274 let CategoryName = "Nullability Issue" in {
9275
9276 def warn_mismatched_nullability_attr : Warning<
9277   "nullability specifier %0 conflicts with existing specifier %1">,
9278   InGroup<Nullability>;
9279
9280 def warn_nullability_declspec : Warning<
9281   "nullability specifier %0 cannot be applied "
9282   "to non-pointer type %1; did you mean to apply the specifier to the "
9283   "%select{pointer|block pointer|member pointer|function pointer|"
9284   "member function pointer}2?">,
9285   InGroup<NullabilityDeclSpec>,
9286   DefaultError;
9287
9288 def note_nullability_here : Note<"%0 specified here">;
9289
9290 def err_nullability_nonpointer : Error<
9291   "nullability specifier %0 cannot be applied to non-pointer type %1">;
9292
9293 def warn_nullability_lost : Warning<
9294   "implicit conversion from nullable pointer %0 to non-nullable pointer "
9295   "type %1">,
9296   InGroup<NullableToNonNullConversion>, DefaultIgnore;
9297 def warn_zero_as_null_pointer_constant : Warning<
9298   "zero as null pointer constant">,
9299   InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
9300
9301 def err_nullability_cs_multilevel : Error<
9302   "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
9303 def note_nullability_type_specifier : Note<
9304   "use nullability type specifier %0 to affect the innermost "
9305   "pointer type of %1">;
9306
9307 def warn_null_resettable_setter : Warning<
9308   "synthesized setter %0 for null_resettable property %1 does not handle nil">,
9309   InGroup<Nullability>;
9310
9311 def warn_nullability_missing : Warning<
9312   "%select{pointer|block pointer|member pointer}0 is missing a nullability "
9313   "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
9314   InGroup<NullabilityCompleteness>;
9315 def warn_nullability_missing_array : Warning<
9316   "array parameter is missing a nullability type specifier (_Nonnull, "
9317   "_Nullable, or _Null_unspecified)">,
9318   InGroup<NullabilityCompletenessOnArrays>;
9319 def note_nullability_fix_it : Note<
9320   "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
9321   "%select{pointer|block pointer|member pointer|array parameter}1 "
9322   "%select{should never be null|may be null|should not declare nullability}0">;
9323
9324 def warn_nullability_inferred_on_nested_type : Warning<
9325   "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
9326   "deprecated">,
9327   InGroup<NullabilityInferredOnNestedType>;
9328
9329 def err_objc_type_arg_explicit_nullability : Error<
9330   "type argument %0 cannot explicitly specify nullability">;
9331
9332 def err_objc_type_param_bound_explicit_nullability : Error<
9333   "type parameter %0 bound %1 cannot explicitly specify nullability">;
9334
9335 }
9336
9337 let CategoryName = "Generics Issue" in {
9338
9339 def err_objc_type_param_bound_nonobject : Error<
9340   "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
9341
9342 def err_objc_type_param_bound_missing_pointer : Error<
9343   "missing '*' in type bound %0 for type parameter %1">;
9344 def err_objc_type_param_bound_qualified : Error<
9345   "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
9346
9347 def err_objc_type_param_redecl : Error<
9348   "redeclaration of type parameter %0">;
9349
9350 def err_objc_type_param_arity_mismatch : Error<
9351   "%select{forward class declaration|class definition|category|extension}0 has "
9352   "too %select{few|many}1 type parameters (expected %2, have %3)">;
9353
9354 def err_objc_type_param_bound_conflict : Error<
9355   "type bound %0 for type parameter %1 conflicts with "
9356   "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
9357
9358 def err_objc_type_param_variance_conflict : Error<
9359   "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
9360   "%select{in|co|contra}2variant type parameter %3">;
9361
9362 def note_objc_type_param_here : Note<"type parameter %0 declared here">;
9363
9364 def err_objc_type_param_bound_missing : Error<
9365   "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
9366
9367 def err_objc_parameterized_category_nonclass : Error<
9368   "%select{extension|category}0 of non-parameterized class %1 cannot have type "
9369   "parameters">;
9370
9371 def err_objc_parameterized_forward_class : Error<
9372   "forward declaration of non-parameterized class %0 cannot have type "
9373   "parameters">;
9374
9375 def err_objc_parameterized_forward_class_first : Error<
9376   "class %0 previously declared with type parameters">;
9377
9378 def err_objc_type_arg_missing_star : Error<
9379   "type argument %0 must be a pointer (requires a '*')">;
9380 def err_objc_type_arg_qualified : Error<
9381   "type argument %0 cannot be qualified with '%1'">;
9382
9383 def err_objc_type_arg_missing : Error<
9384   "no type or protocol named %0">;
9385
9386 def err_objc_type_args_and_protocols : Error<
9387   "angle brackets contain both a %select{type|protocol}0 (%1) and a "
9388   "%select{protocol|type}0 (%2)">;
9389
9390 def err_objc_type_args_non_class : Error<
9391   "type arguments cannot be applied to non-class type %0">;
9392
9393 def err_objc_type_args_non_parameterized_class : Error<
9394   "type arguments cannot be applied to non-parameterized class %0">;
9395
9396 def err_objc_type_args_specialized_class : Error<
9397   "type arguments cannot be applied to already-specialized class type %0">;
9398
9399 def err_objc_type_args_wrong_arity : Error<
9400   "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
9401 }
9402
9403 def err_objc_type_arg_not_id_compatible : Error<
9404   "type argument %0 is neither an Objective-C object nor a block type">;
9405
9406 def err_objc_type_arg_does_not_match_bound : Error<
9407   "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
9408
9409 def warn_objc_redundant_qualified_class_type : Warning<
9410   "parameterized class %0 already conforms to the protocols listed; did you "
9411   "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
9412
9413 def warn_block_literal_attributes_on_omitted_return_type : Warning<
9414   "attribute %0 ignored, because it cannot be applied to omitted return type">,
9415   InGroup<IgnoredAttributes>;
9416
9417 def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
9418   "'%0' qualifier on omitted return type %1 has no effect">,
9419   InGroup<IgnoredQualifiers>;
9420
9421 def warn_shadow_field : Warning<
9422   "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
9423   "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
9424 def note_shadow_field : Note<"declared here">;
9425
9426 def err_multiversion_required_in_redecl : Error<
9427   "function declaration is missing %select{'target'|'cpu_specific' or "
9428   "'cpu_dispatch'}0 attribute in a multiversioned function">;
9429 def note_multiversioning_caused_here : Note<
9430   "function multiversioning caused by this declaration">;
9431 def err_multiversion_after_used : Error<
9432   "function declaration cannot become a multiversioned function after first "
9433   "usage">;
9434 def err_bad_multiversion_option : Error<
9435   "function multiversioning doesn't support %select{feature|architecture}0 "
9436   "'%1'">;
9437 def err_multiversion_duplicate : Error<
9438   "multiversioned function redeclarations require identical target attributes">;
9439 def err_multiversion_noproto : Error<
9440   "multiversioned function must have a prototype">;
9441 def err_multiversion_no_other_attrs : Error<
9442   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
9443   " with other attributes">;
9444 def err_multiversion_diff : Error<
9445   "multiversioned function declaration has a different %select{calling convention"
9446   "|return type|constexpr specification|inline specification|storage class|"
9447   "linkage}0">;
9448 def err_multiversion_doesnt_support : Error<
9449   "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
9450   "yet support %select{function templates|virtual functions|"
9451   "deduced return types|constructors|destructors|deleted functions|"
9452   "defaulted functions|constexpr functions}1">;
9453 def err_multiversion_not_allowed_on_main : Error<
9454   "'main' cannot be a multiversioned function">;
9455 def err_multiversion_not_supported : Error<
9456  "function multiversioning is not supported on the current target">;
9457 def err_multiversion_types_mixed : Error<
9458   "multiversioning attributes cannot be combined">;
9459 def err_cpu_dispatch_mismatch : Error<
9460  "'cpu_dispatch' function redeclared with different CPUs">;
9461 def err_cpu_specific_multiple_defs : Error<
9462  "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
9463 def warn_multiversion_duplicate_entries : Warning<
9464  "CPU list contains duplicate entries; attribute ignored">,
9465   InGroup<FunctionMultiVersioning>;
9466 def warn_dispatch_body_ignored : Warning<
9467   "body of cpu_dispatch function will be ignored">,
9468   InGroup<FunctionMultiVersioning>;
9469
9470 // three-way comparison operator diagnostics
9471 def err_implied_comparison_category_type_not_found : Error<
9472   "cannot deduce return type of 'operator<=>' because type '%0' was not found; "
9473   "include <compare>">;
9474 def err_spaceship_argument_narrowing : Error<
9475   "argument to 'operator<=>' "
9476   "%select{cannot be narrowed from type %1 to %2|"
9477   "evaluates to %1, which cannot be narrowed to type %2}0">;
9478 def err_std_compare_type_not_supported : Error<
9479   "standard library implementation of %0 is not supported; "
9480    "%select{member '%2' does not have expected form|"
9481    "member '%2' is missing|"
9482    "the type is not trivially copyable|"
9483    "the type does not have the expected form}1">;
9484
9485 def warn_dereference_of_noderef_type : Warning<
9486   "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
9487 def warn_dereference_of_noderef_type_no_decl : Warning<
9488   "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
9489 def warn_noderef_on_non_pointer_or_array : Warning<
9490   "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
9491 def warn_noderef_to_dereferenceable_pointer : Warning<
9492   "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
9493
9494 def err_builtin_launder_invalid_arg : Error<
9495   "%select{non-pointer|function pointer|void pointer}0 argument to "
9496   "'__builtin_launder' is not allowed">;
9497
9498 } // end of sema component.