Clang Project

clang_source_code/include/clang/Basic/DiagnosticSemaKinds.td
1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15
16def note_previous_decl : Note<"%0 declared here">;
17def note_entity_declared_at : Note<"%0 declared here">;
18def note_callee_decl : Note<"%0 declared here">;
19def note_defined_here : Note<"%0 defined here">;
20
21// For loop analysis
22def warn_variables_not_in_loop_body : Warning<
23  "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
24  "used in loop condition not modified in loop body">,
25  InGroup<ForLoopAnalysis>, DefaultIgnore;
26def warn_redundant_loop_iteration : Warning<
27  "variable %0 is %select{decremented|incremented}1 both in the loop header "
28  "and in the loop body">,
29  InGroup<ForLoopAnalysis>, DefaultIgnore;
30def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
31
32def warn_duplicate_enum_values : Warning<
33  "element %0 has been implicitly assigned %1 which another element has "
34  "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
35def note_duplicate_element : Note<"element %0 also has value %1">;
36
37// Absolute value functions
38def warn_unsigned_abs : Warning<
39  "taking the absolute value of unsigned type %0 has no effect">,
40  InGroup<AbsoluteValue>;
41def note_remove_abs : Note<
42  "remove the call to '%0' since unsigned values cannot be negative">;
43def warn_abs_too_small : Warning<
44  "absolute value function %0 given an argument of type %1 but has parameter "
45  "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
46def warn_wrong_absolute_value_type : Warning<
47  "using %select{integer|floating point|complex}1 absolute value function %0 "
48  "when argument is of %select{integer|floating point|complex}2 type">,
49  InGroup<AbsoluteValue>;
50def note_replace_abs_function : Note<"use function '%0' instead">;
51def warn_pointer_abs : Warning<
52  "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
53  InGroup<AbsoluteValue>;
54
55def warn_max_unsigned_zero : Warning<
56  "taking the max of "
57  "%select{a value and unsigned zero|unsigned zero and a value}0 "
58  "is always equal to the other value">,
59  InGroup<MaxUnsignedZero>;
60def note_remove_max_call : Note<
61  "remove call to max function and unsigned zero argument">;
62
63def warn_infinite_recursive_function : Warning<
64  "all paths through this function will call itself">,
65  InGroup<InfiniteRecursion>, DefaultIgnore;
66
67def warn_comma_operator : Warning<"possible misuse of comma operator here">,
68  InGroup<DiagGroup<"comma">>, DefaultIgnore;
69def note_cast_to_void : Note<"cast expression to void to silence warning">;
70
71// Constant expressions
72def err_expr_not_ice : Error<
73  "expression is not an %select{integer|integral}0 constant expression">;
74def ext_expr_not_ice : Extension<
75  "expression is not an %select{integer|integral}0 constant expression; "
76  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
77def err_typecheck_converted_constant_expression : Error<
78  "value of type %0 is not implicitly convertible to %1">;
79def err_typecheck_converted_constant_expression_disallowed : Error<
80  "conversion from %0 to %1 is not allowed in a converted constant expression">;
81def err_typecheck_converted_constant_expression_indirect : Error<
82  "conversion from %0 to %1 in converted constant expression would "
83  "bind reference to a temporary">;
84def err_expr_not_cce : Error<
85  "%select{case value|enumerator value|non-type template argument|"
86  "array size|constexpr if condition}0 "
87  "is not a constant expression">;
88def ext_cce_narrowing : ExtWarn<
89  "%select{case value|enumerator value|non-type template argument|"
90  "array size|constexpr if condition}0 "
91  "%select{cannot be narrowed from type %2 to %3|"
92  "evaluates to %2, which cannot be narrowed to type %3}1">,
93  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
94def err_ice_not_integral : Error<
95  "integral constant expression must have integral or unscoped enumeration "
96  "type, not %0">;
97def err_ice_incomplete_type : Error<
98  "integral constant expression has incomplete class type %0">;
99def err_ice_explicit_conversion : Error<
100  "integral constant expression requires explicit conversion from %0 to %1">;
101def note_ice_conversion_here : Note<
102  "conversion to %select{integral|enumeration}0 type %1 declared here">;
103def err_ice_ambiguous_conversion : Error<
104  "ambiguous conversion from type %0 to an integral or unscoped "
105  "enumeration type">;
106def err_ice_too_large : Error<
107  "integer constant expression evaluates to value %0 that cannot be "
108  "represented in a %1-bit %select{signed|unsigned}2 integer type">;
109def err_expr_not_string_literal : Error<"expression is not a string literal">;
110
111// Semantic analysis of constant literals.
112def ext_predef_outside_function : Warning<
113  "predefined identifier is only valid inside function">,
114  InGroup<DiagGroup<"predefined-identifier-outside-function">>;
115def warn_float_overflow : Warning<
116  "magnitude of floating-point constant too large for type %0; maximum is %1">,
117   InGroup<LiteralRange>;
118def warn_float_underflow : Warning<
119  "magnitude of floating-point constant too small for type %0; minimum is %1">,
120  InGroup<LiteralRange>;
121def warn_double_const_requires_fp64 : Warning<
122  "double precision constant requires cl_khr_fp64, casting to single precision">;
123def err_half_const_requires_fp16 : Error<
124  "half precision constant requires cl_khr_fp16">;
125
126// C99 variable-length arrays
127def ext_vla : Extension<"variable length arrays are a C99 feature">,
128  InGroup<VLAExtension>;
129def warn_vla_used : Warning<"variable length array used">,
130  InGroup<VLA>, DefaultIgnore;
131def err_vla_in_sfinae : Error<
132  "variable length array cannot be formed during template argument deduction">;
133def err_array_star_in_function_definition : Error<
134  "variable length array must be bound in function definition">;
135def err_vla_decl_in_file_scope : Error<
136  "variable length array declaration not allowed at file scope">;
137def err_vla_decl_has_static_storage : Error<
138  "variable length array declaration cannot have 'static' storage duration">;
139def err_vla_decl_has_extern_linkage : Error<
140  "variable length array declaration cannot have 'extern' linkage">;
141def ext_vla_folded_to_constant : Extension<
142  "variable length array folded to constant array as an extension">, InGroup<GNUFoldingConstant>;
143def err_vla_unsupported : Error<
144  "variable length arrays are not supported for the current target">;
145def note_vla_unsupported : Note<
146  "variable length arrays are not supported for the current target">;
147
148// C99 variably modified types
149def err_variably_modified_template_arg : Error<
150  "variably modified type %0 cannot be used as a template argument">;
151def err_variably_modified_nontype_template_param : Error<
152  "non-type template parameter of variably modified type %0">;
153def err_variably_modified_new_type : Error<
154  "'new' cannot allocate object of variably modified type %0">;
155
156// C99 Designated Initializers
157def ext_designated_init : Extension<
158  "designated initializers are a C99 feature">, InGroup<C99>;
159def err_array_designator_negative : Error<
160  "array designator value '%0' is negative">;
161def err_array_designator_empty_range : Error<
162  "array designator range [%0, %1] is empty">;
163def err_array_designator_non_array : Error<
164  "array designator cannot initialize non-array type %0">;
165def err_array_designator_too_large : Error<
166  "array designator index (%0) exceeds array bounds (%1)">;
167def err_field_designator_non_aggr : Error<
168  "field designator cannot initialize a "
169  "%select{non-struct, non-union|non-class}0 type %1">;
170def err_field_designator_unknown : Error<
171  "field designator %0 does not refer to any field in type %1">;
172def err_field_designator_nonfield : Error<
173  "field designator %0 does not refer to a non-static data member">;
174def note_field_designator_found : Note<"field designator refers here">;
175def err_designator_for_scalar_init : Error<
176  "designator in initializer for scalar type %0">;
177def warn_subobject_initializer_overrides : Warning<
178  "subobject initialization overrides initialization of other fields "
179  "within its enclosing subobject">, InGroup<InitializerOverrides>;
180def warn_initializer_overrides : Warning<
181  "initializer overrides prior initialization of this subobject">,
182  InGroup<InitializerOverrides>;
183def note_previous_initializer : Note<
184  "previous initialization %select{|with side effects }0is here"
185  "%select{| (side effects may not occur at run time)}0">;
186def err_designator_into_flexible_array_member : Error<
187  "designator into flexible array member subobject">;
188def note_flexible_array_member : Note<
189  "initialized flexible array member %0 is here">;
190def ext_flexible_array_init : Extension<
191  "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
192
193// Declarations.
194def ext_plain_complex : ExtWarn<
195  "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
196def ext_imaginary_constant : Extension<
197  "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
198def ext_integer_complex : Extension<
199  "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
200
201def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
202  "'_Fract' or '_Accum', not '%0'">;
203def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
204def err_invalid_width_spec : Error<
205  "'%select{|short|long|long long}0 %1' is invalid">;
206def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
207
208def ext_auto_type_specifier : ExtWarn<
209  "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
210def warn_auto_storage_class : Warning<
211  "'auto' storage class specifier is redundant and incompatible with C++11">,
212  InGroup<CXX11Compat>, DefaultIgnore;
213
214def warn_deprecated_register : Warning<
215  "'register' storage class specifier is deprecated "
216  "and incompatible with C++17">, InGroup<DeprecatedRegister>;
217def ext_register_storage_class : ExtWarn<
218  "ISO C++17 does not allow 'register' storage class specifier">,
219  DefaultError, InGroup<Register>;
220
221def err_invalid_decl_spec_combination : Error<
222  "cannot combine with previous '%0' declaration specifier">;
223def err_invalid_vector_decl_spec_combination : Error<
224  "cannot combine with previous '%0' declaration specifier. "
225  "'__vector' must be first">;
226def err_invalid_pixel_decl_spec_combination : Error<
227  "'__pixel' must be preceded by '__vector'.  "
228  "'%0' declaration specifier not allowed here">;
229def err_invalid_vector_bool_decl_spec : Error<
230  "cannot use '%0' with '__vector bool'">;
231def err_invalid_vector_long_decl_spec : Error<
232  "cannot use 'long' with '__vector'">;
233def err_invalid_vector_float_decl_spec : Error<
234  "cannot use 'float' with '__vector'">;
235def err_invalid_vector_double_decl_spec : Error <
236  "use of 'double' with '__vector' requires VSX support to be enabled "
237  "(available on POWER7 or later)">;
238def err_invalid_vector_long_long_decl_spec : Error <
239  "use of 'long long' with '__vector bool' requires VSX support (available on "
240  "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
241  "to be enabled">;
242def err_invalid_vector_long_double_decl_spec : Error<
243  "cannot use 'long double' with '__vector'">;
244def warn_vector_long_decl_spec_combination : Warning<
245  "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
246
247def err_redeclaration_different_type : Error<
248  "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
249def err_bad_variable_name : Error<
250  "%0 cannot be the name of a variable or data member">;
251def err_bad_parameter_name : Error<
252  "%0 cannot be the name of a parameter">;
253def err_parameter_name_omitted : Error<"parameter name omitted">;
254def err_anyx86_interrupt_attribute : Error<
255  "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
256  "have %select{a 'void' return type|"
257  "only a pointer parameter optionally followed by an integer parameter|"
258  "a pointer as the first parameter|a %2 type as the second parameter}1">;
259def err_anyx86_interrupt_called : Error<
260  "interrupt service routine cannot be called directly">;
261def warn_arm_interrupt_calling_convention : Warning<
262   "call to function without interrupt attribute could clobber interruptee's VFP registers">,
263   InGroup<Extra>;
264def warn_interrupt_attribute_invalid : Warning<
265   "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
266   "functions that have %select{no parameters|a 'void' return type}1">,
267   InGroup<IgnoredAttributes>;
268def warn_riscv_repeated_interrupt_attribute : Warning<
269  "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
270def note_riscv_repeated_interrupt_attribute : Note<
271  "repeated RISC-V 'interrupt' attribute is here">;
272def warn_unused_parameter : Warning<"unused parameter %0">,
273  InGroup<UnusedParameter>, DefaultIgnore;
274def warn_unused_variable : Warning<"unused variable %0">,
275  InGroup<UnusedVariable>, DefaultIgnore;
276def warn_unused_local_typedef : Warning<
277  "unused %select{typedef|type alias}0 %1">,
278  InGroup<UnusedLocalTypedef>, DefaultIgnore;
279def warn_unused_property_backing_ivar :
280  Warning<"ivar %0 which backs the property is not "
281  "referenced in this property's accessor">,
282  InGroup<UnusedPropertyIvar>, DefaultIgnore;
283def warn_unused_const_variable : Warning<"unused variable %0">,
284  InGroup<UnusedConstVariable>, DefaultIgnore;
285def warn_unused_exception_param : Warning<"unused exception parameter %0">,
286  InGroup<UnusedExceptionParameter>, DefaultIgnore;
287def warn_decl_in_param_list : Warning<
288  "declaration of %0 will not be visible outside of this function">,
289  InGroup<Visibility>;
290def warn_redefinition_in_param_list : Warning<
291  "redefinition of %0 will not be visible outside of this function">,
292  InGroup<Visibility>;
293def warn_empty_parens_are_function_decl : Warning<
294  "empty parentheses interpreted as a function declaration">,
295  InGroup<VexingParse>;
296def warn_parens_disambiguated_as_function_declaration : Warning<
297  "parentheses were disambiguated as a function declaration">,
298  InGroup<VexingParse>;
299def warn_parens_disambiguated_as_variable_declaration : Warning<
300  "parentheses were disambiguated as redundant parentheses around declaration "
301  "of variable named %0">, InGroup<VexingParse>;
302def warn_redundant_parens_around_declarator : Warning<
303  "redundant parentheses surrounding declarator">,
304  InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
305def note_additional_parens_for_variable_declaration : Note<
306  "add a pair of parentheses to declare a variable">;
307def note_raii_guard_add_name : Note<
308  "add a variable name to declare a %0 initialized with %1">;
309def note_function_style_cast_add_parentheses : Note<
310  "add enclosing parentheses to perform a function-style cast">;
311def note_remove_parens_for_variable_declaration : Note<
312  "remove parentheses to silence this warning">;
313def note_empty_parens_function_call : Note<
314  "change this ',' to a ';' to call %0">;
315def note_empty_parens_default_ctor : Note<
316  "remove parentheses to declare a variable">;
317def note_empty_parens_zero_initialize : Note<
318  "replace parentheses with an initializer to declare a variable">;
319def warn_unused_function : Warning<"unused function %0">,
320  InGroup<UnusedFunction>, DefaultIgnore;
321def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
322  InGroup<UnusedTemplate>, DefaultIgnore;
323def warn_unused_member_function : Warning<"unused member function %0">,
324  InGroup<UnusedMemberFunction>, DefaultIgnore;
325def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
326  InGroup<UsedButMarkedUnused>, DefaultIgnore;
327def warn_unneeded_internal_decl : Warning<
328  "%select{function|variable}0 %1 is not needed and will not be emitted">,
329  InGroup<UnneededInternalDecl>, DefaultIgnore;
330def warn_unneeded_static_internal_decl : Warning<
331  "'static' function %0 declared in header file "
332  "should be declared 'static inline'">,
333  InGroup<UnneededInternalDecl>, DefaultIgnore;
334def warn_unneeded_member_function : Warning<
335  "member function %0 is not needed and will not be emitted">,
336  InGroup<UnneededMemberFunction>, DefaultIgnore;
337def warn_unused_private_field: Warning<"private field %0 is not used">,
338  InGroup<UnusedPrivateField>, DefaultIgnore;
339def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
340  "%select{used|required to be captured for this use}1">,
341  InGroup<UnusedLambdaCapture>, DefaultIgnore;
342
343def warn_parameter_size: Warning<
344  "%0 is a large (%1 bytes) pass-by-value argument; "
345  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
346def warn_return_value_size: Warning<
347  "return value of %0 is a large (%1 bytes) pass-by-value object; "
348  "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
349def warn_return_value_udt: Warning<
350  "%0 has C-linkage specified, but returns user-defined type %1 which is "
351  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
352def warn_return_value_udt_incomplete: Warning<
353  "%0 has C-linkage specified, but returns incomplete type %1 which could be "
354  "incompatible with C">, InGroup<ReturnTypeCLinkage>;
355def warn_implicit_function_decl : Warning<
356  "implicit declaration of function %0">,
357  InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
358def ext_implicit_function_decl : ExtWarn<
359  "implicit declaration of function %0 is invalid in C99">,
360  InGroup<ImplicitFunctionDeclare>;
361def note_function_suggestion : Note<"did you mean %0?">;
362
363def err_ellipsis_first_param : Error<
364  "ISO C requires a named parameter before '...'">;
365def err_declarator_need_ident : Error<"declarator requires an identifier">;
366def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
367def err_language_linkage_spec_not_ascii : Error<
368  "string literal in language linkage specifier cannot have an "
369  "encoding-prefix">;
370def ext_use_out_of_scope_declaration : ExtWarn<
371  "use of out-of-scope declaration of %0%select{| whose type is not "
372  "compatible with that of an implicit declaration}1">,
373  InGroup<DiagGroup<"out-of-scope-function">>;
374def err_inline_non_function : Error<
375  "'inline' can only appear on functions%select{| and non-local variables}0">;
376def err_noreturn_non_function : Error<
377  "'_Noreturn' can only appear on functions">;
378def warn_qual_return_type : Warning<
379  "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
380  InGroup<IgnoredQualifiers>, DefaultIgnore;
381def warn_deprecated_redundant_constexpr_static_def : Warning<
382  "out-of-line definition of constexpr static data member is redundant "
383  "in C++17 and is deprecated">,
384  InGroup<Deprecated>, DefaultIgnore;
385
386def warn_decl_shadow :
387  Warning<"declaration shadows a %select{"
388          "local variable|"
389          "variable in %2|"
390          "static data member of %2|"
391          "field of %2|"
392          "typedef in %2|"
393          "type alias in %2}1">,
394  InGroup<Shadow>, DefaultIgnore;
395def warn_decl_shadow_uncaptured_local :
396  Warning<warn_decl_shadow.Text>,
397  InGroup<ShadowUncapturedLocal>, DefaultIgnore;
398def warn_ctor_parm_shadows_field:
399  Warning<"constructor parameter %0 shadows the field %1 of %2">,
400  InGroup<ShadowFieldInConstructor>, DefaultIgnore;
401def warn_modifying_shadowing_decl :
402  Warning<"modifying constructor parameter %0 that shadows a "
403          "field of %1">,
404  InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
405
406// C++ decomposition declarations
407def err_decomp_decl_context : Error<
408  "decomposition declaration not permitted in this context">;
409def warn_cxx14_compat_decomp_decl : Warning<
410  "decomposition declarations are incompatible with "
411  "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
412def ext_decomp_decl : ExtWarn<
413  "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
414def ext_decomp_decl_cond : ExtWarn<
415  "ISO C++17 does not permit structured binding declaration in a condition">,
416  InGroup<DiagGroup<"binding-in-condition">>;
417def err_decomp_decl_spec : Error<
418  "decomposition declaration cannot be declared "
419  "%plural{1:'%1'|:with '%1' specifiers}0">;
420def err_decomp_decl_type : Error<
421  "decomposition declaration cannot be declared with type %0; "
422  "declared type must be 'auto' or reference to 'auto'">;
423def err_decomp_decl_parens : Error<
424  "decomposition declaration cannot be declared with parentheses">;
425def err_decomp_decl_template : Error<
426  "decomposition declaration template not supported">;
427def err_decomp_decl_not_alone : Error<
428  "decomposition declaration must be the only declaration in its group">;
429def err_decomp_decl_requires_init : Error<
430  "decomposition declaration %0 requires an initializer">;
431def err_decomp_decl_wrong_number_bindings : Error<
432  "type %0 decomposes into %2 elements, but %select{only |}3%1 "
433  "names were provided">;
434def err_decomp_decl_unbindable_type : Error<
435  "cannot decompose %select{union|non-class, non-array}1 type %2">;
436def err_decomp_decl_multiple_bases_with_members : Error<
437  "cannot decompose class type %1: "
438  "%select{its base classes %2 and|both it and its base class}0 %3 "
439  "have non-static data members">;
440def err_decomp_decl_ambiguous_base : Error<
441  "cannot decompose members of ambiguous base class %1 of %0:%2">;
442def err_decomp_decl_inaccessible_base : Error<
443  "cannot decompose members of inaccessible base class %1 of %0">,
444  AccessControl;
445def err_decomp_decl_inaccessible_field : Error<
446  "cannot decompose %select{private|protected}0 member %1 of %3">,
447  AccessControl;
448def err_decomp_decl_anon_union_member : Error<
449  "cannot decompose class type %0 because it has an anonymous "
450  "%select{struct|union}1 member">;
451def err_decomp_decl_std_tuple_element_not_specialized : Error<
452  "cannot decompose this type; 'std::tuple_element<%0>::type' "
453  "does not name a type">;
454def err_decomp_decl_std_tuple_size_not_constant : Error<
455  "cannot decompose this type; 'std::tuple_size<%0>::value' "
456  "is not a valid integral constant expression">;
457def note_in_binding_decl_init : Note<
458  "in implicit initialization of binding declaration %0">;
459
460def err_std_type_trait_not_class_template : Error<
461  "unsupported standard library implementation: "
462  "'std::%0' is not a class template">;
463
464// C++ using declarations
465def err_using_requires_qualname : Error<
466  "using declaration requires a qualified name">;
467def err_using_typename_non_type : Error<
468  "'typename' keyword used on a non-type">;
469def err_using_dependent_value_is_type : Error<
470  "dependent using declaration resolved to type without 'typename'">;
471def err_using_decl_nested_name_specifier_is_not_class : Error<
472  "using declaration in class refers into '%0', which is not a class">;
473def err_using_decl_nested_name_specifier_is_current_class : Error<
474  "using declaration refers to its own class">;
475def err_using_decl_nested_name_specifier_is_not_base_class : Error<
476  "using declaration refers into '%0', which is not a base class of %1">;
477def err_using_decl_constructor_not_in_direct_base : Error<
478  "%0 is not a direct base of %1, cannot inherit constructors">;
479def err_using_decl_can_not_refer_to_class_member : Error<
480  "using declaration cannot refer to class member">;
481def err_ambiguous_inherited_constructor : Error<
482  "constructor of %0 inherited from multiple base class subobjects">;
483def note_ambiguous_inherited_constructor_using : Note<
484  "inherited from base class %0 here">;
485def note_using_decl_class_member_workaround : Note<
486  "use %select{an alias declaration|a typedef declaration|a reference|"
487  "a const variable|a constexpr variable}0 instead">;
488def err_using_decl_can_not_refer_to_namespace : Error<
489  "using declaration cannot refer to a namespace">;
490def err_using_decl_can_not_refer_to_scoped_enum : Error<
491  "using declaration cannot refer to a scoped enumerator">;
492def err_using_decl_constructor : Error<
493  "using declaration cannot refer to a constructor">;
494def warn_cxx98_compat_using_decl_constructor : Warning<
495  "inheriting constructors are incompatible with C++98">,
496  InGroup<CXX98Compat>, DefaultIgnore;
497def err_using_decl_destructor : Error<
498  "using declaration cannot refer to a destructor">;
499def err_using_decl_template_id : Error<
500  "using declaration cannot refer to a template specialization">;
501def note_using_decl_target : Note<"target of using declaration">;
502def note_using_decl_conflict : Note<"conflicting declaration">;
503def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
504def err_using_decl_conflict : Error<
505  "target of using declaration conflicts with declaration already in scope">;
506def err_using_decl_conflict_reverse : Error<
507  "declaration conflicts with target of using declaration already in scope">;
508def note_using_decl : Note<"%select{|previous }0using declaration">;
509def err_using_decl_redeclaration_expansion : Error<
510  "using declaration pack expansion at block scope produces multiple values">;
511
512def warn_access_decl_deprecated : Warning<
513  "access declarations are deprecated; use using declarations instead">,
514  InGroup<Deprecated>;
515def err_access_decl : Error<
516  "ISO C++11 does not allow access declarations; "
517  "use using declarations instead">;
518def warn_deprecated_copy_operation : Warning<
519  "definition of implicit copy %select{constructor|assignment operator}1 "
520  "for %0 is deprecated because it has a user-declared "
521  "%select{copy %select{assignment operator|constructor}1|destructor}2">,
522  InGroup<Deprecated>, DefaultIgnore;
523def warn_cxx17_compat_exception_spec_in_signature : Warning<
524  "mangled name of %0 will change in C++17 due to non-throwing exception "
525  "specification in function signature">, InGroup<CXX17CompatMangling>;
526
527def warn_global_constructor : Warning<
528  "declaration requires a global constructor">,
529  InGroup<GlobalConstructors>, DefaultIgnore;
530def warn_global_destructor : Warning<
531  "declaration requires a global destructor">,
532   InGroup<GlobalConstructors>, DefaultIgnore;
533def warn_exit_time_destructor : Warning<
534  "declaration requires an exit-time destructor">,
535  InGroup<ExitTimeDestructors>, DefaultIgnore;
536
537def err_invalid_thread : Error<
538  "'%0' is only allowed on variable declarations">;
539def err_thread_non_global : Error<
540  "'%0' variables must have global storage">;
541def err_thread_unsupported : Error<
542  "thread-local storage is not supported for the current target">;
543
544def warn_maybe_falloff_nonvoid_function : Warning<
545  "control may reach end of non-void function">,
546  InGroup<ReturnType>;
547def warn_falloff_nonvoid_function : Warning<
548  "control reaches end of non-void function">,
549  InGroup<ReturnType>;
550def err_maybe_falloff_nonvoid_block : Error<
551  "control may reach end of non-void block">;
552def err_falloff_nonvoid_block : Error<
553  "control reaches end of non-void block">;
554def warn_maybe_falloff_nonvoid_coroutine : Warning<
555  "control may reach end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
556  InGroup<ReturnType>;
557def warn_falloff_nonvoid_coroutine : Warning<
558  "control reaches end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">,
559  InGroup<ReturnType>;
560def warn_suggest_noreturn_function : Warning<
561  "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
562  InGroup<MissingNoreturn>, DefaultIgnore;
563def warn_suggest_noreturn_block : Warning<
564  "block could be declared with attribute 'noreturn'">,
565  InGroup<MissingNoreturn>, DefaultIgnore;
566
567// Unreachable code.
568def warn_unreachable : Warning<
569  "code will never be executed">,
570  InGroup<UnreachableCode>, DefaultIgnore;
571def warn_unreachable_break : Warning<
572  "'break' will never be executed">,
573  InGroup<UnreachableCodeBreak>, DefaultIgnore;
574def warn_unreachable_return : Warning<
575  "'return' will never be executed">,
576  InGroup<UnreachableCodeReturn>, DefaultIgnore;
577def warn_unreachable_loop_increment : Warning<
578  "loop will run at most once (loop increment never executed)">,
579  InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
580def note_unreachable_silence : Note<
581  "silence by adding parentheses to mark code as explicitly dead">;
582
583/// Built-in functions.
584def ext_implicit_lib_function_decl : ExtWarn<
585  "implicitly declaring library function '%0' with type %1">,
586  InGroup<ImplicitFunctionDeclare>;
587def note_include_header_or_declare : Note<
588  "include the header <%0> or explicitly provide a declaration for '%1'">;
589def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
590def warn_implicit_decl_requires_sysheader : Warning<
591  "declaration of built-in function '%1' requires inclusion of the header <%0>">,
592  InGroup<BuiltinRequiresHeader>;
593def warn_redecl_library_builtin : Warning<
594  "incompatible redeclaration of library function %0">,
595  InGroup<DiagGroup<"incompatible-library-redeclaration">>;
596def err_builtin_definition : Error<"definition of builtin function %0">;
597def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
598def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
599def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
600def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
601def err_invalid_cpu_specific_dispatch_value : Error<
602"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
603def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
604  InGroup<ImplicitFunctionDeclare>, DefaultError;
605def warn_cstruct_memaccess : Warning<
606  "%select{destination for|source of|first operand of|second operand of}0 this "
607  "%1 call is a pointer to record %2 that is not trivial to "
608  "%select{primitive-default-initialize|primitive-copy}3">,
609  InGroup<NonTrivialMemaccess>;
610def note_nontrivial_field : Note<
611  "field is non-trivial to %select{copy|default-initialize}0">;
612def err_nontrivial_primitive_type_in_union : Error<
613  "non-trivial C types are disallowed in union">;
614def warn_dyn_class_memaccess : Warning<
615  "%select{destination for|source of|first operand of|second operand of}0 this "
616  "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
617  "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
618  InGroup<DynamicClassMemaccess>;
619def note_bad_memaccess_silence : Note<
620  "explicitly cast the pointer to silence this warning">;
621def warn_sizeof_pointer_expr_memaccess : Warning<
622  "'%0' call operates on objects of type %1 while the size is based on a "
623  "different type %2">,
624  InGroup<SizeofPointerMemaccess>;
625def warn_sizeof_pointer_expr_memaccess_note : Note<
626  "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
627  "it by the number of elements)|remove the addressof in the argument to "
628  "'sizeof' (and multiply it by the number of elements)|provide an explicit "
629  "length}0?">;
630def warn_sizeof_pointer_type_memaccess : Warning<
631  "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
632  "%select{destination|source}2; expected %3 or an explicit length">,
633  InGroup<SizeofPointerMemaccess>;
634def warn_strlcpycat_wrong_size : Warning<
635  "size argument in %0 call appears to be size of the source; "
636  "expected the size of the destination">,
637  InGroup<DiagGroup<"strlcpy-strlcat-size">>;
638def note_strlcpycat_wrong_size : Note<
639  "change size argument to be the size of the destination">;
640def warn_memsize_comparison : Warning<
641  "size argument in %0 call is a comparison">,
642  InGroup<DiagGroup<"memsize-comparison">>;
643def note_memsize_comparison_paren : Note<
644  "did you mean to compare the result of %0 instead?">;
645def note_memsize_comparison_cast_silence : Note<
646  "explicitly cast the argument to size_t to silence this warning">;
647def warn_suspicious_sizeof_memset : Warning<
648  "%select{'size' argument to memset is '0'|"
649  "setting buffer to a 'sizeof' expression}0"
650  "; did you mean to transpose the last two arguments?">,
651  InGroup<MemsetTransposedArgs>;
652def note_suspicious_sizeof_memset_silence : Note<
653  "%select{parenthesize the third argument|"
654  "cast the second argument to 'int'}0 to silence">;
655def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
656  InGroup<SuspiciousBzero>;
657def note_suspicious_bzero_size_silence : Note<
658  "parenthesize the second argument to silence">;
659
660def warn_strncat_large_size : Warning<
661  "the value of the size argument in 'strncat' is too large, might lead to a "
662  "buffer overflow">, InGroup<StrncatSize>;
663def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
664  "to be size of the source">, InGroup<StrncatSize>;
665def warn_strncat_wrong_size : Warning<
666  "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
667def note_strncat_wrong_size : Note<
668  "change the argument to be the free space in the destination buffer minus "
669  "the terminating null byte">;
670
671def warn_assume_side_effects : Warning<
672  "the argument to %0 has side effects that will be discarded">,
673  InGroup<DiagGroup<"assume">>;
674
675def warn_builtin_chk_overflow : Warning<
676  "'%0' will always overflow; destination buffer has size %1,"
677  " but size argument is %2">,
678  InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
679
680def warn_fortify_source_overflow
681  : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
682def warn_fortify_source_size_mismatch : Warning<
683  "'%0' size argument is too large; destination buffer has size %1,"
684  " but size argument is %2">, InGroup<FortifySource>;
685
686/// main()
687// static main() is not an error in C, just in C++.
688def warn_static_main : Warning<"'main' should not be declared static">,
689    InGroup<Main>;
690def err_static_main : Error<"'main' is not allowed to be declared static">;
691def err_inline_main : Error<"'main' is not allowed to be declared inline">;
692def ext_variadic_main : ExtWarn<
693  "'main' is not allowed to be declared variadic">, InGroup<Main>;
694def ext_noreturn_main : ExtWarn<
695  "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
696def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
697def err_constexpr_main : Error<
698  "'main' is not allowed to be declared constexpr">;
699def err_deleted_main : Error<"'main' is not allowed to be deleted">;
700def err_mainlike_template_decl : Error<"%0 cannot be a template">;
701def err_main_returns_nonint : Error<"'main' must return 'int'">;
702def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
703    InGroup<MainReturnType>;
704def note_main_change_return_type : Note<"change return type to 'int'">;
705def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
706    "must be 0, 2, or 3">;
707def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
708    InGroup<Main>;
709def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
710    "parameter of 'main' (%select{argument count|argument array|environment|"
711    "platform-specific data}0) must be of type %1">;
712def warn_main_returns_bool_literal : Warning<"bool literal returned from "
713    "'main'">, InGroup<Main>;
714def err_main_global_variable :
715    Error<"main cannot be declared as global variable">;
716def warn_main_redefined : Warning<"variable named 'main' with external linkage "
717    "has undefined behavior">, InGroup<Main>;
718def ext_main_used : Extension<
719  "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
720
721/// parser diagnostics
722def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
723  InGroup<MissingDeclarations>;
724def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
725  InGroup<MissingDeclarations>;
726def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
727def err_typedef_changes_linkage : Error<"unsupported: typedef changes linkage"
728  " of anonymous type, but linkage was already computed">;
729def note_typedef_changes_linkage : Note<"use a tag name here to establish "
730  "linkage prior to definition">;
731def err_statically_allocated_object : Error<
732  "interface type cannot be statically allocated">;
733def err_object_cannot_be_passed_returned_by_value : Error<
734  "interface type %1 cannot be %select{returned|passed}0 by value"
735  "; did you forget * in %1?">;
736def err_parameters_retval_cannot_have_fp16_type : Error<
737  "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
738def err_opencl_half_load_store : Error<
739  "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
740  "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
741def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
742def err_opencl_half_declaration : Error<
743  "declaring variable of type %0 is not allowed">;
744def err_opencl_half_param : Error<
745  "declaring function parameter of type %0 is not allowed; did you forget * ?">;
746def err_opencl_invalid_return : Error<
747  "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
748def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
749def warn_pragma_options_align_reset_failed : Warning<
750  "#pragma options align=reset failed: %0">,
751  InGroup<IgnoredPragmas>;
752def err_pragma_options_align_mac68k_target_unsupported : Error<
753  "mac68k alignment pragma is not supported on this target">;
754def warn_pragma_pack_invalid_alignment : Warning<
755  "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
756  InGroup<IgnoredPragmas>;
757def warn_pragma_pack_non_default_at_include : Warning<
758  "non-default #pragma pack value changes the alignment of struct or union "
759  "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
760  DefaultIgnore;
761def warn_pragma_pack_modified_after_include : Warning<
762  "the current #pragma pack alignment value is modified in the included "
763  "file">, InGroup<PragmaPack>;
764def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
765  "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
766def note_pragma_pack_here : Note<
767  "previous '#pragma pack' directive that modifies alignment is here">;
768def note_pragma_pack_pop_instead_reset : Note<
769  "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
770// Follow the Microsoft implementation.
771def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
772def warn_pragma_pack_pop_identifier_and_alignment : Warning<
773  "specifying both a name and alignment to 'pop' is undefined">;
774def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
775  InGroup<IgnoredPragmas>;
776def warn_cxx_ms_struct :
777  Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
778          "with base classes or virtual functions">,
779  DefaultError, InGroup<IncompatibleMSStruct>;
780def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
781def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
782def err_invalid_super_scope : Error<"invalid use of '__super', "
783  "this keyword can only be used inside class or member function scope">;
784def err_super_in_lambda_unsupported : Error<
785  "use of '__super' inside a lambda is unsupported">;
786
787def warn_pragma_unused_undeclared_var : Warning<
788  "undeclared variable %0 used as an argument for '#pragma unused'">,
789  InGroup<IgnoredPragmas>;
790def warn_atl_uuid_deprecated : Warning<
791  "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
792  InGroup<DeprecatedDeclarations>;
793def warn_pragma_unused_expected_var_arg : Warning<
794  "only variables can be arguments to '#pragma unused'">,
795  InGroup<IgnoredPragmas>;
796def err_pragma_push_visibility_mismatch : Error<
797  "#pragma visibility push with no matching #pragma visibility pop">;
798def note_surrounding_namespace_ends_here : Note<
799  "surrounding namespace with visibility attribute ends here">;
800def err_pragma_pop_visibility_mismatch : Error<
801  "#pragma visibility pop with no matching #pragma visibility push">;
802def note_surrounding_namespace_starts_here : Note<
803  "surrounding namespace with visibility attribute starts here">;
804def err_pragma_loop_invalid_argument_type : Error<
805  "invalid argument of type %0; expected an integer type">;
806def err_pragma_loop_invalid_argument_value : Error<
807  "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
808def err_pragma_loop_compatibility : Error<
809  "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
810def err_pragma_loop_precedes_nonloop : Error<
811  "expected a for, while, or do-while loop to follow '%0'">;
812
813def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
814  "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
815  "those declarations">;
816def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
817  "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
818def err_pragma_attribute_invalid_matchers : Error<
819  "attribute %0 can't be applied to %1">;
820def err_pragma_attribute_stack_mismatch : Error<
821  "'#pragma clang attribute %select{%1.|}0pop' with no matching"
822  " '#pragma clang attribute %select{%1.|}0push'">;
823def warn_pragma_attribute_unused : Warning<
824  "unused attribute %0 in '#pragma clang attribute push' region">,
825  InGroup<PragmaClangAttribute>;
826def note_pragma_attribute_region_ends_here : Note<
827  "'#pragma clang attribute push' regions ends here">;
828def err_pragma_attribute_no_pop_eof : Error<"unterminated "
829  "'#pragma clang attribute push' at end of file">;
830def note_pragma_attribute_applied_decl_here : Note<
831  "when applied to this declaration">;
832def err_pragma_attr_attr_no_push : Error<
833  "'#pragma clang attribute' attribute with no matching "
834  "'#pragma clang attribute push'">;
835
836/// Objective-C parser diagnostics
837def err_duplicate_class_def : Error<
838  "duplicate interface definition for class %0">;
839def err_undef_superclass : Error<
840  "cannot find interface declaration for %0, superclass of %1">;
841def err_forward_superclass : Error<
842  "attempting to use the forward class %0 as superclass of %1">;
843def err_no_nsconstant_string_class : Error<
844  "cannot find interface declaration for %0">;
845def err_recursive_superclass : Error<
846  "trying to recursively use %0 as superclass of %1">;
847def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
848def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
849def warn_duplicate_protocol_def : Warning<
850  "duplicate protocol definition of %0 is ignored">,
851  InGroup<DiagGroup<"duplicate-protocol">>;
852def err_protocol_has_circular_dependency : Error<
853  "protocol has circular dependency">;
854def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
855def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
856def err_atprotocol_protocol : Error<
857  "@protocol is using a forward protocol declaration of %0">;
858def warn_readonly_property : Warning<
859  "attribute 'readonly' of property %0 restricts attribute "
860  "'readwrite' of property inherited from %1">,
861  InGroup<PropertyAttr>;
862
863def warn_property_attribute : Warning<
864  "'%1' attribute on property %0 does not match the property inherited from %2">,
865  InGroup<PropertyAttr>;
866def warn_property_types_are_incompatible : Warning<
867  "property type %0 is incompatible with type %1 inherited from %2">,
868  InGroup<DiagGroup<"incompatible-property-type">>;
869def warn_protocol_property_mismatch : Warning<
870  "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
871  "getter %1|with setter %1}0 was selected for synthesis">,
872  InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
873def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
874def err_undef_interface : Error<"cannot find interface declaration for %0">;
875def err_category_forward_interface : Error<
876  "cannot define %select{category|class extension}0 for undefined class %1">;
877def err_class_extension_after_impl : Error<
878  "cannot declare class extension for %0 after class implementation">;
879def note_implementation_declared : Note<
880  "class implementation is declared here">;
881def note_while_in_implementation : Note<
882  "detected while default synthesizing properties in class implementation">;
883def note_class_declared : Note<
884  "class is declared here">;
885def note_receiver_class_declared : Note<
886  "receiver is instance of class declared here">;
887def note_receiver_expr_here : Note<
888  "receiver expression is here">;
889def note_receiver_is_id : Note<
890  "receiver is treated with 'id' type for purpose of method lookup">;
891def note_suppressed_class_declare : Note<
892  "class with specified objc_requires_property_definitions attribute is declared here">;
893def err_objc_root_class_subclass : Error<
894  "objc_root_class attribute may only be specified on a root class declaration">;
895def err_restricted_superclass_mismatch : Error<
896  "cannot subclass a class that was declared with the "
897  "'objc_subclassing_restricted' attribute">;
898def warn_objc_root_class_missing : Warning<
899  "class %0 defined without specifying a base class">,
900  InGroup<ObjCRootClass>;
901def err_objc_runtime_visible_category : Error<
902  "cannot implement a category for class %0 that is only visible via the "
903  "Objective-C runtime">;
904def err_objc_runtime_visible_subclass : Error<
905  "cannot implement subclass %0 of a superclass %1 that is only visible via the "
906  "Objective-C runtime">;
907def note_objc_needs_superclass : Note<
908  "add a super class to fix this problem">;
909def err_conflicting_super_class : Error<"conflicting super class name %0">;
910def err_dup_implementation_class : Error<"reimplementation of class %0">;
911def err_dup_implementation_category : Error<
912  "reimplementation of category %1 for class %0">;
913def err_conflicting_ivar_type : Error<
914  "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
915def err_duplicate_ivar_declaration : Error<
916  "instance variable is already declared">;
917def warn_on_superclass_use : Warning<
918  "class implementation may not have super class">;
919def err_conflicting_ivar_bitwidth : Error<
920  "instance variable %0 has conflicting bit-field width">;
921def err_conflicting_ivar_name : Error<
922  "conflicting instance variable names: %0 vs %1">;
923def err_inconsistent_ivar_count : Error<
924  "inconsistent number of instance variables specified">;
925def warn_undef_method_impl : Warning<"method definition for %0 not found">,
926  InGroup<DiagGroup<"incomplete-implementation">>;
927def warn_objc_boxing_invalid_utf8_string : Warning<
928  "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
929  InGroup<ObjCBoxing>;
930
931def warn_conflicting_overriding_ret_types : Warning<
932  "conflicting return type in "
933  "declaration of %0%diff{: $ vs $|}1,2">,
934  InGroup<OverridingMethodMismatch>, DefaultIgnore;
935
936def warn_conflicting_ret_types : Warning<
937  "conflicting return type in "
938  "implementation of %0%diff{: $ vs $|}1,2">,
939  InGroup<MismatchedReturnTypes>;
940
941def warn_conflicting_overriding_ret_type_modifiers : Warning<
942  "conflicting distributed object modifiers on return type "
943  "in declaration of %0">,
944  InGroup<OverridingMethodMismatch>, DefaultIgnore;
945
946def warn_conflicting_ret_type_modifiers : Warning<
947  "conflicting distributed object modifiers on return type "
948  "in implementation of %0">,
949  InGroup<DistributedObjectModifiers>;
950
951def warn_non_covariant_overriding_ret_types : Warning<
952  "conflicting return type in "
953  "declaration of %0: %1 vs %2">,
954  InGroup<OverridingMethodMismatch>, DefaultIgnore;
955
956def warn_non_covariant_ret_types : Warning<
957  "conflicting return type in "
958  "implementation of %0: %1 vs %2">,
959  InGroup<MethodSignatures>, DefaultIgnore;
960
961def warn_conflicting_overriding_param_types : Warning<
962  "conflicting parameter types in "
963  "declaration of %0%diff{: $ vs $|}1,2">,
964  InGroup<OverridingMethodMismatch>, DefaultIgnore;
965
966def warn_conflicting_param_types : Warning<
967  "conflicting parameter types in "
968  "implementation of %0%diff{: $ vs $|}1,2">,
969  InGroup<MismatchedParameterTypes>;
970
971def warn_conflicting_param_modifiers : Warning<
972  "conflicting distributed object modifiers on parameter type "
973  "in implementation of %0">,
974  InGroup<DistributedObjectModifiers>;
975
976def warn_conflicting_overriding_param_modifiers : Warning<
977  "conflicting distributed object modifiers on parameter type "
978  "in declaration of %0">,
979  InGroup<OverridingMethodMismatch>, DefaultIgnore;
980
981def warn_non_contravariant_overriding_param_types : Warning<
982  "conflicting parameter types in "
983  "declaration of %0: %1 vs %2">,
984  InGroup<OverridingMethodMismatch>, DefaultIgnore;
985
986def warn_non_contravariant_param_types : Warning<
987  "conflicting parameter types in "
988  "implementation of %0: %1 vs %2">,
989  InGroup<MethodSignatures>, DefaultIgnore;
990
991def warn_conflicting_overriding_variadic :Warning<
992  "conflicting variadic declaration of method and its "
993  "implementation">,
994  InGroup<OverridingMethodMismatch>, DefaultIgnore;
995
996def warn_conflicting_variadic :Warning<
997  "conflicting variadic declaration of method and its "
998  "implementation">;
999
1000def warn_category_method_impl_match:Warning<
1001  "category is implementing a method which will also be implemented"
1002  " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1003
1004def warn_implements_nscopying : Warning<
1005"default assign attribute on property %0 which implements "
1006"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1007
1008def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1009  InGroup<ObjCMultipleMethodNames>;
1010def warn_strict_multiple_method_decl : Warning<
1011  "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1012def warn_accessor_property_type_mismatch : Warning<
1013  "type of property %0 does not match type of accessor %1">;
1014def note_conv_function_declared_at : Note<"type conversion function declared here">;
1015def note_method_declared_at : Note<"method %0 declared here">;
1016def note_property_attribute : Note<"property %0 is declared "
1017  "%select{deprecated|unavailable|partial}1 here">;
1018def err_setter_type_void : Error<"type of setter must be void">;
1019def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1020def warn_duplicate_method_decl :
1021  Warning<"multiple declarations of method %0 found and ignored">,
1022  InGroup<MethodDuplicate>, DefaultIgnore;
1023def warn_objc_cdirective_format_string :
1024  Warning<"using %0 directive in %select{NSString|CFString}1 "
1025          "which is being passed as a formatting argument to the formatting "
1026          "%select{method|CFfunction}2">,
1027  InGroup<ObjCCStringFormat>, DefaultIgnore;
1028def err_objc_var_decl_inclass :
1029    Error<"cannot declare variable inside @interface or @protocol">;
1030def err_missing_method_context : Error<
1031  "missing context for method declaration">;
1032def err_objc_property_attr_mutually_exclusive : Error<
1033  "property attributes '%0' and '%1' are mutually exclusive">;
1034def err_objc_property_requires_object : Error<
1035  "property with '%0' attribute must be of object type">;
1036def warn_objc_property_assign_on_object : Warning<
1037  "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1038  InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1039def warn_objc_property_no_assignment_attribute : Warning<
1040  "no 'assign', 'retain', or 'copy' attribute is specified - "
1041  "'assign' is assumed">,
1042  InGroup<ObjCPropertyNoAttribute>;
1043def warn_objc_isa_use : Warning<
1044  "direct access to Objective-C's isa is deprecated in favor of "
1045  "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1046def warn_objc_isa_assign : Warning<
1047  "assignment to Objective-C's isa is deprecated in favor of "
1048  "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1049def warn_objc_pointer_masking : Warning<
1050  "bitmasking for introspection of Objective-C object pointers is strongly "
1051  "discouraged">,
1052  InGroup<ObjCPointerIntrospect>;
1053def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1054  InGroup<ObjCPointerIntrospectPerformSelector>;
1055def warn_objc_property_default_assign_on_object : Warning<
1056  "default property attribute 'assign' not appropriate for object">,
1057  InGroup<ObjCPropertyNoAttribute>;
1058def warn_property_attr_mismatch : Warning<
1059  "property attribute in class extension does not match the primary class">,
1060  InGroup<PropertyAttr>;
1061def warn_property_implicitly_mismatched : Warning <
1062  "primary property declaration is implicitly strong while redeclaration "
1063  "in class extension is weak">,
1064  InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1065def warn_objc_property_copy_missing_on_block : Warning<
1066    "'copy' attribute must be specified for the block property "
1067    "when -fobjc-gc-only is specified">;
1068def warn_objc_property_retain_of_block : Warning<
1069    "retain'ed block property does not copy the block "
1070    "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1071def warn_objc_readonly_property_has_setter : Warning<
1072    "setter cannot be specified for a readonly property">,
1073    InGroup<ObjCReadonlyPropertyHasSetter>;
1074def warn_atomic_property_rule : Warning<
1075  "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1076  "with a user defined %select{getter|setter}2">,
1077  InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1078def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1079  "synthesized, or both be user defined,or the property must be nonatomic">;
1080def err_atomic_property_nontrivial_assign_op : Error<
1081  "atomic property of reference type %0 cannot have non-trivial assignment"
1082  " operator">;
1083def warn_cocoa_naming_owned_rule : Warning<
1084  "property follows Cocoa naming"
1085  " convention for returning 'owned' objects">,
1086  InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1087def err_cocoa_naming_owned_rule : Error<
1088  "property follows Cocoa naming"
1089  " convention for returning 'owned' objects">;
1090def note_cocoa_naming_declare_family : Note<
1091  "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1092  "object">;
1093def warn_auto_synthesizing_protocol_property :Warning<
1094  "auto property synthesis will not synthesize property %0"
1095  " declared in protocol %1">,
1096  InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1097def note_add_synthesize_directive : Note<
1098  "add a '@synthesize' directive">;
1099def warn_no_autosynthesis_shared_ivar_property : Warning <
1100  "auto property synthesis will not synthesize property "
1101  "%0 because it cannot share an ivar with another synthesized property">,
1102  InGroup<ObjCNoPropertyAutoSynthesis>;
1103def warn_no_autosynthesis_property : Warning<
1104  "auto property synthesis will not synthesize property "
1105  "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1106  "via another property">,
1107  InGroup<ObjCNoPropertyAutoSynthesis>;
1108def warn_autosynthesis_property_in_superclass : Warning<
1109  "auto property synthesis will not synthesize property "
1110  "%0; it will be implemented by its superclass, use @dynamic to "
1111  "acknowledge intention">,
1112  InGroup<ObjCNoPropertyAutoSynthesis>;
1113def warn_autosynthesis_property_ivar_match :Warning<
1114  "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1115  "%2, not existing instance variable %3">,
1116  InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1117def warn_missing_explicit_synthesis : Warning <
1118  "auto property synthesis is synthesizing property not explicitly synthesized">,
1119  InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1120def warn_property_getter_owning_mismatch : Warning<
1121  "property declared as returning non-retained objects"
1122  "; getter returning retained objects">;
1123def warn_property_redecl_getter_mismatch : Warning<
1124  "getter name mismatch between property redeclaration (%1) and its original "
1125  "declaration (%0)">, InGroup<PropertyAttr>;
1126def err_property_setter_ambiguous_use : Error<
1127  "synthesized properties %0 and %1 both claim setter %2 -"
1128  " use of this setter will cause unexpected behavior">;
1129def warn_default_atomic_custom_getter_setter : Warning<
1130  "atomic by default property %0 has a user defined %select{getter|setter}1 "
1131  "(property should be marked 'atomic' if this is intended)">,
1132  InGroup<CustomAtomic>, DefaultIgnore;
1133def err_use_continuation_class : Error<
1134  "illegal redeclaration of property in class extension %0"
1135  " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1136def err_type_mismatch_continuation_class : Error<
1137  "type of property %0 in class extension does not match "
1138  "property type in primary class">;
1139def err_use_continuation_class_redeclaration_readwrite : Error<
1140  "illegal redeclaration of 'readwrite' property in class extension %0"
1141  " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1142  "'readonly' public property?)">;
1143def err_continuation_class : Error<"class extension has no primary class">;
1144def err_property_type : Error<"property cannot have array or function type %0">;
1145def err_missing_property_context : Error<
1146  "missing context for property implementation declaration">;
1147def err_bad_property_decl : Error<
1148  "property implementation must have its declaration in interface %0 or one of "
1149  "its extensions">;
1150def err_category_property : Error<
1151  "property declared in category %0 cannot be implemented in "
1152  "class implementation">;
1153def note_property_declare : Note<
1154  "property declared here">;
1155def note_protocol_property_declare : Note<
1156  "it could also be property "
1157  "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1158  "%1|with setter %1}0 declared here">;
1159def note_property_synthesize : Note<
1160  "property synthesized here">;
1161def err_synthesize_category_decl : Error<
1162  "@synthesize not allowed in a category's implementation">;
1163def err_synthesize_on_class_property : Error<
1164  "@synthesize not allowed on a class property %0">;
1165def err_missing_property_interface : Error<
1166  "property implementation in a category with no category declaration">;
1167def err_bad_category_property_decl : Error<
1168  "property implementation must have its declaration in the category %0">;
1169def err_bad_property_context : Error<
1170  "property implementation must be in a class or category implementation">;
1171def err_missing_property_ivar_decl : Error<
1172  "synthesized property %0 must either be named the same as a compatible"
1173  " instance variable or must explicitly name an instance variable">;
1174def err_arc_perform_selector_retains : Error<
1175  "performSelector names a selector which retains the object">;
1176def warn_arc_perform_selector_leaks : Warning<
1177  "performSelector may cause a leak because its selector is unknown">,
1178  InGroup<DiagGroup<"arc-performSelector-leaks">>;
1179def warn_dealloc_in_category : Warning<
1180"-dealloc is being overridden in a category">,
1181InGroup<DeallocInCategory>;
1182def err_gc_weak_property_strong_type : Error<
1183  "weak attribute declared on a __strong type property in GC mode">;
1184def warn_arc_repeated_use_of_weak : Warning <
1185  "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1186  "accessed multiple times in this %select{function|method|block|lambda}2 "
1187  "but may be unpredictably set to nil; assign to a strong variable to keep "
1188  "the object alive">,
1189  InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1190def warn_implicitly_retains_self : Warning <
1191  "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1192  "this is intended behavior">,
1193  InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1194def warn_arc_possible_repeated_use_of_weak : Warning <
1195  "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1196  "be accessed multiple times in this %select{function|method|block|lambda}2 "
1197  "and may be unpredictably set to nil; assign to a strong variable to keep "
1198  "the object alive">,
1199  InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1200def note_arc_weak_also_accessed_here : Note<
1201  "also accessed here">;
1202def err_incomplete_synthesized_property : Error<
1203  "cannot synthesize property %0 with incomplete type %1">;
1204
1205def err_property_ivar_type : Error<
1206  "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1207def err_property_accessor_type : Error<
1208  "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1209def err_ivar_in_superclass_use : Error<
1210  "property %0 attempting to use instance variable %1 declared in super class %2">;
1211def err_weak_property : Error<
1212  "existing instance variable %1 for __weak property %0 must be __weak">;
1213def err_strong_property : Error<
1214  "existing instance variable %1 for strong property %0 may not be __weak">;
1215def err_dynamic_property_ivar_decl : Error<
1216  "dynamic property cannot have instance variable specification">;
1217def err_duplicate_ivar_use : Error<
1218  "synthesized properties %0 and %1 both claim instance variable %2">;
1219def err_property_implemented : Error<"property %0 is already implemented">;
1220def warn_objc_missing_super_call : Warning<
1221  "method possibly missing a [super %0] call">,
1222  InGroup<ObjCMissingSuperCalls>;
1223def err_dealloc_bad_result_type : Error<
1224  "dealloc return type must be correctly specified as 'void' under ARC, "
1225  "instead of %0">;
1226def warn_undeclared_selector : Warning<
1227  "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1228def warn_undeclared_selector_with_typo : Warning<
1229  "undeclared selector %0; did you mean %1?">,
1230  InGroup<UndeclaredSelector>, DefaultIgnore;
1231def warn_implicit_atomic_property : Warning<
1232  "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1233def note_auto_readonly_iboutlet_fixup_suggest : Note<
1234  "property should be changed to be readwrite">;
1235def warn_auto_readonly_iboutlet_property : Warning<
1236  "readonly IBOutlet property %0 when auto-synthesized may "
1237  "not work correctly with 'nib' loader">,
1238  InGroup<DiagGroup<"readonly-iboutlet-property">>;
1239def warn_auto_implicit_atomic_property : Warning<
1240  "property is assumed atomic when auto-synthesizing the property">,
1241  InGroup<ImplicitAtomic>, DefaultIgnore;
1242def warn_unimplemented_selector:  Warning<
1243  "no method with selector %0 is implemented in this translation unit">,
1244  InGroup<Selector>, DefaultIgnore;
1245def warn_unimplemented_protocol_method : Warning<
1246  "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1247def warn_multiple_selectors: Warning<
1248  "several methods with selector %0 of mismatched types are found "
1249  "for the @selector expression">,
1250  InGroup<SelectorTypeMismatch>, DefaultIgnore;
1251
1252def err_objc_kindof_nonobject : Error<
1253  "'__kindof' specifier cannot be applied to non-object type %0">;
1254def err_objc_kindof_wrong_position : Error<
1255  "'__kindof' type specifier must precede the declarator">;
1256
1257def err_objc_method_unsupported_param_ret_type : Error<
1258  "%0 %select{parameter|return}1 type is unsupported; "
1259  "support for vector types for this target is introduced in %2">;
1260
1261def warn_messaging_unqualified_id : Warning<
1262  "messaging unqualified id">, DefaultIgnore,
1263  InGroup<DiagGroup<"objc-messaging-id">>;
1264
1265// C++ declarations
1266def err_static_assert_expression_is_not_constant : Error<
1267  "static_assert expression is not an integral constant expression">;
1268def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1269def err_static_assert_requirement_failed : Error<
1270  "static_assert failed due to requirement '%0'%select{ %2|}1">;
1271
1272def ext_inline_variable : ExtWarn<
1273  "inline variables are a C++17 extension">, InGroup<CXX17>;
1274def warn_cxx14_compat_inline_variable : Warning<
1275  "inline variables are incompatible with C++ standards before C++17">,
1276  DefaultIgnore, InGroup<CXXPre17Compat>;
1277
1278def warn_inline_namespace_reopened_noninline : Warning<
1279  "inline namespace reopened as a non-inline namespace">;
1280def err_inline_namespace_mismatch : Error<
1281  "non-inline namespace cannot be reopened as inline">;
1282
1283def err_unexpected_friend : Error<
1284  "friends can only be classes or functions">;
1285def ext_enum_friend : ExtWarn<
1286  "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1287def warn_cxx98_compat_enum_friend : Warning<
1288  "befriending enumeration type %0 is incompatible with C++98">,
1289  InGroup<CXX98Compat>, DefaultIgnore;
1290def ext_nonclass_type_friend : ExtWarn<
1291  "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1292def warn_cxx98_compat_nonclass_type_friend : Warning<
1293  "non-class friend type %0 is incompatible with C++98">,
1294  InGroup<CXX98Compat>, DefaultIgnore;
1295def err_friend_is_member : Error<
1296  "friends cannot be members of the declaring class">;
1297def warn_cxx98_compat_friend_is_member : Warning<
1298  "friend declaration naming a member of the declaring class is incompatible "
1299  "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1300def ext_unelaborated_friend_type : ExtWarn<
1301  "unelaborated friend declaration is a C++11 extension; specify "
1302  "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1303  InGroup<CXX11>;
1304def warn_cxx98_compat_unelaborated_friend_type : Warning<
1305  "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1306  "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1307def err_qualified_friend_no_match : Error<
1308  "friend declaration of %0 does not match any declaration in %1">;
1309def err_introducing_special_friend : Error<
1310  "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1311  " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1312  "as a friend">;
1313def err_tagless_friend_type_template : Error<
1314  "friend type templates must use an elaborated type">;
1315def err_no_matching_local_friend : Error<
1316  "no matching function found in local scope">;
1317def err_no_matching_local_friend_suggest : Error<
1318  "no matching function %0 found in local scope; did you mean %3?">;
1319def err_partial_specialization_friend : Error<
1320  "partial specialization cannot be declared as a friend">;
1321def err_qualified_friend_def : Error<
1322  "friend function definition cannot be qualified with '%0'">;
1323def err_friend_def_in_local_class : Error<
1324  "friend function cannot be defined in a local class">;
1325def err_friend_not_first_in_declaration : Error<
1326  "'friend' must appear first in a non-function declaration">;
1327def err_using_decl_friend : Error<
1328  "cannot befriend target of using declaration">;
1329def warn_template_qualified_friend_unsupported : Warning<
1330  "dependent nested name specifier '%0' for friend class declaration is "
1331  "not supported; turning off access control for %1">,
1332  InGroup<UnsupportedFriend>;
1333def warn_template_qualified_friend_ignored : Warning<
1334  "dependent nested name specifier '%0' for friend template declaration is "
1335  "not supported; ignoring this friend declaration">,
1336  InGroup<UnsupportedFriend>;
1337def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1338  "unqualified friend declaration referring to type outside of the nearest "
1339  "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1340  InGroup<MicrosoftUnqualifiedFriend>;
1341def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1342
1343def err_invalid_base_in_interface : Error<
1344  "interface type cannot inherit from "
1345  "%select{struct|non-public interface|class}0 %1">;
1346
1347def err_abstract_type_in_decl : Error<
1348  "%select{return|parameter|variable|field|instance variable|"
1349  "synthesized instance variable}0 type %1 is an abstract class">;
1350def err_allocation_of_abstract_type : Error<
1351  "allocating an object of abstract class type %0">;
1352def err_throw_abstract_type : Error<
1353  "cannot throw an object of abstract type %0">;
1354def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1355def err_capture_of_abstract_type : Error<
1356  "by-copy capture of value of abstract type %0">;
1357def err_capture_of_incomplete_type : Error<
1358  "by-copy capture of variable %0 with incomplete type %1">;
1359def err_capture_default_non_local : Error<
1360  "non-local lambda expression cannot have a capture-default">;
1361
1362def err_multiple_final_overriders : Error<
1363  "virtual function %q0 has more than one final overrider in %1">;
1364def note_final_overrider : Note<"final overrider of %q0 in %1">;
1365
1366def err_type_defined_in_type_specifier : Error<
1367  "%0 cannot be defined in a type specifier">;
1368def err_type_defined_in_result_type : Error<
1369  "%0 cannot be defined in the result type of a function">;
1370def err_type_defined_in_param_type : Error<
1371  "%0 cannot be defined in a parameter type">;
1372def err_type_defined_in_alias_template : Error<
1373  "%0 cannot be defined in a type alias template">;
1374def err_type_defined_in_condition : Error<
1375  "%0 cannot be defined in a condition">;
1376def err_type_defined_in_enum : Error<
1377  "%0 cannot be defined in an enumeration">;
1378
1379def note_pure_virtual_function : Note<
1380  "unimplemented pure virtual method %0 in %1">;
1381
1382def note_pure_qualified_call_kext : Note<
1383  "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1384
1385def err_deleted_decl_not_first : Error<
1386  "deleted definition must be first declaration">;
1387
1388def err_deleted_override : Error<
1389  "deleted function %0 cannot override a non-deleted function">;
1390
1391def err_non_deleted_override : Error<
1392  "non-deleted function %0 cannot override a deleted function">;
1393
1394def warn_weak_vtable : Warning<
1395  "%0 has no out-of-line virtual method definitions; its vtable will be "
1396  "emitted in every translation unit">,
1397  InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1398def warn_weak_template_vtable : Warning<
1399  "explicit template instantiation %0 will emit a vtable in every "
1400  "translation unit">,
1401  InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1402
1403def ext_using_undefined_std : ExtWarn<
1404  "using directive refers to implicitly-defined namespace 'std'">;
1405
1406// C++ exception specifications
1407def err_exception_spec_in_typedef : Error<
1408  "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1409def err_distant_exception_spec : Error<
1410  "exception specifications are not allowed beyond a single level "
1411  "of indirection">;
1412def err_incomplete_in_exception_spec : Error<
1413  "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1414  "in exception specification">;
1415def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1416  InGroup<MicrosoftExceptionSpec>;
1417def err_rref_in_exception_spec : Error<
1418  "rvalue reference type %0 is not allowed in exception specification">;
1419def err_mismatched_exception_spec : Error<
1420  "exception specification in declaration does not match previous declaration">;
1421def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1422  InGroup<MicrosoftExceptionSpec>;
1423def err_override_exception_spec : Error<
1424  "exception specification of overriding function is more lax than "
1425  "base version">;
1426def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1427  InGroup<MicrosoftExceptionSpec>;
1428def err_incompatible_exception_specs : Error<
1429  "target exception specification is not superset of source">;
1430def warn_incompatible_exception_specs : Warning<
1431  err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1432def err_deep_exception_specs_differ : Error<
1433  "exception specifications of %select{return|argument}0 types differ">;
1434def warn_deep_exception_specs_differ : Warning<
1435  err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1436def err_missing_exception_specification : Error<
1437  "%0 is missing exception specification '%1'">;
1438def ext_missing_exception_specification : ExtWarn<
1439  err_missing_exception_specification.Text>,
1440  InGroup<DiagGroup<"missing-exception-spec">>;
1441def ext_ms_missing_exception_specification : ExtWarn<
1442  err_missing_exception_specification.Text>,
1443  InGroup<MicrosoftExceptionSpec>;
1444def err_noexcept_needs_constant_expression : Error<
1445  "argument to noexcept specifier must be a constant expression">;
1446def err_exception_spec_not_parsed : Error<
1447  "exception specification is not available until end of class definition">;
1448def err_exception_spec_cycle : Error<
1449  "exception specification of %0 uses itself">;
1450def err_exception_spec_incomplete_type : Error<
1451  "exception specification needed for member of incomplete class %0">;
1452
1453// C++ access checking
1454def err_class_redeclared_with_different_access : Error<
1455  "%0 redeclared with '%1' access">;
1456def err_access : Error<
1457  "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1458def ext_ms_using_declaration_inaccessible : ExtWarn<
1459  "using declaration referring to inaccessible member '%0' (which refers "
1460  "to accessible member '%1') is a Microsoft compatibility extension">,
1461    AccessControl, InGroup<MicrosoftUsingDecl>;
1462def err_access_ctor : Error<
1463  "calling a %select{private|protected}0 constructor of class %2">,
1464  AccessControl;
1465def ext_rvalue_to_reference_access_ctor : Extension<
1466  "C++98 requires an accessible copy constructor for class %2 when binding "
1467  "a reference to a temporary; was %select{private|protected}0">,
1468  AccessControl, InGroup<BindToTemporaryCopy>;
1469def err_access_base_ctor : Error<
1470  // The ERRORs represent other special members that aren't constructors, in
1471  // hopes that someone will bother noticing and reporting if they appear
1472  "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1473  "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1474  "|*ERROR*|}2constructor">, AccessControl;
1475def err_access_field_ctor : Error<
1476  // The ERRORs represent other special members that aren't constructors, in
1477  // hopes that someone will bother noticing and reporting if they appear
1478  "field of type %0 has %select{private|protected}2 "
1479  "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1480  AccessControl;
1481def err_access_friend_function : Error<
1482  "friend function %1 is a %select{private|protected}0 member of %3">,
1483  AccessControl;
1484
1485def err_access_dtor : Error<
1486  "calling a %select{private|protected}1 destructor of class %0">,
1487  AccessControl;
1488def err_access_dtor_base :
1489    Error<"base class %0 has %select{private|protected}1 destructor">,
1490    AccessControl;
1491def err_access_dtor_vbase :
1492    Error<"inherited virtual base class %1 has "
1493    "%select{private|protected}2 destructor">,
1494    AccessControl;
1495def err_access_dtor_temp :
1496    Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1497    AccessControl;
1498def err_access_dtor_exception :
1499    Error<"exception object of type %0 has %select{private|protected}1 "
1500          "destructor">, AccessControl;
1501def err_access_dtor_field :
1502    Error<"field of type %1 has %select{private|protected}2 destructor">,
1503    AccessControl;
1504def err_access_dtor_var :
1505    Error<"variable of type %1 has %select{private|protected}2 destructor">,
1506    AccessControl;
1507def err_access_dtor_ivar :
1508    Error<"instance variable of type %0 has %select{private|protected}1 "
1509          "destructor">,
1510    AccessControl;
1511def note_previous_access_declaration : Note<
1512  "previously declared '%1' here">;
1513def note_access_natural : Note<
1514  "%select{|implicitly }1declared %select{private|protected}0 here">;
1515def note_access_constrained_by_path : Note<
1516  "constrained by %select{|implicitly }1%select{private|protected}0"
1517  " inheritance here">;
1518def note_access_protected_restricted_noobject : Note<
1519  "must name member using the type of the current context %0">;
1520def note_access_protected_restricted_ctordtor : Note<
1521  "protected %select{constructor|destructor}0 can only be used to "
1522  "%select{construct|destroy}0 a base class subobject">;
1523def note_access_protected_restricted_object : Note<
1524  "can only access this member on an object of type %0">;
1525def warn_cxx98_compat_sfinae_access_control : Warning<
1526  "substitution failure due to access control is incompatible with C++98">,
1527  InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1528
1529// C++ name lookup
1530def err_incomplete_nested_name_spec : Error<
1531  "incomplete type %0 named in nested name specifier">;
1532def err_dependent_nested_name_spec : Error<
1533  "nested name specifier for a declaration cannot depend on a template "
1534  "parameter">;
1535def err_nested_name_member_ref_lookup_ambiguous : Error<
1536  "lookup of %0 in member access expression is ambiguous">;
1537def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1538  "lookup of %0 in member access expression is ambiguous; using member of %1">,
1539  InGroup<AmbigMemberTemplate>;
1540def note_ambig_member_ref_object_type : Note<
1541  "lookup in the object type %0 refers here">;
1542def note_ambig_member_ref_scope : Note<
1543  "lookup from the current scope refers here">;
1544def err_qualified_member_nonclass : Error<
1545  "qualified member access refers to a member in %0">;
1546def err_incomplete_member_access : Error<
1547  "member access into incomplete type %0">;
1548def err_incomplete_type : Error<
1549  "incomplete type %0 where a complete type is required">;
1550def warn_cxx98_compat_enum_nested_name_spec : Warning<
1551  "enumeration type in nested name specifier is incompatible with C++98">,
1552  InGroup<CXX98Compat>, DefaultIgnore;
1553def err_nested_name_spec_is_not_class : Error<
1554  "%0 cannot appear before '::' because it is not a class"
1555  "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1556def ext_nested_name_spec_is_enum : ExtWarn<
1557  "use of enumeration in a nested name specifier is a C++11 extension">,
1558  InGroup<CXX11>;
1559def err_out_of_line_qualified_id_type_names_constructor : Error<
1560  "qualified reference to %0 is a constructor name rather than a "
1561  "%select{template name|type}1 in this context">;
1562def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1563  "ISO C++ specifies that "
1564  "qualified reference to %0 is a constructor name rather than a "
1565  "%select{template name|type}1 in this context, despite preceding "
1566  "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1567  InGroup<DiagGroup<"injected-class-name">>;
1568
1569// C++ class members
1570def err_storageclass_invalid_for_member : Error<
1571  "storage class specified for a member declaration">;
1572def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1573def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1574def ext_mutable_reference : ExtWarn<
1575  "'mutable' on a reference type is a Microsoft extension">,
1576  InGroup<MicrosoftMutableReference>;
1577def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1578def err_mutable_nonmember : Error<
1579  "'mutable' can only be applied to member variables">;
1580def err_virtual_in_union : Error<
1581  "unions cannot have virtual functions">;
1582def err_virtual_non_function : Error<
1583  "'virtual' can only appear on non-static member functions">;
1584def err_virtual_out_of_class : Error<
1585  "'virtual' can only be specified inside the class definition">;
1586def err_virtual_member_function_template : Error<
1587  "'virtual' cannot be specified on member function templates">;
1588def err_static_overrides_virtual : Error<
1589  "'static' member function %0 overrides a virtual function in a base class">;
1590def err_explicit_non_function : Error<
1591  "'explicit' can only appear on non-static member functions">;
1592def err_explicit_out_of_class : Error<
1593  "'explicit' can only be specified inside the class definition">;
1594def err_explicit_non_ctor_or_conv_function : Error<
1595  "'explicit' can only be applied to a constructor or conversion function">;
1596def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1597def err_static_out_of_line : Error<
1598  "'static' can only be specified inside the class definition">;
1599def ext_static_out_of_line : ExtWarn<
1600  err_static_out_of_line.Text>,
1601  InGroup<MicrosoftTemplate>;
1602def err_storage_class_for_static_member : Error<
1603  "static data member definition cannot specify a storage class">;
1604def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1605def err_not_integral_type_bitfield : Error<
1606  "bit-field %0 has non-integral type %1">;
1607def err_not_integral_type_anon_bitfield : Error<
1608  "anonymous bit-field has non-integral type %0">;
1609def err_anon_bitfield_qualifiers : Error<
1610  "anonymous bit-field cannot have qualifiers">;
1611def err_member_function_initialization : Error<
1612  "initializer on function does not look like a pure-specifier">;
1613def err_non_virtual_pure : Error<
1614  "%0 is not virtual and cannot be declared pure">;
1615def ext_pure_function_definition : ExtWarn<
1616  "function definition with pure-specifier is a Microsoft extension">,
1617  InGroup<MicrosoftPureDefinition>;
1618def err_qualified_member_of_unrelated : Error<
1619  "%q0 is not a member of class %1">;
1620
1621def err_member_function_call_bad_cvr : Error<
1622  "'this' argument to member function %0 has type %1, but function is not marked "
1623  "%select{const|restrict|const or restrict|volatile|const or volatile|"
1624  "volatile or restrict|const, volatile, or restrict}2">;
1625def err_member_function_call_bad_ref : Error<
1626  "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1627  "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1628def err_member_function_call_bad_type : Error<
1629  "cannot initialize object parameter of type %0 with an expression "
1630  "of type %1">;
1631
1632def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1633  "call to pure virtual member function %0 has undefined behavior; "
1634  "overrides of %0 in subclasses are not available in the "
1635  "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1636
1637def select_special_member_kind : TextSubstitution<
1638  "%select{default constructor|copy constructor|move constructor|"
1639  "copy assignment operator|move assignment operator|destructor}0">;
1640
1641def note_member_declared_at : Note<"member is declared here">;
1642def note_ivar_decl : Note<"instance variable is declared here">;
1643def note_bitfield_decl : Note<"bit-field is declared here">;
1644def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1645def note_member_synthesized_at : Note<
1646  "in implicit %sub{select_special_member_kind}0 for %1 "
1647  "first required here">;
1648def err_missing_default_ctor : Error<
1649  "%select{constructor for %1 must explicitly initialize the|"
1650  "implicit default constructor for %1 must explicitly initialize the|"
1651  "cannot use constructor inherited from base class %4;}0 "
1652  "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1653  "does not have a default constructor">;
1654def note_due_to_dllexported_class : Note<
1655  "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1656
1657def err_illegal_union_or_anon_struct_member : Error<
1658  "%select{anonymous struct|union}0 member %1 has a non-trivial "
1659  "%sub{select_special_member_kind}2">;
1660def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1661  "%select{anonymous struct|union}0 member %1 with a non-trivial "
1662  "%sub{select_special_member_kind}2 is incompatible with C++98">,
1663  InGroup<CXX98Compat>, DefaultIgnore;
1664
1665def note_nontrivial_virtual_dtor : Note<
1666  "destructor for %0 is not trivial because it is virtual">;
1667def note_nontrivial_has_virtual : Note<
1668  "because type %0 has a virtual %select{member function|base class}1">;
1669def note_nontrivial_no_def_ctor : Note<
1670  "because %select{base class of |field of |}0type %1 has no "
1671  "default constructor">;
1672def note_user_declared_ctor : Note<
1673  "implicit default constructor suppressed by user-declared constructor">;
1674def note_nontrivial_no_copy : Note<
1675  "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1676  "assignment operator|<<ERROR>>}2 can be used to "
1677  "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1678  "%select{base class|field|an object}0 of type %3">;
1679def note_nontrivial_user_provided : Note<
1680  "because %select{base class of |field of |}0type %1 has a user-provided "
1681  "%sub{select_special_member_kind}2">;
1682def note_nontrivial_in_class_init : Note<
1683  "because field %0 has an initializer">;
1684def note_nontrivial_param_type : Note<
1685  "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1686def note_nontrivial_default_arg : Note<"because it has a default argument">;
1687def note_nontrivial_variadic : Note<"because it is a variadic function">;
1688def note_nontrivial_subobject : Note<
1689  "because the function selected to %select{construct|copy|move|copy|move|"
1690  "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1691def note_nontrivial_objc_ownership : Note<
1692  "because type %0 has a member with %select{no|no|__strong|__weak|"
1693  "__autoreleasing}1 ownership">;
1694
1695def err_static_data_member_not_allowed_in_anon_struct : Error<
1696  "static data member %0 not allowed in anonymous struct">;
1697def ext_static_data_member_in_union : ExtWarn<
1698  "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1699def warn_cxx98_compat_static_data_member_in_union : Warning<
1700  "static data member %0 in union is incompatible with C++98">,
1701  InGroup<CXX98Compat>, DefaultIgnore;
1702def ext_union_member_of_reference_type : ExtWarn<
1703  "union member %0 has reference type %1, which is a Microsoft extension">,
1704  InGroup<MicrosoftUnionMemberReference>;
1705def err_union_member_of_reference_type : Error<
1706  "union member %0 has reference type %1">;
1707def ext_anonymous_struct_union_qualified : Extension<
1708  "anonymous %select{struct|union}0 cannot be '%1'">;
1709def err_different_return_type_for_overriding_virtual_function : Error<
1710  "virtual function %0 has a different return type "
1711  "%diff{($) than the function it overrides (which has return type $)|"
1712  "than the function it overrides}1,2">;
1713def note_overridden_virtual_function : Note<
1714  "overridden virtual function is here">;
1715def err_conflicting_overriding_cc_attributes : Error<
1716  "virtual function %0 has different calling convention attributes "
1717  "%diff{($) than the function it overrides (which has calling convention $)|"
1718  "than the function it overrides}1,2">;
1719def warn_overriding_method_missing_noescape : Warning<
1720  "parameter of overriding method should be annotated with "
1721  "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1722def note_overridden_marked_noescape : Note<
1723  "parameter of overridden method is annotated with __attribute__((noescape))">;
1724def note_cat_conform_to_noescape_prot : Note<
1725  "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1726
1727def err_covariant_return_inaccessible_base : Error<
1728  "invalid covariant return for virtual function: %1 is a "
1729  "%select{private|protected}2 base class of %0">, AccessControl;
1730def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1731  "return type of virtual function %3 is not covariant with the return type of "
1732  "the function it overrides (ambiguous conversion from derived class "
1733  "%0 to base class %1:%2)">;
1734def err_covariant_return_not_derived : Error<
1735  "return type of virtual function %0 is not covariant with the return type of "
1736  "the function it overrides (%1 is not derived from %2)">;
1737def err_covariant_return_incomplete : Error<
1738  "return type of virtual function %0 is not covariant with the return type of "
1739  "the function it overrides (%1 is incomplete)">;
1740def err_covariant_return_type_different_qualifications : Error<
1741  "return type of virtual function %0 is not covariant with the return type of "
1742  "the function it overrides (%1 has different qualifiers than %2)">;
1743def err_covariant_return_type_class_type_more_qualified : Error<
1744  "return type of virtual function %0 is not covariant with the return type of "
1745  "the function it overrides (class type %1 is more qualified than class "
1746  "type %2">;
1747
1748// C++ implicit special member functions
1749def note_in_declaration_of_implicit_special_member : Note<
1750  "while declaring the implicit %sub{select_special_member_kind}1"
1751  " for %0">;
1752
1753// C++ constructors
1754def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1755def err_invalid_qualified_constructor : Error<
1756  "'%0' qualifier is not allowed on a constructor">;
1757def err_ref_qualifier_constructor : Error<
1758  "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1759
1760def err_constructor_return_type : Error<
1761  "constructor cannot have a return type">;
1762def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1763def err_constructor_byvalue_arg : Error<
1764  "copy constructor must pass its first argument by reference">;
1765def warn_no_constructor_for_refconst : Warning<
1766  "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1767  "constructor to initialize its non-modifiable members">;
1768def note_refconst_member_not_initialized : Note<
1769  "%select{const|reference}0 member %1 will never be initialized">;
1770def ext_ms_explicit_constructor_call : ExtWarn<
1771  "explicit constructor calls are a Microsoft extension">,
1772  InGroup<MicrosoftExplicitConstructorCall>;
1773
1774// C++ destructors
1775def err_destructor_not_member : Error<
1776  "destructor must be a non-static member function">;
1777def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1778def err_invalid_qualified_destructor : Error<
1779  "'%0' qualifier is not allowed on a destructor">;
1780def err_ref_qualifier_destructor : Error<
1781  "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1782def err_destructor_return_type : Error<"destructor cannot have a return type">;
1783def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1784def err_destructor_with_params : Error<"destructor cannot have any parameters">;
1785def err_destructor_variadic : Error<"destructor cannot be variadic">;
1786def err_destructor_typedef_name : Error<
1787  "destructor cannot be declared using a %select{typedef|type alias}1 %0 of the class name">;
1788def err_destructor_name : Error<
1789  "expected the class name after '~' to name the enclosing class">;
1790def err_destructor_class_name : Error<
1791  "expected the class name after '~' to name a destructor">;
1792def err_ident_in_dtor_not_a_type : Error<
1793  "identifier %0 in object destruction expression does not name a type">;
1794def err_destructor_expr_type_mismatch : Error<
1795  "destructor type %0 in object destruction expression does not match the "
1796  "type %1 of the object being destroyed">;
1797def note_destructor_type_here : Note<
1798  "type %0 is declared here">;
1799
1800def err_destroy_attr_on_non_static_var : Error<
1801  "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
1802  " variable with static or thread storage duration">;
1803
1804def err_destructor_template : Error<
1805  "destructor cannot be declared as a template">;
1806
1807// C++ initialization
1808def err_init_conversion_failed : Error<
1809  "cannot initialize %select{a variable|a parameter|return object|"
1810  "statement expression result|an "
1811  "exception object|a member subobject|an array element|a new value|a value|a "
1812  "base class|a constructor delegation|a vector element|a block element|a "
1813  "block element|a complex element|a lambda capture|a compound literal "
1814  "initializer|a related result|a parameter of CF audited function}0 "
1815  "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
1816  "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
1817  "%select{|: different classes%diff{ ($ vs $)|}5,6"
1818  "|: different number of parameters (%5 vs %6)"
1819  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
1820  "|: different return type%diff{ ($ vs $)|}5,6"
1821  "|: different qualifiers (%5 vs %6)"
1822  "|: different exception specifications}4">;
1823
1824def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
1825  "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
1826def err_lvalue_reference_bind_to_initlist : Error<
1827  "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
1828  "initializer list temporary">;
1829def err_lvalue_reference_bind_to_temporary : Error<
1830  "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
1831  "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
1832def err_lvalue_reference_bind_to_unrelated : Error<
1833  "%select{non-const|volatile}0 lvalue reference "
1834  "%diff{to type $ cannot bind to a value of unrelated type $|"
1835  "cannot bind to a value of unrelated type}1,2">;
1836def err_reference_bind_drops_quals : Error<
1837  "binding value %diff{of type $ to reference to type $|to reference}0,1 "
1838  "drops %select{<<ERROR>>|'const'|'restrict'|'const' and 'restrict'|"
1839  "'volatile'|'const' and 'volatile'|'restrict' and 'volatile'|"
1840  "'const', 'restrict', and 'volatile'}2 qualifier%plural{1:|2:|4:|:s}2">;
1841def err_reference_bind_failed : Error<
1842  "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
1843  "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
1844  "incompatible type}0,3">;
1845def err_reference_bind_init_list : Error<
1846  "reference to type %0 cannot bind to an initializer list">;
1847def err_init_list_bad_dest_type : Error<
1848  "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
1849  "list">;
1850def warn_cxx2a_compat_aggregate_init_with_ctors : Warning<
1851  "aggregate initialization of type %0 with user-declared constructors "
1852  "is incompatible with C++2a">, DefaultIgnore, InGroup<CXX2aCompat>;
1853
1854def err_reference_bind_to_bitfield : Error<
1855  "%select{non-const|volatile}0 reference cannot bind to "
1856  "bit-field%select{| %1}2">;
1857def err_reference_bind_to_vector_element : Error<
1858  "%select{non-const|volatile}0 reference cannot bind to vector element">;
1859def err_reference_var_requires_init : Error<
1860  "declaration of reference variable %0 requires an initializer">;
1861def err_reference_without_init : Error<
1862  "reference to type %0 requires an initializer">;
1863def note_value_initialization_here : Note<
1864  "in value-initialization of type %0 here">;
1865def err_reference_has_multiple_inits : Error<
1866  "reference cannot be initialized with multiple values">;
1867def err_init_non_aggr_init_list : Error<
1868  "initialization of non-aggregate type %0 with an initializer list">;
1869def err_init_reference_member_uninitialized : Error<
1870  "reference member of type %0 uninitialized">;
1871def note_uninit_reference_member : Note<
1872  "uninitialized reference member is here">;
1873def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
1874  InGroup<Uninitialized>;
1875def warn_base_class_is_uninit : Warning<
1876  "base class %0 is uninitialized when used here to access %q1">,
1877  InGroup<Uninitialized>;
1878def warn_reference_field_is_uninit : Warning<
1879  "reference %0 is not yet bound to a value when used here">,
1880  InGroup<Uninitialized>;
1881def note_uninit_in_this_constructor : Note<
1882  "during field initialization in %select{this|the implicit default}0 "
1883  "constructor">;
1884def warn_static_self_reference_in_init : Warning<
1885  "static variable %0 is suspiciously used within its own initialization">,
1886  InGroup<UninitializedStaticSelfInit>;
1887def warn_uninit_self_reference_in_init : Warning<
1888  "variable %0 is uninitialized when used within its own initialization">,
1889  InGroup<Uninitialized>;
1890def warn_uninit_self_reference_in_reference_init : Warning<
1891  "reference %0 is not yet bound to a value when used within its own"
1892  " initialization">,
1893  InGroup<Uninitialized>;
1894def warn_uninit_var : Warning<
1895  "variable %0 is uninitialized when %select{used here|captured by block}1">,
1896  InGroup<Uninitialized>, DefaultIgnore;
1897def warn_sometimes_uninit_var : Warning<
1898  "variable %0 is %select{used|captured}1 uninitialized whenever "
1899  "%select{'%3' condition is %select{true|false}4|"
1900  "'%3' loop %select{is entered|exits because its condition is false}4|"
1901  "'%3' loop %select{condition is true|exits because its condition is false}4|"
1902  "switch %3 is taken|"
1903  "its declaration is reached|"
1904  "%3 is called}2">,
1905  InGroup<UninitializedSometimes>, DefaultIgnore;
1906def warn_maybe_uninit_var : Warning<
1907  "variable %0 may be uninitialized when "
1908  "%select{used here|captured by block}1">,
1909  InGroup<UninitializedMaybe>, DefaultIgnore;
1910def note_var_declared_here : Note<"variable %0 is declared here">;
1911def note_uninit_var_use : Note<
1912  "%select{uninitialized use occurs|variable is captured by block}0 here">;
1913def warn_uninit_byref_blockvar_captured_by_block : Warning<
1914  "block pointer variable %0 is uninitialized when captured by block">,
1915  InGroup<Uninitialized>, DefaultIgnore;
1916def note_block_var_fixit_add_initialization : Note<
1917  "did you mean to use __block %0?">;
1918def note_in_omitted_aggregate_initializer : Note<
1919  "in implicit initialization of %select{"
1920  "array element %1 with omitted initializer|"
1921  "field %1 with omitted initializer|"
1922  "trailing array elements in runtime-sized array new}0">;
1923def note_in_reference_temporary_list_initializer : Note<
1924  "in initialization of temporary of type %0 created to "
1925  "list-initialize this reference">;
1926def note_var_fixit_add_initialization : Note<
1927  "initialize the variable %0 to silence this warning">;
1928def note_uninit_fixit_remove_cond : Note<
1929  "remove the %select{'%1' if its condition|condition if it}0 "
1930  "is always %select{false|true}2">;
1931def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
1932def err_list_init_in_parens : Error<
1933  "cannot initialize %select{non-class|reference}0 type %1 with a "
1934  "parenthesized initializer list">;
1935
1936def warn_unsequenced_mod_mod : Warning<
1937  "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
1938def warn_unsequenced_mod_use : Warning<
1939  "unsequenced modification and access to %0">, InGroup<Unsequenced>;
1940
1941def select_initialized_entity_kind : TextSubstitution<
1942  "%select{copying variable|copying parameter|"
1943  "returning object|initializing statement expression result|"
1944  "throwing object|copying member subobject|copying array element|"
1945  "allocating object|copying temporary|initializing base subobject|"
1946  "initializing vector element|capturing value}0">;
1947
1948def err_temp_copy_no_viable : Error<
1949  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
1950def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
1951  "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
1952  "C++98 requires a copy constructor when binding a reference to a temporary">,
1953  InGroup<BindToTemporaryCopy>;
1954def err_temp_copy_ambiguous : Error<
1955  "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
1956  "of type %1">;
1957def err_temp_copy_deleted : Error<
1958  "%sub{select_initialized_entity_kind}0 of type %1 "
1959  "invokes deleted constructor">;
1960def err_temp_copy_incomplete : Error<
1961  "copying a temporary object of incomplete type %0">;
1962def warn_cxx98_compat_temp_copy : Warning<
1963  "%sub{select_initialized_entity_kind}1 "
1964  "of type %2 when binding a reference to a temporary would %select{invoke "
1965  "an inaccessible constructor|find no viable constructor|find ambiguous "
1966  "constructors|invoke a deleted constructor}0 in C++98">,
1967  InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
1968def err_selected_explicit_constructor : Error<
1969  "chosen constructor is explicit in copy-initialization">;
1970def note_explicit_ctor_deduction_guide_here : Note<
1971  "explicit %select{constructor|deduction guide}0 declared here">;
1972
1973// C++11 decltype
1974def err_decltype_in_declarator : Error<
1975    "'decltype' cannot be used to name a declaration">;
1976
1977// C++11 auto
1978def warn_cxx98_compat_auto_type_specifier : Warning<
1979  "'auto' type specifier is incompatible with C++98">,
1980  InGroup<CXX98Compat>, DefaultIgnore;
1981def err_auto_variable_cannot_appear_in_own_initializer : Error<
1982  "variable %0 declared with deduced type %1 "
1983  "cannot appear in its own initializer">;
1984def err_binding_cannot_appear_in_own_initializer : Error<
1985  "binding %0 cannot appear in the initializer of its own "
1986  "decomposition declaration">;
1987def err_illegal_decl_array_of_auto : Error<
1988  "'%0' declared as array of %1">;
1989def err_new_array_of_auto : Error<
1990  "cannot allocate array of 'auto'">;
1991def err_auto_not_allowed : Error<
1992  "%select{'auto'|'decltype(auto)'|'__auto_type'|"
1993  "use of "
1994  "%select{class template|function template|variable template|alias template|"
1995  "template template parameter|template}2 %3 requires template arguments; "
1996  "argument deduction}0 not allowed "
1997  "%select{in function prototype"
1998  "|in non-static struct member|in struct member"
1999  "|in non-static union member|in union member"
2000  "|in non-static class member|in interface member"
2001  "|in exception declaration|in template parameter until C++17|in block literal"
2002  "|in template argument|in typedef|in type alias|in function return type"
2003  "|in conversion function type|here|in lambda parameter"
2004  "|in type allocated by 'new'|in K&R-style function parameter"
2005  "|in template parameter|in friend declaration}1">;
2006def err_dependent_deduced_tst : Error<
2007  "typename specifier refers to "
2008  "%select{class template|function template|variable template|alias template|"
2009  "template template parameter|template}0 member in %1; "
2010  "argument deduction not allowed here">;
2011def err_auto_not_allowed_var_inst : Error<
2012  "'auto' variable template instantiation is not allowed">;
2013def err_auto_var_requires_init : Error<
2014  "declaration of variable %0 with deduced type %1 requires an initializer">;
2015def err_auto_new_requires_ctor_arg : Error<
2016  "new expression for type %0 requires a constructor argument">;
2017def ext_auto_new_list_init : Extension<
2018  "ISO C++ standards before C++17 do not allow new expression for "
2019  "type %0 to use list-initialization">, InGroup<CXX17>;
2020def err_auto_var_init_no_expression : Error<
2021  "initializer for variable %0 with type %1 is empty">;
2022def err_auto_var_init_multiple_expressions : Error<
2023  "initializer for variable %0 with type %1 contains multiple expressions">;
2024def err_auto_var_init_paren_braces : Error<
2025  "cannot deduce type for variable %1 with type %2 from "
2026  "%select{parenthesized|nested}0 initializer list">;
2027def err_auto_new_ctor_multiple_expressions : Error<
2028  "new expression for type %0 contains multiple constructor arguments">;
2029def err_auto_missing_trailing_return : Error<
2030  "'auto' return without trailing return type; deduced return types are a "
2031  "C++14 extension">;
2032def err_deduced_return_type : Error<
2033  "deduced return types are a C++14 extension">;
2034def err_trailing_return_without_auto : Error<
2035  "function with trailing return type must specify return type 'auto', not %0">;
2036def err_trailing_return_in_parens : Error<
2037  "trailing return type may not be nested within parentheses">;
2038def err_auto_var_deduction_failure : Error<
2039  "variable %0 with type %1 has incompatible initializer of type %2">;
2040def err_auto_var_deduction_failure_from_init_list : Error<
2041  "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2042def err_auto_new_deduction_failure : Error<
2043  "new expression for type %0 has incompatible constructor argument of type %1">;
2044def err_auto_inconsistent_deduction : Error<
2045  "deduced conflicting types %diff{($ vs $) |}0,1"
2046  "for initializer list element type">;
2047def err_auto_different_deductions : Error<
2048  "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2049  "deduced as %1 in declaration of %2 and "
2050  "deduced as %3 in declaration of %4">;
2051def err_auto_non_deduced_not_alone : Error<
2052  "%select{function with deduced return type|"
2053  "declaration with trailing return type}0 "
2054  "must be the only declaration in its group">;
2055def err_implied_std_initializer_list_not_found : Error<
2056  "cannot deduce type of initializer list because std::initializer_list was "
2057  "not found; include <initializer_list>">;
2058def err_malformed_std_initializer_list : Error<
2059  "std::initializer_list must be a class template with a single type parameter">;
2060def err_auto_init_list_from_c : Error<
2061  "cannot use __auto_type with initializer list in C">;
2062def err_auto_bitfield : Error<
2063  "cannot pass bit-field as __auto_type initializer in C">;
2064
2065// C++1y decltype(auto) type
2066def err_decltype_auto_invalid : Error<
2067  "'decltype(auto)' not allowed here">;
2068def err_decltype_auto_cannot_be_combined : Error<
2069  "'decltype(auto)' cannot be combined with other type specifiers">;
2070def err_decltype_auto_function_declarator_not_declaration : Error<
2071  "'decltype(auto)' can only be used as a return type "
2072  "in a function declaration">;
2073def err_decltype_auto_compound_type : Error<
2074  "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2075def err_decltype_auto_initializer_list : Error<
2076  "cannot deduce 'decltype(auto)' from initializer list">;
2077
2078// C++17 deduced class template specialization types
2079def err_deduced_class_template_compound_type : Error<
2080  "cannot %select{form pointer to|form reference to|form array of|"
2081  "form function returning|use parentheses when declaring variable with}0 "
2082  "deduced class template specialization type">;
2083def err_deduced_non_class_template_specialization_type : Error<
2084  "%select{<error>|function template|variable template|alias template|"
2085  "template template parameter|template}0 %1 requires template arguments; "
2086  "argument deduction only allowed for class templates">;
2087def err_deduced_class_template_ctor_ambiguous : Error<
2088  "ambiguous deduction for template arguments of %0">;
2089def err_deduced_class_template_ctor_no_viable : Error<
2090  "no viable constructor or deduction guide for deduction of "
2091  "template arguments of %0">;
2092def err_deduced_class_template_incomplete : Error<
2093  "template %0 has no definition and no %select{|viable }1deduction guides "
2094  "for deduction of template arguments">;
2095def err_deduced_class_template_deleted : Error<
2096  "class template argument deduction for %0 selected a deleted constructor">;
2097def err_deduced_class_template_explicit : Error<
2098  "class template argument deduction for %0 selected an explicit "
2099  "%select{constructor|deduction guide}1 for copy-list-initialization">;
2100def err_deduction_guide_no_trailing_return_type : Error<
2101  "deduction guide declaration without trailing return type">;
2102def err_deduction_guide_bad_trailing_return_type : Error<
2103  "deduced type %1 of deduction guide is not %select{|written as }2"
2104  "a specialization of template %0">;
2105def err_deduction_guide_with_complex_decl : Error<
2106  "cannot specify any part of a return type in the "
2107  "declaration of a deduction guide">;
2108def err_deduction_guide_invalid_specifier : Error<
2109  "deduction guide cannot be declared '%0'">;
2110def err_deduction_guide_name_not_class_template : Error<
2111  "cannot specify deduction guide for "
2112  "%select{<error>|function template|variable template|alias template|"
2113  "template template parameter|dependent template name}0 %1">;
2114def err_deduction_guide_wrong_scope : Error<
2115  "deduction guide must be declared in the same scope as template %q0">;
2116def err_deduction_guide_defines_function : Error<
2117  "deduction guide cannot have a function definition">;
2118def err_deduction_guide_explicit_mismatch : Error<
2119  "deduction guide is %select{not |}0declared 'explicit' but "
2120  "previous declaration was%select{ not|}0">;
2121def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2122  "%select{explicitly instantiated|explicitly specialized}0">;
2123def err_deduction_guide_template_not_deducible : Error<
2124  "deduction guide template contains "
2125  "%select{a template parameter|template parameters}0 that cannot be "
2126  "deduced">;
2127def err_deduction_guide_wrong_access : Error<
2128  "deduction guide has different access from the corresponding "
2129  "member template">;
2130def note_deduction_guide_template_access : Note<
2131  "member template declared %0 here">;
2132def note_deduction_guide_access : Note<
2133  "deduction guide declared %0 by intervening access specifier">;
2134def warn_cxx14_compat_class_template_argument_deduction : Warning<
2135  "class template argument deduction is incompatible with C++ standards "
2136  "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2137  InGroup<CXXPre17Compat>, DefaultIgnore;
2138def warn_ctad_maybe_unsupported : Warning<
2139  "%0 may not intend to support class template argument deduction">,
2140  InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2141def note_suppress_ctad_maybe_unsupported : Note<
2142  "add a deduction guide to suppress this warning">;
2143
2144
2145// C++14 deduced return types
2146def err_auto_fn_deduction_failure : Error<
2147  "cannot deduce return type %0 from returned value of type %1">;
2148def err_auto_fn_different_deductions : Error<
2149  "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2150  "deduced as %2 in earlier return statement">;
2151def err_auto_fn_used_before_defined : Error<
2152  "function %0 with deduced return type cannot be used before it is defined">;
2153def err_auto_fn_no_return_but_not_auto : Error<
2154  "cannot deduce return type %0 for function with no return statements">;
2155def err_auto_fn_return_void_but_not_auto : Error<
2156  "cannot deduce return type %0 from omitted return expression">;
2157def err_auto_fn_return_init_list : Error<
2158  "cannot deduce return type from initializer list">;
2159def err_auto_fn_virtual : Error<
2160  "function with deduced return type cannot be virtual">;
2161def warn_cxx11_compat_deduced_return_type : Warning<
2162  "return type deduction is incompatible with C++ standards before C++14">,
2163  InGroup<CXXPre14Compat>, DefaultIgnore;
2164
2165// C++11 override control
2166def override_keyword_only_allowed_on_virtual_member_functions : Error<
2167  "only virtual member functions can be marked '%0'">;
2168def override_keyword_hides_virtual_member_function : Error<
2169  "non-virtual member function marked '%0' hides virtual member "
2170  "%select{function|functions}1">;
2171def err_function_marked_override_not_overriding : Error<
2172  "%0 marked 'override' but does not override any member functions">;
2173def warn_destructor_marked_not_override_overriding : Warning <
2174  "%0 overrides a destructor but is not marked 'override'">,
2175  InGroup<CXX11WarnOverrideDestructor>, DefaultIgnore;
2176def warn_function_marked_not_override_overriding : Warning <
2177  "%0 overrides a member function but is not marked 'override'">,
2178  InGroup<CXX11WarnOverrideMethod>;
2179def err_class_marked_final_used_as_base : Error<
2180  "base %0 is marked '%select{final|sealed}1'">;
2181def warn_abstract_final_class : Warning<
2182  "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2183
2184// C++11 attributes
2185def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2186
2187// C++11 final
2188def err_final_function_overridden : Error<
2189  "declaration of %0 overrides a '%select{final|sealed}1' function">;
2190
2191// C++11 scoped enumerations
2192def err_enum_invalid_underlying : Error<
2193  "non-integral type %0 is an invalid underlying type">;
2194def err_enumerator_too_large : Error<
2195  "enumerator value is not representable in the underlying type %0">;
2196def ext_enumerator_too_large : Extension<
2197  "enumerator value is not representable in the underlying type %0">,
2198  InGroup<MicrosoftEnumValue>;
2199def err_enumerator_wrapped : Error<
2200  "enumerator value %0 is not representable in the underlying type %1">;
2201def err_enum_redeclare_type_mismatch : Error<
2202  "enumeration redeclared with different underlying type %0 (was %1)">;
2203def err_enum_redeclare_fixed_mismatch : Error<
2204  "enumeration previously declared with %select{non|}0fixed underlying type">;
2205def err_enum_redeclare_scoped_mismatch : Error<
2206  "enumeration previously declared as %select{un|}0scoped">;
2207def err_enum_class_reference : Error<
2208  "reference to %select{|scoped }0enumeration must use 'enum' "
2209  "not 'enum class'">;
2210def err_only_enums_have_underlying_types : Error<
2211  "only enumeration types have underlying types">;
2212def err_underlying_type_of_incomplete_enum : Error<
2213  "cannot determine underlying type of incomplete enumeration type %0">;
2214
2215// C++11 delegating constructors
2216def err_delegating_ctor : Error<
2217  "delegating constructors are permitted only in C++11">;
2218def warn_cxx98_compat_delegating_ctor : Warning<
2219  "delegating constructors are incompatible with C++98">,
2220  InGroup<CXX98Compat>, DefaultIgnore;
2221def err_delegating_initializer_alone : Error<
2222  "an initializer for a delegating constructor must appear alone">;
2223def warn_delegating_ctor_cycle : Warning<
2224  "constructor for %0 creates a delegation cycle">, DefaultError,
2225  InGroup<DelegatingCtorCycles>;
2226def note_it_delegates_to : Note<"it delegates to">;
2227def note_which_delegates_to : Note<"which delegates to">;
2228
2229// C++11 range-based for loop
2230def err_for_range_decl_must_be_var : Error<
2231  "for range declaration must declare a variable">;
2232def err_for_range_storage_class : Error<
2233  "loop variable %0 may not be declared %select{'extern'|'static'|"
2234  "'__private_extern__'|'auto'|'register'|'constexpr'}1">;
2235def err_type_defined_in_for_range : Error<
2236  "types may not be defined in a for range declaration">;
2237def err_for_range_deduction_failure : Error<
2238  "cannot use type %0 as a range">;
2239def err_for_range_incomplete_type : Error<
2240  "cannot use incomplete type %0 as a range">;
2241def err_for_range_iter_deduction_failure : Error<
2242  "cannot use type %0 as an iterator">;
2243def ext_for_range_begin_end_types_differ : ExtWarn<
2244  "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2245  InGroup<CXX17>;
2246def warn_for_range_begin_end_types_differ : Warning<
2247  "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2248  "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2249def note_in_for_range: Note<
2250  "when looking up '%select{begin|end}0' function for range expression "
2251  "of type %1">;
2252def err_for_range_invalid: Error<
2253  "invalid range expression of type %0; no viable '%select{begin|end}1' "
2254  "function available">;
2255def note_for_range_member_begin_end_ignored : Note<
2256  "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2257def err_range_on_array_parameter : Error<
2258  "cannot build range expression with array function parameter %0 since "
2259  "parameter with array type %1 is treated as pointer type %2">;
2260def err_for_range_dereference : Error<
2261  "invalid range expression of type %0; did you mean to dereference it "
2262  "with '*'?">;
2263def note_for_range_invalid_iterator : Note <
2264  "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2265def note_for_range_begin_end : Note<
2266  "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2267def warn_for_range_const_reference_copy : Warning<
2268  "loop variable %0 "
2269  "%diff{has type $ but is initialized with type $"
2270  "| is initialized with a value of a different type}1,2 resulting in a copy">,
2271  InGroup<RangeLoopAnalysis>, DefaultIgnore;
2272def note_use_type_or_non_reference : Note<
2273  "use non-reference type %0 to keep the copy or type %1 to prevent copying">;
2274def warn_for_range_variable_always_copy : Warning<
2275  "loop variable %0 is always a copy because the range of type %1 does not "
2276  "return a reference">,
2277  InGroup<RangeLoopAnalysis>, DefaultIgnore;
2278def note_use_non_reference_type : Note<"use non-reference type %0">;
2279def warn_for_range_copy : Warning<
2280  "loop variable %0 of type %1 creates a copy from type %2">,
2281  InGroup<RangeLoopAnalysis>, DefaultIgnore;
2282def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2283def err_objc_for_range_init_stmt : Error<
2284  "initialization statement is not supported when iterating over Objective-C "
2285  "collection">;
2286
2287// C++11 constexpr
2288def warn_cxx98_compat_constexpr : Warning<
2289  "'constexpr' specifier is incompatible with C++98">,
2290  InGroup<CXX98Compat>, DefaultIgnore;
2291// FIXME: Maybe this should also go in -Wc++14-compat?
2292def warn_cxx14_compat_constexpr_not_const : Warning<
2293  "'constexpr' non-static member function will not be implicitly 'const' "
2294  "in C++14; add 'const' to avoid a change in behavior">,
2295  InGroup<DiagGroup<"constexpr-not-const">>;
2296def err_invalid_constexpr : Error<
2297  "%select{function parameter|typedef|non-static data member}0 "
2298  "cannot be constexpr">;
2299def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2300  "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2301def err_constexpr_tag : Error<
2302  "%select{class|struct|interface|union|enum}0 cannot be marked constexpr">;
2303def err_constexpr_dtor : Error<"destructor cannot be marked constexpr">;
2304def err_constexpr_no_declarators : Error<
2305  "constexpr can only be used in variable and function declarations">;
2306def err_invalid_constexpr_var_decl : Error<
2307  "constexpr variable declaration must be a definition">;
2308def err_constexpr_static_mem_var_requires_init : Error<
2309  "declaration of constexpr static data member %0 requires an initializer">;
2310def err_constexpr_var_non_literal : Error<
2311  "constexpr variable cannot have non-literal type %0">;
2312def err_constexpr_var_requires_const_init : Error<
2313  "constexpr variable %0 must be initialized by a constant expression">;
2314def err_constexpr_redecl_mismatch : Error<
2315  "%select{non-constexpr declaration of %0 follows constexpr declaration"
2316  "|constexpr declaration of %0 follows non-constexpr declaration}1">;
2317def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2318def err_constexpr_virtual_base : Error<
2319  "constexpr %select{member function|constructor}0 not allowed in "
2320  "%select{struct|interface|class}1 with virtual base "
2321  "%plural{1:class|:classes}2">;
2322def note_non_literal_incomplete : Note<
2323  "incomplete type %0 is not a literal type">;
2324def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2325  "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2326def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2327def err_constexpr_non_literal_return : Error<
2328  "constexpr function's return type %0 is not a literal type">;
2329def err_constexpr_non_literal_param : Error<
2330  "constexpr %select{function|constructor}1's %ordinal0 parameter type %2 is "
2331  "not a literal type">;
2332def err_constexpr_body_invalid_stmt : Error<
2333  "statement not allowed in constexpr %select{function|constructor}0">;
2334def ext_constexpr_body_invalid_stmt : ExtWarn<
2335  "use of this statement in a constexpr %select{function|constructor}0 "
2336  "is a C++14 extension">, InGroup<CXX14>;
2337def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2338  "use of this statement in a constexpr %select{function|constructor}0 "
2339  "is incompatible with C++ standards before C++14">,
2340  InGroup<CXXPre14Compat>, DefaultIgnore;
2341def ext_constexpr_body_invalid_stmt_cxx2a : ExtWarn<
2342  "use of this statement in a constexpr %select{function|constructor}0 "
2343  "is a C++2a extension">, InGroup<CXX2a>;
2344def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2345  "use of this statement in a constexpr %select{function|constructor}0 "
2346  "is incompatible with C++ standards before C++2a">,
2347  InGroup<CXXPre2aCompat>, DefaultIgnore;
2348def ext_constexpr_type_definition : ExtWarn<
2349  "type definition in a constexpr %select{function|constructor}0 "
2350  "is a C++14 extension">, InGroup<CXX14>;
2351def warn_cxx11_compat_constexpr_type_definition : Warning<
2352  "type definition in a constexpr %select{function|constructor}0 "
2353  "is incompatible with C++ standards before C++14">,
2354  InGroup<CXXPre14Compat>, DefaultIgnore;
2355def err_constexpr_vla : Error<
2356  "variably-modified type %0 cannot be used in a constexpr "
2357  "%select{function|constructor}1">;
2358def ext_constexpr_local_var : ExtWarn<
2359  "variable declaration in a constexpr %select{function|constructor}0 "
2360  "is a C++14 extension">, InGroup<CXX14>;
2361def warn_cxx11_compat_constexpr_local_var : Warning<
2362  "variable declaration in a constexpr %select{function|constructor}0 "
2363  "is incompatible with C++ standards before C++14">,
2364  InGroup<CXXPre14Compat>, DefaultIgnore;
2365def err_constexpr_local_var_static : Error<
2366  "%select{static|thread_local}1 variable not permitted in a constexpr "
2367  "%select{function|constructor}0">;
2368def err_constexpr_local_var_non_literal_type : Error<
2369  "variable of non-literal type %1 cannot be defined in a constexpr "
2370  "%select{function|constructor}0">;
2371def err_constexpr_local_var_no_init : Error<
2372  "variables defined in a constexpr %select{function|constructor}0 must be "
2373  "initialized">;
2374def ext_constexpr_function_never_constant_expr : ExtWarn<
2375  "constexpr %select{function|constructor}0 never produces a "
2376  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2377def err_attr_cond_never_constant_expr : Error<
2378  "%0 attribute expression never produces a constant expression">;
2379def err_diagnose_if_invalid_diagnostic_type : Error<
2380  "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2381  "instead">;
2382def err_constexpr_body_no_return : Error<
2383  "no return statement in constexpr function">;
2384def err_constexpr_return_missing_expr : Error<
2385  "non-void constexpr function %0 should return a value">;
2386def warn_cxx11_compat_constexpr_body_no_return : Warning<
2387  "constexpr function with no return statements is incompatible with C++ "
2388  "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2389def ext_constexpr_body_multiple_return : ExtWarn<
2390  "multiple return statements in constexpr function is a C++14 extension">,
2391  InGroup<CXX14>;
2392def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2393  "multiple return statements in constexpr function "
2394  "is incompatible with C++ standards before C++14">,
2395  InGroup<CXXPre14Compat>, DefaultIgnore;
2396def note_constexpr_body_previous_return : Note<
2397  "previous return statement is here">;
2398def err_constexpr_function_try_block : Error<
2399  "function try block not allowed in constexpr %select{function|constructor}0">;
2400
2401// c++2a function try blocks in constexpr
2402def ext_constexpr_function_try_block_cxx2a : ExtWarn<
2403  "function try block in constexpr %select{function|constructor}0 is "
2404  "a C++2a extension">, InGroup<CXX2a>;
2405def warn_cxx17_compat_constexpr_function_try_block : Warning<
2406  "function try block in constexpr %select{function|constructor}0 is "
2407  "incompatible with C++ standards before C++2a">,
2408  InGroup<CXXPre2aCompat>, DefaultIgnore;
2409
2410def err_constexpr_union_ctor_no_init : Error<
2411  "constexpr union constructor does not initialize any member">;
2412def err_constexpr_ctor_missing_init : Error<
2413  "constexpr constructor must initialize all members">;
2414def note_constexpr_ctor_missing_init : Note<
2415  "member not initialized by constructor">;
2416def note_non_literal_no_constexpr_ctors : Note<
2417  "%0 is not literal because it is not an aggregate and has no constexpr "
2418  "constructors other than copy or move constructors">;
2419def note_non_literal_base_class : Note<
2420  "%0 is not literal because it has base class %1 of non-literal type">;
2421def note_non_literal_field : Note<
2422  "%0 is not literal because it has data member %1 of "
2423  "%select{non-literal|volatile}3 type %2">;
2424def note_non_literal_user_provided_dtor : Note<
2425  "%0 is not literal because it has a user-provided destructor">;
2426def note_non_literal_nontrivial_dtor : Note<
2427  "%0 is not literal because it has a non-trivial destructor">;
2428def note_non_literal_lambda : Note<
2429  "lambda closure types are non-literal types before C++17">;
2430def warn_private_extern : Warning<
2431  "use of __private_extern__ on a declaration may not produce external symbol "
2432  "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2433def note_private_extern : Note<
2434  "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2435
2436// C++ Concepts TS
2437def err_concept_wrong_decl_kind : Error<
2438  "'concept' can only appear on the definition of a function template or variable template">;
2439def err_concept_decls_may_only_appear_in_namespace_scope : Error<
2440  "concept declarations may only appear in namespace scope">;
2441def err_function_concept_not_defined : Error<
2442  "function concept declaration must be a definition">;
2443def err_var_concept_not_initialized : Error<
2444  "variable concept declaration must be initialized">;
2445def err_function_concept_exception_spec : Error<
2446  "function concept cannot have exception specification">;
2447def err_concept_decl_invalid_specifiers : Error<
2448  "%select{variable|function}0 concept cannot be declared "
2449  "'%select{thread_local|inline|friend|constexpr}1'">;
2450def err_function_concept_with_params : Error<
2451  "function concept cannot have any parameters">;
2452def err_function_concept_bool_ret : Error<
2453  "declared return type of function concept must be 'bool'">;
2454def err_variable_concept_bool_decl : Error<
2455  "declared type of variable concept must be 'bool'">;
2456def err_concept_specified_specialization : Error<
2457  "'concept' cannot be applied on an "
2458  "%select{explicit instantiation|explicit specialization|partial specialization}0">;
2459def err_concept_specialized : Error<
2460  "%select{function|variable}0 concept cannot be "
2461  "%select{explicitly instantiated|explicitly specialized|partially specialized}1">;
2462
2463def err_template_different_associated_constraints : Error<
2464  "associated constraints differ in template redeclaration">;
2465
2466// C++11 char16_t/char32_t
2467def warn_cxx98_compat_unicode_type : Warning<
2468  "'%0' type specifier is incompatible with C++98">,
2469  InGroup<CXX98Compat>, DefaultIgnore;
2470def warn_cxx17_compat_unicode_type : Warning<
2471  "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2472  InGroup<CXXPre2aCompat>, DefaultIgnore;
2473
2474// __make_integer_seq
2475def err_integer_sequence_negative_length : Error<
2476  "integer sequences must have non-negative sequence length">;
2477def err_integer_sequence_integral_element_type : Error<
2478  "integer sequences must have integral element type">;
2479
2480// __type_pack_element
2481def err_type_pack_element_out_of_bounds : Error<
2482  "a parameter pack may not be accessed at an out of bounds index">;
2483
2484// Objective-C++
2485def err_objc_decls_may_only_appear_in_global_scope : Error<
2486  "Objective-C declarations may only appear in global scope">;
2487def warn_auto_var_is_id : Warning<
2488  "'auto' deduced as 'id' in declaration of %0">,
2489  InGroup<DiagGroup<"auto-var-id">>;
2490
2491// Attributes
2492def err_nsobject_attribute : Error<
2493  "'NSObject' attribute is for pointer types only">;
2494def err_attributes_are_not_compatible : Error<
2495  "%0 and %1 attributes are not compatible">;
2496def err_attribute_wrong_number_arguments : Error<
2497  "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2498  ":requires exactly %1 arguments}1">;
2499def err_attribute_too_many_arguments : Error<
2500  "%0 attribute takes no more than %1 argument%s1">;
2501def err_attribute_too_few_arguments : Error<
2502  "%0 attribute takes at least %1 argument%s1">;
2503def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2504def err_attribute_bad_neon_vector_size : Error<
2505  "Neon vector size must be 64 or 128 bits">;
2506def err_attribute_requires_positive_integer : Error<
2507  "%0 attribute requires a %select{positive|non-negative}1 "
2508  "integral compile time constant expression">;
2509def err_attribute_requires_opencl_version : Error<
2510  "%0 attribute requires OpenCL version %1%select{| or above}2">;
2511def warn_unsupported_target_attribute
2512    : Warning<"%select{unsupported|duplicate}0%select{| architecture}1 '%2' in"
2513              " the 'target' attribute string; 'target' attribute ignored">,
2514      InGroup<IgnoredAttributes>;
2515def err_attribute_unsupported
2516    : Error<"%0 attribute is not supported for this target">;
2517// The err_*_attribute_argument_not_int are separate because they're used by
2518// VerifyIntegerConstantExpression.
2519def err_aligned_attribute_argument_not_int : Error<
2520  "'aligned' attribute requires integer constant">;
2521def err_align_value_attribute_argument_not_int : Error<
2522  "'align_value' attribute requires integer constant">;
2523def err_alignas_attribute_wrong_decl_type : Error<
2524  "%0 attribute cannot be applied to a %select{function parameter|"
2525  "variable with 'register' storage class|'catch' variable|bit-field}1">;
2526def err_alignas_missing_on_definition : Error<
2527  "%0 must be specified on definition if it is specified on any declaration">;
2528def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2529def err_alignas_mismatch : Error<
2530  "redeclaration has different alignment requirement (%1 vs %0)">;
2531def err_alignas_underaligned : Error<
2532  "requested alignment is less than minimum alignment of %1 for type %0">;
2533def err_attribute_argument_n_type : Error<
2534  "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2535  "constant|a string|an identifier}2">;
2536def err_attribute_argument_type : Error<
2537  "%0 attribute requires %select{int or bool|an integer "
2538  "constant|a string|an identifier}1">;
2539def err_attribute_argument_out_of_range : Error<
2540  "%0 attribute requires integer constant between %1 and %2 inclusive">;
2541def err_init_priority_object_attr : Error<
2542  "can only use 'init_priority' attribute on file-scope definitions "
2543  "of objects of class type">;
2544def err_attribute_argument_vec_type_hint : Error<
2545  "invalid attribute argument %0 - expecting a vector or vectorizable scalar type">;
2546def err_attribute_argument_out_of_bounds : Error<
2547  "%0 attribute parameter %1 is out of bounds">;
2548def err_attribute_only_once_per_parameter : Error<
2549  "%0 attribute can only be applied once per parameter">;
2550def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2551def note_previous_uuid : Note<"previous uuid specified here">;
2552def warn_attribute_pointers_only : Warning<
2553  "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2554  InGroup<IgnoredAttributes>;
2555def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2556def err_attribute_integers_only : Error<
2557  "%0 attribute argument may only refer to a function parameter of integer "
2558  "type">;
2559def warn_attribute_return_pointers_only : Warning<
2560  "%0 attribute only applies to return values that are pointers">,
2561  InGroup<IgnoredAttributes>;
2562def warn_attribute_return_pointers_refs_only : Warning<
2563  "%0 attribute only applies to return values that are pointers or references">,
2564  InGroup<IgnoredAttributes>;
2565def warn_attribute_pointer_or_reference_only : Warning<
2566  "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2567  InGroup<IgnoredAttributes>;
2568def err_attribute_no_member_pointers : Error<
2569  "%0 attribute cannot be used with pointers to members">;
2570def err_attribute_invalid_implicit_this_argument : Error<
2571  "%0 attribute is invalid for the implicit this argument">;
2572def err_ownership_type : Error<
2573  "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2574def err_ownership_returns_index_mismatch : Error<
2575  "'ownership_returns' attribute index does not match; here it is %0">;
2576def note_ownership_returns_index_mismatch : Note<
2577  "declared with index %0 here">;
2578def err_format_strftime_third_parameter : Error<
2579  "strftime format attribute requires 3rd parameter to be 0">;
2580def err_format_attribute_requires_variadic : Error<
2581  "format attribute requires variadic function">;
2582def err_format_attribute_not : Error<"format argument not %0">;
2583def err_format_attribute_result_not : Error<"function does not return %0">;
2584def err_format_attribute_implicit_this_format_string : Error<
2585  "format attribute cannot specify the implicit this argument as the format "
2586  "string">;
2587def err_callback_attribute_no_callee : Error<
2588  "'callback' attribute specifies no callback callee">;
2589def err_callback_attribute_invalid_callee : Error<
2590  "'callback' attribute specifies invalid callback callee">;
2591def err_callback_attribute_multiple : Error<
2592  "multiple 'callback' attributes specified">;
2593def err_callback_attribute_argument_unknown : Error<
2594  "'callback' attribute argument %0 is not a known function parameter">;
2595def err_callback_callee_no_function_type : Error<
2596  "'callback' attribute callee does not have function type">;
2597def err_callback_callee_is_variadic : Error<
2598  "'callback' attribute callee may not be variadic">;
2599def err_callback_implicit_this_not_available : Error<
2600  "'callback' argument at position %0 references unavailable implicit 'this'">;
2601def err_init_method_bad_return_type : Error<
2602  "init methods must return an object pointer type, not %0">;
2603def err_attribute_invalid_size : Error<
2604  "vector size not an integral multiple of component size">;
2605def err_attribute_zero_size : Error<"zero vector size">;
2606def err_attribute_size_too_large : Error<"vector size too large">;
2607def err_typecheck_vector_not_convertable_implict_truncation : Error<
2608   "cannot convert between %select{scalar|vector}0 type %1 and vector type"
2609   " %2 as implicit conversion would cause truncation">;
2610def err_typecheck_vector_not_convertable : Error<
2611  "cannot convert between vector values of different size (%0 and %1)">;
2612def err_typecheck_vector_not_convertable_non_scalar : Error<
2613  "cannot convert between vector and non-scalar values (%0 and %1)">;
2614def err_typecheck_vector_lengths_not_equal : Error<
2615  "vector operands do not have the same number of elements (%0 and %1)">;
2616def warn_typecheck_vector_element_sizes_not_equal : Warning<
2617  "vector operands do not have the same elements sizes (%0 and %1)">,
2618  InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
2619def err_ext_vector_component_exceeds_length : Error<
2620  "vector component access exceeds type %0">;
2621def err_ext_vector_component_name_illegal : Error<
2622  "illegal vector component name '%0'">;
2623def err_attribute_address_space_negative : Error<
2624  "address space is negative">;
2625def err_attribute_address_space_too_high : Error<
2626  "address space is larger than the maximum supported (%0)">;
2627def err_attribute_address_multiple_qualifiers : Error<
2628  "multiple address spaces specified for type">;
2629def warn_attribute_address_multiple_identical_qualifiers : Warning<
2630  "multiple identical address spaces specified for type">,
2631  InGroup<DuplicateDeclSpecifier>;
2632def err_attribute_address_function_type : Error<
2633  "function type may not be qualified with an address space">;
2634def err_as_qualified_auto_decl : Error<
2635  "automatic variable qualified with an%select{| invalid}0 address space">;
2636def err_arg_with_address_space : Error<
2637  "parameter may not be qualified with an address space">;
2638def err_field_with_address_space : Error<
2639  "field may not be qualified with an address space">;
2640def err_compound_literal_with_address_space : Error<
2641  "compound literal in function scope may not be qualified with an address space">;
2642def err_address_space_mismatch_templ_inst : Error<
2643  "conflicting address space qualifiers are provided between types %0 and %1">;
2644def err_attr_objc_ownership_redundant : Error<
2645  "the type %0 is already explicitly ownership-qualified">;
2646def err_invalid_nsnumber_type : Error<
2647  "%0 is not a valid literal type for NSNumber">;
2648def err_objc_illegal_boxed_expression_type : Error<
2649  "illegal type %0 used in a boxed expression">;
2650def err_objc_non_trivially_copyable_boxed_expression_type : Error<
2651  "non-trivially copyable type %0 cannot be used in a boxed expression">;
2652def err_objc_incomplete_boxed_expression_type : Error<
2653  "incomplete type %0 used in a boxed expression">;
2654def err_undeclared_objc_literal_class : Error<
2655  "definition of class %0 must be available to use Objective-C "
2656  "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
2657  "string literals}1">;
2658def err_undeclared_boxing_method : Error<
2659  "declaration of %0 is missing in %1 class">;
2660def err_objc_literal_method_sig : Error<
2661  "literal construction method %0 has incompatible signature">;
2662def note_objc_literal_method_param : Note<
2663  "%select{first|second|third}0 parameter has unexpected type %1 "
2664  "(should be %2)">;
2665def note_objc_literal_method_return : Note<
2666  "method returns unexpected type %0 (should be an object type)">;
2667def err_invalid_collection_element : Error<
2668  "collection element of type %0 is not an Objective-C object">;
2669def err_box_literal_collection : Error<
2670  "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
2671  "in a collection">;
2672def warn_objc_literal_comparison : Warning<
2673  "direct comparison of %select{an array literal|a dictionary literal|"
2674  "a numeric literal|a boxed expression|}0 has undefined behavior">,
2675  InGroup<ObjCLiteralComparison>;
2676def err_missing_atsign_prefix : Error<
2677  "string literal must be prefixed by '@' ">;
2678def warn_objc_string_literal_comparison : Warning<
2679  "direct comparison of a string literal has undefined behavior">,
2680  InGroup<ObjCStringComparison>;
2681def warn_concatenated_nsarray_literal : Warning<
2682  "concatenated NSString literal for an NSArray expression - "
2683  "possibly missing a comma">,
2684  InGroup<ObjCStringConcatenation>;
2685def note_objc_literal_comparison_isequal : Note<
2686  "use 'isEqual:' instead">;
2687def warn_objc_collection_literal_element : Warning<
2688  "object of type %0 is not compatible with "
2689  "%select{array element type|dictionary key type|dictionary value type}1 %2">,
2690  InGroup<ObjCLiteralConversion>;
2691def err_swift_param_attr_not_swiftcall : Error<
2692  "'%0' parameter can only be used with swiftcall calling convention">;
2693def err_swift_indirect_result_not_first : Error<
2694  "'swift_indirect_result' parameters must be first parameters of function">;
2695def err_swift_error_result_not_after_swift_context : Error<
2696  "'swift_error_result' parameter must follow 'swift_context' parameter">;
2697def err_swift_abi_parameter_wrong_type : Error<
2698  "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
2699  "type here is %2">;
2700
2701def err_attribute_argument_invalid : Error<
2702  "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
2703  "min must not be greater than max}1">;
2704def err_attribute_argument_is_zero : Error<
2705  "%0 attribute must be greater than 0">;
2706def warn_attribute_argument_n_negative : Warning<
2707  "%0 attribute parameter %1 is negative and will be ignored">,
2708  InGroup<CudaCompat>;
2709def err_property_function_in_objc_container : Error<
2710  "use of Objective-C property in function nested in Objective-C "
2711  "container not supported, move function outside its container">;
2712
2713let CategoryName = "Cocoa API Issue" in {
2714def warn_objc_redundant_literal_use : Warning<
2715  "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
2716}
2717
2718def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
2719  "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
2720
2721def err_tls_var_aligned_over_maximum : Error<
2722  "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
2723  "alignment (%2) for a thread-local variable on this target">;
2724
2725def err_only_annotate_after_access_spec : Error<
2726  "access specifier can only have annotation attributes">;
2727
2728def err_attribute_section_invalid_for_target : Error<
2729  "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
2730def warn_mismatched_section : Warning<
2731  "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
2732def warn_attribute_section_on_redeclaration : Warning<
2733  "section attribute is specified on redeclared variable">, InGroup<Section>;
2734def err_mismatched_code_seg_base : Error<
2735  "derived class must specify the same code segment as its base classes">;
2736def err_mismatched_code_seg_override : Error<
2737  "overriding virtual function must specify the same code segment as its overridden function">;
2738def err_conflicting_codeseg_attribute : Error<
2739  "conflicting code segment specifiers">;
2740def warn_duplicate_codeseg_attribute : Warning<
2741  "duplicate code segment specifiers">, InGroup<Section>;
2742
2743def err_anonymous_property: Error<
2744  "anonymous property is not supported">;
2745def err_property_is_variably_modified : Error<
2746  "property %0 has a variably modified type">;
2747def err_no_accessor_for_property : Error<
2748  "no %select{getter|setter}0 defined for property %1">;
2749def err_cannot_find_suitable_accessor : Error<
2750  "cannot find suitable %select{getter|setter}0 for property %1">;
2751
2752def warn_alloca_align_alignof : Warning<
2753  "second argument to __builtin_alloca_with_align is supposed to be in bits">,
2754  InGroup<DiagGroup<"alloca-with-align-alignof">>;
2755
2756def err_alignment_too_small : Error<
2757  "requested alignment must be %0 or greater">;
2758def err_alignment_too_big : Error<
2759  "requested alignment must be %0 or smaller">;
2760def err_alignment_not_power_of_two : Error<
2761  "requested alignment is not a power of 2">;
2762def err_alignment_dependent_typedef_name : Error<
2763  "requested alignment is dependent but declaration is not dependent">;
2764
2765def err_attribute_aligned_too_great : Error<
2766  "requested alignment must be %0 bytes or smaller">;
2767def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
2768  "%q0 redeclared without %1 attribute: previous %1 ignored">,
2769  InGroup<MicrosoftInconsistentDllImport>;
2770def warn_redeclaration_without_import_attribute : Warning<
2771  "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
2772  InGroup<MicrosoftInconsistentDllImport>;
2773def warn_dllimport_dropped_from_inline_function : Warning<
2774  "%q0 redeclared inline; %1 attribute ignored">,
2775  InGroup<IgnoredAttributes>;
2776def warn_attribute_ignored : Warning<"%0 attribute ignored">,
2777  InGroup<IgnoredAttributes>;
2778def warn_attribute_ignored_on_inline :
2779  Warning<"%0 attribute ignored on inline function">,
2780  InGroup<IgnoredAttributes>;
2781def warn_nocf_check_attribute_ignored :
2782  Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
2783  InGroup<IgnoredAttributes>;
2784def warn_attribute_after_definition_ignored : Warning<
2785  "attribute %0 after definition is ignored">,
2786   InGroup<IgnoredAttributes>;
2787def warn_cxx11_gnu_attribute_on_type : Warning<
2788  "attribute %0 ignored, because it cannot be applied to a type">,
2789  InGroup<IgnoredAttributes>;
2790def warn_unhandled_ms_attribute_ignored : Warning<
2791  "__declspec attribute %0 is not supported">,
2792  InGroup<IgnoredAttributes>;
2793def err_decl_attribute_invalid_on_stmt : Error<
2794  "%0 attribute cannot be applied to a statement">;
2795def err_stmt_attribute_invalid_on_decl : Error<
2796  "%0 attribute cannot be applied to a declaration">;
2797def warn_declspec_attribute_ignored : Warning<
2798  "attribute %0 is ignored, place it after "
2799  "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
2800  "type declaration">, InGroup<IgnoredAttributes>;
2801def warn_attribute_precede_definition : Warning<
2802  "attribute declaration must precede definition">,
2803  InGroup<IgnoredAttributes>;
2804def warn_attribute_void_function_method : Warning<
2805  "attribute %0 cannot be applied to "
2806  "%select{functions|Objective-C method}1 without return value">,
2807  InGroup<IgnoredAttributes>;
2808def warn_attribute_weak_on_field : Warning<
2809  "__weak attribute cannot be specified on a field declaration">,
2810  InGroup<IgnoredAttributes>;
2811def warn_gc_attribute_weak_on_local : Warning<
2812  "Objective-C GC does not allow weak variables on the stack">,
2813  InGroup<IgnoredAttributes>;
2814def warn_nsobject_attribute : Warning<
2815  "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
2816  InGroup<NSobjectAttribute>;
2817def warn_independentclass_attribute : Warning<
2818  "'objc_independent_class' attribute may be put on a typedef only; "
2819  "attribute is ignored">,
2820  InGroup<IndependentClassAttribute>;
2821def warn_ptr_independentclass_attribute : Warning<
2822  "'objc_independent_class' attribute may be put on Objective-C object "
2823  "pointer type only; attribute is ignored">,
2824  InGroup<IndependentClassAttribute>;
2825def warn_attribute_weak_on_local : Warning<
2826  "__weak attribute cannot be specified on an automatic variable when ARC "
2827  "is not enabled">,
2828  InGroup<IgnoredAttributes>;
2829def warn_weak_identifier_undeclared : Warning<
2830  "weak identifier %0 never declared">;
2831def err_attribute_weak_static : Error<
2832  "weak declaration cannot have internal linkage">;
2833def err_attribute_selectany_non_extern_data : Error<
2834  "'selectany' can only be applied to data items with external linkage">;
2835def err_declspec_thread_on_thread_variable : Error<
2836  "'__declspec(thread)' applied to variable that already has a "
2837  "thread-local storage specifier">;
2838def err_attribute_dll_not_extern : Error<
2839  "%q0 must have external linkage when declared %q1">;
2840def err_attribute_dll_thread_local : Error<
2841  "%q0 cannot be thread local when declared %q1">;
2842def err_attribute_dll_lambda : Error<
2843  "lambda cannot be declared %0">;
2844def warn_attribute_invalid_on_definition : Warning<
2845  "'%0' attribute cannot be specified on a definition">,
2846  InGroup<IgnoredAttributes>;
2847def err_attribute_dll_redeclaration : Error<
2848  "redeclaration of %q0 cannot add %q1 attribute">;
2849def warn_attribute_dll_redeclaration : Warning<
2850  "redeclaration of %q0 should not add %q1 attribute">,
2851  InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
2852def err_attribute_dllimport_function_definition : Error<
2853  "dllimport cannot be applied to non-inline function definition">;
2854def err_attribute_dll_deleted : Error<
2855  "attribute %q0 cannot be applied to a deleted function">;
2856def err_attribute_dllimport_data_definition : Error<
2857  "definition of dllimport data">;
2858def err_attribute_dllimport_static_field_definition : Error<
2859  "definition of dllimport static field not allowed">;
2860def warn_attribute_dllimport_static_field_definition : Warning<
2861  "definition of dllimport static field">,
2862  InGroup<DiagGroup<"dllimport-static-field-def">>;
2863def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
2864  "explicit instantiation declaration should not be 'dllexport'">,
2865  InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
2866def warn_invalid_initializer_from_system_header : Warning<
2867  "invalid constructor form class in system header, should not be explicit">,
2868  InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
2869def note_used_in_initialization_here : Note<"used in initialization here">;
2870def err_attribute_dll_member_of_dll_class : Error<
2871  "attribute %q0 cannot be applied to member of %q1 class">;
2872def warn_attribute_dll_instantiated_base_class : Warning<
2873  "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
2874  "base class template without dll attribute is not supported">,
2875  InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
2876def err_attribute_dll_ambiguous_default_ctor : Error<
2877  "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
2878def err_attribute_weakref_not_static : Error<
2879  "weakref declaration must have internal linkage">;
2880def err_attribute_weakref_not_global_context : Error<
2881  "weakref declaration of %0 must be in a global context">;
2882def err_attribute_weakref_without_alias : Error<
2883  "weakref declaration of %0 must also have an alias attribute">;
2884def err_alias_not_supported_on_darwin : Error <
2885  "aliases are not supported on darwin">;
2886def warn_attribute_wrong_decl_type_str : Warning<
2887  "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
2888def err_attribute_wrong_decl_type_str : Error<
2889  warn_attribute_wrong_decl_type_str.Text>;
2890def warn_attribute_wrong_decl_type : Warning<
2891  "%0 attribute only applies to %select{"
2892  "functions"
2893  "|unions"
2894  "|variables and functions"
2895  "|functions and methods"
2896  "|functions, methods and blocks"
2897  "|functions, methods, and parameters"
2898  "|variables"
2899  "|variables and fields"
2900  "|variables, data members and tag types"
2901  "|types and namespaces"
2902  "|variables, functions and classes"
2903  "|kernel functions"
2904  "|non-K&R-style functions}1">,
2905  InGroup<IgnoredAttributes>;
2906def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
2907def warn_type_attribute_wrong_type : Warning<
2908  "'%0' only applies to %select{function|pointer|"
2909  "Objective-C object or block pointer}1 types; type here is %2">,
2910  InGroup<IgnoredAttributes>;
2911def warn_incomplete_encoded_type : Warning<
2912  "encoding of %0 type is incomplete because %1 component has unknown encoding">,
2913  InGroup<DiagGroup<"encode-type">>;
2914def warn_gnu_inline_attribute_requires_inline : Warning<
2915  "'gnu_inline' attribute requires function to be marked 'inline',"
2916  " attribute ignored">,
2917  InGroup<IgnoredAttributes>;
2918def err_attribute_vecreturn_only_vector_member : Error<
2919  "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
2920def err_attribute_vecreturn_only_pod_record : Error<
2921  "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
2922def err_cconv_change : Error<
2923  "function declared '%0' here was previously declared "
2924  "%select{'%2'|without calling convention}1">;
2925def warn_cconv_ignored : Warning<
2926  "%0 calling convention ignored %select{"
2927  // Use CallingConventionIgnoredReason Enum to specify these.
2928  "for this target"
2929  "|on variadic function"
2930  "|on constructor/destructor"
2931  "|on builtin function"
2932  "}1">,
2933  InGroup<IgnoredAttributes>;
2934def err_cconv_knr : Error<
2935  "function with no prototype cannot use the %0 calling convention">;
2936def warn_cconv_knr : Warning<
2937  err_cconv_knr.Text>,
2938  InGroup<DiagGroup<"missing-prototype-for-cc">>;
2939def err_cconv_varargs : Error<
2940  "variadic function cannot use %0 calling convention">;
2941def err_regparm_mismatch : Error<"function declared with regparm(%0) "
2942  "attribute was previously declared "
2943  "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
2944def err_function_attribute_mismatch : Error<
2945  "function declared with %0 attribute "
2946  "was previously declared without the %0 attribute">;
2947def err_objc_precise_lifetime_bad_type : Error<
2948  "objc_precise_lifetime only applies to retainable types; type here is %0">;
2949def warn_objc_precise_lifetime_meaningless : Error<
2950  "objc_precise_lifetime is not meaningful for "
2951  "%select{__unsafe_unretained|__autoreleasing}0 objects">;
2952def err_invalid_pcs : Error<"invalid PCS type">;
2953def warn_attribute_not_on_decl : Warning<
2954  "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
2955def err_base_specifier_attribute : Error<
2956  "%0 attribute cannot be applied to a base specifier">;
2957def err_invalid_attribute_on_virtual_function : Error<
2958  "%0 attribute cannot be applied to virtual functions">;
2959def warn_declspec_allocator_nonpointer : Warning<
2960  "ignoring __declspec(allocator) because the function return type %0 is not "
2961  "a pointer or reference type">, InGroup<IgnoredAttributes>;
2962
2963def ext_cannot_use_trivial_abi : ExtWarn<
2964  "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
2965
2966// Availability attribute
2967def warn_availability_unknown_platform : Warning<
2968  "unknown platform %0 in availability macro">, InGroup<Availability>;
2969def warn_availability_version_ordering : Warning<
2970  "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
2971  "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
2972  "attribute ignored">, InGroup<Availability>;
2973def warn_mismatched_availability: Warning<
2974  "availability does not match previous declaration">, InGroup<Availability>;
2975def warn_mismatched_availability_override : Warning<
2976  "%select{|overriding }4method %select{introduced after|"
2977  "deprecated before|obsoleted before}0 "
2978  "%select{the protocol method it implements|overridden method}4 "
2979  "on %1 (%2 vs. %3)">, InGroup<Availability>;
2980def warn_mismatched_availability_override_unavail : Warning<
2981  "%select{|overriding }1method cannot be unavailable on %0 when "
2982  "%select{the protocol method it implements|its overridden method}1 is "
2983  "available">,
2984  InGroup<Availability>;
2985def warn_availability_on_static_initializer : Warning<
2986  "ignoring availability attribute %select{on '+load' method|"
2987  "with constructor attribute|with destructor attribute}0">,
2988  InGroup<Availability>;
2989def note_overridden_method : Note<
2990  "overridden method is here">;
2991def warn_availability_swift_unavailable_deprecated_only : Warning<
2992  "only 'unavailable' and 'deprecated' are supported for Swift availability">,
2993  InGroup<Availability>;
2994def note_protocol_method : Note<
2995  "protocol method is here">;
2996
2997def warn_unguarded_availability :
2998  Warning<"%0 is only available on %1 %2 or newer">,
2999  InGroup<UnguardedAvailability>, DefaultIgnore;
3000def warn_unguarded_availability_new :
3001  Warning<warn_unguarded_availability.Text>,
3002  InGroup<UnguardedAvailabilityNew>;
3003def note_decl_unguarded_availability_silence : Note<
3004  "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3005def note_unguarded_available_silence : Note<
3006  "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3007  " this warning">;
3008def warn_at_available_unchecked_use : Warning<
3009  "%select{@available|__builtin_available}0 does not guard availability here; "
3010  "use if (%select{@available|__builtin_available}0) instead">,
3011  InGroup<DiagGroup<"unsupported-availability-guard">>;
3012
3013// Thread Safety Attributes
3014def warn_invalid_capability_name : Warning<
3015  "invalid capability name '%0'; capability name must be 'mutex' or 'role'">,
3016  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3017def warn_thread_attribute_ignored : Warning<
3018  "ignoring %0 attribute because its argument is invalid">,
3019  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3020def warn_thread_attribute_not_on_non_static_member : Warning<
3021  "%0 attribute without capability arguments can only be applied to non-static "
3022  "methods of a class">,
3023  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3024def warn_thread_attribute_not_on_capability_member : Warning<
3025  "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3026  "annotated with 'capability' or 'scoped_lockable' attribute">,
3027  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3028def warn_thread_attribute_argument_not_lockable : Warning<
3029  "%0 attribute requires arguments whose type is annotated "
3030  "with 'capability' attribute; type here is %1">,
3031  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3032def warn_thread_attribute_decl_not_lockable : Warning<
3033  "%0 attribute can only be applied in a context annotated "
3034  "with 'capability(\"mutex\")' attribute">,
3035  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3036def warn_thread_attribute_decl_not_pointer : Warning<
3037  "%0 only applies to pointer types; type here is %1">,
3038  InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3039def err_attribute_argument_out_of_bounds_extra_info : Error<
3040  "%0 attribute parameter %1 is out of bounds: "
3041  "%plural{0:no parameters to index into|"
3042  "1:can only be 1, since there is one parameter|"
3043  ":must be between 1 and %2}2">;
3044
3045// Thread Safety Analysis
3046def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3047  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3048def warn_unlock_kind_mismatch : Warning<
3049  "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3050  "%select{shared|exclusive}3 access">,
3051  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3052def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3053  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3054def warn_no_unlock : Warning<
3055  "%0 '%1' is still held at the end of function">,
3056  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3057def warn_expecting_locked : Warning<
3058  "expecting %0 '%1' to be held at the end of function">,
3059  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3060// FIXME: improve the error message about locks not in scope
3061def warn_lock_some_predecessors : Warning<
3062  "%0 '%1' is not held on every path through here">,
3063  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3064def warn_expecting_lock_held_on_loop : Warning<
3065  "expecting %0 '%1' to be held at start of each loop">,
3066  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3067def note_locked_here : Note<"%0 acquired here">;
3068def warn_lock_exclusive_and_shared : Warning<
3069  "%0 '%1' is acquired exclusively and shared in the same scope">,
3070  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3071def note_lock_exclusive_and_shared : Note<
3072  "the other acquisition of %0 '%1' is here">;
3073def warn_variable_requires_any_lock : Warning<
3074  "%select{reading|writing}1 variable %0 requires holding "
3075  "%select{any mutex|any mutex exclusively}1">,
3076  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3077def warn_var_deref_requires_any_lock : Warning<
3078  "%select{reading|writing}1 the value pointed to by %0 requires holding "
3079  "%select{any mutex|any mutex exclusively}1">,
3080  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3081def warn_fun_excludes_mutex : Warning<
3082  "cannot call function '%1' while %0 '%2' is held">,
3083  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3084def warn_cannot_resolve_lock : Warning<
3085  "cannot resolve lock expression">,
3086  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3087def warn_acquired_before : Warning<
3088  "%0 '%1' must be acquired before '%2'">,
3089  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3090def warn_acquired_before_after_cycle : Warning<
3091  "Cycle in acquired_before/after dependencies, starting with '%0'">,
3092  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3093
3094
3095// Thread safety warnings negative capabilities
3096def warn_acquire_requires_negative_cap : Warning<
3097  "acquiring %0 '%1' requires negative capability '%2'">,
3098  InGroup<ThreadSafetyNegative>, DefaultIgnore;
3099
3100// Thread safety warnings on pass by reference
3101def warn_guarded_pass_by_reference : Warning<
3102  "passing variable %1 by reference requires holding %0 "
3103  "%select{'%2'|'%2' exclusively}3">,
3104  InGroup<ThreadSafetyReference>, DefaultIgnore;
3105def warn_pt_guarded_pass_by_reference : Warning<
3106  "passing the value that %1 points to by reference requires holding %0 "
3107  "%select{'%2'|'%2' exclusively}3">,
3108  InGroup<ThreadSafetyReference>, DefaultIgnore;
3109
3110// Imprecise thread safety warnings
3111def warn_variable_requires_lock : Warning<
3112  "%select{reading|writing}3 variable %1 requires holding %0 "
3113  "%select{'%2'|'%2' exclusively}3">,
3114  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3115def warn_var_deref_requires_lock : Warning<
3116  "%select{reading|writing}3 the value pointed to by %1 requires "
3117  "holding %0 %select{'%2'|'%2' exclusively}3">,
3118  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3119def warn_fun_requires_lock : Warning<
3120  "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3121  InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3122
3123// Precise thread safety warnings
3124def warn_variable_requires_lock_precise :
3125  Warning<warn_variable_requires_lock.Text>,
3126  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3127def warn_var_deref_requires_lock_precise :
3128  Warning<warn_var_deref_requires_lock.Text>,
3129  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3130def warn_fun_requires_lock_precise :
3131  Warning<warn_fun_requires_lock.Text>,
3132  InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3133def note_found_mutex_near_match : Note<"found near match '%0'">;
3134
3135// Verbose thread safety warnings
3136def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3137  InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3138def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3139def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3140
3141// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3142def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3143  InGroup<ThreadSafetyBeta>, DefaultIgnore;
3144
3145// Consumed warnings
3146def warn_use_in_invalid_state : Warning<
3147  "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3148  "state">, InGroup<Consumed>, DefaultIgnore;
3149def warn_use_of_temp_in_invalid_state : Warning<
3150  "invalid invocation of method '%0' on a temporary object while it is in the "
3151  "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3152def warn_attr_on_unconsumable_class : Warning<
3153  "consumed analysis attribute is attached to member of class '%0' which isn't "
3154  "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3155def warn_return_typestate_for_unconsumable_type : Warning<
3156  "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3157  DefaultIgnore;
3158def warn_return_typestate_mismatch : Warning<
3159  "return value not in expected state; expected '%0', observed '%1'">,
3160  InGroup<Consumed>, DefaultIgnore;
3161def warn_loop_state_mismatch : Warning<
3162  "state of variable '%0' must match at the entry and exit of loop">,
3163  InGroup<Consumed>, DefaultIgnore;
3164def warn_param_return_typestate_mismatch : Warning<
3165  "parameter '%0' not in expected state when the function returns: expected "
3166  "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3167def warn_param_typestate_mismatch : Warning<
3168  "argument not in expected state; expected '%0', observed '%1'">,
3169  InGroup<Consumed>, DefaultIgnore;
3170
3171// no_sanitize attribute
3172def warn_unknown_sanitizer_ignored : Warning<
3173  "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3174
3175def warn_impcast_vector_scalar : Warning<
3176  "implicit conversion turns vector to scalar: %0 to %1">,
3177  InGroup<Conversion>, DefaultIgnore;
3178def warn_impcast_complex_scalar : Warning<
3179  "implicit conversion discards imaginary component: %0 to %1">,
3180  InGroup<Conversion>, DefaultIgnore;
3181def err_impcast_complex_scalar : Error<
3182  "implicit conversion from %0 to %1 is not permitted in C++">;
3183def warn_impcast_float_precision : Warning<
3184  "implicit conversion loses floating-point precision: %0 to %1">,
3185  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3186def warn_impcast_float_result_precision : Warning<
3187  "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3188  InGroup<ImplicitFloatConversion>, DefaultIgnore;
3189def warn_impcast_double_promotion : Warning<
3190  "implicit conversion increases floating-point precision: %0 to %1">,
3191  InGroup<DoublePromotion>, DefaultIgnore;
3192def warn_impcast_integer_sign : Warning<
3193  "implicit conversion changes signedness: %0 to %1">,
3194  InGroup<SignConversion>, DefaultIgnore;
3195def warn_impcast_integer_sign_conditional : Warning<
3196  "operand of ? changes signedness: %0 to %1">,
3197  InGroup<SignConversion>, DefaultIgnore;
3198def warn_impcast_integer_precision : Warning<
3199  "implicit conversion loses integer precision: %0 to %1">,
3200  InGroup<ImplicitIntConversion>, DefaultIgnore;
3201def warn_impcast_high_order_zero_bits : Warning<
3202  "higher order bits are zeroes after implicit conversion">,
3203  InGroup<ImplicitIntConversion>, DefaultIgnore;
3204def warn_impcast_nonnegative_result : Warning<
3205  "the resulting value is always non-negative after implicit conversion">,
3206  InGroup<SignConversion>, DefaultIgnore;
3207def warn_impcast_integer_64_32 : Warning<
3208  "implicit conversion loses integer precision: %0 to %1">,
3209  InGroup<Shorten64To32>, DefaultIgnore;
3210def warn_impcast_integer_precision_constant : Warning<
3211  "implicit conversion from %2 to %3 changes value from %0 to %1">,
3212  InGroup<ConstantConversion>;
3213def warn_impcast_bitfield_precision_constant : Warning<
3214  "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3215  InGroup<BitFieldConstantConversion>;
3216
3217def warn_impcast_fixed_point_range : Warning<
3218  "implicit conversion from %0 cannot fit within the range of values for %1">,
3219  InGroup<ImplicitFixedPointConversion>;
3220
3221def warn_impcast_literal_float_to_integer : Warning<
3222  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3223  InGroup<LiteralConversion>;
3224def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3225  "implicit conversion of out of range value from %0 to %1 is undefined">,
3226  InGroup<LiteralConversion>;
3227def warn_impcast_float_integer : Warning<
3228  "implicit conversion turns floating-point number into integer: %0 to %1">,
3229  InGroup<FloatConversion>, DefaultIgnore;
3230
3231def warn_impcast_float_to_integer : Warning<
3232  "implicit conversion from %0 to %1 changes value from %2 to %3">,
3233  InGroup<FloatOverflowConversion>, DefaultIgnore;
3234def warn_impcast_float_to_integer_out_of_range : Warning<
3235  "implicit conversion of out of range value from %0 to %1 is undefined">,
3236  InGroup<FloatOverflowConversion>, DefaultIgnore;
3237def warn_impcast_float_to_integer_zero : Warning<
3238  "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3239  InGroup<FloatZeroConversion>, DefaultIgnore;
3240
3241def warn_impcast_string_literal_to_bool : Warning<
3242  "implicit conversion turns string literal into bool: %0 to %1">,
3243  InGroup<StringConversion>, DefaultIgnore;
3244def warn_impcast_different_enum_types : Warning<
3245  "implicit conversion from enumeration type %0 to different enumeration type "
3246  "%1">, InGroup<EnumConversion>;
3247def warn_impcast_bool_to_null_pointer : Warning<
3248    "initialization of pointer of type %0 to null from a constant boolean "
3249    "expression">, InGroup<BoolConversion>;
3250def warn_non_literal_null_pointer : Warning<
3251    "expression which evaluates to zero treated as a null pointer constant of "
3252    "type %0">, InGroup<NonLiteralNullConversion>;
3253def warn_impcast_null_pointer_to_integer : Warning<
3254    "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3255    InGroup<NullConversion>;
3256def warn_impcast_floating_point_to_bool : Warning<
3257    "implicit conversion turns floating-point number into bool: %0 to %1">,
3258    InGroup<ImplicitConversionFloatingPointToBool>;
3259def ext_ms_impcast_fn_obj : ExtWarn<
3260  "implicit conversion between pointer-to-function and pointer-to-object is a "
3261  "Microsoft extension">, InGroup<MicrosoftCast>;
3262
3263def warn_impcast_pointer_to_bool : Warning<
3264    "address of%select{| function| array}0 '%1' will always evaluate to "
3265    "'true'">,
3266    InGroup<PointerBoolConversion>;
3267def warn_cast_nonnull_to_bool : Warning<
3268    "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3269    "'true' on first encounter">,
3270    InGroup<PointerBoolConversion>;
3271def warn_this_bool_conversion : Warning<
3272  "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3273  "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3274def warn_address_of_reference_bool_conversion : Warning<
3275  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3276  "code; pointer may be assumed to always convert to true">,
3277  InGroup<UndefinedBoolConversion>;
3278
3279def warn_null_pointer_compare : Warning<
3280    "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3281    "equal to a null pointer is always %select{true|false}2">,
3282    InGroup<TautologicalPointerCompare>;
3283def warn_nonnull_expr_compare : Warning<
3284    "comparison of nonnull %select{function call|parameter}0 '%1' "
3285    "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3286    "encounter">,
3287    InGroup<TautologicalPointerCompare>;
3288def warn_this_null_compare : Warning<
3289  "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3290  "assumed to always evaluate to %select{true|false}0">,
3291  InGroup<TautologicalUndefinedCompare>;
3292def warn_address_of_reference_null_compare : Warning<
3293  "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3294  "code; comparison may be assumed to always evaluate to "
3295  "%select{true|false}0">,
3296  InGroup<TautologicalUndefinedCompare>;
3297def note_reference_is_return_value : Note<"%0 returns a reference">;
3298
3299def warn_division_sizeof_ptr : Warning<
3300  "'%0' will return the size of the pointer, not the array itself">,
3301  InGroup<DiagGroup<"sizeof-pointer-div">>;
3302
3303def note_function_warning_silence : Note<
3304    "prefix with the address-of operator to silence this warning">;
3305def note_function_to_function_call : Note<
3306    "suffix with parentheses to turn this into a function call">;
3307def warn_impcast_objective_c_literal_to_bool : Warning<
3308    "implicit boolean conversion of Objective-C object literal always "
3309    "evaluates to true">,
3310    InGroup<ObjCLiteralConversion>;
3311
3312def warn_cast_align : Warning<
3313  "cast from %0 to %1 increases required alignment from %2 to %3">,
3314  InGroup<CastAlign>, DefaultIgnore;
3315def warn_old_style_cast : Warning<
3316  "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3317
3318// Separate between casts to void* and non-void* pointers.
3319// Some APIs use (abuse) void* for something like a user context,
3320// and often that value is an integer even if it isn't a pointer itself.
3321// Having a separate warning flag allows users to control the warning
3322// for their workflow.
3323def warn_int_to_pointer_cast : Warning<
3324  "cast to %1 from smaller integer type %0">,
3325  InGroup<IntToPointerCast>;
3326def warn_int_to_void_pointer_cast : Warning<
3327  "cast to %1 from smaller integer type %0">,
3328  InGroup<IntToVoidPointerCast>;
3329
3330def warn_attribute_ignored_for_field_of_type : Warning<
3331  "%0 attribute ignored for field of type %1">,
3332  InGroup<IgnoredAttributes>;
3333def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3334  "enums in the Microsoft ABI are signed integers by default; consider giving "
3335  "the enum %0 an unsigned underlying type to make this code portable">,
3336  InGroup<SignedEnumBitfield>, DefaultIgnore;
3337def warn_attribute_packed_for_bitfield : Warning<
3338  "'packed' attribute was ignored on bit-fields with single-byte alignment "
3339  "in older versions of GCC and Clang">,
3340  InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3341def warn_transparent_union_attribute_field_size_align : Warning<
3342  "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3343  "%select{alignment|size}0 of the first field in transparent union; "
3344  "transparent_union attribute ignored">,
3345  InGroup<IgnoredAttributes>;
3346def note_transparent_union_first_field_size_align : Note<
3347  "%select{alignment|size}0 of first field is %1 bits">;
3348def warn_transparent_union_attribute_not_definition : Warning<
3349  "transparent_union attribute can only be applied to a union definition; "
3350  "attribute ignored">,
3351  InGroup<IgnoredAttributes>;
3352def warn_transparent_union_attribute_floating : Warning<
3353  "first field of a transparent union cannot have %select{floating point|"
3354  "vector}0 type %1; transparent_union attribute ignored">,
3355  InGroup<IgnoredAttributes>;
3356def warn_transparent_union_attribute_zero_fields : Warning<
3357  "transparent union definition must contain at least one field; "
3358  "transparent_union attribute ignored">,
3359  InGroup<IgnoredAttributes>;
3360def warn_attribute_type_not_supported : Warning<
3361  "%0 attribute argument not supported: %1">,
3362  InGroup<IgnoredAttributes>;
3363def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3364  InGroup<IgnoredAttributes>;
3365def warn_attribute_protected_visibility :
3366  Warning<"target does not support 'protected' visibility; using 'default'">,
3367  InGroup<DiagGroup<"unsupported-visibility">>;
3368def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3369def note_previous_attribute : Note<"previous attribute is here">;
3370def note_conflicting_attribute : Note<"conflicting attribute is here">;
3371def note_attribute : Note<"attribute is here">;
3372def err_mismatched_ms_inheritance : Error<
3373  "inheritance model does not match %select{definition|previous declaration}0">;
3374def warn_ignored_ms_inheritance : Warning<
3375  "inheritance model ignored on %select{primary template|partial specialization}0">,
3376  InGroup<IgnoredAttributes>;
3377def note_previous_ms_inheritance : Note<
3378  "previous inheritance model specified here">;
3379def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3380def err_mode_not_primitive : Error<
3381  "mode attribute only supported for integer and floating-point types">;
3382def err_mode_wrong_type : Error<
3383  "type of machine mode does not match type of base type">;
3384def warn_vector_mode_deprecated : Warning<
3385  "specifying vector types with the 'mode' attribute is deprecated; "
3386  "use the 'vector_size' attribute instead">,
3387  InGroup<DeprecatedAttributes>;
3388def err_complex_mode_vector_type : Error<
3389  "type of machine mode does not support base vector types">;
3390def err_enum_mode_vector_type : Error<
3391  "mode %0 is not supported for enumeration types">;
3392def warn_attribute_nonnull_no_pointers : Warning<
3393  "'nonnull' attribute applied to function with no pointer arguments">,
3394  InGroup<IgnoredAttributes>;
3395def warn_attribute_nonnull_parm_no_args : Warning<
3396  "'nonnull' attribute when used on parameters takes no arguments">,
3397  InGroup<IgnoredAttributes>;
3398def note_declared_nonnull : Note<
3399  "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3400def warn_attribute_sentinel_named_arguments : Warning<
3401  "'sentinel' attribute requires named arguments">,
3402  InGroup<IgnoredAttributes>;
3403def warn_attribute_sentinel_not_variadic : Warning<
3404  "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3405  InGroup<IgnoredAttributes>;
3406def err_attribute_sentinel_less_than_zero : Error<
3407  "'sentinel' parameter 1 less than zero">;
3408def err_attribute_sentinel_not_zero_or_one : Error<
3409  "'sentinel' parameter 2 not 0 or 1">;
3410def warn_cleanup_ext : Warning<
3411  "GCC does not allow the 'cleanup' attribute argument to be anything other "
3412  "than a simple identifier">,
3413  InGroup<GccCompat>;
3414def err_attribute_cleanup_arg_not_function : Error<
3415  "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3416def err_attribute_cleanup_func_must_take_one_arg : Error<
3417  "'cleanup' function %0 must take 1 parameter">;
3418def err_attribute_cleanup_func_arg_incompatible_type : Error<
3419  "'cleanup' function %0 parameter has "
3420  "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3421def err_attribute_regparm_wrong_platform : Error<
3422  "'regparm' is not valid on this platform">;
3423def err_attribute_regparm_invalid_number : Error<
3424  "'regparm' parameter must be between 0 and %0 inclusive">;
3425def err_attribute_not_supported_in_lang : Error<
3426  "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3427def err_attribute_not_supported_on_arch
3428    : Error<"%0 attribute is not supported on '%1'">;
3429def warn_gcc_ignores_type_attr : Warning<
3430  "GCC does not allow the %0 attribute to be written on a type">,
3431  InGroup<GccCompat>;
3432
3433// Clang-Specific Attributes
3434def warn_attribute_iboutlet : Warning<
3435  "%0 attribute can only be applied to instance variables or properties">,
3436  InGroup<IgnoredAttributes>;
3437def err_iboutletcollection_type : Error<
3438  "invalid type %0 as argument of iboutletcollection attribute">;
3439def err_iboutletcollection_builtintype : Error<
3440  "type argument of iboutletcollection attribute cannot be a builtin type">;
3441def warn_iboutlet_object_type : Warning<
3442  "%select{instance variable|property}2 with %0 attribute must "
3443  "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3444def warn_iboutletcollection_property_assign : Warning<
3445  "IBOutletCollection properties should be copy/strong and not assign">,
3446  InGroup<ObjCInvalidIBOutletProperty>;
3447
3448def err_attribute_overloadable_mismatch : Error<
3449  "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
3450def note_attribute_overloadable_prev_overload : Note<
3451  "previous %select{unmarked |}0overload of function is here">;
3452def err_attribute_overloadable_no_prototype : Error<
3453  "'overloadable' function %0 must have a prototype">;
3454def err_attribute_overloadable_multiple_unmarked_overloads : Error<
3455  "at most one overload for a given name may lack the 'overloadable' "
3456  "attribute">;
3457def warn_ns_attribute_wrong_return_type : Warning<
3458  "%0 attribute only applies to %select{functions|methods|properties}1 that "
3459  "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
3460  InGroup<IgnoredAttributes>;
3461def err_ns_attribute_wrong_parameter_type : Error<
3462  "%0 attribute only applies to "
3463  "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
3464def warn_ns_attribute_wrong_parameter_type : Warning<
3465  "%0 attribute only applies to "
3466  "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
3467  InGroup<IgnoredAttributes>;
3468def warn_objc_requires_super_protocol : Warning<
3469  "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
3470  InGroup<DiagGroup<"requires-super-attribute">>;
3471def note_protocol_decl : Note<
3472  "protocol is declared here">;
3473def note_protocol_decl_undefined : Note<
3474  "protocol %0 has no definition">;
3475
3476// objc_designated_initializer attribute diagnostics.
3477def warn_objc_designated_init_missing_super_call : Warning<
3478  "designated initializer missing a 'super' call to a designated initializer of the super class">,
3479  InGroup<ObjCDesignatedInit>;
3480def note_objc_designated_init_marked_here : Note<
3481  "method marked as designated initializer of the class here">;
3482def warn_objc_designated_init_non_super_designated_init_call : Warning<
3483  "designated initializer should only invoke a designated initializer on 'super'">,
3484  InGroup<ObjCDesignatedInit>;
3485def warn_objc_designated_init_non_designated_init_call : Warning<
3486  "designated initializer invoked a non-designated initializer">,
3487  InGroup<ObjCDesignatedInit>;
3488def warn_objc_secondary_init_super_init_call : Warning<
3489  "convenience initializer should not invoke an initializer on 'super'">,
3490  InGroup<ObjCDesignatedInit>;
3491def warn_objc_secondary_init_missing_init_call : Warning<
3492  "convenience initializer missing a 'self' call to another initializer">,
3493  InGroup<ObjCDesignatedInit>;
3494def warn_objc_implementation_missing_designated_init_override : Warning<
3495  "method override for the designated initializer of the superclass %objcinstance0 not found">,
3496  InGroup<ObjCDesignatedInit>;
3497def err_designated_init_attr_non_init : Error<
3498  "'objc_designated_initializer' attribute only applies to init methods "
3499  "of interface or class extension declarations">;
3500
3501// objc_bridge attribute diagnostics.
3502def err_objc_attr_not_id : Error<
3503  "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
3504def err_objc_attr_typedef_not_id : Error<
3505  "parameter of %0 attribute must be 'id' when used on a typedef">;
3506def err_objc_attr_typedef_not_void_pointer : Error<
3507  "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
3508def err_objc_cf_bridged_not_interface : Error<
3509  "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
3510def err_objc_ns_bridged_invalid_cfobject : Error<
3511  "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
3512def warn_objc_invalid_bridge : Warning<
3513  "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
3514def warn_objc_invalid_bridge_to_cf : Warning<
3515  "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
3516
3517// objc_bridge_related attribute diagnostics.
3518def err_objc_bridged_related_invalid_class : Error<
3519  "could not find Objective-C class %0 to convert %1 to %2">;
3520def err_objc_bridged_related_invalid_class_name : Error<
3521  "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
3522def err_objc_bridged_related_known_method : Error<
3523 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
3524 "method for this conversion">;
3525
3526def err_objc_attr_protocol_requires_definition : Error<
3527  "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
3528
3529def warn_ignored_objc_externally_retained : Warning<
3530  "'objc_externally_retained' can only be applied to local variables "
3531  "%select{of retainable type|with strong ownership}0">,
3532  InGroup<IgnoredAttributes>;
3533
3534// Function Parameter Semantic Analysis.
3535def err_param_with_void_type : Error<"argument may not have 'void' type">;
3536def err_void_only_param : Error<
3537  "'void' must be the first and only parameter if specified">;
3538def err_void_param_qualified : Error<
3539  "'void' as parameter must not have type qualifiers">;
3540def err_ident_list_in_fn_declaration : Error<
3541  "a parameter list without types is only allowed in a function definition">;
3542def ext_param_not_declared : Extension<
3543  "parameter %0 was not declared, defaulting to type 'int'">;
3544def err_param_default_argument : Error<
3545  "C does not support default arguments">;
3546def err_param_default_argument_redefinition : Error<
3547  "redefinition of default argument">;
3548def ext_param_default_argument_redefinition : ExtWarn<
3549  err_param_default_argument_redefinition.Text>,
3550  InGroup<MicrosoftDefaultArgRedefinition>;
3551def err_param_default_argument_missing : Error<
3552  "missing default argument on parameter">;
3553def err_param_default_argument_missing_name : Error<
3554  "missing default argument on parameter %0">;
3555def err_param_default_argument_references_param : Error<
3556  "default argument references parameter %0">;
3557def err_param_default_argument_references_local : Error<
3558  "default argument references local variable %0 of enclosing function">;
3559def err_param_default_argument_references_this : Error<
3560  "default argument references 'this'">;
3561def err_param_default_argument_nonfunc : Error<
3562  "default arguments can only be specified for parameters in a function "
3563  "declaration">;
3564def err_param_default_argument_template_redecl : Error<
3565  "default arguments cannot be added to a function template that has already "
3566  "been declared">;
3567def err_param_default_argument_member_template_redecl : Error<
3568  "default arguments cannot be added to an out-of-line definition of a member "
3569  "of a %select{class template|class template partial specialization|nested "
3570  "class in a template}0">;
3571def err_param_default_argument_on_parameter_pack : Error<
3572  "parameter pack cannot have a default argument">;
3573def err_uninitialized_member_for_assign : Error<
3574  "cannot define the implicit copy assignment operator for %0, because "
3575  "non-static %select{reference|const}1 member %2 cannot use copy "
3576  "assignment operator">;
3577def err_uninitialized_member_in_ctor : Error<
3578  "%select{constructor for %1|"
3579  "implicit default constructor for %1|"
3580  "cannot use constructor inherited from %1:}0 must explicitly "
3581  "initialize the %select{reference|const}2 member %3">;
3582def err_default_arg_makes_ctor_special : Error<
3583  "addition of default argument on redeclaration makes this constructor a "
3584  "%select{default|copy|move}0 constructor">;
3585
3586def err_use_of_default_argument_to_function_declared_later : Error<
3587  "use of default argument to function %0 that is declared later in class %1">;
3588def note_default_argument_declared_here : Note<
3589  "default argument declared here">;
3590def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
3591
3592def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
3593  "%diff{promoted type $ of K&R function parameter is not compatible with the "
3594  "parameter type $|promoted type of K&R function parameter is not compatible "
3595  "with parameter type}0,1 declared in a previous prototype">,
3596  InGroup<KNRPromotedParameter>;
3597
3598
3599// C++ Overloading Semantic Analysis.
3600def err_ovl_diff_return_type : Error<
3601  "functions that differ only in their return type cannot be overloaded">;
3602def err_ovl_static_nonstatic_member : Error<
3603  "static and non-static member functions with the same parameter types "
3604  "cannot be overloaded">;
3605
3606def err_ovl_no_viable_function_in_call : Error<
3607  "no matching function for call to %0">;
3608def err_ovl_no_viable_member_function_in_call : Error<
3609  "no matching member function for call to %0">;
3610def err_ovl_ambiguous_call : Error<
3611  "call to %0 is ambiguous">;
3612def err_ovl_deleted_call : Error<"call to deleted function %0">;
3613def err_ovl_ambiguous_member_call : Error<
3614  "call to member function %0 is ambiguous">;
3615def err_ovl_deleted_member_call : Error<
3616  "call to deleted member function %0">;
3617def note_ovl_too_many_candidates : Note<
3618    "remaining %0 candidate%s0 omitted; "
3619    "pass -fshow-overloads=all to show them">;
3620
3621def select_ovl_candidate_kind : TextSubstitution<
3622  "%select{function|function|constructor|"
3623    "constructor (the implicit default constructor)|"
3624    "constructor (the implicit copy constructor)|"
3625    "constructor (the implicit move constructor)|"
3626    "function (the implicit copy assignment operator)|"
3627    "function (the implicit move assignment operator)|"
3628    "inherited constructor}0%select{| template| %2}1">;
3629
3630def note_ovl_candidate : Note<
3631    "candidate %sub{select_ovl_candidate_kind}0,1,3"
3632    "%select{| has different class%diff{ (expected $ but has $)|}5,6"
3633    "| has different number of parameters (expected %5 but has %6)"
3634    "| has type mismatch at %ordinal5 parameter"
3635    "%diff{ (expected $ but has $)|}6,7"
3636    "| has different return type%diff{ ($ expected but has $)|}5,6"
3637    "| has different qualifiers (expected %5 but found %6)"
3638    "| has different exception specification}4">;
3639
3640def note_ovl_candidate_inherited_constructor : Note<
3641    "constructor from base class %0 inherited here">;
3642def note_ovl_candidate_inherited_constructor_slice : Note<
3643    "candidate %select{constructor|template}0 ignored: "
3644    "inherited constructor cannot be used to %select{copy|move}1 object">;
3645def note_ovl_candidate_illegal_constructor : Note<
3646    "candidate %select{constructor|template}0 ignored: "
3647    "instantiation %select{takes|would take}0 its own class type by value">;
3648def note_ovl_candidate_bad_deduction : Note<
3649    "candidate template ignored: failed template argument deduction">;
3650def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
3651    "couldn't infer template argument %0">;
3652def note_ovl_candidate_incomplete_deduction_pack : Note<"candidate template ignored: "
3653    "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
3654    "expanded parameter in deduced argument pack %2">;
3655def note_ovl_candidate_inconsistent_deduction : Note<
3656    "candidate template ignored: deduced conflicting %select{types|values|"
3657    "templates}0 for parameter %1%diff{ ($ vs. $)|}2,3">;
3658def note_ovl_candidate_inconsistent_deduction_types : Note<
3659    "candidate template ignored: deduced values %diff{"
3660    "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
3661    "%1 and %3 of conflicting types for parameter %0}2,4">;
3662def note_ovl_candidate_explicit_arg_mismatch_named : Note<
3663    "candidate template ignored: invalid explicitly-specified argument "
3664    "for template parameter %0">;
3665def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
3666    "candidate template ignored: invalid explicitly-specified argument "
3667    "for %ordinal0 template parameter">;
3668def note_ovl_candidate_instantiation_depth : Note<
3669    "candidate template ignored: substitution exceeded maximum template "
3670    "instantiation depth">;
3671def note_ovl_candidate_underqualified : Note<
3672    "candidate template ignored: cannot deduce a type for %0 that would "
3673    "make %2 equal %1">;
3674def note_ovl_candidate_substitution_failure : Note<
3675    "candidate template ignored: substitution failure%0%1">;
3676def note_ovl_candidate_disabled_by_enable_if : Note<
3677    "candidate template ignored: disabled by %0%1">;
3678def note_ovl_candidate_disabled_by_requirement : Note<
3679    "candidate template ignored: requirement '%0' was not satisfied%1">;
3680def note_ovl_candidate_has_pass_object_size_params: Note<
3681    "candidate address cannot be taken because parameter %0 has "
3682    "pass_object_size attribute">;
3683def err_diagnose_if_succeeded : Error<"%0">;
3684def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
3685    ShowInSystemHeader;
3686def note_ovl_candidate_disabled_by_function_cond_attr : Note<
3687    "candidate disabled: %0">;
3688def note_ovl_candidate_disabled_by_extension : Note<
3689    "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
3690def err_addrof_function_disabled_by_enable_if_attr : Error<
3691    "cannot take address of function %0 because it has one or more "
3692    "non-tautological enable_if conditions">;
3693def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
3694    "candidate function made ineligible by enable_if">;
3695def note_ovl_candidate_deduced_mismatch : Note<
3696    "candidate template ignored: deduced type "
3697    "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
3698    "adjusted type $ of %select{|element of }4argument"
3699    "|of %select{|element of }4%ordinal0 parameter does not match "
3700    "adjusted type of %select{|element of }4argument}1,2%3">;
3701def note_ovl_candidate_non_deduced_mismatch : Note<
3702    "candidate template ignored: could not match %diff{$ against $|types}0,1">;
3703// This note is needed because the above note would sometimes print two
3704// different types with the same name.  Remove this note when the above note
3705// can handle that case properly.
3706def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
3707    "candidate template ignored: could not match %q0 against %q1">;
3708
3709// Note that we don't treat templates differently for this diagnostic.
3710def note_ovl_candidate_arity : Note<"candidate "
3711    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
3712    "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
3713    "%plural{1:was|:were}5 provided">;
3714
3715def note_ovl_candidate_arity_one : Note<"candidate "
3716    "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
3717    "%select{requires at least|allows at most single|requires single}3 "
3718    "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
3719
3720def note_ovl_candidate_deleted : Note<
3721    "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
3722    "%select{explicitly made unavailable|explicitly deleted|"
3723    "implicitly deleted}3">;
3724
3725// Giving the index of the bad argument really clutters this message, and
3726// it's relatively unimportant because 1) it's generally obvious which
3727// argument(s) are of the given object type and 2) the fix is usually
3728// to complete the type, which doesn't involve changes to the call line
3729// anyway.  If people complain, we can change it.
3730def note_ovl_candidate_bad_conv_incomplete : Note<
3731    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3732    "cannot convert argument of incomplete type "
3733    "%diff{$ to $|to parameter type}3,4 for "
3734    "%select{%ordinal6 argument|object argument}5"
3735    "%select{|; dereference the argument with *|"
3736    "; take the address of the argument with &|"
3737    "; remove *|"
3738    "; remove &}7">;
3739def note_ovl_candidate_bad_list_argument : Note<
3740    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3741    "cannot convert initializer list argument to %4">;
3742def note_ovl_candidate_bad_overload : Note<
3743    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3744    "no overload of %4 matching %3 for %ordinal5 argument">;
3745def note_ovl_candidate_bad_conv : Note<
3746    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3747    "no known conversion "
3748    "%diff{from $ to $|from argument type to parameter type}3,4 for "
3749    "%select{%ordinal6 argument|object argument}5"
3750    "%select{|; dereference the argument with *|"
3751    "; take the address of the argument with &|"
3752    "; remove *|"
3753    "; remove &}7">;
3754def note_ovl_candidate_bad_arc_conv : Note<
3755    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3756    "cannot implicitly convert argument "
3757    "%diff{of type $ to $|type to parameter type}3,4 for "
3758    "%select{%ordinal6 argument|object argument}5 under ARC">;
3759def note_ovl_candidate_bad_lvalue : Note<
3760    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3761    "expects an l-value for "
3762    "%select{%ordinal4 argument|object argument}3">;
3763def note_ovl_candidate_bad_addrspace : Note<
3764    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3765    "address space mismatch in %select{%ordinal6|'this'}5 argument (%3), "
3766    "parameter type must be %4">;
3767def note_ovl_candidate_bad_gc : Note<
3768    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3769    "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
3770    "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
3771def note_ovl_candidate_bad_ownership : Note<
3772    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3773    "%select{%ordinal7|'this'}6 argument (%3) has "
3774    "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
3775    " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
3776    "__autoreleasing}5 ownership">;
3777def note_ovl_candidate_bad_cvr_this : Note<
3778    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3779    "'this' argument has type %3, but method is not marked "
3780    "%select{const|restrict|const or restrict|volatile|const or volatile|"
3781    "volatile or restrict|const, volatile, or restrict}4">;
3782def note_ovl_candidate_bad_cvr : Note<
3783    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3784    "%ordinal5 argument (%3) would lose "
3785    "%select{const|restrict|const and restrict|volatile|const and volatile|"
3786    "volatile and restrict|const, volatile, and restrict}4 qualifier"
3787    "%select{||s||s|s|s}4">;
3788def note_ovl_candidate_bad_unaligned : Note<
3789    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3790    "%ordinal5 argument (%3) would lose __unaligned qualifier">;
3791def note_ovl_candidate_bad_base_to_derived_conv : Note<
3792    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3793    "cannot %select{convert from|convert from|bind}3 "
3794    "%select{base class pointer|superclass|base class object of type}3 %4 to "
3795    "%select{derived class pointer|subclass|derived class reference}3 %5 for "
3796    "%ordinal6 argument">;
3797def note_ovl_candidate_bad_target : Note<
3798    "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
3799    "call to "
3800    "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
3801    " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
3802def note_implicit_member_target_infer_collision : Note<
3803    "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
3804    "%select{__device__|__global__|__host__|__host__ __device__}1 and "
3805    "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
3806
3807def note_ambiguous_type_conversion: Note<
3808    "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
3809def note_ovl_builtin_binary_candidate : Note<
3810    "built-in candidate %0">;
3811def note_ovl_builtin_unary_candidate : Note<
3812    "built-in candidate %0">;
3813def err_ovl_no_viable_function_in_init : Error<
3814  "no matching constructor for initialization of %0">;
3815def err_ovl_no_conversion_in_cast : Error<
3816  "cannot convert %1 to %2 without a conversion operator">;
3817def err_ovl_no_viable_conversion_in_cast : Error<
3818  "no matching conversion for %select{|static_cast|reinterpret_cast|"
3819  "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
3820def err_ovl_ambiguous_conversion_in_cast : Error<
3821  "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
3822  "dynamic_cast|C-style cast|functional-style cast}0 from %1 to %2">;
3823def err_ovl_deleted_conversion_in_cast : Error<
3824  "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
3825  "functional-style cast}0 from %1 to %2 uses deleted function">;
3826def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
3827def err_ref_init_ambiguous : Error<
3828  "reference initialization of type %0 with initializer of type %1 is ambiguous">;
3829def err_ovl_deleted_init : Error<
3830  "call to deleted constructor of %0">;
3831def err_ovl_deleted_special_init : Error<
3832  "call to implicitly-deleted %select{default constructor|copy constructor|"
3833  "move constructor|copy assignment operator|move assignment operator|"
3834  "destructor|function}0 of %1">;
3835def err_ovl_ambiguous_oper_unary : Error<
3836  "use of overloaded operator '%0' is ambiguous (operand type %1)">;
3837def err_ovl_ambiguous_oper_binary : Error<
3838  "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
3839def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
3840def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
3841def err_ovl_deleted_oper : Error<
3842  "overload resolution selected deleted operator '%0'">;
3843def err_ovl_deleted_special_oper : Error<
3844  "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
3845  "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is implicitly deleted">;
3846def err_ovl_no_viable_subscript :
3847    Error<"no viable overloaded operator[] for type %0">;
3848def err_ovl_no_oper :
3849    Error<"type %0 does not provide a %select{subscript|call}1 operator">;
3850def err_ovl_unresolvable : Error<
3851  "reference to %select{overloaded|multiversioned}1 function could not be "
3852  "resolved; did you mean to call it%select{| with no arguments}0?">;
3853def err_bound_member_function : Error<
3854  "reference to non-static member function must be called"
3855  "%select{|; did you mean to call it with no arguments?}0">;
3856def note_possible_target_of_call : Note<"possible target for call">;
3857
3858def err_ovl_no_viable_object_call : Error<
3859  "no matching function for call to object of type %0">;
3860def err_ovl_ambiguous_object_call : Error<
3861  "call to object of type %0 is ambiguous">;
3862def err_ovl_deleted_object_call : Error<
3863  "call to deleted function call operator in type %0">;
3864def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
3865def err_member_call_without_object : Error<
3866  "call to non-static member function without an object argument">;
3867
3868// C++ Address of Overloaded Function
3869def err_addr_ovl_no_viable : Error<
3870  "address of overloaded function %0 does not match required type %1">;
3871def err_addr_ovl_ambiguous : Error<
3872  "address of overloaded function %0 is ambiguous">;
3873def err_addr_ovl_not_func_ptrref : Error<
3874  "address of overloaded function %0 cannot be converted to type %1">;
3875def err_addr_ovl_no_qualifier : Error<
3876  "cannot form member pointer of type %0 without '&' and class name">;
3877
3878// C++11 Literal Operators
3879def err_ovl_no_viable_literal_operator : Error<
3880  "no matching literal operator for call to %0"
3881  "%select{| with argument of type %2| with arguments of types %2 and %3}1"
3882  "%select{| or 'const char *'}4"
3883  "%select{|, and no matching literal operator template}5">;
3884
3885// C++ Template Declarations
3886def err_template_param_shadow : Error<
3887  "declaration of %0 shadows template parameter">;
3888def note_template_param_here : Note<"template parameter is declared here">;
3889def warn_template_export_unsupported : Warning<
3890  "exported templates are unsupported">;
3891def err_template_outside_namespace_or_class_scope : Error<
3892  "templates can only be declared in namespace or class scope">;
3893def err_template_inside_local_class : Error<
3894  "templates cannot be declared inside of a local class">;
3895def err_template_linkage : Error<"templates must have C++ linkage">;
3896def err_template_typedef : Error<"a typedef cannot be a template">;
3897def err_template_unnamed_class : Error<
3898  "cannot declare a class template with no name">;
3899def err_template_param_list_different_arity : Error<
3900  "%select{too few|too many}0 template parameters in template "
3901  "%select{|template parameter }1redeclaration">;
3902def note_template_param_list_different_arity : Note<
3903  "%select{too few|too many}0 template parameters in template template "
3904  "argument">;
3905def note_template_prev_declaration : Note<
3906  "previous template %select{declaration|template parameter}0 is here">;
3907def err_template_param_different_kind : Error<
3908  "template parameter has a different kind in template "
3909  "%select{|template parameter }0redeclaration">;
3910def note_template_param_different_kind : Note<
3911  "template parameter has a different kind in template argument">;
3912
3913def err_invalid_decl_specifier_in_nontype_parm : Error<
3914  "invalid declaration specifier in template non-type parameter">;
3915
3916def err_template_nontype_parm_different_type : Error<
3917  "template non-type parameter has a different type %0 in template "
3918  "%select{|template parameter }1redeclaration">;
3919
3920def note_template_nontype_parm_different_type : Note<
3921  "template non-type parameter has a different type %0 in template argument">;
3922def note_template_nontype_parm_prev_declaration : Note<
3923  "previous non-type template parameter with type %0 is here">;
3924def err_template_nontype_parm_bad_type : Error<
3925  "a non-type template parameter cannot have type %0">;
3926def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
3927  "non-type template parameters declared with %0 are incompatible with C++ "
3928  "standards before C++17">,
3929  DefaultIgnore, InGroup<CXXPre17Compat>;
3930def err_template_param_default_arg_redefinition : Error<
3931  "template parameter redefines default argument">;
3932def note_template_param_prev_default_arg : Note<
3933  "previous default template argument defined here">;
3934def err_template_param_default_arg_missing : Error<
3935  "template parameter missing a default argument">;
3936def ext_template_parameter_default_in_function_template : ExtWarn<
3937  "default template arguments for a function template are a C++11 extension">,
3938  InGroup<CXX11>;
3939def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
3940  "default template arguments for a function template are incompatible with C++98">,
3941  InGroup<CXX98Compat>, DefaultIgnore;
3942def err_template_parameter_default_template_member : Error<
3943  "cannot add a default template argument to the definition of a member of a "
3944  "class template">;
3945def err_template_parameter_default_friend_template : Error<
3946  "default template argument not permitted on a friend template">;
3947def err_template_template_parm_no_parms : Error<
3948  "template template parameter must have its own template parameters">;
3949
3950def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
3951  InGroup<CXX14>;
3952def warn_cxx11_compat_variable_template : Warning<
3953  "variable templates are incompatible with C++ standards before C++14">,
3954  InGroup<CXXPre14Compat>, DefaultIgnore;
3955def err_template_variable_noparams : Error<
3956  "extraneous 'template<>' in declaration of variable %0">;
3957def err_template_member : Error<"member %0 declared as a template">;
3958def err_template_member_noparams : Error<
3959  "extraneous 'template<>' in declaration of member %0">;
3960def err_template_tag_noparams : Error<
3961  "extraneous 'template<>' in declaration of %0 %1">;
3962
3963// C++ Template Argument Lists
3964def err_template_missing_args : Error<
3965  "use of "
3966  "%select{class template|function template|variable template|alias template|"
3967  "template template parameter|template}0 %1 requires template arguments">;
3968def err_template_arg_list_different_arity : Error<
3969  "%select{too few|too many}0 template arguments for "
3970  "%select{class template|function template|variable template|alias template|"
3971  "template template parameter|template}1 %2">;
3972def note_template_decl_here : Note<"template is declared here">;
3973def err_template_arg_must_be_type : Error<
3974  "template argument for template type parameter must be a type">;
3975def err_template_arg_must_be_type_suggest : Error<
3976  "template argument for template type parameter must be a type; "
3977  "did you forget 'typename'?">;
3978def ext_ms_template_type_arg_missing_typename : ExtWarn<
3979  "template argument for template type parameter must be a type; "
3980  "omitted 'typename' is a Microsoft extension">,
3981  InGroup<MicrosoftTemplate>;
3982def err_template_arg_must_be_expr : Error<
3983  "template argument for non-type template parameter must be an expression">;
3984def err_template_arg_nontype_ambig : Error<
3985  "template argument for non-type template parameter is treated as function type %0">;
3986def err_template_arg_must_be_template : Error<
3987  "template argument for template template parameter must be a class template%select{| or type alias template}0">;
3988def ext_template_arg_local_type : ExtWarn<
3989  "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
3990def ext_template_arg_unnamed_type : ExtWarn<
3991  "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
3992def warn_cxx98_compat_template_arg_local_type : Warning<
3993  "local type %0 as template argument is incompatible with C++98">,
3994  InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
3995def warn_cxx98_compat_template_arg_unnamed_type : Warning<
3996  "unnamed type as template argument is incompatible with C++98">,
3997  InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
3998def note_template_unnamed_type_here : Note<
3999  "unnamed type used in template argument was declared here">;
4000def err_template_arg_overload_type : Error<
4001  "template argument is the type of an unresolved overloaded function">;
4002def err_template_arg_not_valid_template : Error<
4003  "template argument does not refer to a class or alias template, or template "
4004  "template parameter">;
4005def note_template_arg_refers_here_func : Note<
4006  "template argument refers to function template %0, here">;
4007def err_template_arg_template_params_mismatch : Error<
4008  "template template argument has different template parameters than its "
4009  "corresponding template template parameter">;
4010def err_template_arg_not_integral_or_enumeral : Error<
4011  "non-type template argument of type %0 must have an integral or enumeration"
4012  " type">;
4013def err_template_arg_not_ice : Error<
4014  "non-type template argument of type %0 is not an integral constant "
4015  "expression">;
4016def err_template_arg_not_address_constant : Error<
4017  "non-type template argument of type %0 is not a constant expression">;
4018def warn_cxx98_compat_template_arg_null : Warning<
4019  "use of null pointer as non-type template argument is incompatible with "
4020  "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4021def err_template_arg_untyped_null_constant : Error<
4022  "null non-type template argument must be cast to template parameter type %0">;
4023def err_template_arg_wrongtype_null_constant : Error<
4024  "null non-type template argument of type %0 does not match template parameter "
4025  "of type %1">;
4026def err_non_type_template_parm_type_deduction_failure : Error<
4027  "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4028def err_deduced_non_type_template_arg_type_mismatch : Error<
4029  "deduced non-type template argument does not have the same type as the "
4030  "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4031def err_non_type_template_arg_subobject : Error<
4032  "non-type template argument refers to subobject '%0'">;
4033def err_non_type_template_arg_addr_label_diff : Error<
4034  "template argument / label address difference / what did you expect?">;
4035def err_template_arg_not_convertible : Error<
4036  "non-type template argument of type %0 cannot be converted to a value "
4037  "of type %1">;
4038def warn_template_arg_negative : Warning<
4039  "non-type template argument with value '%0' converted to '%1' for unsigned "
4040  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4041def warn_template_arg_too_large : Warning<
4042  "non-type template argument value '%0' truncated to '%1' for "
4043  "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4044def err_template_arg_no_ref_bind : Error<
4045  "non-type template parameter of reference type "
4046  "%diff{$ cannot bind to template argument of type $"
4047  "|cannot bind to template of incompatible argument type}0,1">;
4048def err_template_arg_ref_bind_ignores_quals : Error<
4049  "reference binding of non-type template parameter "
4050  "%diff{of type $ to template argument of type $|to template argument}0,1 "
4051  "ignores qualifiers">;
4052def err_template_arg_not_decl_ref : Error<
4053  "non-type template argument does not refer to any declaration">;
4054def err_template_arg_not_address_of : Error<
4055  "non-type template argument for template parameter of pointer type %0 must "
4056  "have its address taken">;
4057def err_template_arg_address_of_non_pointer : Error<
4058  "address taken in non-type template argument for template parameter of "
4059  "reference type %0">;
4060def err_template_arg_reference_var : Error<
4061  "non-type template argument of reference type %0 is not an object">;
4062def err_template_arg_field : Error<
4063  "non-type template argument refers to non-static data member %0">;
4064def err_template_arg_method : Error<
4065  "non-type template argument refers to non-static member function %0">;
4066def err_template_arg_object_no_linkage : Error<
4067  "non-type template argument refers to %select{function|object}0 %1 that "
4068  "does not have linkage">;
4069def warn_cxx98_compat_template_arg_object_internal : Warning<
4070  "non-type template argument referring to %select{function|object}0 %1 with "
4071  "internal linkage is incompatible with C++98">,
4072  InGroup<CXX98Compat>, DefaultIgnore;
4073def ext_template_arg_object_internal : ExtWarn<
4074  "non-type template argument referring to %select{function|object}0 %1 with "
4075  "internal linkage is a C++11 extension">, InGroup<CXX11>;
4076def err_template_arg_thread_local : Error<
4077  "non-type template argument refers to thread-local object">;
4078def note_template_arg_internal_object : Note<
4079  "non-type template argument refers to %select{function|object}0 here">;
4080def note_template_arg_refers_here : Note<
4081  "non-type template argument refers here">;
4082def err_template_arg_not_object_or_func : Error<
4083  "non-type template argument does not refer to an object or function">;
4084def err_template_arg_not_pointer_to_member_form : Error<
4085  "non-type template argument is not a pointer to member constant">;
4086def err_template_arg_member_ptr_base_derived_not_supported : Error<
4087  "sorry, non-type template argument of pointer-to-member type %1 that refers "
4088  "to member %q0 of a different class is not supported yet">;
4089def ext_template_arg_extra_parens : ExtWarn<
4090  "address non-type template argument cannot be surrounded by parentheses">;
4091def warn_cxx98_compat_template_arg_extra_parens : Warning<
4092  "redundant parentheses surrounding address non-type template argument are "
4093  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4094def err_pointer_to_member_type : Error<
4095  "invalid use of pointer to member type after %select{.*|->*}0">;
4096def err_pointer_to_member_call_drops_quals : Error<
4097  "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4098def err_pointer_to_member_oper_value_classify: Error<
4099  "pointer-to-member function type %0 can only be called on an "
4100  "%select{rvalue|lvalue}1">;
4101def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4102  "invoking a pointer to a 'const &' member function on an rvalue is a C++2a extension">,
4103  InGroup<CXX2a>, SFINAEFailure;
4104def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4105  "invoking a pointer to a 'const &' member function on an rvalue is "
4106  "incompatible with C++ standards before C++2a">,
4107  InGroup<CXXPre2aCompatPedantic>, DefaultIgnore;
4108def ext_ms_deref_template_argument: ExtWarn<
4109  "non-type template argument containing a dereference operation is a "
4110  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4111def ext_ms_delayed_template_argument: ExtWarn<
4112  "using the undeclared type %0 as a default template argument is a "
4113  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4114def err_template_arg_deduced_incomplete_pack : Error<
4115  "deduced incomplete pack %0 for template parameter %1">;
4116
4117// C++ template specialization
4118def err_template_spec_unknown_kind : Error<
4119  "can only provide an explicit specialization for a class template, function "
4120  "template, variable template, or a member function, static data member, "
4121  "%select{or member class|member class, or member enumeration}0 of a "
4122  "class template">;
4123def note_specialized_entity : Note<
4124  "explicitly specialized declaration is here">;
4125def note_explicit_specialization_declared_here : Note<
4126  "explicit specialization declared here">;
4127def err_template_spec_decl_function_scope : Error<
4128  "explicit specialization of %0 in function scope">;
4129def err_template_spec_decl_friend : Error<
4130  "cannot declare an explicit specialization in a friend">;
4131def err_template_spec_redecl_out_of_scope : Error<
4132  "%select{class template|class template partial|variable template|"
4133  "variable template partial|function template|member "
4134  "function|static data member|member class|member enumeration}0 "
4135  "specialization of %1 not in %select{a namespace enclosing %2|"
4136  "class %2 or an enclosing namespace}3">;
4137def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4138  "%select{class template|class template partial|variable template|"
4139  "variable template partial|function template|member "
4140  "function|static data member|member class|member enumeration}0 "
4141  "specialization of %1 not in %select{a namespace enclosing %2|"
4142  "class %2 or an enclosing namespace}3 "
4143  "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4144def err_template_spec_redecl_global_scope : Error<
4145  "%select{class template|class template partial|variable template|"
4146  "variable template partial|function template|member "
4147  "function|static data member|member class|member enumeration}0 "
4148  "specialization of %1 must occur at global scope">;
4149def err_spec_member_not_instantiated : Error<
4150  "specialization of member %q0 does not specialize an instantiated member">;
4151def note_specialized_decl : Note<"attempt to specialize declaration here">;
4152def err_specialization_after_instantiation : Error<
4153  "explicit specialization of %0 after instantiation">;
4154def note_instantiation_required_here : Note<
4155  "%select{implicit|explicit}0 instantiation first required here">;
4156def err_template_spec_friend : Error<
4157  "template specialization declaration cannot be a friend">;
4158def err_template_spec_default_arg : Error<
4159  "default argument not permitted on an explicit "
4160  "%select{instantiation|specialization}0 of function %1">;
4161def err_not_class_template_specialization : Error<
4162  "cannot specialize a %select{dependent template|template template "
4163  "parameter}0">;
4164def ext_explicit_specialization_storage_class : ExtWarn<
4165  "explicit specialization cannot have a storage class">;
4166def err_explicit_specialization_inconsistent_storage_class : Error<
4167  "explicit specialization has extraneous, inconsistent storage class "
4168  "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4169def err_dependent_function_template_spec_no_match : Error<
4170  "no candidate function template was found for dependent"
4171  " friend function template specialization">;
4172def note_dependent_function_template_spec_discard_reason : Note<
4173  "candidate ignored: %select{not a function template"
4174  "|not a member of the enclosing namespace;"
4175  " did you mean to explicitly qualify the specialization?}0">;
4176
4177// C++ class template specializations and out-of-line definitions
4178def err_template_spec_needs_header : Error<
4179  "template specialization requires 'template<>'">;
4180def err_template_spec_needs_template_parameters : Error<
4181  "template specialization or definition requires a template parameter list "
4182  "corresponding to the nested type %0">;
4183def err_template_param_list_matches_nontemplate : Error<
4184  "template parameter list matching the non-templated nested type %0 should "
4185  "be empty ('template<>')">;
4186def err_alias_template_extra_headers : Error<
4187  "extraneous template parameter list in alias template declaration">;
4188def err_template_spec_extra_headers : Error<
4189  "extraneous template parameter list in template specialization or "
4190  "out-of-line template definition">;
4191def warn_template_spec_extra_headers : Warning<
4192  "extraneous template parameter list in template specialization">;
4193def note_explicit_template_spec_does_not_need_header : Note<
4194  "'template<>' header not required for explicitly-specialized class %0 "
4195  "declared here">;
4196def err_template_qualified_declarator_no_match : Error<
4197  "nested name specifier '%0' for declaration does not refer into a class, "
4198  "class template or class template partial specialization">;
4199def err_specialize_member_of_template : Error<
4200  "cannot specialize %select{|(with 'template<>') }0a member of an "
4201  "unspecialized template">;
4202
4203// C++ Class Template Partial Specialization
4204def err_default_arg_in_partial_spec : Error<
4205    "default template argument in a class template partial specialization">;
4206def err_dependent_non_type_arg_in_partial_spec : Error<
4207    "type of specialized non-type template argument depends on a template "
4208    "parameter of the partial specialization">;
4209def note_dependent_non_type_default_arg_in_partial_spec : Note<
4210    "template parameter is used in default argument declared here">;
4211def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4212    "non-type template argument specializes a template parameter with "
4213    "dependent type %0">;
4214def err_partial_spec_args_match_primary_template : Error<
4215    "%select{class|variable}0 template partial specialization does not "
4216    "specialize any template argument; to %select{declare|define}1 the "
4217    "primary template, remove the template argument list">;
4218def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4219    "%select{class|variable}0 template partial specialization is not "
4220    "more specialized than the primary template">, DefaultError,
4221    InGroup<DiagGroup<"invalid-partial-specialization">>;
4222def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4223def ext_partial_specs_not_deducible : ExtWarn<
4224    "%select{class|variable}0 template partial specialization contains "
4225    "%select{a template parameter|template parameters}1 that cannot be "
4226    "deduced; this partial specialization will never be used">,
4227    DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4228def note_non_deducible_parameter : Note<
4229    "non-deducible template parameter %0">;
4230def err_partial_spec_ordering_ambiguous : Error<
4231    "ambiguous partial specializations of %0">;
4232def note_partial_spec_match : Note<"partial specialization matches %0">;
4233def err_partial_spec_redeclared : Error<
4234  "class template partial specialization %0 cannot be redeclared">;
4235def note_partial_specialization_declared_here : Note<
4236  "explicit specialization declared here">;
4237def note_prev_partial_spec_here : Note<
4238  "previous declaration of class template partial specialization %0 is here">;
4239def err_partial_spec_fully_specialized : Error<
4240  "partial specialization of %0 does not use any of its template parameters">;
4241
4242// C++ Variable Template Partial Specialization
4243def err_var_partial_spec_redeclared : Error<
4244  "variable template partial specialization %0 cannot be redefined">;
4245def note_var_prev_partial_spec_here : Note<
4246  "previous declaration of variable template partial specialization is here">;
4247def err_var_spec_no_template : Error<
4248  "no variable template matches%select{| partial}0 specialization">;
4249def err_var_spec_no_template_but_method : Error<
4250  "no variable template matches specialization; "
4251  "did you mean to use %0 as function template instead?">;
4252
4253// C++ Function template specializations
4254def err_function_template_spec_no_match : Error<
4255    "no function template matches function template specialization %0">;
4256def err_function_template_spec_ambiguous : Error<
4257    "function template specialization %0 ambiguously refers to more than one "
4258    "function template; explicitly specify%select{| additional}1 template "
4259    "arguments to identify a particular function template">;
4260def note_function_template_spec_matched : Note<
4261    "function template %q0 matches specialization %1">;
4262def err_function_template_partial_spec : Error<
4263    "function template partial specialization is not allowed">;
4264
4265// C++ Template Instantiation
4266def err_template_recursion_depth_exceeded : Error<
4267  "recursive template instantiation exceeded maximum depth of %0">,
4268  DefaultFatal, NoSFINAE;
4269def note_template_recursion_depth : Note<
4270  "use -ftemplate-depth=N to increase recursive template instantiation depth">;
4271
4272def err_template_instantiate_within_definition : Error<
4273  "%select{implicit|explicit}0 instantiation of template %1 within its"
4274  " own definition">;
4275def err_template_instantiate_undefined : Error<
4276  "%select{implicit|explicit}0 instantiation of undefined template %1">;
4277def err_implicit_instantiate_member_undefined : Error<
4278  "implicit instantiation of undefined member %0">;
4279def note_template_class_instantiation_was_here : Note<
4280  "class template %0 was instantiated here">;
4281def note_template_class_explicit_specialization_was_here : Note<
4282  "class template %0 was explicitly specialized here">;
4283def note_template_class_instantiation_here : Note<
4284  "in instantiation of template class %q0 requested here">;
4285def note_template_member_class_here : Note<
4286  "in instantiation of member class %q0 requested here">;
4287def note_template_member_function_here : Note<
4288  "in instantiation of member function %q0 requested here">;
4289def note_function_template_spec_here : Note<
4290  "in instantiation of function template specialization %q0 requested here">;
4291def note_template_static_data_member_def_here : Note<
4292  "in instantiation of static data member %q0 requested here">;
4293def note_template_variable_def_here : Note<
4294  "in instantiation of variable template specialization %q0 requested here">;
4295def note_template_enum_def_here : Note<
4296  "in instantiation of enumeration %q0 requested here">;
4297def note_template_nsdmi_here : Note<
4298  "in instantiation of default member initializer %q0 requested here">;
4299def note_template_type_alias_instantiation_here : Note<
4300  "in instantiation of template type alias %0 requested here">;
4301def note_template_exception_spec_instantiation_here : Note<
4302  "in instantiation of exception specification for %0 requested here">;
4303def warn_var_template_missing : Warning<"instantiation of variable %q0 "
4304  "required here, but no definition is available">,
4305  InGroup<UndefinedVarTemplate>;
4306def warn_func_template_missing : Warning<"instantiation of function %q0 "
4307  "required here, but no definition is available">,
4308  InGroup<UndefinedFuncTemplate>, DefaultIgnore;
4309def note_forward_template_decl : Note<
4310  "forward declaration of template entity is here">;
4311def note_inst_declaration_hint : Note<"add an explicit instantiation "
4312  "declaration to suppress this warning if %q0 is explicitly instantiated in "
4313  "another translation unit">;
4314def note_evaluating_exception_spec_here : Note<
4315  "in evaluation of exception specification for %q0 needed here">;
4316
4317def note_default_arg_instantiation_here : Note<
4318  "in instantiation of default argument for '%0' required here">;
4319def note_default_function_arg_instantiation_here : Note<
4320  "in instantiation of default function argument expression "
4321  "for '%0' required here">;
4322def note_explicit_template_arg_substitution_here : Note<
4323  "while substituting explicitly-specified template arguments into function "
4324  "template %0 %1">;
4325def note_function_template_deduction_instantiation_here : Note<
4326  "while substituting deduced template arguments into function template %0 "
4327  "%1">;
4328def note_deduced_template_arg_substitution_here : Note<
4329  "during template argument deduction for %select{class|variable}0 template "
4330  "%select{partial specialization |}1%2 %3">;
4331def note_prior_template_arg_substitution : Note<
4332  "while substituting prior template arguments into %select{non-type|template}0"
4333  " template parameter%1 %2">;
4334def note_template_default_arg_checking : Note<
4335  "while checking a default template argument used here">;
4336def note_instantiation_contexts_suppressed : Note<
4337  "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
4338  "see all)">;
4339
4340def err_field_instantiates_to_function : Error<
4341  "data member instantiated with function type %0">;
4342def err_variable_instantiates_to_function : Error<
4343  "%select{variable|static data member}0 instantiated with function type %1">;
4344def err_nested_name_spec_non_tag : Error<
4345  "type %0 cannot be used prior to '::' because it has no members">;
4346
4347def err_using_pack_expansion_empty : Error<
4348  "%select{|member}0 using declaration %1 instantiates to an empty pack">;
4349
4350// C++ Explicit Instantiation
4351def err_explicit_instantiation_duplicate : Error<
4352    "duplicate explicit instantiation of %0">;
4353def ext_explicit_instantiation_duplicate : ExtWarn<
4354    "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
4355    InGroup<MicrosoftTemplate>;
4356def note_previous_explicit_instantiation : Note<
4357    "previous explicit instantiation is here">;
4358def warn_explicit_instantiation_after_specialization : Warning<
4359  "explicit instantiation of %0 that occurs after an explicit "
4360  "specialization has no effect">,
4361  InGroup<DiagGroup<"instantiation-after-specialization">>;
4362def note_previous_template_specialization : Note<
4363    "previous template specialization is here">;
4364def err_explicit_instantiation_nontemplate_type : Error<
4365    "explicit instantiation of non-templated type %0">;
4366def note_nontemplate_decl_here : Note<
4367    "non-templated declaration is here">;
4368def err_explicit_instantiation_in_class : Error<
4369  "explicit instantiation of %0 in class scope">;
4370def err_explicit_instantiation_out_of_scope : Error<
4371  "explicit instantiation of %0 not in a namespace enclosing %1">;
4372def err_explicit_instantiation_must_be_global : Error<
4373  "explicit instantiation of %0 must occur at global scope">;
4374def warn_explicit_instantiation_out_of_scope_0x : Warning<
4375  "explicit instantiation of %0 not in a namespace enclosing %1">,
4376  InGroup<CXX11Compat>, DefaultIgnore;
4377def warn_explicit_instantiation_must_be_global_0x : Warning<
4378  "explicit instantiation of %0 must occur at global scope">,
4379  InGroup<CXX11Compat>, DefaultIgnore;
4380
4381def err_explicit_instantiation_requires_name : Error<
4382  "explicit instantiation declaration requires a name">;
4383def err_explicit_instantiation_of_typedef : Error<
4384  "explicit instantiation of typedef %0">;
4385def err_explicit_instantiation_storage_class : Error<
4386  "explicit instantiation cannot have a storage class">;
4387def err_explicit_instantiation_not_known : Error<
4388  "explicit instantiation of %0 does not refer to a function template, "
4389  "variable template, member function, member class, or static data member">;
4390def note_explicit_instantiation_here : Note<
4391  "explicit instantiation refers here">;
4392def err_explicit_instantiation_data_member_not_instantiated : Error<
4393  "explicit instantiation refers to static data member %q0 that is not an "
4394  "instantiation">;
4395def err_explicit_instantiation_member_function_not_instantiated : Error<
4396  "explicit instantiation refers to member function %q0 that is not an "
4397  "instantiation">;
4398def err_explicit_instantiation_ambiguous : Error<
4399  "partial ordering for explicit instantiation of %0 is ambiguous">;
4400def note_explicit_instantiation_candidate : Note<
4401  "explicit instantiation candidate function %q0 template here %1">;
4402def err_explicit_instantiation_inline : Error<
4403  "explicit instantiation cannot be 'inline'">;
4404def warn_explicit_instantiation_inline_0x : Warning<
4405  "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
4406  DefaultIgnore;
4407def err_explicit_instantiation_constexpr : Error<
4408  "explicit instantiation cannot be 'constexpr'">;
4409def ext_explicit_instantiation_without_qualified_id : Extension<
4410  "qualifier in explicit instantiation of %q0 requires a template-id "
4411  "(a typedef is not permitted)">;
4412def err_explicit_instantiation_without_template_id : Error<
4413  "explicit instantiation of %q0 must specify a template argument list">;
4414def err_explicit_instantiation_unqualified_wrong_namespace : Error<
4415  "explicit instantiation of %q0 must occur in namespace %1">;
4416def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
4417  "explicit instantiation of %q0 must occur in namespace %1">,
4418  InGroup<CXX11Compat>, DefaultIgnore;
4419def err_explicit_instantiation_undefined_member : Error<
4420  "explicit instantiation of undefined %select{member class|member function|"
4421  "static data member}0 %1 of class template %2">;
4422def err_explicit_instantiation_undefined_func_template : Error<
4423  "explicit instantiation of undefined function template %0">;
4424def err_explicit_instantiation_undefined_var_template : Error<
4425  "explicit instantiation of undefined variable template %q0">;
4426def err_explicit_instantiation_declaration_after_definition : Error<
4427  "explicit instantiation declaration (with 'extern') follows explicit "
4428  "instantiation definition (without 'extern')">;
4429def note_explicit_instantiation_definition_here : Note<
4430  "explicit instantiation definition is here">;
4431def err_invalid_var_template_spec_type : Error<"type %2 "
4432  "of %select{explicit instantiation|explicit specialization|"
4433  "partial specialization|redeclaration}0 of %1 does not match"
4434  " expected type %3">;
4435def err_mismatched_exception_spec_explicit_instantiation : Error<
4436  "exception specification in explicit instantiation does not match "
4437  "instantiated one">;
4438def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
4439  err_mismatched_exception_spec_explicit_instantiation.Text>,
4440  InGroup<MicrosoftExceptionSpec>;
4441
4442// C++ typename-specifiers
4443def err_typename_nested_not_found : Error<"no type named %0 in %1">;
4444def err_typename_nested_not_found_enable_if : Error<
4445  "no type named 'type' in %0; 'enable_if' cannot be used to disable "
4446  "this declaration">;
4447def err_typename_nested_not_found_requirement : Error<
4448  "failed requirement '%0'; 'enable_if' cannot be used to disable this "
4449  "declaration">;
4450def err_typename_nested_not_type : Error<
4451    "typename specifier refers to non-type member %0 in %1">;
4452def note_typename_refers_here : Note<
4453    "referenced member %0 is declared here">;
4454def err_typename_missing : Error<
4455  "missing 'typename' prior to dependent type name '%0%1'">;
4456def err_typename_missing_template : Error<
4457  "missing 'typename' prior to dependent type template name '%0%1'">;
4458def ext_typename_missing : ExtWarn<
4459  "missing 'typename' prior to dependent type name '%0%1'">,
4460  InGroup<DiagGroup<"typename-missing">>;
4461def ext_typename_outside_of_template : ExtWarn<
4462  "'typename' occurs outside of a template">, InGroup<CXX11>;
4463def warn_cxx98_compat_typename_outside_of_template : Warning<
4464  "use of 'typename' outside of a template is incompatible with C++98">,
4465  InGroup<CXX98Compat>, DefaultIgnore;
4466def err_typename_refers_to_using_value_decl : Error<
4467  "typename specifier refers to a dependent using declaration for a value "
4468  "%0 in %1">;
4469def note_using_value_decl_missing_typename : Note<
4470  "add 'typename' to treat this using declaration as a type">;
4471
4472def err_template_kw_refers_to_non_template : Error<
4473  "%0 following the 'template' keyword does not refer to a template">;
4474def note_template_kw_refers_to_non_template : Note<
4475  "declared as a non-template here">;
4476def err_template_kw_refers_to_class_template : Error<
4477  "'%0%1' instantiated to a class template, not a function template">;
4478def note_referenced_class_template : Note<
4479  "class template declared here">;
4480def err_template_kw_missing : Error<
4481  "missing 'template' keyword prior to dependent template name '%0%1'">;
4482def ext_template_outside_of_template : ExtWarn<
4483  "'template' keyword outside of a template">, InGroup<CXX11>;
4484def warn_cxx98_compat_template_outside_of_template : Warning<
4485  "use of 'template' keyword outside of a template is incompatible with C++98">,
4486  InGroup<CXX98Compat>, DefaultIgnore;
4487
4488def err_non_type_template_in_nested_name_specifier : Error<
4489  "qualified name refers into a specialization of %select{function|variable}0 "
4490  "template %1">;
4491def err_template_id_not_a_type : Error<
4492  "template name refers to non-type template %0">;
4493def note_template_declared_here : Note<
4494  "%select{function template|class template|variable template"
4495  "|type alias template|template template parameter}0 "
4496  "%1 declared here">;
4497def err_alias_template_expansion_into_fixed_list : Error<
4498  "pack expansion used as argument for non-pack parameter of alias template">;
4499def note_parameter_type : Note<
4500  "parameter of type %0 is declared here">;
4501
4502// C++11 Variadic Templates
4503def err_template_param_pack_default_arg : Error<
4504  "template parameter pack cannot have a default argument">;
4505def err_template_param_pack_must_be_last_template_parameter : Error<
4506  "template parameter pack must be the last template parameter">;
4507
4508def err_template_parameter_pack_non_pack : Error<
4509  "%select{template type|non-type template|template template}0 parameter"
4510  "%select{| pack}1 conflicts with previous %select{template type|"
4511  "non-type template|template template}0 parameter%select{ pack|}1">;
4512def note_template_parameter_pack_non_pack : Note<
4513  "%select{template type|non-type template|template template}0 parameter"
4514  "%select{| pack}1 does not match %select{template type|non-type template"
4515  "|template template}0 parameter%select{ pack|}1 in template argument">;
4516def note_template_parameter_pack_here : Note<
4517  "previous %select{template type|non-type template|template template}0 "
4518  "parameter%select{| pack}1 declared here">;
4519
4520def err_unexpanded_parameter_pack : Error<
4521  "%select{expression|base type|declaration type|data member type|bit-field "
4522  "size|static assertion|fixed underlying type|enumerator value|"
4523  "using declaration|friend declaration|qualifier|initializer|default argument|"
4524  "non-type template parameter type|exception type|partial specialization|"
4525  "__if_exists name|__if_not_exists name|lambda|block}0 contains"
4526  "%plural{0: an|:}1 unexpanded parameter pack"
4527  "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
4528
4529def err_pack_expansion_without_parameter_packs : Error<
4530  "pack expansion does not contain any unexpanded parameter packs">;
4531def err_pack_expansion_length_conflict : Error<
4532  "pack expansion contains parameter packs %0 and %1 that have different "
4533  "lengths (%2 vs. %3)">;
4534def err_pack_expansion_length_conflict_multilevel : Error<
4535  "pack expansion contains parameter pack %0 that has a different "
4536  "length (%1 vs. %2) from outer parameter packs">;
4537def err_pack_expansion_length_conflict_partial : Error<
4538  "pack expansion contains parameter pack %0 that has a different "
4539  "length (at least %1 vs. %2) from outer parameter packs">;
4540def err_pack_expansion_member_init : Error<
4541  "pack expansion for initialization of member %0">;
4542
4543def err_function_parameter_pack_without_parameter_packs : Error<
4544  "type %0 of function parameter pack does not contain any unexpanded "
4545  "parameter packs">;
4546def err_ellipsis_in_declarator_not_parameter : Error<
4547  "only function and template parameters can be parameter packs">;
4548
4549def err_sizeof_pack_no_pack_name : Error<
4550  "%0 does not refer to the name of a parameter pack">;
4551
4552def err_fold_expression_packs_both_sides : Error<
4553  "binary fold expression has unexpanded parameter packs in both operands">;
4554def err_fold_expression_empty : Error<
4555  "unary fold expression has empty expansion for operator '%0' "
4556  "with no fallback value">;
4557def err_fold_expression_bad_operand : Error<
4558  "expression not permitted as operand of fold expression">;
4559
4560def err_unexpected_typedef : Error<
4561  "unexpected type name %0: expected expression">;
4562def err_unexpected_namespace : Error<
4563  "unexpected namespace name %0: expected expression">;
4564def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
4565def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
4566  "use of undeclared identifier %0; "
4567  "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
4568  InGroup<MicrosoftTemplate>;
4569def ext_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
4570  "found via unqualified lookup into dependent bases of class templates is a "
4571  "Microsoft extension">, InGroup<MicrosoftTemplate>;
4572def note_dependent_var_use : Note<"must qualify identifier to find this "
4573    "declaration in dependent base class">;
4574def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
4575    "visible in the template definition nor found by argument-dependent lookup">;
4576def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
4577    "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
4578def err_undeclared_use : Error<"use of undeclared %0">;
4579def warn_deprecated : Warning<"%0 is deprecated">,
4580    InGroup<DeprecatedDeclarations>;
4581def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
4582def warn_property_method_deprecated :
4583    Warning<"property access is using %0 method which is deprecated">,
4584    InGroup<DeprecatedDeclarations>;
4585def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
4586    InGroup<DeprecatedDeclarations>;
4587def warn_deprecated_anonymous_namespace : Warning<
4588  "'deprecated' attribute on anonymous namespace ignored">,
4589  InGroup<IgnoredAttributes>;
4590def warn_deprecated_fwdclass_message : Warning<
4591    "%0 may be deprecated because the receiver type is unknown">,
4592    InGroup<DeprecatedDeclarations>;
4593def warn_deprecated_def : Warning<
4594  "implementing deprecated %select{method|class|category}0">,
4595  InGroup<DeprecatedImplementations>, DefaultIgnore;
4596def warn_unavailable_def : Warning<
4597  "implementing unavailable method">,
4598  InGroup<DeprecatedImplementations>, DefaultIgnore;
4599def err_unavailable : Error<"%0 is unavailable">;
4600def err_property_method_unavailable :
4601    Error<"property access is using %0 method which is unavailable">;
4602def err_unavailable_message : Error<"%0 is unavailable: %1">;
4603def warn_unavailable_fwdclass_message : Warning<
4604    "%0 may be unavailable because the receiver type is unknown">,
4605    InGroup<UnavailableDeclarations>;
4606def note_availability_specified_here : Note<
4607  "%0 has been explicitly marked "
4608  "%select{unavailable|deleted|deprecated}1 here">;
4609def note_partial_availability_specified_here : Note<
4610  "%0 has been marked as being introduced in %1 %2 here, "
4611  "but the deployment target is %1 %3">;
4612def note_implicitly_deleted : Note<
4613  "explicitly defaulted function was implicitly deleted here">;
4614def warn_not_enough_argument : Warning<
4615  "not enough variable arguments in %0 declaration to fit a sentinel">,
4616  InGroup<Sentinel>;
4617def warn_missing_sentinel : Warning <
4618  "missing sentinel in %select{function call|method dispatch|block call}0">,
4619  InGroup<Sentinel>;
4620def note_sentinel_here : Note<
4621  "%select{function|method|block}0 has been explicitly marked sentinel here">;
4622def warn_missing_prototype : Warning<
4623  "no previous prototype for function %0">,
4624  InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
4625def note_declaration_not_a_prototype : Note<
4626  "this declaration is not a prototype; add 'void' to make it a prototype for a zero-parameter function">;
4627def warn_strict_prototypes : Warning<
4628  "this %select{function declaration is not|block declaration is not|"
4629  "old-style function definition is not preceded by}0 a prototype">,
4630  InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
4631def warn_missing_variable_declarations : Warning<
4632  "no previous extern declaration for non-static variable %0">,
4633  InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
4634def err_static_data_member_reinitialization :
4635  Error<"static data member %0 already has an initializer">;
4636def err_redefinition : Error<"redefinition of %0">;
4637def err_alias_after_tentative :
4638  Error<"alias definition of %0 after tentative definition">;
4639def err_alias_is_definition :
4640  Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
4641def err_definition_of_implicitly_declared_member : Error<
4642  "definition of implicitly declared %select{default constructor|copy "
4643  "constructor|move constructor|copy assignment operator|move assignment "
4644  "operator|destructor|function}1">;
4645def err_definition_of_explicitly_defaulted_member : Error<
4646  "definition of explicitly defaulted %select{default constructor|copy "
4647  "constructor|move constructor|copy assignment operator|move assignment "
4648  "operator|destructor|function}0">;
4649def err_redefinition_extern_inline : Error<
4650  "redefinition of a 'extern inline' function %0 is not supported in "
4651  "%select{C99 mode|C++}1">;
4652def warn_attr_abi_tag_namespace : Warning<
4653  "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
4654  InGroup<IgnoredAttributes>;
4655def err_abi_tag_on_redeclaration : Error<
4656  "cannot add 'abi_tag' attribute in a redeclaration">;
4657def err_new_abi_tag_on_redeclaration : Error<
4658  "'abi_tag' %0 missing in original declaration">;
4659def note_use_ifdef_guards : Note<
4660  "unguarded header; consider using #ifdef guards or #pragma once">;
4661
4662def note_deleted_dtor_no_operator_delete : Note<
4663  "virtual destructor requires an unambiguous, accessible 'operator delete'">;
4664def note_deleted_special_member_class_subobject : Note<
4665  "%select{default constructor of|copy constructor of|move constructor of|"
4666  "copy assignment operator of|move assignment operator of|destructor of|"
4667  "constructor inherited by}0 "
4668  "%1 is implicitly deleted because "
4669  "%select{base class %3|%select{||||variant }4field %3}2 "
4670  "%select{has "
4671  "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
4672  "%select{%select{default constructor|copy constructor|move constructor|copy "
4673  "assignment operator|move assignment operator|destructor|"
4674  "%select{default|corresponding|default|default|default}4 constructor}0|"
4675  "destructor}5"
4676  "%select{||s||}4"
4677  "|is an ObjC pointer}6">;
4678def note_deleted_default_ctor_uninit_field : Note<
4679  "%select{default constructor of|constructor inherited by}0 "
4680  "%1 is implicitly deleted because field %2 of "
4681  "%select{reference|const-qualified}4 type %3 would not be initialized">;
4682def note_deleted_default_ctor_all_const : Note<
4683  "%select{default constructor of|constructor inherited by}0 "
4684  "%1 is implicitly deleted because all "
4685  "%select{data members|data members of an anonymous union member}2"
4686  " are const-qualified">;
4687def note_deleted_copy_ctor_rvalue_reference : Note<
4688  "copy constructor of %0 is implicitly deleted because field %1 is of "
4689  "rvalue reference type %2">;
4690def note_deleted_copy_user_declared_move : Note<
4691  "copy %select{constructor|assignment operator}0 is implicitly deleted because"
4692  " %1 has a user-declared move %select{constructor|assignment operator}2">;
4693def note_deleted_assign_field : Note<
4694  "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
4695  "because field %2 is of %select{reference|const-qualified}4 type %3">;
4696
4697// These should be errors.
4698def warn_undefined_internal : Warning<
4699  "%select{function|variable}0 %q1 has internal linkage but is not defined">,
4700  InGroup<DiagGroup<"undefined-internal">>;
4701def err_undefined_internal_type : Error<
4702  "%select{function|variable}0 %q1 is used but not defined in this "
4703  "translation unit, and cannot be defined in any other translation unit "
4704  "because its type does not have linkage">;
4705def ext_undefined_internal_type : Extension<
4706  "ISO C++ requires a definition in this translation unit for "
4707  "%select{function|variable}0 %q1 because its type does not have linkage">,
4708  InGroup<DiagGroup<"undefined-internal-type">>;
4709def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
4710  InGroup<DiagGroup<"undefined-inline">>;
4711def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
4712def note_used_here : Note<"used here">;
4713
4714def err_internal_linkage_redeclaration : Error<
4715  "'internal_linkage' attribute does not appear on the first declaration of %0">;
4716def warn_internal_linkage_local_storage : Warning<
4717  "'internal_linkage' attribute on a non-static local variable is ignored">,
4718  InGroup<IgnoredAttributes>;
4719
4720def ext_internal_in_extern_inline : ExtWarn<
4721  "static %select{function|variable}0 %1 is used in an inline function with "
4722  "external linkage">, InGroup<StaticInInline>;
4723def ext_internal_in_extern_inline_quiet : Extension<
4724  "static %select{function|variable}0 %1 is used in an inline function with "
4725  "external linkage">, InGroup<StaticInInline>;
4726def warn_static_local_in_extern_inline : Warning<
4727  "non-constant static local variable in inline function may be different "
4728  "in different files">, InGroup<StaticLocalInInline>;
4729def note_convert_inline_to_static : Note<
4730  "use 'static' to give inline function %0 internal linkage">;
4731
4732def ext_redefinition_of_typedef : ExtWarn<
4733  "redefinition of typedef %0 is a C11 feature">,
4734  InGroup<DiagGroup<"typedef-redefinition"> >;
4735def err_redefinition_variably_modified_typedef : Error<
4736  "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
4737
4738def err_inline_decl_follows_def : Error<
4739  "inline declaration of %0 follows non-inline definition">;
4740def err_inline_declaration_block_scope : Error<
4741  "inline declaration of %0 not allowed in block scope">;
4742def err_static_non_static : Error<
4743  "static declaration of %0 follows non-static declaration">;
4744def err_different_language_linkage : Error<
4745  "declaration of %0 has a different language linkage">;
4746def ext_retained_language_linkage : Extension<
4747  "friend function %0 retaining previous language linkage is an extension">,
4748  InGroup<DiagGroup<"retained-language-linkage">>;
4749def err_extern_c_global_conflict : Error<
4750  "declaration of %1 %select{with C language linkage|in global scope}0 "
4751  "conflicts with declaration %select{in global scope|with C language linkage}0">;
4752def note_extern_c_global_conflict : Note<
4753  "declared %select{in global scope|with C language linkage}0 here">;
4754def note_extern_c_begins_here : Note<
4755  "extern \"C\" language linkage specification begins here">;
4756def warn_weak_import : Warning <
4757  "an already-declared variable is made a weak_import declaration %0">;
4758def ext_static_non_static : Extension<
4759  "redeclaring non-static %0 as static is a Microsoft extension">,
4760  InGroup<MicrosoftRedeclareStatic>;
4761def err_non_static_static : Error<
4762  "non-static declaration of %0 follows static declaration">;
4763def err_extern_non_extern : Error<
4764  "extern declaration of %0 follows non-extern declaration">;
4765def err_non_extern_extern : Error<
4766  "non-extern declaration of %0 follows extern declaration">;
4767def err_non_thread_thread : Error<
4768  "non-thread-local declaration of %0 follows thread-local declaration">;
4769def err_thread_non_thread : Error<
4770  "thread-local declaration of %0 follows non-thread-local declaration">;
4771def err_thread_thread_different_kind : Error<
4772  "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
4773  "follows declaration with %select{dynamic|static}1 initialization">;
4774def err_mismatched_owning_module : Error<
4775  "declaration of %0 in %select{the global module|module %2}1 follows "
4776  "declaration in %select{the global module|module %4}3">;
4777def err_redefinition_different_type : Error<
4778  "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
4779def err_redefinition_different_kind : Error<
4780  "redefinition of %0 as different kind of symbol">;
4781def err_redefinition_different_namespace_alias : Error<
4782  "redefinition of %0 as an alias for a different namespace">;
4783def note_previous_namespace_alias : Note<
4784  "previously defined as an alias for %0">;
4785def warn_forward_class_redefinition : Warning<
4786  "redefinition of forward class %0 of a typedef name of an object type is ignored">,
4787  InGroup<DiagGroup<"objc-forward-class-redefinition">>;
4788def err_redefinition_different_typedef : Error<
4789  "%select{typedef|type alias|type alias template}0 "
4790  "redefinition with different types%diff{ ($ vs $)|}1,2">;
4791def err_tag_reference_non_tag : Error<
4792  "%select{non-struct type|non-class type|non-union type|non-enum "
4793  "type|typedef|type alias|template|type alias template|template "
4794  "template argument}1 %0 cannot be referenced with a "
4795  "%select{struct|interface|union|class|enum}2 specifier">;
4796def err_tag_reference_conflict : Error<
4797  "implicit declaration introduced by elaborated type conflicts with a "
4798  "%select{non-struct type|non-class type|non-union type|non-enum "
4799  "type|typedef|type alias|template|type alias template|template "
4800  "template argument}0 of the same name">;
4801def err_dependent_tag_decl : Error<
4802  "%select{declaration|definition}0 of "
4803  "%select{struct|interface|union|class|enum}1 in a dependent scope">;
4804def err_tag_definition_of_typedef : Error<
4805  "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
4806def err_conflicting_types : Error<"conflicting types for %0">;
4807def err_different_pass_object_size_params : Error<
4808  "conflicting pass_object_size attributes on parameters">;
4809def err_late_asm_label_name : Error<
4810  "cannot apply asm label to %select{variable|function}0 after its first use">;
4811def err_different_asm_label : Error<"conflicting asm label">;
4812def err_nested_redefinition : Error<"nested redefinition of %0">;
4813def err_use_with_wrong_tag : Error<
4814  "use of %0 with tag type that does not match previous declaration">;
4815def warn_struct_class_tag_mismatch : Warning<
4816  "%select{struct|interface|class}0%select{| template}1 %2 was previously "
4817  "declared as a %select{struct|interface|class}3%select{| template}1; "
4818  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
4819  InGroup<MismatchedTags>, DefaultIgnore;
4820def warn_struct_class_previous_tag_mismatch : Warning<
4821  "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
4822  "here but previously declared as "
4823  "%select{a struct|an interface|a class}3%select{| template}1; "
4824  "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
4825  InGroup<MismatchedTags>, DefaultIgnore;
4826def note_struct_class_suggestion : Note<
4827  "did you mean %select{struct|interface|class}0 here?">;
4828def ext_forward_ref_enum : Extension<
4829  "ISO C forbids forward references to 'enum' types">;
4830def err_forward_ref_enum : Error<
4831  "ISO C++ forbids forward references to 'enum' types">;
4832def ext_ms_forward_ref_enum : ExtWarn<
4833  "forward references to 'enum' types are a Microsoft extension">,
4834  InGroup<MicrosoftEnumForwardReference>;
4835def ext_forward_ref_enum_def : Extension<
4836  "redeclaration of already-defined enum %0 is a GNU extension">,
4837  InGroup<GNURedeclaredEnum>;
4838
4839def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
4840def err_duplicate_member : Error<"duplicate member %0">;
4841def err_misplaced_ivar : Error<
4842  "instance variables may not be placed in %select{categories|class extension}0">;
4843def warn_ivars_in_interface : Warning<
4844  "declaration of instance variables in the interface is deprecated">,
4845  InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
4846def ext_enum_value_not_int : Extension<
4847  "ISO C restricts enumerator values to range of 'int' (%0 is too "
4848  "%select{small|large}1)">;
4849def ext_enum_too_large : ExtWarn<
4850  "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
4851def ext_enumerator_increment_too_large : ExtWarn<
4852  "incremented enumerator value %0 is not representable in the "
4853  "largest integer type">, InGroup<EnumTooLarge>;
4854def warn_flag_enum_constant_out_of_range : Warning<
4855  "enumeration value %0 is out of range of flags in enumeration type %1">,
4856  InGroup<FlagEnum>;
4857
4858def warn_illegal_constant_array_size : Extension<
4859  "size of static array must be an integer constant expression">;
4860def err_vm_decl_in_file_scope : Error<
4861  "variably modified type declaration not allowed at file scope">;
4862def err_vm_decl_has_extern_linkage : Error<
4863  "variably modified type declaration cannot have 'extern' linkage">;
4864def err_typecheck_field_variable_size : Error<
4865  "fields must have a constant size: 'variable length array in structure' "
4866  "extension will never be supported">;
4867def err_vm_func_decl : Error<
4868  "function declaration cannot have variably modified type">;
4869def err_array_too_large : Error<
4870  "array is too large (%0 elements)">;
4871
4872def err_typecheck_negative_array_size : Error<"array size is negative">;
4873def warn_typecheck_function_qualifiers_ignored : Warning<
4874  "'%0' qualifier on function type %1 has no effect">,
4875  InGroup<IgnoredQualifiers>;
4876def warn_typecheck_function_qualifiers_unspecified : Warning<
4877  "'%0' qualifier on function type %1 has unspecified behavior">;
4878def warn_typecheck_reference_qualifiers : Warning<
4879  "'%0' qualifier on reference type %1 has no effect">,
4880  InGroup<IgnoredQualifiers>;
4881def err_typecheck_invalid_restrict_not_pointer : Error<
4882  "restrict requires a pointer or reference (%0 is invalid)">;
4883def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
4884  "restrict requires a pointer or reference">;
4885def err_typecheck_invalid_restrict_invalid_pointee : Error<
4886  "pointer to function type %0 may not be 'restrict' qualified">;
4887def ext_typecheck_zero_array_size : Extension<
4888  "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
4889def err_typecheck_zero_array_size : Error<
4890  "zero-length arrays are not permitted in C++">;
4891def warn_typecheck_zero_static_array_size : Warning<
4892  "'static' has no effect on zero-length arrays">,
4893  InGroup<ArrayBounds>;
4894def err_array_size_non_int : Error<"size of array has non-integer type %0">;
4895def err_init_element_not_constant : Error<
4896  "initializer element is not a compile-time constant">;
4897def ext_aggregate_init_not_constant : Extension<
4898  "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
4899def err_local_cant_init : Error<
4900  "'__local' variable cannot have an initializer">;
4901def err_block_extern_cant_init : Error<
4902  "'extern' variable cannot have an initializer">;
4903def warn_extern_init : Warning<"'extern' variable has an initializer">,
4904  InGroup<DiagGroup<"extern-initializer">>;
4905def err_variable_object_no_init : Error<
4906  "variable-sized object may not be initialized">;
4907def err_excess_initializers : Error<
4908  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
4909def ext_excess_initializers : ExtWarn<
4910  "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
4911def err_excess_initializers_in_char_array_initializer : Error<
4912  "excess elements in char array initializer">;
4913def ext_excess_initializers_in_char_array_initializer : ExtWarn<
4914  "excess elements in char array initializer">;
4915def err_initializer_string_for_char_array_too_long : Error<
4916  "initializer-string for char array is too long">;
4917def ext_initializer_string_for_char_array_too_long : ExtWarn<
4918  "initializer-string for char array is too long">;
4919def warn_missing_field_initializers : Warning<
4920  "missing field %0 initializer">,
4921  InGroup<MissingFieldInitializers>, DefaultIgnore;
4922def warn_braces_around_scalar_init : Warning<
4923  "braces around scalar initializer">, InGroup<DiagGroup<"braced-scalar-init">>;
4924def ext_many_braces_around_scalar_init : ExtWarn<
4925  "too many braces around scalar initializer">,
4926  InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
4927def ext_complex_component_init : Extension<
4928  "complex initialization specifying real and imaginary components "
4929  "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
4930def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
4931def warn_cxx98_compat_empty_scalar_initializer : Warning<
4932  "scalar initialized from empty initializer list is incompatible with C++98">,
4933  InGroup<CXX98Compat>, DefaultIgnore;
4934def warn_cxx98_compat_reference_list_init : Warning<
4935  "reference initialized from initializer list is incompatible with C++98">,
4936  InGroup<CXX98Compat>, DefaultIgnore;
4937def warn_cxx98_compat_initializer_list_init : Warning<
4938  "initialization of initializer_list object is incompatible with C++98">,
4939  InGroup<CXX98Compat>, DefaultIgnore;
4940def warn_cxx98_compat_ctor_list_init : Warning<
4941  "constructor call from initializer list is incompatible with C++98">,
4942  InGroup<CXX98Compat>, DefaultIgnore;
4943def err_illegal_initializer : Error<
4944  "illegal initializer (only variables can be initialized)">;
4945def err_illegal_initializer_type : Error<"illegal initializer type %0">;
4946def ext_init_list_type_narrowing : ExtWarn<
4947  "type %0 cannot be narrowed to %1 in initializer list">,
4948  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4949def ext_init_list_variable_narrowing : ExtWarn<
4950  "non-constant-expression cannot be narrowed from type %0 to %1 in "
4951  "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4952def ext_init_list_constant_narrowing : ExtWarn<
4953  "constant expression evaluates to %0 which cannot be narrowed to type %1">,
4954  InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
4955def warn_init_list_type_narrowing : Warning<
4956  "type %0 cannot be narrowed to %1 in initializer list in C++11">,
4957  InGroup<CXX11Narrowing>, DefaultIgnore;
4958def warn_init_list_variable_narrowing : Warning<
4959  "non-constant-expression cannot be narrowed from type %0 to %1 in "
4960  "initializer list in C++11">,
4961  InGroup<CXX11Narrowing>, DefaultIgnore;
4962def warn_init_list_constant_narrowing : Warning<
4963  "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
4964  "C++11">,
4965  InGroup<CXX11Narrowing>, DefaultIgnore;
4966def note_init_list_narrowing_silence : Note<
4967  "insert an explicit cast to silence this issue">;
4968def err_init_objc_class : Error<
4969  "cannot initialize Objective-C class type %0">;
4970def err_implicit_empty_initializer : Error<
4971  "initializer for aggregate with no elements requires explicit braces">;
4972def err_bitfield_has_negative_width : Error<
4973  "bit-field %0 has negative width (%1)">;
4974def err_anon_bitfield_has_negative_width : Error<
4975  "anonymous bit-field has negative width (%0)">;
4976def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
4977def err_bitfield_width_exceeds_type_width : Error<
4978  "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
4979  "of its type (%3 bit%s3)">;
4980def err_anon_bitfield_width_exceeds_type_width : Error<
4981  "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
4982  "of its type (%2 bit%s2)">;
4983def err_incorrect_number_of_vector_initializers : Error<
4984  "number of elements must be either one or match the size of the vector">;
4985
4986// Used by C++ which allows bit-fields that are wider than the type.
4987def warn_bitfield_width_exceeds_type_width: Warning<
4988  "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
4989  "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
4990def warn_anon_bitfield_width_exceeds_type_width : Warning<
4991  "width of anonymous bit-field (%0 bits) exceeds width of its type; value "
4992  "will be truncated to %1 bit%s1">, InGroup<BitFieldWidth>;
4993def warn_bitfield_too_small_for_enum : Warning<
4994  "bit-field %0 is not wide enough to store all enumerators of %1">,
4995  InGroup<BitFieldEnumConversion>, DefaultIgnore;
4996def note_widen_bitfield : Note<
4997  "widen this field to %0 bits to store all values of %1">;
4998def warn_unsigned_bitfield_assigned_signed_enum : Warning<
4999  "assigning value of signed enum type %1 to unsigned bit-field %0; "
5000  "negative enumerators of enum %1 will be converted to positive values">,
5001  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5002def warn_signed_bitfield_enum_conversion : Warning<
5003  "signed bit-field %0 needs an extra bit to represent the largest positive "
5004  "enumerators of %1">,
5005  InGroup<BitFieldEnumConversion>, DefaultIgnore;
5006def note_change_bitfield_sign : Note<
5007  "consider making the bitfield type %select{unsigned|signed}0">;
5008
5009def warn_missing_braces : Warning<
5010  "suggest braces around initialization of subobject">,
5011  InGroup<MissingBraces>, DefaultIgnore;
5012
5013def err_redefinition_of_label : Error<"redefinition of label %0">;
5014def err_undeclared_label_use : Error<"use of undeclared label %0">;
5015def err_goto_ms_asm_label : Error<
5016  "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5017def note_goto_ms_asm_label : Note<
5018  "inline assembly label %0 declared here">;
5019def warn_unused_label : Warning<"unused label %0">,
5020  InGroup<UnusedLabel>, DefaultIgnore;
5021
5022def err_goto_into_protected_scope : Error<
5023  "cannot jump from this goto statement to its label">;
5024def ext_goto_into_protected_scope : ExtWarn<
5025  "jump from this goto statement to its label is a Microsoft extension">,
5026  InGroup<MicrosoftGoto>;
5027def warn_cxx98_compat_goto_into_protected_scope : Warning<
5028  "jump from this goto statement to its label is incompatible with C++98">,
5029  InGroup<CXX98Compat>, DefaultIgnore;
5030def err_switch_into_protected_scope : Error<
5031  "cannot jump from switch statement to this case label">;
5032def warn_cxx98_compat_switch_into_protected_scope : Warning<
5033  "jump from switch statement to this case label is incompatible with C++98">,
5034  InGroup<CXX98Compat>, DefaultIgnore;
5035def err_indirect_goto_without_addrlabel : Error<
5036  "indirect goto in function with no address-of-label expressions">;
5037def err_indirect_goto_in_protected_scope : Error<
5038  "cannot jump from this indirect goto statement to one of its possible targets">;
5039def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5040  "jump from this indirect goto statement to one of its possible targets "
5041  "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5042def note_indirect_goto_target : Note<
5043  "possible target of indirect goto statement">;
5044def note_protected_by_variable_init : Note<
5045  "jump bypasses variable initialization">;
5046def note_protected_by_variable_nontriv_destructor : Note<
5047  "jump bypasses variable with a non-trivial destructor">;
5048def note_protected_by_variable_non_pod : Note<
5049  "jump bypasses initialization of non-POD variable">;
5050def note_protected_by_cleanup : Note<
5051  "jump bypasses initialization of variable with __attribute__((cleanup))">;
5052def note_protected_by_vla_typedef : Note<
5053  "jump bypasses initialization of VLA typedef">;
5054def note_protected_by_vla_type_alias : Note<
5055  "jump bypasses initialization of VLA type alias">;
5056def note_protected_by_constexpr_if : Note<
5057  "jump enters controlled statement of constexpr if">;
5058def note_protected_by_if_available : Note<
5059  "jump enters controlled statement of if available">;
5060def note_protected_by_vla : Note<
5061  "jump bypasses initialization of variable length array">;
5062def note_protected_by_objc_fast_enumeration : Note<
5063  "jump enters Objective-C fast enumeration loop">;
5064def note_protected_by_objc_try : Note<
5065  "jump bypasses initialization of @try block">;
5066def note_protected_by_objc_catch : Note<
5067  "jump bypasses initialization of @catch block">;
5068def note_protected_by_objc_finally : Note<
5069  "jump bypasses initialization of @finally block">;
5070def note_protected_by_objc_synchronized : Note<
5071  "jump bypasses initialization of @synchronized block">;
5072def note_protected_by_objc_autoreleasepool : Note<
5073  "jump bypasses auto release push of @autoreleasepool block">;
5074def note_protected_by_cxx_try : Note<
5075  "jump bypasses initialization of try block">;
5076def note_protected_by_cxx_catch : Note<
5077  "jump bypasses initialization of catch block">;
5078def note_protected_by_seh_try : Note<
5079  "jump bypasses initialization of __try block">;
5080def note_protected_by_seh_except : Note<
5081  "jump bypasses initialization of __except block">;
5082def note_protected_by_seh_finally : Note<
5083  "jump bypasses initialization of __finally block">;
5084def note_protected_by___block : Note<
5085  "jump bypasses setup of __block variable">;
5086def note_protected_by_objc_strong_init : Note<
5087  "jump bypasses initialization of __strong variable">;
5088def note_protected_by_objc_weak_init : Note<
5089  "jump bypasses initialization of __weak variable">;
5090def note_protected_by_non_trivial_c_struct_init : Note<
5091  "jump bypasses initialization of variable of non-trivial C struct type">;
5092def note_enters_block_captures_cxx_obj : Note<
5093  "jump enters lifetime of block which captures a destructible C++ object">;
5094def note_enters_block_captures_strong : Note<
5095  "jump enters lifetime of block which strongly captures a variable">;
5096def note_enters_block_captures_weak : Note<
5097  "jump enters lifetime of block which weakly captures a variable">;
5098def note_enters_block_captures_non_trivial_c_struct : Note<
5099  "jump enters lifetime of block which captures a C struct that is non-trivial "
5100  "to destroy">;
5101
5102def note_exits_cleanup : Note<
5103  "jump exits scope of variable with __attribute__((cleanup))">;
5104def note_exits_dtor : Note<
5105  "jump exits scope of variable with non-trivial destructor">;
5106def note_exits_temporary_dtor : Note<
5107  "jump exits scope of lifetime-extended temporary with non-trivial "
5108  "destructor">;
5109def note_exits___block : Note<
5110  "jump exits scope of __block variable">;
5111def note_exits_objc_try : Note<
5112  "jump exits @try block">;
5113def note_exits_objc_catch : Note<
5114  "jump exits @catch block">;
5115def note_exits_objc_finally : Note<
5116  "jump exits @finally block">;
5117def note_exits_objc_synchronized : Note<
5118  "jump exits @synchronized block">;
5119def note_exits_cxx_try : Note<
5120  "jump exits try block">;
5121def note_exits_cxx_catch : Note<
5122  "jump exits catch block">;
5123def note_exits_seh_try : Note<
5124  "jump exits __try block">;
5125def note_exits_seh_except : Note<
5126  "jump exits __except block">;
5127def note_exits_seh_finally : Note<
5128  "jump exits __finally block">;
5129def note_exits_objc_autoreleasepool : Note<
5130  "jump exits autoreleasepool block">;
5131def note_exits_objc_strong : Note<
5132  "jump exits scope of __strong variable">;
5133def note_exits_objc_weak : Note<
5134  "jump exits scope of __weak variable">;
5135def note_exits_block_captures_cxx_obj : Note<
5136  "jump exits lifetime of block which captures a destructible C++ object">;
5137def note_exits_block_captures_strong : Note<
5138  "jump exits lifetime of block which strongly captures a variable">;
5139def note_exits_block_captures_weak : Note<
5140  "jump exits lifetime of block which weakly captures a variable">;
5141def note_exits_block_captures_non_trivial_c_struct : Note<
5142  "jump exits lifetime of block which captures a C struct that is non-trivial "
5143  "to destroy">;
5144
5145def err_func_returning_qualified_void : ExtWarn<
5146  "function cannot return qualified void type %0">,
5147  InGroup<DiagGroup<"qualified-void-return-type">>;
5148def err_func_returning_array_function : Error<
5149  "function cannot return %select{array|function}0 type %1">;
5150def err_field_declared_as_function : Error<"field %0 declared as a function">;
5151def err_field_incomplete : Error<"field has incomplete type %0">;
5152def ext_variable_sized_type_in_struct : ExtWarn<
5153  "field %0 with variable sized type %1 not at the end of a struct or class is"
5154  " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5155
5156def ext_c99_flexible_array_member : Extension<
5157  "flexible array members are a C99 feature">, InGroup<C99>;
5158def err_flexible_array_virtual_base : Error<
5159  "flexible array member %0 not allowed in "
5160  "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5161def err_flexible_array_empty_aggregate : Error<
5162  "flexible array member %0 not allowed in otherwise empty "
5163  "%select{struct|interface|union|class|enum}1">;
5164def err_flexible_array_has_nontrivial_dtor : Error<
5165  "flexible array member %0 of type %1 with non-trivial destruction">;
5166def ext_flexible_array_in_struct : Extension<
5167  "%0 may not be nested in a struct due to flexible array member">,
5168  InGroup<FlexibleArrayExtensions>;
5169def ext_flexible_array_in_array : Extension<
5170  "%0 may not be used as an array element due to flexible array member">,
5171  InGroup<FlexibleArrayExtensions>;
5172def err_flexible_array_init : Error<
5173  "initialization of flexible array member is not allowed">;
5174def ext_flexible_array_empty_aggregate_ms : Extension<
5175  "flexible array member %0 in otherwise empty "
5176  "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
5177  InGroup<MicrosoftFlexibleArray>;
5178def err_flexible_array_union : Error<
5179  "flexible array member %0 in a union is not allowed">;
5180def ext_flexible_array_union_ms : Extension<
5181  "flexible array member %0 in a union is a Microsoft extension">,
5182  InGroup<MicrosoftFlexibleArray>;
5183def ext_flexible_array_empty_aggregate_gnu : Extension<
5184  "flexible array member %0 in otherwise empty "
5185  "%select{struct|interface|union|class|enum}1 is a GNU extension">,
5186  InGroup<GNUEmptyStruct>;
5187def ext_flexible_array_union_gnu : Extension<
5188  "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
5189
5190def err_flexible_array_not_at_end : Error<
5191  "flexible array member %0 with type %1 is not at the end of"
5192  " %select{struct|interface|union|class|enum}2">;
5193def err_objc_variable_sized_type_not_at_end : Error<
5194  "field %0 with variable sized type %1 is not at the end of class">;
5195def note_next_field_declaration : Note<
5196  "next field declaration is here">;
5197def note_next_ivar_declaration : Note<
5198  "next %select{instance variable declaration|synthesized instance variable}0"
5199  " is here">;
5200def err_synthesize_variable_sized_ivar : Error<
5201  "synthesized property with variable size type %0"
5202  " requires an existing instance variable">;
5203def err_flexible_array_arc_retainable : Error<
5204  "ARC forbids flexible array members with retainable object type">;
5205def warn_variable_sized_ivar_visibility : Warning<
5206  "field %0 with variable sized type %1 is not visible to subclasses and"
5207  " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
5208def warn_superclass_variable_sized_type_not_at_end : Warning<
5209  "field %0 can overwrite instance variable %1 with variable sized type %2"
5210  " in superclass %3">, InGroup<ObjCFlexibleArray>;
5211
5212let CategoryName = "ARC Semantic Issue" in {
5213
5214// ARC-mode diagnostics.
5215
5216let CategoryName = "ARC Weak References" in {
5217
5218def err_arc_weak_no_runtime : Error<
5219  "cannot create __weak reference because the current deployment target "
5220  "does not support weak references">;
5221def err_arc_weak_disabled : Error<
5222  "cannot create __weak reference in file using manual reference counting">;
5223def err_synthesizing_arc_weak_property_disabled : Error<
5224  "cannot synthesize weak property in file using manual reference counting">;
5225def err_synthesizing_arc_weak_property_no_runtime : Error<
5226  "cannot synthesize weak property because the current deployment target "
5227  "does not support weak references">;
5228def err_arc_unsupported_weak_class : Error<
5229  "class is incompatible with __weak references">;
5230def err_arc_weak_unavailable_assign : Error<
5231  "assignment of a weak-unavailable object to a __weak object">;
5232def err_arc_weak_unavailable_property : Error<
5233  "synthesizing __weak instance variable of type %0, which does not "
5234  "support weak references">;
5235def note_implemented_by_class : Note<
5236  "when implemented by class %0">;
5237def err_arc_convesion_of_weak_unavailable : Error<
5238  "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
5239  " a __weak object of type %2">;
5240
5241} // end "ARC Weak References" category
5242
5243let CategoryName = "ARC Restrictions" in {
5244
5245def err_unavailable_in_arc : Error<
5246  "%0 is unavailable in ARC">;
5247def note_arc_forbidden_type : Note<
5248  "declaration uses type that is ill-formed in ARC">;
5249def note_performs_forbidden_arc_conversion : Note<
5250  "inline function performs a conversion which is forbidden in ARC">;
5251def note_arc_init_returns_unrelated : Note<
5252  "init method must return a type related to its receiver type">;
5253def note_arc_weak_disabled : Note<
5254  "declaration uses __weak, but ARC is disabled">;
5255def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
5256  "the current deployment target does not support">;
5257def note_arc_field_with_ownership : Note<
5258  "field has non-trivial ownership qualification">;
5259
5260def err_arc_illegal_explicit_message : Error<
5261  "ARC forbids explicit message send of %0">;
5262def err_arc_unused_init_message : Error<
5263  "the result of a delegate init call must be immediately returned "
5264  "or assigned to 'self'">;
5265def err_arc_mismatched_cast : Error<
5266  "%select{implicit conversion|cast}0 of "
5267  "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
5268  "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
5269  " to %3 is disallowed with ARC">;
5270def err_arc_nolifetime_behavior : Error<
5271  "explicit ownership qualifier on cast result has no effect">;
5272def err_arc_objc_object_in_tag : Error<
5273  "ARC forbids %select{Objective-C objects|blocks}0 in "
5274  "%select{struct|interface|union|<<ERROR>>|enum}1">;
5275def err_arc_objc_property_default_assign_on_object : Error<
5276  "ARC forbids synthesizing a property of an Objective-C object "
5277  "with unspecified ownership or storage attribute">;
5278def err_arc_illegal_selector : Error<
5279  "ARC forbids use of %0 in a @selector">;
5280def err_arc_illegal_method_def : Error<
5281  "ARC forbids %select{implementation|synthesis}0 of %1">;
5282def warn_arc_strong_pointer_objc_pointer : Warning<
5283  "method parameter of type %0 with no explicit ownership">,
5284  InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
5285
5286} // end "ARC Restrictions" category
5287
5288def err_arc_lost_method_convention : Error<
5289  "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
5290  "method, but its implementation doesn't match because %select{"
5291  "its result type is not an object pointer|"
5292  "its result type is unrelated to its receiver type}1">;
5293def note_arc_lost_method_convention : Note<"declaration in interface">;
5294def err_arc_gained_method_convention : Error<
5295  "method implementation does not match its declaration">;
5296def note_arc_gained_method_convention : Note<
5297  "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
5298  "family because %select{its result type is not an object pointer|"
5299  "its result type is unrelated to its receiver type}1">;
5300def err_typecheck_arc_assign_self : Error<
5301  "cannot assign to 'self' outside of a method in the init family">;
5302def err_typecheck_arc_assign_self_class_method : Error<
5303  "cannot assign to 'self' in a class method">;
5304def err_typecheck_arr_assign_enumeration : Error<
5305  "fast enumeration variables cannot be modified in ARC by default; "
5306  "declare the variable __strong to allow this">;
5307def err_typecheck_arc_assign_externally_retained : Error<
5308  "variable declared with 'objc_externally_retained' "
5309  "cannot be modified in ARC">;
5310def warn_arc_retained_assign : Warning<
5311  "assigning retained object to %select{weak|unsafe_unretained}0 "
5312  "%select{property|variable}1"
5313  "; object will be released after assignment">,
5314  InGroup<ARCUnsafeRetainedAssign>;
5315def warn_arc_retained_property_assign : Warning<
5316  "assigning retained object to unsafe property"
5317  "; object will be released after assignment">,
5318  InGroup<ARCUnsafeRetainedAssign>;
5319def warn_arc_literal_assign : Warning<
5320  "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
5321  " to a weak %select{property|variable}1"
5322  "; object will be released after assignment">,
5323  InGroup<ARCUnsafeRetainedAssign>;
5324def err_arc_new_array_without_ownership : Error<
5325  "'new' cannot allocate an array of %0 with no explicit ownership">;
5326def err_arc_autoreleasing_var : Error<
5327  "%select{__block variables|global variables|fields|instance variables}0 cannot have "
5328  "__autoreleasing ownership">;
5329def err_arc_autoreleasing_capture : Error<
5330  "cannot capture __autoreleasing variable in a "
5331  "%select{block|lambda by copy}0">;
5332def err_arc_thread_ownership : Error<
5333  "thread-local variable has non-trivial ownership: type is %0">;
5334def err_arc_indirect_no_ownership : Error<
5335  "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
5336def err_arc_array_param_no_ownership : Error<
5337  "must explicitly describe intended ownership of an object array parameter">;
5338def err_arc_pseudo_dtor_inconstant_quals : Error<
5339  "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
5340  "type %1">;
5341def err_arc_init_method_unrelated_result_type : Error<
5342  "init methods must return a type related to the receiver type">;
5343def err_arc_nonlocal_writeback : Error<
5344  "passing address of %select{non-local|non-scalar}0 object to "
5345  "__autoreleasing parameter for write-back">;
5346def err_arc_method_not_found : Error<
5347  "no known %select{instance|class}1 method for selector %0">;
5348def err_arc_receiver_forward_class : Error<
5349  "receiver %0 for class message is a forward declaration">;
5350def err_arc_may_not_respond : Error<
5351  "no visible @interface for %0 declares the selector %1">;
5352def err_arc_receiver_forward_instance : Error<
5353  "receiver type %0 for instance message is a forward declaration">;
5354def warn_receiver_forward_instance : Warning<
5355  "receiver type %0 for instance message is a forward declaration">,
5356  InGroup<ForwardClassReceiver>, DefaultIgnore;
5357def err_arc_collection_forward : Error<
5358  "collection expression type %0 is a forward declaration">;
5359def err_arc_multiple_method_decl : Error<
5360  "multiple methods named %0 found with mismatched result, "
5361  "parameter type or attributes">;
5362def warn_arc_lifetime_result_type : Warning<
5363  "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
5364  "lifetime qualifier on return type is ignored">,
5365  InGroup<IgnoredQualifiers>;
5366
5367let CategoryName = "ARC Retain Cycle" in {
5368
5369def warn_arc_retain_cycle : Warning<
5370  "capturing %0 strongly in this block is likely to lead to a retain cycle">,
5371  InGroup<ARCRetainCycles>;
5372def note_arc_retain_cycle_owner : Note<
5373  "block will be retained by %select{the captured object|an object strongly "
5374  "retained by the captured object}0">;
5375
5376} // end "ARC Retain Cycle" category
5377
5378def warn_arc_object_memaccess : Warning<
5379  "%select{destination for|source of}0 this %1 call is a pointer to "
5380  "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
5381
5382let CategoryName = "ARC and @properties" in {
5383
5384def err_arc_strong_property_ownership : Error<
5385  "existing instance variable %1 for strong property %0 may not be "
5386  "%select{|__unsafe_unretained||__weak}2">;
5387def err_arc_assign_property_ownership : Error<
5388  "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
5389  "attribute must be __unsafe_unretained">;
5390def err_arc_inconsistent_property_ownership : Error<
5391  "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
5392  "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
5393
5394} // end "ARC and @properties" category
5395
5396def warn_block_capture_autoreleasing : Warning<
5397  "block captures an autoreleasing out-parameter, which may result in "
5398  "use-after-free bugs">,
5399  InGroup<BlockCaptureAutoReleasing>;
5400def note_declare_parameter_strong : Note<
5401  "declare the parameter __strong or capture a __block __strong variable to "
5402  "keep values alive across autorelease pools">;
5403
5404def err_arc_atomic_ownership : Error<
5405  "cannot perform atomic operation on a pointer to type %0: type has "
5406  "non-trivial ownership">;
5407
5408let CategoryName = "ARC Casting Rules" in {
5409
5410def err_arc_bridge_cast_incompatible : Error<
5411  "incompatible types casting %0 to %1 with a %select{__bridge|"
5412  "__bridge_transfer|__bridge_retained}2 cast">;
5413def err_arc_bridge_cast_wrong_kind : Error<
5414  "cast of %select{Objective-C|block|C}0 pointer type %1 to "
5415  "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
5416  "__bridge_transfer|__bridge_retained}4">;
5417def err_arc_cast_requires_bridge : Error<
5418  "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
5419  "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
5420  "requires a bridged cast">;
5421def note_arc_bridge : Note<
5422  "use __bridge to convert directly (no change in ownership)">;
5423def note_arc_cstyle_bridge : Note<
5424  "use __bridge with C-style cast to convert directly (no change in ownership)">;
5425def note_arc_bridge_transfer : Note<
5426  "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
5427  "ownership of a +1 %0 into ARC">;
5428def note_arc_cstyle_bridge_transfer : Note<
5429  "use __bridge_transfer with C-style cast to transfer "
5430  "ownership of a +1 %0 into ARC">;
5431def note_arc_bridge_retained : Note<
5432  "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
5433  "ARC object available as a +1 %0">;
5434def note_arc_cstyle_bridge_retained : Note<
5435  "use __bridge_retained with C-style cast to make an "
5436  "ARC object available as a +1 %0">;
5437
5438} // ARC Casting category
5439
5440} // ARC category name
5441
5442def err_flexible_array_init_needs_braces : Error<
5443  "flexible array requires brace-enclosed initializer">;
5444def err_illegal_decl_array_of_functions : Error<
5445  "'%0' declared as array of functions of type %1">;
5446def err_illegal_decl_array_incomplete_type : Error<
5447  "array has incomplete element type %0">;
5448def err_illegal_message_expr_incomplete_type : Error<
5449  "Objective-C message has incomplete result type %0">;
5450def err_illegal_decl_array_of_references : Error<
5451  "'%0' declared as array of references of type %1">;
5452def err_decl_negative_array_size : Error<
5453  "'%0' declared as an array with a negative size">;
5454def err_array_static_outside_prototype : Error<
5455  "%0 used in array declarator outside of function prototype">;
5456def err_array_static_not_outermost : Error<
5457  "%0 used in non-outermost array type derivation">;
5458def err_array_star_outside_prototype : Error<
5459  "star modifier used outside of function prototype">;
5460def err_illegal_decl_pointer_to_reference : Error<
5461  "'%0' declared as a pointer to a reference of type %1">;
5462def err_illegal_decl_mempointer_to_reference : Error<
5463  "'%0' declared as a member pointer to a reference of type %1">;
5464def err_illegal_decl_mempointer_to_void : Error<
5465  "'%0' declared as a member pointer to void">;
5466def err_illegal_decl_mempointer_in_nonclass : Error<
5467  "'%0' does not point into a class">;
5468def err_mempointer_in_nonclass_type : Error<
5469  "member pointer refers into non-class type %0">;
5470def err_reference_to_void : Error<"cannot form a reference to 'void'">;
5471def err_nonfunction_block_type : Error<
5472  "block pointer to non-function type is invalid">;
5473def err_return_block_has_expr : Error<"void block should not return a value">;
5474def err_block_return_missing_expr : Error<
5475  "non-void block should return a value">;
5476def err_func_def_incomplete_result : Error<
5477  "incomplete result type %0 in function definition">;
5478def err_atomic_specifier_bad_type : Error<
5479  "_Atomic cannot be applied to "
5480  "%select{incomplete |array |function |reference |atomic |qualified |}0type "
5481  "%1 %select{||||||which is not trivially copyable}0">;
5482
5483// Expressions.
5484def select_unary_expr_or_type_trait_kind : TextSubstitution<
5485  "%select{sizeof|alignof|vec_step|__builtin_omp_required_simd_align|"
5486  "__alignof}0">;
5487def ext_sizeof_alignof_function_type : Extension<
5488  "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5489  "to a function type">, InGroup<PointerArith>;
5490def ext_sizeof_alignof_void_type : Extension<
5491  "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5492  "to a void type">, InGroup<PointerArith>;
5493def err_opencl_sizeof_alignof_type : Error<
5494  "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5495  "to a void type">;
5496def err_sizeof_alignof_incomplete_type : Error<
5497  "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5498  "to an incomplete type %1">;
5499def err_sizeof_alignof_function_type : Error<
5500  "invalid application of '%sub{select_unary_expr_or_type_trait_kind}0' "
5501  "to a function type">;
5502def err_openmp_default_simd_align_expr : Error<
5503  "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
5504def err_sizeof_alignof_typeof_bitfield : Error<
5505  "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
5506def err_alignof_member_of_incomplete_type : Error<
5507  "invalid application of 'alignof' to a field of a class still being defined">;
5508def err_vecstep_non_scalar_vector_type : Error<
5509  "'vec_step' requires built-in scalar or vector type, %0 invalid">;
5510def err_offsetof_incomplete_type : Error<
5511  "offsetof of incomplete type %0">;
5512def err_offsetof_record_type : Error<
5513  "offsetof requires struct, union, or class type, %0 invalid">;
5514def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
5515def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
5516  InGroup<InvalidOffsetof>;
5517def ext_offsetof_non_standardlayout_type : ExtWarn<
5518  "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
5519def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
5520def err_offsetof_field_of_virtual_base : Error<
5521  "invalid application of 'offsetof' to a field of a virtual base">;
5522def warn_sub_ptr_zero_size_types : Warning<
5523  "subtraction of pointers to type %0 of zero size has undefined behavior">,
5524  InGroup<PointerArith>;
5525def warn_pointer_arith_null_ptr : Warning<
5526  "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
5527  InGroup<NullPointerArithmetic>, DefaultIgnore;
5528def warn_gnu_null_ptr_arith : Warning<
5529  "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
5530  InGroup<NullPointerArithmetic>, DefaultIgnore;
5531
5532def warn_floatingpoint_eq : Warning<
5533  "comparing floating point with == or != is unsafe">,
5534  InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
5535
5536def warn_remainder_division_by_zero : Warning<
5537  "%select{remainder|division}0 by zero is undefined">,
5538  InGroup<DivZero>;
5539def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
5540  InGroup<DiagGroup<"shift-negative-value">>;
5541def warn_shift_negative : Warning<"shift count is negative">,
5542  InGroup<DiagGroup<"shift-count-negative">>;
5543def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
5544  InGroup<DiagGroup<"shift-count-overflow">>;
5545def warn_shift_result_gt_typewidth : Warning<
5546  "signed shift result (%0) requires %1 bits to represent, but %2 only has "
5547  "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
5548def warn_shift_result_sets_sign_bit : Warning<
5549  "signed shift result (%0) sets the sign bit of the shift expression's "
5550  "type (%1) and becomes negative">,
5551  InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
5552
5553def warn_precedence_bitwise_rel : Warning<
5554  "%0 has lower precedence than %1; %1 will be evaluated first">,
5555  InGroup<Parentheses>;
5556def note_precedence_bitwise_first : Note<
5557  "place parentheses around the %0 expression to evaluate it first">;
5558def note_precedence_silence : Note<
5559  "place parentheses around the '%0' expression to silence this warning">;
5560
5561def warn_precedence_conditional : Warning<
5562  "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
5563  InGroup<Parentheses>;
5564def note_precedence_conditional_first : Note<
5565  "place parentheses around the '?:' expression to evaluate it first">;
5566
5567def warn_logical_instead_of_bitwise : Warning<
5568  "use of logical '%0' with constant operand">,
5569  InGroup<DiagGroup<"constant-logical-operand">>;
5570def note_logical_instead_of_bitwise_change_operator : Note<
5571  "use '%0' for a bitwise operation">;
5572def note_logical_instead_of_bitwise_remove_constant : Note<
5573  "remove constant to silence this warning">;
5574
5575def warn_bitwise_op_in_bitwise_op : Warning<
5576  "'%0' within '%1'">, InGroup<BitwiseOpParentheses>;
5577
5578def warn_logical_and_in_logical_or : Warning<
5579  "'&&' within '||'">, InGroup<LogicalOpParentheses>;
5580
5581def warn_overloaded_shift_in_comparison :Warning<
5582  "overloaded operator %select{>>|<<}0 has higher precedence than "
5583  "comparison operator">,
5584  InGroup<OverloadedShiftOpParentheses>;
5585def note_evaluate_comparison_first :Note<
5586  "place parentheses around comparison expression to evaluate it first">;
5587
5588def warn_addition_in_bitshift : Warning<
5589  "operator '%0' has lower precedence than '%1'; "
5590  "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
5591
5592def warn_self_assignment_builtin : Warning<
5593  "explicitly assigning value of variable of type %0 to itself">,
5594  InGroup<SelfAssignment>, DefaultIgnore;
5595def warn_self_assignment_overloaded : Warning<
5596  "explicitly assigning value of variable of type %0 to itself">,
5597  InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
5598def warn_self_move : Warning<
5599  "explicitly moving variable of type %0 to itself">,
5600  InGroup<SelfMove>, DefaultIgnore;
5601
5602def warn_redundant_move_on_return : Warning<
5603  "redundant move in return statement">,
5604  InGroup<RedundantMove>, DefaultIgnore;
5605def warn_pessimizing_move_on_return : Warning<
5606  "moving a local object in a return statement prevents copy elision">,
5607  InGroup<PessimizingMove>, DefaultIgnore;
5608def warn_pessimizing_move_on_initialization : Warning<
5609  "moving a temporary object prevents copy elision">,
5610  InGroup<PessimizingMove>, DefaultIgnore;
5611def note_remove_move : Note<"remove std::move call here">;
5612
5613def warn_return_std_move : Warning<
5614  "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
5615  InGroup<ReturnStdMove>, DefaultIgnore;
5616def note_add_std_move : Note<
5617  "call 'std::move' explicitly to avoid copying">;
5618def warn_return_std_move_in_cxx11 : Warning<
5619  "prior to the resolution of a defect report against ISO C++11, "
5620  "local variable %0 would have been copied despite being returned by name, "
5621  "due to its not matching the function return type%diff{ ($ vs $)|}1,2">,
5622  InGroup<ReturnStdMoveInCXX11>, DefaultIgnore;
5623def note_add_std_move_in_cxx11 : Note<
5624  "call 'std::move' explicitly to avoid copying on older compilers">;
5625
5626def warn_string_plus_int : Warning<
5627  "adding %0 to a string does not append to the string">,
5628  InGroup<StringPlusInt>;
5629def warn_string_plus_char : Warning<
5630  "adding %0 to a string pointer does not append to the string">,
5631  InGroup<StringPlusChar>;
5632def note_string_plus_scalar_silence : Note<
5633  "use array indexing to silence this warning">;
5634
5635def warn_sizeof_array_param : Warning<
5636  "sizeof on array function parameter will return size of %0 instead of %1">,
5637  InGroup<SizeofArrayArgument>;
5638
5639def warn_sizeof_array_decay : Warning<
5640  "sizeof on pointer operation will return size of %0 instead of %1">,
5641  InGroup<SizeofArrayDecay>;
5642
5643def err_sizeof_nonfragile_interface : Error<
5644  "application of '%select{alignof|sizeof}1' to interface %0 is "
5645  "not supported on this architecture and platform">;
5646def err_atdef_nonfragile_interface : Error<
5647  "use of @defs is not supported on this architecture and platform">;
5648def err_subscript_nonfragile_interface : Error<
5649  "subscript requires size of interface %0, which is not constant for "
5650  "this architecture and platform">;
5651
5652def err_arithmetic_nonfragile_interface : Error<
5653  "arithmetic on pointer to interface %0, which is not a constant size for "
5654  "this architecture and platform">;
5655
5656
5657def ext_subscript_non_lvalue : Extension<
5658  "ISO C90 does not allow subscripting non-lvalue array">;
5659def err_typecheck_subscript_value : Error<
5660  "subscripted value is not an array, pointer, or vector">;
5661def err_typecheck_subscript_not_integer : Error<
5662  "array subscript is not an integer">;
5663def err_subscript_function_type : Error<
5664  "subscript of pointer to function type %0">;
5665def err_subscript_incomplete_type : Error<
5666  "subscript of pointer to incomplete type %0">;
5667def err_dereference_incomplete_type : Error<
5668  "dereference of pointer to incomplete type %0">;
5669def ext_gnu_subscript_void_type : Extension<
5670  "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
5671def err_typecheck_member_reference_struct_union : Error<
5672  "member reference base type %0 is not a structure or union">;
5673def err_typecheck_member_reference_ivar : Error<
5674  "%0 does not have a member named %1">;
5675def err_arc_weak_ivar_access : Error<
5676  "dereferencing a __weak pointer is not allowed due to possible "
5677  "null value caused by race condition, assign it to strong variable first">;
5678def err_typecheck_member_reference_arrow : Error<
5679  "member reference type %0 is not a pointer">;
5680def err_typecheck_member_reference_suggestion : Error<
5681  "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
5682def note_typecheck_member_reference_suggestion : Note<
5683  "did you mean to use '.' instead?">;
5684def note_member_reference_arrow_from_operator_arrow : Note<
5685  "'->' applied to return value of the operator->() declared here">;
5686def err_typecheck_member_reference_type : Error<
5687  "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
5688def err_typecheck_member_reference_unknown : Error<
5689  "cannot refer to member %0 in %1 with '%select{.|->}2'">;
5690def err_member_reference_needs_call : Error<
5691  "base of member reference is a function; perhaps you meant to call "
5692  "it%select{| with no arguments}0?">;
5693def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
5694  InGroup<CharSubscript>, DefaultIgnore;
5695
5696def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
5697def err_no_member : Error<"no member named %0 in %1">;
5698def err_no_member_overloaded_arrow : Error<
5699  "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
5700
5701def err_member_not_yet_instantiated : Error<
5702  "no member %0 in %1; it has not yet been instantiated">;
5703def note_non_instantiated_member_here : Note<
5704  "not-yet-instantiated member is declared here">;
5705
5706def err_enumerator_does_not_exist : Error<
5707  "enumerator %0 does not exist in instantiation of %1">;
5708def note_enum_specialized_here : Note<
5709  "enum %0 was explicitly specialized here">;
5710
5711def err_specialization_not_primary_template : Error<
5712  "cannot reference member of primary template because deduced class "
5713  "template specialization %0 is %select{instantiated from a partial|"
5714  "an explicit}1 specialization">;
5715
5716def err_member_redeclared : Error<"class member cannot be redeclared">;
5717def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
5718  InGroup<RedeclaredClassMember>;
5719def err_member_redeclared_in_instantiation : Error<
5720  "multiple overloads of %0 instantiate to the same signature %1">;
5721def err_member_name_of_class : Error<"member %0 has the same name as its class">;
5722def err_member_def_undefined_record : Error<
5723  "out-of-line definition of %0 from class %1 without definition">;
5724def err_member_decl_does_not_match : Error<
5725  "out-of-line %select{declaration|definition}2 of %0 "
5726  "does not match any declaration in %1">;
5727def err_friend_decl_with_def_arg_must_be_def : Error<
5728  "friend declaration specifying a default argument must be a definition">;
5729def err_friend_decl_with_def_arg_redeclared : Error<
5730  "friend declaration specifying a default argument must be the only declaration">;
5731def err_friend_decl_does_not_match : Error<
5732  "friend declaration of %0 does not match any declaration in %1">;
5733def err_member_decl_does_not_match_suggest : Error<
5734  "out-of-line %select{declaration|definition}2 of %0 "
5735  "does not match any declaration in %1; did you mean %3?">;
5736def err_member_def_does_not_match_ret_type : Error<
5737  "return type of out-of-line definition of %q0 differs from "
5738  "that in the declaration">;
5739def err_nonstatic_member_out_of_line : Error<
5740  "non-static data member defined out-of-line">;
5741def err_qualified_typedef_declarator : Error<
5742  "typedef declarator cannot be qualified">;
5743def err_qualified_param_declarator : Error<
5744  "parameter declarator cannot be qualified">;
5745def ext_out_of_line_declaration : ExtWarn<
5746  "out-of-line declaration of a member must be a definition">,
5747  InGroup<OutOfLineDeclaration>, DefaultError;
5748def err_member_extra_qualification : Error<
5749  "extra qualification on member %0">;
5750def warn_member_extra_qualification : Warning<
5751  err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
5752def warn_namespace_member_extra_qualification : Warning<
5753  "extra qualification on member %0">,
5754  InGroup<DiagGroup<"extra-qualification">>;
5755def err_member_qualification : Error<
5756  "non-friend class member %0 cannot have a qualified name">;
5757def note_member_def_close_match : Note<"member declaration nearly matches">;
5758def note_member_def_close_const_match : Note<
5759  "member declaration does not match because "
5760  "it %select{is|is not}0 const qualified">;
5761def note_member_def_close_param_match : Note<
5762  "type of %ordinal0 parameter of member declaration does not match definition"
5763  "%diff{ ($ vs $)|}1,2">;
5764def note_local_decl_close_match : Note<"local declaration nearly matches">;
5765def note_local_decl_close_param_match : Note<
5766  "type of %ordinal0 parameter of local declaration does not match definition"
5767  "%diff{ ($ vs $)|}1,2">;
5768def err_typecheck_ivar_variable_size : Error<
5769  "instance variables must have a constant size">;
5770def err_ivar_reference_type : Error<
5771  "instance variables cannot be of reference type">;
5772def err_typecheck_illegal_increment_decrement : Error<
5773  "cannot %select{decrement|increment}1 value of type %0">;
5774def err_typecheck_expect_int : Error<
5775  "used type %0 where integer is required">;
5776def err_typecheck_arithmetic_incomplete_type : Error<
5777  "arithmetic on a pointer to an incomplete type %0">;
5778def err_typecheck_pointer_arith_function_type : Error<
5779  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
5780  "function type%select{|s}2 %1%select{| and %3}2">;
5781def err_typecheck_pointer_arith_void_type : Error<
5782  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
5783def err_typecheck_decl_incomplete_type : Error<
5784  "variable has incomplete type %0">;
5785def ext_typecheck_decl_incomplete_type : ExtWarn<
5786  "tentative definition of variable with internal linkage has incomplete non-array type %0">,
5787  InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
5788def err_tentative_def_incomplete_type : Error<
5789  "tentative definition has type %0 that is never completed">;
5790def warn_tentative_incomplete_array : Warning<
5791  "tentative array definition assumed to have one element">;
5792def err_typecheck_incomplete_array_needs_initializer : Error<
5793  "definition of variable with array type needs an explicit size "
5794  "or an initializer">;
5795def err_array_init_not_init_list : Error<
5796  "array initializer must be an initializer "
5797  "list%select{| or string literal| or wide string literal}0">;
5798def err_array_init_narrow_string_into_wchar : Error<
5799  "initializing wide char array with non-wide string literal">;
5800def err_array_init_wide_string_into_char : Error<
5801  "initializing char array with wide string literal">;
5802def err_array_init_incompat_wide_string_into_wchar : Error<
5803  "initializing wide char array with incompatible wide string literal">;
5804def err_array_init_plain_string_into_char8_t : Error<
5805  "initializing 'char8_t' array with plain string literal">;
5806def note_array_init_plain_string_into_char8_t : Note<
5807  "add 'u8' prefix to form a 'char8_t' string literal">;
5808def err_array_init_utf8_string_into_char : Error<
5809  "%select{|ISO C++20 does not permit }0initialization of char array with "
5810  "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
5811def warn_cxx2a_compat_utf8_string : Warning<
5812  "type of UTF-8 string literal will change from array of const char to "
5813  "array of const char8_t in C++2a">, InGroup<CXX2aCompat>, DefaultIgnore;
5814def note_cxx2a_compat_utf8_string_remove_u8 : Note<
5815  "remove 'u8' prefix to avoid a change of behavior; "
5816  "Clang encodes unprefixed narrow string literals as UTF-8">;
5817def err_array_init_different_type : Error<
5818  "cannot initialize array %diff{of type $ with array of type $|"
5819  "with different type of array}0,1">;
5820def err_array_init_non_constant_array : Error<
5821  "cannot initialize array %diff{of type $ with non-constant array of type $|"
5822  "with different type of array}0,1">;
5823def ext_array_init_copy : Extension<
5824  "initialization of an array "
5825  "%diff{of type $ from a compound literal of type $|"
5826  "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
5827// This is intentionally not disabled by -Wno-gnu.
5828def ext_array_init_parens : ExtWarn<
5829  "parenthesized initialization of a member array is a GNU extension">,
5830  InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
5831def warn_deprecated_string_literal_conversion : Warning<
5832  "conversion from string literal to %0 is deprecated">,
5833  InGroup<CXX11CompatDeprecatedWritableStr>;
5834def ext_deprecated_string_literal_conversion : ExtWarn<
5835  "ISO C++11 does not allow conversion from string literal to %0">,
5836  InGroup<WritableStrings>, SFINAEFailure;
5837def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
5838def err_typecheck_sclass_fscope : Error<
5839  "illegal storage class on file-scoped variable">;
5840def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
5841  InGroup<MissingDeclarations>;
5842def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
5843  "of a type">, InGroup<MissingDeclarations>;
5844def err_standalone_class_nested_name_specifier : Error<
5845  "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
5846  "have a nested name specifier">;
5847def err_typecheck_sclass_func : Error<"illegal storage class on function">;
5848def err_static_block_func : Error<
5849  "function declared in block scope cannot have 'static' storage class">;
5850def err_typecheck_address_of : Error<"address of %select{bit-field"
5851  "|vector element|property expression|register variable}0 requested">;
5852def ext_typecheck_addrof_void : Extension<
5853  "ISO C forbids taking the address of an expression of type 'void'">;
5854def err_unqualified_pointer_member_function : Error<
5855  "must explicitly qualify name of member function when taking its address">;
5856def err_invalid_form_pointer_member_function : Error<
5857  "cannot create a non-constant pointer to member function">;
5858def err_address_of_function_with_pass_object_size_params: Error<
5859  "cannot take address of function %0 because parameter %1 has "
5860  "pass_object_size attribute">;
5861def err_parens_pointer_member_function : Error<
5862  "cannot parenthesize the name of a method when forming a member pointer">;
5863def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
5864  "extra '&' taking address of overloaded function">;
5865def err_typecheck_invalid_lvalue_addrof : Error<
5866  "cannot take the address of an rvalue of type %0">;
5867def ext_typecheck_addrof_temporary : ExtWarn<
5868  "taking the address of a temporary object of type %0">,
5869  InGroup<AddressOfTemporary>, DefaultError;
5870def err_typecheck_addrof_temporary : Error<
5871  "taking the address of a temporary object of type %0">;
5872def err_typecheck_addrof_dtor : Error<
5873  "taking the address of a destructor">;
5874def err_typecheck_unary_expr : Error<
5875  "invalid argument type %0 to unary expression">;
5876def err_typecheck_indirection_requires_pointer : Error<
5877  "indirection requires pointer operand (%0 invalid)">;
5878def ext_typecheck_indirection_through_void_pointer : ExtWarn<
5879  "ISO C++ does not allow indirection on operand of type %0">,
5880  InGroup<DiagGroup<"void-ptr-dereference">>;
5881def warn_indirection_through_null : Warning<
5882  "indirection of non-volatile null pointer will be deleted, not trap">,
5883  InGroup<NullDereference>;
5884def warn_binding_null_to_reference : Warning<
5885  "binding dereferenced null pointer to reference has undefined behavior">,
5886  InGroup<NullDereference>;
5887def note_indirection_through_null : Note<
5888  "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
5889def warn_pointer_indirection_from_incompatible_type : Warning<
5890  "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
5891  "behavior">,
5892  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
5893def warn_taking_address_of_packed_member : Warning<
5894  "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
5895  InGroup<DiagGroup<"address-of-packed-member">>;
5896
5897def err_objc_object_assignment : Error<
5898  "cannot assign to class object (%0 invalid)">;
5899def err_typecheck_invalid_operands : Error<
5900  "invalid operands to binary expression (%0 and %1)">;
5901def note_typecheck_invalid_operands_converted : Note<
5902  "%select{first|second}0 operand was implicitly converted to type %1">;
5903def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
5904  "logical expression with vector %select{type %1 and non-vector type %2|types"
5905  " %1 and %2}0 is only supported in C++">;
5906def err_typecheck_sub_ptr_compatible : Error<
5907  "%diff{$ and $ are not pointers to compatible types|"
5908  "pointers to incompatible types}0,1">;
5909def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
5910  "ordered comparison between pointer and integer (%0 and %1)">;
5911def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
5912  "ordered comparison between pointer and zero (%0 and %1) is an extension">;
5913def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
5914  "ordered comparison between pointer and zero (%0 and %1)">;
5915def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
5916  "ordered comparison of function pointers (%0 and %1)">,
5917  InGroup<DiagGroup<"ordered-compare-function-pointers">>;
5918def ext_typecheck_comparison_of_fptr_to_void : Extension<
5919  "equality comparison between function pointer and void pointer (%0 and %1)">;
5920def err_typecheck_comparison_of_fptr_to_void : Error<
5921  "equality comparison between function pointer and void pointer (%0 and %1)">;
5922def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
5923  "comparison between pointer and integer (%0 and %1)">,
5924  InGroup<DiagGroup<"pointer-integer-compare">>;
5925def err_typecheck_comparison_of_pointer_integer : Error<
5926  "comparison between pointer and integer (%0 and %1)">;
5927def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
5928  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
5929  InGroup<CompareDistinctPointerType>;
5930def ext_typecheck_cond_incompatible_operands : ExtWarn<
5931  "incompatible operand types (%0 and %1)">;
5932def err_cond_voidptr_arc : Error <
5933  "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
5934  "in ARC mode">;
5935def err_typecheck_comparison_of_distinct_pointers : Error<
5936  "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
5937def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
5938  "%select{comparison between %diff{ ($ and $)|}0,1"
5939  "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
5940  "|conditional operator with the second and third operands of type "
5941  "%diff{ ($ and $)|}0,1}2"
5942  " which are pointers to non-overlapping address spaces">;
5943
5944def err_typecheck_assign_const : Error<
5945  "%select{"
5946  "cannot assign to return value because function %1 returns a const value|"
5947  "cannot assign to variable %1 with const-qualified type %2|"
5948  "cannot assign to %select{non-|}1static data member %2 "
5949  "with const-qualified type %3|"
5950  "cannot assign to non-static data member within const member function %1|"
5951  "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
5952  "with %select{|nested }3const-qualified data member %4|"
5953  "read-only variable is not assignable}0">;
5954
5955def note_typecheck_assign_const : Note<
5956  "%select{"
5957  "function %1 which returns const-qualified type %2 declared here|"
5958  "variable %1 declared const here|"
5959  "%select{non-|}1static data member %2 declared const here|"
5960  "member function %q1 is declared const here|"
5961  "%select{|nested }1data member %2 declared const here}0">;
5962
5963def warn_unsigned_always_true_comparison : Warning<
5964  "result of comparison of %select{%3|unsigned expression}0 %2 "
5965  "%select{unsigned expression|%3}0 is always %4">,
5966  InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
5967def warn_unsigned_enum_always_true_comparison : Warning<
5968  "result of comparison of %select{%3|unsigned enum expression}0 %2 "
5969  "%select{unsigned enum expression|%3}0 is always %4">,
5970  InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
5971def warn_tautological_constant_compare : Warning<
5972  "result of comparison %select{%3|%1}0 %2 "
5973  "%select{%1|%3}0 is always %4">,
5974  InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
5975
5976def warn_mixed_sign_comparison : Warning<
5977  "comparison of integers of different signs: %0 and %1">,
5978  InGroup<SignCompare>, DefaultIgnore;
5979def warn_out_of_range_compare : Warning<
5980  "result of comparison of %select{constant %0|true|false}1 with "
5981  "%select{expression of type %2|boolean expression}3 is always %4">,
5982  InGroup<TautologicalOutOfRangeCompare>;
5983def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
5984  InGroup<TautologicalConstantCompare>;
5985def warn_comparison_of_mixed_enum_types : Warning<
5986  "comparison of two values with different enumeration types"
5987  "%diff{ ($ and $)|}0,1">,
5988  InGroup<EnumCompare>;
5989def warn_comparison_of_mixed_enum_types_switch : Warning<
5990  "comparison of two values with different enumeration types in switch statement"
5991  "%diff{ ($ and $)|}0,1">,
5992  InGroup<EnumCompareSwitch>;
5993def warn_null_in_arithmetic_operation : Warning<
5994  "use of NULL in arithmetic operation">,
5995  InGroup<NullArithmetic>;
5996def warn_null_in_comparison_operation : Warning<
5997  "comparison between NULL and non-pointer "
5998  "%select{(%1 and NULL)|(NULL and %1)}0">,
5999  InGroup<NullArithmetic>;
6000def err_shift_rhs_only_vector : Error<
6001  "requested shift is a vector of type %0 but the first operand is not a "
6002  "vector (%1)">;
6003
6004def warn_logical_not_on_lhs_of_check : Warning<
6005  "logical not is only applied to the left hand side of this "
6006  "%select{comparison|bitwise operator}0">,
6007  InGroup<LogicalNotParentheses>;
6008def note_logical_not_fix : Note<
6009  "add parentheses after the '!' to evaluate the "
6010  "%select{comparison|bitwise operator}0 first">;
6011def note_logical_not_silence_with_parens : Note<
6012  "add parentheses around left hand side expression to silence this warning">;
6013
6014def err_invalid_this_use : Error<
6015  "invalid use of 'this' outside of a non-static member function">;
6016def err_this_static_member_func : Error<
6017  "'this' cannot be%select{| implicitly}0 used in a static member function "
6018  "declaration">;
6019def err_invalid_member_use_in_static_method : Error<
6020  "invalid use of member %0 in static member function">;
6021def err_invalid_qualified_function_type : Error<
6022  "%select{non-member function|static member function|deduction guide}0 "
6023  "%select{of type %2 |}1cannot have '%3' qualifier">;
6024def err_compound_qualified_function_type : Error<
6025  "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6026  "cannot have '%3' qualifier">;
6027
6028def err_ref_qualifier_overload : Error<
6029  "cannot overload a member function %select{without a ref-qualifier|with "
6030  "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6031  "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6032
6033def err_invalid_non_static_member_use : Error<
6034  "invalid use of non-static data member %0">;
6035def err_nested_non_static_member_use : Error<
6036  "%select{call to non-static member function|use of non-static data member}0 "
6037  "%2 of %1 from nested type %3">;
6038def warn_cxx98_compat_non_static_member_use : Warning<
6039  "use of non-static data member %0 in an unevaluated context is "
6040  "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6041def err_invalid_incomplete_type_use : Error<
6042  "invalid use of incomplete type %0">;
6043def err_builtin_func_cast_more_than_one_arg : Error<
6044  "function-style cast to a builtin type can only take one argument">;
6045def err_value_init_for_array_type : Error<
6046  "array types cannot be value-initialized">;
6047def err_init_for_function_type : Error<
6048  "cannot create object of function type %0">;
6049def warn_format_nonliteral_noargs : Warning<
6050  "format string is not a string literal (potentially insecure)">,
6051  InGroup<FormatSecurity>;
6052def warn_format_nonliteral : Warning<
6053  "format string is not a string literal">,
6054  InGroup<FormatNonLiteral>, DefaultIgnore;
6055
6056def err_unexpected_interface : Error<
6057  "unexpected interface name %0: expected expression">;
6058def err_ref_non_value : Error<"%0 does not refer to a value">;
6059def err_ref_vm_type : Error<
6060  "cannot refer to declaration with a variably modified type inside block">;
6061def err_ref_flexarray_type : Error<
6062  "cannot refer to declaration of structure variable with flexible array member "
6063  "inside block">;
6064def err_ref_array_type : Error<
6065  "cannot refer to declaration with an array type inside block">;
6066def err_property_not_found : Error<
6067  "property %0 not found on object of type %1">;
6068def err_invalid_property_name : Error<
6069  "%0 is not a valid property name (accessing an object of type %1)">;
6070def err_getter_not_found : Error<
6071  "no getter method for read from property">;
6072def err_objc_subscript_method_not_found : Error<
6073  "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6074  "found on object of type %0">;
6075def err_objc_subscript_index_type : Error<
6076  "method index parameter type %0 is not integral type">;
6077def err_objc_subscript_key_type : Error<
6078  "method key parameter type %0 is not object type">;
6079def err_objc_subscript_dic_object_type : Error<
6080  "method object parameter type %0 is not object type">;
6081def err_objc_subscript_object_type : Error<
6082  "cannot assign to this %select{dictionary|array}1 because assigning method's "
6083  "2nd parameter of type %0 is not an Objective-C pointer type">;
6084def err_objc_subscript_base_type : Error<
6085  "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6086def err_objc_multiple_subscript_type_conversion : Error<
6087  "indexing expression is invalid because subscript type %0 has "
6088  "multiple type conversion functions">;
6089def err_objc_subscript_type_conversion : Error<
6090  "indexing expression is invalid because subscript type %0 is not an integral"
6091  " or Objective-C pointer type">;
6092def err_objc_subscript_pointer : Error<
6093  "indexing expression is invalid because subscript type %0 is not an"
6094  " Objective-C pointer">;
6095def err_objc_indexing_method_result_type : Error<
6096  "method for accessing %select{dictionary|array}1 element must have Objective-C"
6097  " object return type instead of %0">;
6098def err_objc_index_incomplete_class_type : Error<
6099  "Objective-C index expression has incomplete class type %0">;
6100def err_illegal_container_subscripting_op : Error<
6101  "illegal operation on Objective-C container subscripting">;
6102def err_property_not_found_forward_class : Error<
6103  "property %0 cannot be found in forward class object %1">;
6104def err_property_not_as_forward_class : Error<
6105  "property %0 refers to an incomplete Objective-C class %1 "
6106  "(with no @interface available)">;
6107def note_forward_class : Note<
6108  "forward declaration of class here">;
6109def err_duplicate_property : Error<
6110  "property has a previous declaration">;
6111def ext_gnu_void_ptr : Extension<
6112  "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
6113  InGroup<PointerArith>;
6114def ext_gnu_ptr_func_arith : Extension<
6115  "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
6116  "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
6117  InGroup<PointerArith>;
6118def err_readonly_message_assignment : Error<
6119  "assigning to 'readonly' return result of an Objective-C message not allowed">;
6120def ext_integer_increment_complex : Extension<
6121  "ISO C does not support '++'/'--' on complex integer type %0">;
6122def ext_integer_complement_complex : Extension<
6123  "ISO C does not support '~' for complex conjugation of %0">;
6124def err_nosetter_property_assignment : Error<
6125  "%select{assignment to readonly property|"
6126  "no setter method %1 for assignment to property}0">;
6127def err_nosetter_property_incdec : Error<
6128  "%select{%select{increment|decrement}1 of readonly property|"
6129  "no setter method %2 for %select{increment|decrement}1 of property}0">;
6130def err_nogetter_property_compound_assignment : Error<
6131  "a getter method is needed to perform a compound assignment on a property">;
6132def err_nogetter_property_incdec : Error<
6133  "no getter method %1 for %select{increment|decrement}0 of property">;
6134def err_no_subobject_property_setting : Error<
6135  "expression is not assignable">;
6136def err_qualified_objc_access : Error<
6137  "%select{property|instance variable}0 access cannot be qualified with '%1'">;
6138
6139def ext_freestanding_complex : Extension<
6140  "complex numbers are an extension in a freestanding C99 implementation">;
6141
6142// FIXME: Remove when we support imaginary.
6143def err_imaginary_not_supported : Error<"imaginary types are not supported">;
6144
6145// Obj-c expressions
6146def warn_root_inst_method_not_found : Warning<
6147  "instance method %0 is being used on 'Class' which is not in the root class">,
6148  InGroup<MethodAccess>;
6149def warn_class_method_not_found : Warning<
6150  "class method %objcclass0 not found (return type defaults to 'id')">,
6151  InGroup<MethodAccess>;
6152def warn_instance_method_on_class_found : Warning<
6153  "instance method %0 found instead of class method %1">,
6154  InGroup<MethodAccess>;
6155def warn_inst_method_not_found : Warning<
6156  "instance method %objcinstance0 not found (return type defaults to 'id')">,
6157  InGroup<MethodAccess>;
6158def warn_instance_method_not_found_with_typo : Warning<
6159  "instance method %objcinstance0 not found (return type defaults to 'id')"
6160  "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
6161def warn_class_method_not_found_with_typo : Warning<
6162  "class method %objcclass0 not found (return type defaults to 'id')"
6163  "; did you mean %objcclass2?">, InGroup<MethodAccess>;
6164def err_method_not_found_with_typo : Error<
6165  "%select{instance|class}1 method %0 not found "
6166  "; did you mean %2?">;
6167def err_no_super_class_message : Error<
6168  "no @interface declaration found in class messaging of %0">;
6169def err_root_class_cannot_use_super : Error<
6170  "%0 cannot use 'super' because it is a root class">;
6171def err_invalid_receiver_to_message_super : Error<
6172  "'super' is only valid in a method body">;
6173def err_invalid_receiver_class_message : Error<
6174  "receiver type %0 is not an Objective-C class">;
6175def err_missing_open_square_message_send : Error<
6176  "missing '[' at start of message send expression">;
6177def warn_bad_receiver_type : Warning<
6178  "receiver type %0 is not 'id' or interface pointer, consider "
6179  "casting it to 'id'">,InGroup<ObjCReceiver>;
6180def err_bad_receiver_type : Error<"bad receiver type %0">;
6181def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
6182def err_unknown_receiver_suggest : Error<
6183  "unknown receiver %0; did you mean %1?">;
6184def err_objc_throw_expects_object : Error<
6185  "@throw requires an Objective-C object type (%0 invalid)">;
6186def err_objc_synchronized_expects_object : Error<
6187  "@synchronized requires an Objective-C object type (%0 invalid)">;
6188def err_rethrow_used_outside_catch : Error<
6189  "@throw (rethrow) used outside of a @catch block">;
6190def err_attribute_multiple_objc_gc : Error<
6191  "multiple garbage collection attributes specified for type">;
6192def err_catch_param_not_objc_type : Error<
6193  "@catch parameter is not a pointer to an interface type">;
6194def err_illegal_qualifiers_on_catch_parm : Error<
6195  "illegal qualifiers on @catch parameter">;
6196def err_storage_spec_on_catch_parm : Error<
6197  "@catch parameter cannot have storage specifier '%0'">;
6198def warn_register_objc_catch_parm : Warning<
6199  "'register' storage specifier on @catch parameter will be ignored">;
6200def err_qualified_objc_catch_parm : Error<
6201  "@catch parameter declarator cannot be qualified">;
6202def warn_objc_pointer_cxx_catch_fragile : Warning<
6203  "cannot catch an exception thrown with @throw in C++ in the non-unified "
6204  "exception model">, InGroup<ObjCNonUnifiedException>;
6205def err_objc_object_catch : Error<
6206  "cannot catch an Objective-C object by value">;
6207def err_incomplete_type_objc_at_encode : Error<
6208  "'@encode' of incomplete type %0">;
6209def warn_objc_circular_container : Warning<
6210  "adding %0 to %1 might cause circular dependency in container">,
6211  InGroup<DiagGroup<"objc-circular-container">>;
6212def note_objc_circular_container_declared_here : Note<"%0 declared here">;
6213def warn_objc_unsafe_perform_selector : Warning<
6214  "%0 is incompatible with selectors that return a "
6215  "%select{struct|union|vector}1 type">,
6216  InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
6217def note_objc_unsafe_perform_selector_method_declared_here :  Note<
6218  "method %0 that returns %1 declared here">;
6219
6220def warn_setter_getter_impl_required : Warning<
6221  "property %0 requires method %1 to be defined - "
6222  "use @synthesize, @dynamic or provide a method implementation "
6223  "in this class implementation">,
6224  InGroup<ObjCPropertyImpl>;
6225def warn_setter_getter_impl_required_in_category : Warning<
6226  "property %0 requires method %1 to be defined - "
6227  "use @dynamic or provide a method implementation in this category">,
6228  InGroup<ObjCPropertyImpl>;
6229def note_parameter_named_here : Note<
6230  "passing argument to parameter %0 here">;
6231def note_parameter_here : Note<
6232  "passing argument to parameter here">;
6233def note_method_return_type_change : Note<
6234  "compiler has implicitly changed method %0 return type">;
6235
6236def warn_impl_required_for_class_property : Warning<
6237  "class property %0 requires method %1 to be defined - "
6238  "use @dynamic or provide a method implementation "
6239  "in this class implementation">,
6240  InGroup<ObjCPropertyImpl>;
6241def warn_impl_required_in_category_for_class_property : Warning<
6242  "class property %0 requires method %1 to be defined - "
6243  "use @dynamic or provide a method implementation in this category">,
6244  InGroup<ObjCPropertyImpl>;
6245
6246// C++ casts
6247// These messages adhere to the TryCast pattern: %0 is an int specifying the
6248// cast type, %1 is the source type, %2 is the destination type.
6249def err_bad_reinterpret_cast_overload : Error<
6250  "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
6251
6252def warn_reinterpret_different_from_static : Warning<
6253  "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
6254  "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
6255  "'static_cast'">, InGroup<ReinterpretBaseClass>;
6256def note_reinterpret_updowncast_use_static: Note<
6257  "use 'static_cast' to adjust the pointer correctly while "
6258  "%select{upcasting|downcasting}0">;
6259
6260def err_bad_static_cast_overload : Error<
6261  "address of overloaded function %0 cannot be static_cast to type %1">;
6262
6263def err_bad_cstyle_cast_overload : Error<
6264  "address of overloaded function %0 cannot be cast to type %1">;
6265
6266
6267def err_bad_cxx_cast_generic : Error<
6268  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6269  "functional-style cast}0 from %1 to %2 is not allowed">;
6270def err_bad_cxx_cast_unrelated_class : Error<
6271  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6272  "functional-style cast}0 from %1 to %2, which are not related by "
6273  "inheritance, is not allowed">;
6274def note_type_incomplete : Note<"%0 is incomplete">;
6275def err_bad_cxx_cast_rvalue : Error<
6276  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6277  "functional-style cast}0 from rvalue to reference type %2">;
6278def err_bad_cxx_cast_bitfield : Error<
6279  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6280  "functional-style cast}0 from bit-field lvalue to reference type %2">;
6281def err_bad_cxx_cast_qualifiers_away : Error<
6282  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6283  "functional-style cast}0 from %1 to %2 casts away qualifiers">;
6284def err_bad_cxx_cast_addr_space_mismatch : Error<
6285  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6286  "functional-style cast}0 from %1 to %2 converts between mismatching address"
6287  " spaces">;
6288def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
6289  "ISO C++ does not allow "
6290  "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
6291  "functional-style cast}0 from %1 to %2 because it casts away qualifiers, "
6292  "even though the source and destination types are unrelated">,
6293  SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
6294def err_bad_const_cast_dest : Error<
6295  "%select{const_cast||||C-style cast|functional-style cast}0 to %2, "
6296  "which is not a reference, pointer-to-object, or pointer-to-data-member">;
6297def ext_cast_fn_obj : Extension<
6298  "cast between pointer-to-function and pointer-to-object is an extension">;
6299def ext_ms_cast_fn_obj : ExtWarn<
6300  "static_cast between pointer-to-function and pointer-to-object is a "
6301  "Microsoft extension">, InGroup<MicrosoftCast>;
6302def warn_cxx98_compat_cast_fn_obj : Warning<
6303  "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
6304  InGroup<CXX98CompatPedantic>, DefaultIgnore;
6305def err_bad_reinterpret_cast_small_int : Error<
6306  "cast from pointer to smaller type %2 loses information">;
6307def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
6308  "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6309  "to scalar %2 of different size">;
6310def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
6311  "%select{||reinterpret_cast||C-style cast|}0 from scalar %1 "
6312  "to vector %2 of different size">;
6313def err_bad_cxx_cast_vector_to_vector_different_size : Error<
6314  "%select{||reinterpret_cast||C-style cast|}0 from vector %1 "
6315  "to vector %2 of different size">;
6316def err_bad_lvalue_to_rvalue_cast : Error<
6317  "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
6318  "not compatible">;
6319def err_bad_rvalue_to_rvalue_cast : Error<
6320  "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
6321  "not compatible">;
6322def err_bad_static_cast_pointer_nonpointer : Error<
6323  "cannot cast from type %1 to pointer type %2">;
6324def err_bad_static_cast_member_pointer_nonmp : Error<
6325  "cannot cast from type %1 to member pointer type %2">;
6326def err_bad_cxx_cast_member_pointer_size : Error<
6327  "cannot %select{||reinterpret_cast||C-style cast|}0 from member pointer "
6328  "type %1 to member pointer type %2 of different size">;
6329def err_bad_reinterpret_cast_reference : Error<
6330  "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
6331def warn_undefined_reinterpret_cast : Warning<
6332  "reinterpret_cast from %0 to %1 has undefined behavior">,
6333  InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6334
6335// These messages don't adhere to the pattern.
6336// FIXME: Display the path somehow better.
6337def err_ambiguous_base_to_derived_cast : Error<
6338  "ambiguous cast from base %0 to derived %1:%2">;
6339def err_static_downcast_via_virtual : Error<
6340  "cannot cast %0 to %1 via virtual base %2">;
6341def err_downcast_from_inaccessible_base : Error<
6342  "cannot cast %select{private|protected}2 base class %1 to %0">;
6343def err_upcast_to_inaccessible_base : Error<
6344  "cannot cast %0 to its %select{private|protected}2 base class %1">;
6345def err_bad_dynamic_cast_not_ref_or_ptr : Error<
6346  "%0 is not a reference or pointer">;
6347def err_bad_dynamic_cast_not_class : Error<"%0 is not a class">;
6348def err_bad_dynamic_cast_incomplete : Error<"%0 is an incomplete type">;
6349def err_bad_dynamic_cast_not_ptr : Error<"%0 is not a pointer">;
6350def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
6351
6352// Other C++ expressions
6353def err_need_header_before_typeid : Error<
6354  "you need to include <typeinfo> before using the 'typeid' operator">;
6355def err_need_header_before_ms_uuidof : Error<
6356  "you need to include <guiddef.h> before using the '__uuidof' operator">;
6357def err_ms___leave_not_in___try : Error<
6358  "'__leave' statement not in __try block">;
6359def err_uuidof_without_guid : Error<
6360  "cannot call operator __uuidof on a type with no GUID">;
6361def err_uuidof_with_multiple_guids : Error<
6362  "cannot call operator __uuidof on a type with multiple GUIDs">;
6363def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
6364def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
6365def err_static_illegal_in_new : Error<
6366  "the 'static' modifier for the array size is not legal in new expressions">;
6367def err_array_new_needs_size : Error<
6368  "array size must be specified in new expressions">;
6369def err_bad_new_type : Error<
6370  "cannot allocate %select{function|reference}1 type %0 with new">;
6371def err_new_incomplete_type : Error<
6372  "allocation of incomplete type %0">;
6373def err_new_array_nonconst : Error<
6374  "only the first dimension of an allocated array may have dynamic size">;
6375def err_new_array_init_args : Error<
6376  "array 'new' cannot have initialization arguments">;
6377def ext_new_paren_array_nonconst : ExtWarn<
6378  "when type is in parentheses, array cannot have dynamic size">;
6379def err_placement_new_non_placement_delete : Error<
6380  "'new' expression with placement arguments refers to non-placement "
6381  "'operator delete'">;
6382def err_array_size_not_integral : Error<
6383  "array size expression must have integral or %select{|unscoped }0"
6384  "enumeration type, not %1">;
6385def err_array_size_incomplete_type : Error<
6386  "array size expression has incomplete class type %0">;
6387def err_array_size_explicit_conversion : Error<
6388  "array size expression of type %0 requires explicit conversion to type %1">;
6389def note_array_size_conversion : Note<
6390  "conversion to %select{integral|enumeration}0 type %1 declared here">;
6391def err_array_size_ambiguous_conversion : Error<
6392  "ambiguous conversion of array size expression of type %0 to an integral or "
6393  "enumeration type">;
6394def ext_array_size_conversion : Extension<
6395  "implicit conversion from array size expression of type %0 to "
6396  "%select{integral|enumeration}1 type %2 is a C++11 extension">,
6397  InGroup<CXX11>;
6398def warn_cxx98_compat_array_size_conversion : Warning<
6399  "implicit conversion from array size expression of type %0 to "
6400  "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
6401  InGroup<CXX98CompatPedantic>, DefaultIgnore;
6402def err_address_space_qualified_new : Error<
6403  "'new' cannot allocate objects of type %0 in address space '%1'">;
6404def err_address_space_qualified_delete : Error<
6405  "'delete' cannot delete objects of type %0 in address space '%1'">;
6406
6407def err_default_init_const : Error<
6408  "default initialization of an object of const type %0"
6409  "%select{| without a user-provided default constructor}1">;
6410def ext_default_init_const : ExtWarn<
6411  "default initialization of an object of const type %0"
6412  "%select{| without a user-provided default constructor}1 "
6413  "is a Microsoft extension">,
6414  InGroup<MicrosoftConstInit>;
6415def err_delete_operand : Error<"cannot delete expression of type %0">;
6416def ext_delete_void_ptr_operand : ExtWarn<
6417  "cannot delete expression with pointer-to-'void' type %0">,
6418  InGroup<DeleteIncomplete>;
6419def err_ambiguous_delete_operand : Error<
6420  "ambiguous conversion of delete expression of type %0 to a pointer">;
6421def warn_delete_incomplete : Warning<
6422  "deleting pointer to incomplete type %0 may cause undefined behavior">,
6423  InGroup<DeleteIncomplete>;
6424def err_delete_incomplete_class_type : Error<
6425  "deleting incomplete class type %0; no conversions to pointer type">;
6426def err_delete_explicit_conversion : Error<
6427  "converting delete expression from type %0 to type %1 invokes an explicit "
6428  "conversion function">;
6429def note_delete_conversion : Note<"conversion to pointer type %0">;
6430def warn_delete_array_type : Warning<
6431  "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
6432def warn_mismatched_delete_new : Warning<
6433  "'delete%select{|[]}0' applied to a pointer that was allocated with "
6434  "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
6435  InGroup<DiagGroup<"mismatched-new-delete">>;
6436def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
6437def err_no_suitable_delete_member_function_found : Error<
6438  "no suitable member %0 in %1">;
6439def err_ambiguous_suitable_delete_member_function_found : Error<
6440  "multiple suitable %0 functions in %1">;
6441def warn_ambiguous_suitable_delete_function_found : Warning<
6442  "multiple suitable %0 functions for %1; no 'operator delete' function "
6443  "will be invoked if initialization throws an exception">,
6444  InGroup<DiagGroup<"ambiguous-delete">>;
6445def note_member_declared_here : Note<
6446  "member %0 declared here">;
6447def note_member_first_declared_here : Note<
6448  "member %0 first declared here">;
6449def err_decrement_bool : Error<"cannot decrement expression of type bool">;
6450def warn_increment_bool : Warning<
6451  "incrementing expression of type bool is deprecated and "
6452  "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
6453def ext_increment_bool : ExtWarn<
6454  "ISO C++17 does not allow incrementing expression of type bool">,
6455  DefaultError, InGroup<IncrementBool>;
6456def err_increment_decrement_enum : Error<
6457  "cannot %select{decrement|increment}0 expression of enum type %1">;
6458def err_catch_incomplete_ptr : Error<
6459  "cannot catch pointer to incomplete type %0">;
6460def err_catch_incomplete_ref : Error<
6461  "cannot catch reference to incomplete type %0">;
6462def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
6463def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
6464def err_catch_variably_modified : Error<
6465  "cannot catch variably modified type %0">;
6466def err_qualified_catch_declarator : Error<
6467  "exception declarator cannot be qualified">;
6468def err_early_catch_all : Error<"catch-all handler must come last">;
6469def err_bad_memptr_rhs : Error<
6470  "right hand operand to %0 has non-pointer-to-member type %1">;
6471def err_bad_memptr_lhs : Error<
6472  "left hand operand to %0 must be a %select{|pointer to }1class "
6473  "compatible with the right hand operand, but is %2">;
6474def err_memptr_incomplete : Error<
6475  "member pointer has incomplete base type %0">;
6476def warn_exception_caught_by_earlier_handler : Warning<
6477  "exception of type %0 will be caught by earlier handler">,
6478  InGroup<Exceptions>;
6479def note_previous_exception_handler : Note<"for type %0">;
6480def err_exceptions_disabled : Error<
6481  "cannot use '%0' with exceptions disabled">;
6482def err_objc_exceptions_disabled : Error<
6483  "cannot use '%0' with Objective-C exceptions disabled">;
6484def warn_throw_in_noexcept_func : Warning<
6485  "%0 has a non-throwing exception specification but can still throw">,
6486  InGroup<Exceptions>;
6487def note_throw_in_dtor : Note<
6488  "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
6489  "non-throwing}1 exception specification">;
6490def note_throw_in_function : Note<"function declared non-throwing here">;
6491def err_seh_try_outside_functions : Error<
6492  "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
6493def err_mixing_cxx_try_seh_try : Error<
6494  "cannot use C++ 'try' in the same function as SEH '__try'">;
6495def err_seh_try_unsupported : Error<
6496  "SEH '__try' is not supported on this target">;
6497def note_conflicting_try_here : Note<
6498  "conflicting %0 here">;
6499def warn_jump_out_of_seh_finally : Warning<
6500  "jump out of __finally block has undefined behavior">,
6501  InGroup<DiagGroup<"jump-seh-finally">>;
6502def warn_non_virtual_dtor : Warning<
6503  "%0 has virtual functions but non-virtual destructor">,
6504  InGroup<NonVirtualDtor>, DefaultIgnore;
6505def warn_delete_non_virtual_dtor : Warning<
6506  "%select{delete|destructor}0 called on non-final %1 that has "
6507  "virtual functions but non-virtual destructor">,
6508  InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
6509def note_delete_non_virtual : Note<
6510  "qualify call to silence this warning">;
6511def warn_delete_abstract_non_virtual_dtor : Warning<
6512  "%select{delete|destructor}0 called on %1 that is abstract but has "
6513  "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
6514def warn_overloaded_virtual : Warning<
6515  "%q0 hides overloaded virtual %select{function|functions}1">,
6516  InGroup<OverloadedVirtual>, DefaultIgnore;
6517def note_hidden_overloaded_virtual_declared_here : Note<
6518  "hidden overloaded virtual function %q0 declared here"
6519  "%select{|: different classes%diff{ ($ vs $)|}2,3"
6520  "|: different number of parameters (%2 vs %3)"
6521  "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
6522  "|: different return type%diff{ ($ vs $)|}2,3"
6523  "|: different qualifiers (%2 vs %3)"
6524  "|: different exception specifications}1">;
6525def warn_using_directive_in_header : Warning<
6526  "using namespace directive in global context in header">,
6527  InGroup<HeaderHygiene>, DefaultIgnore;
6528def warn_overaligned_type : Warning<
6529  "type %0 requires %1 bytes of alignment and the default allocator only "
6530  "guarantees %2 bytes">,
6531  InGroup<OveralignedType>, DefaultIgnore;
6532def err_aligned_allocation_unavailable : Error<
6533  "aligned %select{allocation|deallocation}0 function of type '%1' is only "
6534  "available on %2 %3 or newer">;
6535def note_silence_aligned_allocation_unavailable : Note<
6536  "if you supply your own aligned allocation functions, use "
6537  "-faligned-allocation to silence this diagnostic">;
6538
6539def err_conditional_void_nonvoid : Error<
6540  "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
6541  "is of type %0">;
6542def err_conditional_ambiguous : Error<
6543  "conditional expression is ambiguous; "
6544  "%diff{$ can be converted to $ and vice versa|"
6545  "types can be convert to each other}0,1">;
6546def err_conditional_ambiguous_ovl : Error<
6547  "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
6548  "can be converted to several common types">;
6549def err_conditional_vector_size : Error<
6550  "vector condition type %0 and result type %1 do not have the same number "
6551  "of elements">;
6552def err_conditional_vector_element_size : Error<
6553  "vector condition type %0 and result type %1 do not have elements of the "
6554  "same size">;
6555
6556def err_throw_incomplete : Error<
6557  "cannot throw object of incomplete type %0">;
6558def err_throw_incomplete_ptr : Error<
6559  "cannot throw pointer to object of incomplete type %0">;
6560def err_return_in_constructor_handler : Error<
6561  "return in the catch of a function try block of a constructor is illegal">;
6562def warn_cdtor_function_try_handler_mem_expr : Warning<
6563  "cannot refer to a non-static member from the handler of a "
6564  "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
6565
6566let CategoryName = "Lambda Issue" in {
6567  def err_capture_more_than_once : Error<
6568    "%0 can appear only once in a capture list">;
6569  def err_reference_capture_with_reference_default : Error<
6570    "'&' cannot precede a capture when the capture default is '&'">;
6571  def err_copy_capture_with_copy_default : Error<
6572    "'&' must precede a capture when the capture default is '='">;
6573  def err_capture_does_not_name_variable : Error<
6574    "%0 in capture list does not name a variable">;
6575  def err_capture_non_automatic_variable : Error<
6576    "%0 cannot be captured because it does not have automatic storage "
6577    "duration">;
6578  def err_this_capture : Error<
6579    "'this' cannot be %select{implicitly |}0captured in this context">;
6580  def err_lambda_capture_anonymous_var : Error<
6581    "unnamed variable cannot be implicitly captured in a lambda expression">;
6582  def err_lambda_capture_flexarray_type : Error<
6583    "variable %0 with flexible array member cannot be captured in "
6584    "a lambda expression">;
6585  def err_lambda_impcap : Error<
6586    "variable %0 cannot be implicitly captured in a lambda with no "
6587    "capture-default specified">;
6588  def note_lambda_decl : Note<"lambda expression begins here">;
6589  def err_lambda_unevaluated_operand : Error<
6590    "lambda expression in an unevaluated operand">;
6591  def err_lambda_in_constant_expression : Error<
6592    "a lambda expression may not appear inside of a constant expression">;
6593  def err_lambda_in_invalid_context : Error<
6594    "a lambda expression cannot appear in this context">;
6595  def err_lambda_return_init_list : Error<
6596    "cannot deduce lambda return type from initializer list">;
6597  def err_lambda_capture_default_arg : Error<
6598    "lambda expression in default argument cannot capture any entity">;
6599  def err_lambda_incomplete_result : Error<
6600    "incomplete result type %0 in lambda expression">;
6601  def err_noreturn_lambda_has_return_expr : Error<
6602    "lambda declared 'noreturn' should not return">;
6603  def warn_maybe_falloff_nonvoid_lambda : Warning<
6604    "control may reach end of non-void lambda">,
6605    InGroup<ReturnType>;
6606  def warn_falloff_nonvoid_lambda : Warning<
6607    "control reaches end of non-void lambda">,
6608    InGroup<ReturnType>;
6609  def err_access_lambda_capture : Error<
6610    // The ERRORs represent other special members that aren't constructors, in
6611    // hopes that someone will bother noticing and reporting if they appear
6612    "capture of variable '%0' as type %1 calls %select{private|protected}3 "
6613    "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
6614    AccessControl;
6615  def note_lambda_to_block_conv : Note<
6616    "implicit capture of lambda object due to conversion to block pointer "
6617    "here">;
6618  def note_var_explicitly_captured_here : Note<"variable %0 is"
6619    "%select{| explicitly}1 captured here">;
6620
6621  // C++14 lambda init-captures.
6622  def warn_cxx11_compat_init_capture : Warning<
6623    "initialized lambda captures are incompatible with C++ standards "
6624    "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
6625  def ext_init_capture : ExtWarn<
6626    "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
6627  def err_init_capture_no_expression : Error<
6628    "initializer missing for lambda capture %0">;
6629  def err_init_capture_multiple_expressions : Error<
6630    "initializer for lambda capture %0 contains multiple expressions">;
6631  def err_init_capture_paren_braces : Error<
6632    "cannot deduce type for lambda capture %1 from "
6633    "%select{parenthesized|nested}0 initializer list">;
6634  def err_init_capture_deduction_failure : Error<
6635    "cannot deduce type for lambda capture %0 from initializer of type %2">;
6636  def err_init_capture_deduction_failure_from_init_list : Error<
6637    "cannot deduce type for lambda capture %0 from initializer list">;
6638
6639  // C++14 generic lambdas.
6640  def warn_cxx11_compat_generic_lambda : Warning<
6641    "generic lambdas are incompatible with C++11">,
6642    InGroup<CXXPre14Compat>, DefaultIgnore;
6643
6644  // C++17 '*this' captures.
6645  def warn_cxx14_compat_star_this_lambda_capture : Warning<
6646    "by value capture of '*this' is incompatible with C++ standards before C++17">,
6647     InGroup<CXXPre17Compat>, DefaultIgnore;
6648  def ext_star_this_lambda_capture_cxx17 : ExtWarn<
6649    "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
6650
6651  // C++17 parameter shadows capture
6652  def err_parameter_shadow_capture : Error<
6653    "a lambda parameter cannot shadow an explicitly captured entity">;
6654
6655  // C++2a [=, this] captures.
6656  def warn_cxx17_compat_equals_this_lambda_capture : Warning<
6657    "explicit capture of 'this' with a capture default of '=' is incompatible "
6658    "with C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
6659  def ext_equals_this_lambda_capture_cxx2a : ExtWarn<
6660    "explicit capture of 'this' with a capture default of '=' "
6661    "is a C++2a extension">, InGroup<CXX2a>;
6662  def warn_deprecated_this_capture : Warning<
6663    "implicit capture of 'this' with a capture default of '=' is deprecated">,
6664    InGroup<DeprecatedThisCapture>, DefaultIgnore;
6665  def note_deprecated_this_capture : Note<
6666    "add an explicit capture of 'this' to capture '*this' by reference">;
6667
6668  // C++2a default constructible / assignable lambdas.
6669  def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
6670    "%select{default construction|assignment}0 of lambda is incompatible with "
6671    "C++ standards before C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
6672}
6673
6674def err_return_in_captured_stmt : Error<
6675  "cannot return from %0">;
6676def err_capture_block_variable : Error<
6677  "__block variable %0 cannot be captured in a "
6678  "%select{lambda expression|captured statement}1">;
6679
6680def err_operator_arrow_circular : Error<
6681  "circular pointer delegation detected">;
6682def err_operator_arrow_depth_exceeded : Error<
6683  "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
6684  "'operator->' calls">;
6685def note_operator_arrow_here : Note<
6686  "'operator->' declared here produces an object of type %0">;
6687def note_operator_arrows_suppressed : Note<
6688  "(skipping %0 'operator->'%s0 in backtrace)">;
6689def note_operator_arrow_depth : Note<
6690  "use -foperator-arrow-depth=N to increase 'operator->' limit">;
6691
6692def err_pseudo_dtor_base_not_scalar : Error<
6693  "object expression of non-scalar type %0 cannot be used in a "
6694  "pseudo-destructor expression">;
6695def ext_pseudo_dtor_on_void : ExtWarn<
6696  "pseudo-destructors on type void are a Microsoft extension">,
6697  InGroup<MicrosoftVoidPseudoDtor>;
6698def err_pseudo_dtor_type_mismatch : Error<
6699  "the type of object expression "
6700  "%diff{($) does not match the type being destroyed ($)|"
6701  "does not match the type being destroyed}0,1 "
6702  "in pseudo-destructor expression">;
6703def err_pseudo_dtor_call_with_args : Error<
6704  "call to pseudo-destructor cannot have any arguments">;
6705def err_dtor_expr_without_call : Error<
6706  "reference to %select{destructor|pseudo-destructor}0 must be called"
6707  "%select{|; did you mean to call it with no arguments?}1">;
6708def err_pseudo_dtor_destructor_non_type : Error<
6709  "%0 does not refer to a type name in pseudo-destructor expression; expected "
6710  "the name of type %1">;
6711def err_invalid_use_of_function_type : Error<
6712  "a function type is not allowed here">;
6713def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
6714def err_typecheck_bool_condition : Error<
6715  "value of type %0 is not contextually convertible to 'bool'">;
6716def err_typecheck_ambiguous_condition : Error<
6717  "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
6718def err_typecheck_nonviable_condition : Error<
6719  "no viable conversion%select{%diff{ from $ to $|}1,2|"
6720  "%diff{ from returned value of type $ to function return type $|}1,2}0">;
6721def err_typecheck_nonviable_condition_incomplete : Error<
6722  "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
6723def err_typecheck_deleted_function : Error<
6724  "conversion function %diff{from $ to $|between types}0,1 "
6725  "invokes a deleted function">;
6726
6727def err_expected_class_or_namespace : Error<"%0 is not a class"
6728  "%select{ or namespace|, namespace, or enumeration}1">;
6729def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
6730  "because namespace %1 does not enclose namespace %2">;
6731def err_invalid_declarator_global_scope : Error<
6732  "definition or redeclaration of %0 cannot name the global scope">;
6733def err_invalid_declarator_in_function : Error<
6734  "definition or redeclaration of %0 not allowed inside a function">;
6735def err_invalid_declarator_in_block : Error<
6736  "definition or redeclaration of %0 not allowed inside a block">;
6737def err_not_tag_in_scope : Error<
6738  "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
6739
6740def err_no_typeid_with_fno_rtti : Error<
6741  "use of typeid requires -frtti">;
6742def err_no_dynamic_cast_with_fno_rtti : Error<
6743  "use of dynamic_cast requires -frtti">;
6744
6745def err_cannot_form_pointer_to_member_of_reference_type : Error<
6746  "cannot form a pointer-to-member to member %0 of reference type %1">;
6747def err_incomplete_object_call : Error<
6748  "incomplete type in call to object of type %0">;
6749
6750def warn_condition_is_assignment : Warning<"using the result of an "
6751  "assignment as a condition without parentheses">,
6752  InGroup<Parentheses>;
6753// Completely identical except off by default.
6754def warn_condition_is_idiomatic_assignment : Warning<"using the result "
6755  "of an assignment as a condition without parentheses">,
6756  InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
6757def note_condition_assign_to_comparison : Note<
6758  "use '==' to turn this assignment into an equality comparison">;
6759def note_condition_or_assign_to_comparison : Note<
6760  "use '!=' to turn this compound assignment into an inequality comparison">;
6761def note_condition_assign_silence : Note<
6762  "place parentheses around the assignment to silence this warning">;
6763
6764def warn_equality_with_extra_parens : Warning<"equality comparison with "
6765  "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
6766def note_equality_comparison_to_assign : Note<
6767  "use '=' to turn this equality comparison into an assignment">;
6768def note_equality_comparison_silence : Note<
6769  "remove extraneous parentheses around the comparison to silence this warning">;
6770
6771// assignment related diagnostics (also for argument passing, returning, etc).
6772// In most of these diagnostics the %2 is a value from the
6773// Sema::AssignmentAction enumeration
6774def err_typecheck_convert_incompatible : Error<
6775  "%select{%diff{assigning to $ from incompatible type $|"
6776  "assigning to type from incompatible type}0,1"
6777  "|%diff{passing $ to parameter of incompatible type $|"
6778  "passing type to parameter of incompatible type}0,1"
6779  "|%diff{returning $ from a function with incompatible result type $|"
6780  "returning type from a function with incompatible result type}0,1"
6781  "|%diff{converting $ to incompatible type $|"
6782  "converting type to incompatible type}0,1"
6783  "|%diff{initializing $ with an expression of incompatible type $|"
6784  "initializing type with an expression of incompatible type}0,1"
6785  "|%diff{sending $ to parameter of incompatible type $|"
6786  "sending type to parameter of incompatible type}0,1"
6787  "|%diff{casting $ to incompatible type $|"
6788  "casting type to incompatible type}0,1}2"
6789  "%select{|; dereference with *|"
6790  "; take the address with &|"
6791  "; remove *|"
6792  "; remove &}3"
6793  "%select{|: different classes%diff{ ($ vs $)|}5,6"
6794  "|: different number of parameters (%5 vs %6)"
6795  "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
6796  "|: different return type%diff{ ($ vs $)|}5,6"
6797  "|: different qualifiers (%5 vs %6)"
6798  "|: different exception specifications}4">;
6799def err_typecheck_missing_return_type_incompatible : Error<
6800  "%diff{return type $ must match previous return type $|"
6801  "return type must match previous return type}0,1 when %select{block "
6802  "literal|lambda expression}2 has unspecified explicit return type">;
6803
6804def note_incomplete_class_and_qualified_id : Note<
6805  "conformance of forward class %0 to protocol %1 can not be confirmed">;
6806def warn_incompatible_qualified_id : Warning<
6807  "%select{%diff{assigning to $ from incompatible type $|"
6808  "assigning to type from incompatible type}0,1"
6809  "|%diff{passing $ to parameter of incompatible type $|"
6810  "passing type to parameter of incompatible type}0,1"
6811  "|%diff{returning $ from a function with incompatible result type $|"
6812  "returning type from a function with incompatible result type}0,1"
6813  "|%diff{converting $ to incompatible type $|"
6814  "converting type to incompatible type}0,1"
6815  "|%diff{initializing $ with an expression of incompatible type $|"
6816  "initializing type with an expression of incompatible type}0,1"
6817  "|%diff{sending $ to parameter of incompatible type $|"
6818  "sending type to parameter of incompatible type}0,1"
6819  "|%diff{casting $ to incompatible type $|"
6820  "casting type to incompatible type}0,1}2">;
6821def ext_typecheck_convert_pointer_int : ExtWarn<
6822  "incompatible pointer to integer conversion "
6823  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6824  "|%diff{passing $ to parameter of type $|"
6825  "passing to parameter of different type}0,1"
6826  "|%diff{returning $ from a function with result type $|"
6827  "returning from function with different return type}0,1"
6828  "|%diff{converting $ to type $|converting between types}0,1"
6829  "|%diff{initializing $ with an expression of type $|"
6830  "initializing with expression of different type}0,1"
6831  "|%diff{sending $ to parameter of type $|"
6832  "sending to parameter of different type}0,1"
6833  "|%diff{casting $ to type $|casting between types}0,1}2"
6834  "%select{|; dereference with *|"
6835  "; take the address with &|"
6836  "; remove *|"
6837  "; remove &}3">,
6838  InGroup<IntConversion>;
6839def ext_typecheck_convert_int_pointer : ExtWarn<
6840  "incompatible integer to pointer conversion "
6841  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6842  "|%diff{passing $ to parameter of type $|"
6843  "passing to parameter of different type}0,1"
6844  "|%diff{returning $ from a function with result type $|"
6845  "returning from function with different return type}0,1"
6846  "|%diff{converting $ to type $|converting between types}0,1"
6847  "|%diff{initializing $ with an expression of type $|"
6848  "initializing with expression of different type}0,1"
6849  "|%diff{sending $ to parameter of type $|"
6850  "sending to parameter of different type}0,1"
6851  "|%diff{casting $ to type $|casting between types}0,1}2"
6852  "%select{|; dereference with *|"
6853  "; take the address with &|"
6854  "; remove *|"
6855  "; remove &}3">,
6856  InGroup<IntConversion>, SFINAEFailure;
6857def ext_typecheck_convert_pointer_void_func : Extension<
6858  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6859  "|%diff{passing $ to parameter of type $|"
6860  "passing to parameter of different type}0,1"
6861  "|%diff{returning $ from a function with result type $|"
6862  "returning from function with different return type}0,1"
6863  "|%diff{converting $ to type $|converting between types}0,1"
6864  "|%diff{initializing $ with an expression of type $|"
6865  "initializing with expression of different type}0,1"
6866  "|%diff{sending $ to parameter of type $|"
6867  "sending to parameter of different type}0,1"
6868  "|%diff{casting $ to type $|casting between types}0,1}2"
6869  " converts between void pointer and function pointer">;
6870def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
6871  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6872  "|%diff{passing $ to parameter of type $|"
6873  "passing to parameter of different type}0,1"
6874  "|%diff{returning $ from a function with result type $|"
6875  "returning from function with different return type}0,1"
6876  "|%diff{converting $ to type $|converting between types}0,1"
6877  "|%diff{initializing $ with an expression of type $|"
6878  "initializing with expression of different type}0,1"
6879  "|%diff{sending $ to parameter of type $|"
6880  "sending to parameter of different type}0,1"
6881  "|%diff{casting $ to type $|casting between types}0,1}2"
6882  " converts between pointers to integer types with different sign">,
6883  InGroup<DiagGroup<"pointer-sign">>;
6884def ext_typecheck_convert_incompatible_pointer : ExtWarn<
6885  "incompatible pointer types "
6886  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6887  "|%diff{passing $ to parameter of type $|"
6888  "passing to parameter of different type}0,1"
6889  "|%diff{returning $ from a function with result type $|"
6890  "returning from function with different return type}0,1"
6891  "|%diff{converting $ to type $|converting between types}0,1"
6892  "|%diff{initializing $ with an expression of type $|"
6893  "initializing with expression of different type}0,1"
6894  "|%diff{sending $ to parameter of type $|"
6895  "sending to parameter of different type}0,1"
6896  "|%diff{casting $ to type $|casting between types}0,1}2"
6897  "%select{|; dereference with *|"
6898  "; take the address with &|"
6899  "; remove *|"
6900  "; remove &}3">,
6901  InGroup<IncompatiblePointerTypes>;
6902def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
6903  "incompatible function pointer types "
6904  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6905  "|%diff{passing $ to parameter of type $|"
6906  "passing to parameter of different type}0,1"
6907  "|%diff{returning $ from a function with result type $|"
6908  "returning from function with different return type}0,1"
6909  "|%diff{converting $ to type $|converting between types}0,1"
6910  "|%diff{initializing $ with an expression of type $|"
6911  "initializing with expression of different type}0,1"
6912  "|%diff{sending $ to parameter of type $|"
6913  "sending to parameter of different type}0,1"
6914  "|%diff{casting $ to type $|casting between types}0,1}2"
6915  "%select{|; dereference with *|"
6916  "; take the address with &|"
6917  "; remove *|"
6918  "; remove &}3">,
6919  InGroup<IncompatibleFunctionPointerTypes>;
6920def ext_typecheck_convert_discards_qualifiers : ExtWarn<
6921  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6922  "|%diff{passing $ to parameter of type $|"
6923  "passing to parameter of different type}0,1"
6924  "|%diff{returning $ from a function with result type $|"
6925  "returning from function with different return type}0,1"
6926  "|%diff{converting $ to type $|converting between types}0,1"
6927  "|%diff{initializing $ with an expression of type $|"
6928  "initializing with expression of different type}0,1"
6929  "|%diff{sending $ to parameter of type $|"
6930  "sending to parameter of different type}0,1"
6931  "|%diff{casting $ to type $|casting between types}0,1}2"
6932  " discards qualifiers">,
6933  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6934def ext_nested_pointer_qualifier_mismatch : ExtWarn<
6935  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6936  "|%diff{passing $ to parameter of type $|"
6937  "passing to parameter of different type}0,1"
6938  "|%diff{returning $ from a function with result type $|"
6939  "returning from function with different return type}0,1"
6940  "|%diff{converting $ to type $|converting between types}0,1"
6941  "|%diff{initializing $ with an expression of type $|"
6942  "initializing with expression of different type}0,1"
6943  "|%diff{sending $ to parameter of type $|"
6944  "sending to parameter of different type}0,1"
6945  "|%diff{casting $ to type $|casting between types}0,1}2"
6946  " discards qualifiers in nested pointer types">,
6947  InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
6948def warn_incompatible_vectors : Warning<
6949  "incompatible vector types "
6950  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
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  InGroup<VectorConversion>, DefaultIgnore;
6962def err_int_to_block_pointer : Error<
6963  "invalid block pointer conversion "
6964  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6965  "|%diff{passing $ to parameter of type $|"
6966  "passing to parameter of different type}0,1"
6967  "|%diff{returning $ from a function with result type $|"
6968  "returning from function with different return type}0,1"
6969  "|%diff{converting $ to type $|converting between types}0,1"
6970  "|%diff{initializing $ with an expression of type $|"
6971  "initializing with expression of different type}0,1"
6972  "|%diff{sending $ to parameter of type $|"
6973  "sending to parameter of different type}0,1"
6974  "|%diff{casting $ to type $|casting between types}0,1}2">;
6975def err_typecheck_convert_incompatible_block_pointer : Error<
6976  "incompatible block pointer types "
6977  "%select{%diff{assigning to $ from $|assigning to different types}0,1"
6978  "|%diff{passing $ to parameter of type $|"
6979  "passing to parameter of different type}0,1"
6980  "|%diff{returning $ from a function with result type $|"
6981  "returning from function with different return type}0,1"
6982  "|%diff{converting $ to type $|converting between types}0,1"
6983  "|%diff{initializing $ with an expression of type $|"
6984  "initializing with expression of different type}0,1"
6985  "|%diff{sending $ to parameter of type $|"
6986  "sending to parameter of different type}0,1"
6987  "|%diff{casting $ to type $|casting between types}0,1}2">;
6988def err_typecheck_incompatible_address_space : Error<
6989  "%select{%diff{assigning $ to $|assigning to different types}1,0"
6990  "|%diff{passing $ to parameter of type $|"
6991  "passing to parameter of different type}0,1"
6992  "|%diff{returning $ from a function with result type $|"
6993  "returning from function with different return type}0,1"
6994  "|%diff{converting $ to type $|converting between types}0,1"
6995  "|%diff{initializing $ with an expression of type $|"
6996  "initializing with expression of different type}0,1"
6997  "|%diff{sending $ to parameter of type $|"
6998  "sending to parameter of different type}0,1"
6999  "|%diff{casting $ to type $|casting between types}0,1}2"
7000  " changes address space of pointer">;
7001def err_typecheck_incompatible_ownership : Error<
7002  "%select{%diff{assigning $ to $|assigning to different types}1,0"
7003  "|%diff{passing $ to parameter of type $|"
7004  "passing to parameter of different type}0,1"
7005  "|%diff{returning $ from a function with result type $|"
7006  "returning from function with different return type}0,1"
7007  "|%diff{converting $ to type $|converting between types}0,1"
7008  "|%diff{initializing $ with an expression of type $|"
7009  "initializing with expression of different type}0,1"
7010  "|%diff{sending $ to parameter of type $|"
7011  "sending to parameter of different type}0,1"
7012  "|%diff{casting $ to type $|casting between types}0,1}2"
7013  " changes retain/release properties of pointer">;
7014def err_typecheck_comparison_of_distinct_blocks : Error<
7015  "comparison of distinct block types%diff{ ($ and $)|}0,1">;
7016
7017def err_typecheck_array_not_modifiable_lvalue : Error<
7018  "array type %0 is not assignable">;
7019def err_typecheck_non_object_not_modifiable_lvalue : Error<
7020  "non-object type %0 is not assignable">;
7021def err_typecheck_expression_not_modifiable_lvalue : Error<
7022  "expression is not assignable">;
7023def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
7024  "incomplete type %0 is not assignable">;
7025def err_typecheck_lvalue_casts_not_supported : Error<
7026  "assignment to cast is illegal, lvalue casts are not supported">;
7027
7028def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
7029  "vector is not assignable (contains duplicate components)">;
7030def err_block_decl_ref_not_modifiable_lvalue : Error<
7031  "variable is not assignable (missing __block type specifier)">;
7032def err_lambda_decl_ref_not_modifiable_lvalue : Error<
7033  "cannot assign to a variable captured by copy in a non-mutable lambda">;
7034def err_typecheck_call_not_function : Error<
7035  "called object type %0 is not a function or function pointer">;
7036def err_call_incomplete_return : Error<
7037  "calling function with incomplete return type %0">;
7038def err_call_function_incomplete_return : Error<
7039  "calling %0 with incomplete return type %1">;
7040def err_call_incomplete_argument : Error<
7041  "argument type %0 is incomplete">;
7042def err_typecheck_call_too_few_args : Error<
7043  "too few %select{|||execution configuration }0arguments to "
7044  "%select{function|block|method|kernel function}0 call, "
7045  "expected %1, have %2">;
7046def err_typecheck_call_too_few_args_one : Error<
7047  "too few %select{|||execution configuration }0arguments to "
7048  "%select{function|block|method|kernel function}0 call, "
7049  "single argument %1 was not specified">;
7050def err_typecheck_call_too_few_args_at_least : Error<
7051  "too few %select{|||execution configuration }0arguments to "
7052  "%select{function|block|method|kernel function}0 call, "
7053  "expected at least %1, have %2">;
7054def err_typecheck_call_too_few_args_at_least_one : Error<
7055  "too few %select{|||execution configuration }0arguments to "
7056  "%select{function|block|method|kernel function}0 call, "
7057  "at least argument %1 must be specified">;
7058def err_typecheck_call_too_few_args_suggest : Error<
7059  "too few %select{|||execution configuration }0arguments to "
7060  "%select{function|block|method|kernel function}0 call, "
7061  "expected %1, have %2; did you mean %3?">;
7062def err_typecheck_call_too_few_args_at_least_suggest : Error<
7063  "too few %select{|||execution configuration }0arguments to "
7064  "%select{function|block|method|kernel function}0 call, "
7065  "expected at least %1, have %2; did you mean %3?">;
7066def err_typecheck_call_too_many_args : Error<
7067  "too many %select{|||execution configuration }0arguments to "
7068  "%select{function|block|method|kernel function}0 call, "
7069  "expected %1, have %2">;
7070def err_typecheck_call_too_many_args_one : Error<
7071  "too many %select{|||execution configuration }0arguments to "
7072  "%select{function|block|method|kernel function}0 call, "
7073  "expected single argument %1, have %2 arguments">;
7074def err_typecheck_call_too_many_args_at_most : Error<
7075  "too many %select{|||execution configuration }0arguments to "
7076  "%select{function|block|method|kernel function}0 call, "
7077  "expected at most %1, have %2">;
7078def err_typecheck_call_too_many_args_at_most_one : Error<
7079  "too many %select{|||execution configuration }0arguments to "
7080  "%select{function|block|method|kernel function}0 call, "
7081  "expected at most single argument %1, have %2 arguments">;
7082def err_typecheck_call_too_many_args_suggest : Error<
7083  "too many %select{|||execution configuration }0arguments to "
7084  "%select{function|block|method|kernel function}0 call, "
7085  "expected %1, have %2; did you mean %3?">;
7086def err_typecheck_call_too_many_args_at_most_suggest : Error<
7087  "too many %select{|||execution configuration }0arguments to "
7088  "%select{function|block|method|kernel function}0 call, "
7089  "expected at most %1, have %2; did you mean %3?">;
7090
7091def err_arc_typecheck_convert_incompatible_pointer : Error<
7092  "incompatible pointer types passing retainable parameter of type %0"
7093  "to a CF function expecting %1 type">;
7094
7095def err_builtin_fn_use : Error<"builtin functions must be directly called">;
7096
7097def warn_call_wrong_number_of_arguments : Warning<
7098  "too %select{few|many}0 arguments in call to %1">;
7099def err_atomic_builtin_must_be_pointer : Error<
7100  "address argument to atomic builtin must be a pointer (%0 invalid)">;
7101def err_atomic_builtin_must_be_pointer_intptr : Error<
7102  "address argument to atomic builtin must be a pointer to integer or pointer"
7103  " (%0 invalid)">;
7104def err_atomic_builtin_cannot_be_const : Error<
7105  "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
7106def err_atomic_builtin_must_be_pointer_intfltptr : Error<
7107  "address argument to atomic builtin must be a pointer to integer,"
7108  " floating-point or pointer (%0 invalid)">;
7109def err_atomic_builtin_pointer_size : Error<
7110  "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
7111  "type (%0 invalid)">;
7112def err_atomic_exclusive_builtin_pointer_size : Error<
7113  "address argument to load or store exclusive builtin must be a pointer to"
7114  " 1,2,4 or 8 byte type (%0 invalid)">;
7115def err_atomic_op_needs_atomic : Error<
7116  "address argument to atomic operation must be a pointer to _Atomic "
7117  "type (%0 invalid)">;
7118def err_atomic_op_needs_non_const_atomic : Error<
7119  "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
7120  "type (%1 invalid)">;
7121def err_atomic_op_needs_non_const_pointer : Error<
7122  "address argument to atomic operation must be a pointer to non-const "
7123  "type (%0 invalid)">;
7124def err_atomic_op_needs_trivial_copy : Error<
7125  "address argument to atomic operation must be a pointer to a "
7126  "trivially-copyable type (%0 invalid)">;
7127def err_atomic_op_needs_atomic_int_or_ptr : Error<
7128  "address argument to atomic operation must be a pointer to %select{|atomic }0"
7129  "integer or pointer (%1 invalid)">;
7130def err_atomic_op_needs_int32_or_ptr : Error<
7131  "address argument to atomic operation must be a pointer to signed or unsigned 32-bit integer">;
7132def err_atomic_op_bitwise_needs_atomic_int : Error<
7133  "address argument to bitwise atomic operation must be a pointer to "
7134  "%select{|atomic }0integer (%1 invalid)">;
7135def warn_atomic_op_has_invalid_memory_order : Warning<
7136  "memory order argument to atomic operation is invalid">,
7137  InGroup<DiagGroup<"atomic-memory-ordering">>;
7138def err_atomic_op_has_invalid_synch_scope : Error<
7139  "synchronization scope argument to atomic operation is invalid">;
7140def warn_atomic_implicit_seq_cst : Warning<
7141  "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
7142  InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
7143
7144def err_overflow_builtin_must_be_int : Error<
7145  "operand argument to overflow builtin must be an integer (%0 invalid)">;
7146def err_overflow_builtin_must_be_ptr_int : Error<
7147  "result argument to overflow builtin must be a pointer "
7148  "to a non-const integer (%0 invalid)">;
7149
7150def err_atomic_load_store_uses_lib : Error<
7151  "atomic %select{load|store}0 requires runtime support that is not "
7152  "available for this target">;
7153
7154def err_nontemporal_builtin_must_be_pointer : Error<
7155  "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
7156def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
7157  "address argument to nontemporal builtin must be a pointer to integer, float, "
7158  "pointer, or a vector of such types (%0 invalid)">;
7159
7160def err_deleted_function_use : Error<"attempt to use a deleted function">;
7161def err_deleted_inherited_ctor_use : Error<
7162  "constructor inherited by %0 from base class %1 is implicitly deleted">;
7163
7164def note_called_by : Note<"called by %0">;
7165def err_kern_type_not_void_return : Error<
7166  "kernel function type %0 must have void return type">;
7167def err_kern_is_nonstatic_method : Error<
7168  "kernel function %0 must be a free function or static member function">;
7169def err_config_scalar_return : Error<
7170  "CUDA special function '%0' must have scalar return type">;
7171def err_kern_call_not_global_function : Error<
7172  "kernel call to non-global function %0">;
7173def err_global_call_not_config : Error<
7174  "call to global function %0 not configured">;
7175def err_ref_bad_target : Error<
7176  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7177  "function %1 in %select{__device__|__global__|__host__|__host__ __device__}2 function">;
7178def err_ref_bad_target_global_initializer : Error<
7179  "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
7180  "function %1 in global initializer">;
7181def warn_kern_is_method : Extension<
7182  "kernel function %0 is a member function; this may not be accepted by nvcc">,
7183  InGroup<CudaCompat>;
7184def warn_kern_is_inline : Warning<
7185  "ignored 'inline' attribute on kernel function %0">,
7186  InGroup<CudaCompat>;
7187def err_variadic_device_fn : Error<
7188  "CUDA device code does not support variadic functions">;
7189def err_va_arg_in_device : Error<
7190  "CUDA device code does not support va_arg">;
7191def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
7192def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
7193  "constexpr function %0 without __host__ or __device__ attributes cannot "
7194  "overload __device__ function with same signature.  Add a __host__ "
7195  "attribute, or build with -fno-cuda-host-device-constexpr.">;
7196def note_cuda_conflicting_device_function_declared_here : Note<
7197  "conflicting __device__ function declared here">;
7198def err_cuda_device_exceptions : Error<
7199  "cannot use '%0' in "
7200  "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
7201def err_dynamic_var_init : Error<
7202    "dynamic initialization is not supported for "
7203    "__device__, __constant__, and __shared__ variables.">;
7204def err_shared_var_init : Error<
7205    "initialization is not supported for __shared__ variables.">;
7206def err_device_static_local_var : Error<
7207    "within a %select{__device__|__global__|__host__|__host__ __device__}0 "
7208    "function, only __shared__ variables or const variables without device "
7209    "memory qualifier may be marked 'static'">;
7210def err_cuda_vla : Error<
7211    "cannot use variable-length arrays in "
7212    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7213def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
7214def err_cuda_host_shared : Error<
7215    "__shared__ local variables not allowed in "
7216    "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
7217def err_cuda_nonglobal_constant : Error<"__constant__ variables must be global">;
7218def err_cuda_ovl_target : Error<
7219  "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
7220  "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
7221def note_cuda_ovl_candidate_target_mismatch : Note<
7222    "candidate template ignored: target attributes do not match">;
7223
7224def warn_non_pod_vararg_with_format_string : Warning<
7225  "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
7226  "%select{function|block|method|constructor}2; expected type from format "
7227  "string was %3">, InGroup<NonPODVarargs>, DefaultError;
7228// The arguments to this diagnostic should match the warning above.
7229def err_cannot_pass_objc_interface_to_vararg_format : Error<
7230  "cannot pass object with interface type %1 by value to variadic "
7231  "%select{function|block|method|constructor}2; expected type from format "
7232  "string was %3">;
7233def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
7234  "cannot pass non-trivial C object of type %0 by value to variadic "
7235  "%select{function|block|method|constructor}1">;
7236
7237
7238def err_cannot_pass_objc_interface_to_vararg : Error<
7239  "cannot pass object with interface type %0 by value through variadic "
7240  "%select{function|block|method|constructor}1">;
7241def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
7242  "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
7243  " %select{function|block|method|constructor}2; call will abort at runtime">,
7244  InGroup<NonPODVarargs>, DefaultError;
7245def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
7246  "passing object of trivial but non-POD type %0 through variadic"
7247  " %select{function|block|method|constructor}1 is incompatible with C++98">,
7248  InGroup<CXX98Compat>, DefaultIgnore;
7249def warn_pass_class_arg_to_vararg : Warning<
7250  "passing object of class type %0 through variadic "
7251  "%select{function|block|method|constructor}1"
7252  "%select{|; did you mean to call '%3'?}2">,
7253  InGroup<ClassVarargs>, DefaultIgnore;
7254def err_cannot_pass_to_vararg : Error<
7255  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7256  "%select{function|block|method|constructor}2">;
7257def err_cannot_pass_to_vararg_format : Error<
7258  "cannot pass %select{expression of type %1|initializer list}0 to variadic "
7259  "%select{function|block|method|constructor}2; expected type from format "
7260  "string was %3">;
7261
7262def err_typecheck_call_invalid_ordered_compare : Error<
7263  "ordered compare requires two args of floating point type"
7264  "%diff{ ($ and $)|}0,1">;
7265def err_typecheck_call_invalid_unary_fp : Error<
7266  "floating point classification requires argument of floating point type "
7267  "(passed in %0)">;
7268def err_typecheck_cond_expect_int_float : Error<
7269  "used type %0 where integer or floating point type is required">;
7270def err_typecheck_cond_expect_scalar : Error<
7271  "used type %0 where arithmetic or pointer type is required">;
7272def err_typecheck_cond_expect_nonfloat : Error<
7273  "used type %0 where floating point type is not allowed">;
7274def ext_typecheck_cond_one_void : Extension<
7275  "C99 forbids conditional expressions with only one void side">;
7276def err_typecheck_cast_to_incomplete : Error<
7277  "cast to incomplete type %0">;
7278def ext_typecheck_cast_nonscalar : Extension<
7279  "C99 forbids casting nonscalar type %0 to the same type">;
7280def ext_typecheck_cast_to_union : Extension<
7281  "cast to union type is a GNU extension">,
7282  InGroup<GNUUnionCast>;
7283def err_typecheck_cast_to_union_no_type : Error<
7284  "cast to union type from type %0 not present in union">;
7285def err_cast_pointer_from_non_pointer_int : Error<
7286  "operand of type %0 cannot be cast to a pointer type">;
7287def warn_cast_pointer_from_sel : Warning<
7288  "cast of type %0 to %1 is deprecated; use sel_getName instead">,
7289  InGroup<SelTypeCast>;
7290def warn_function_def_in_objc_container : Warning<
7291  "function definition inside an Objective-C container is deprecated">,
7292  InGroup<FunctionDefInObjCContainer>;
7293
7294def warn_cast_calling_conv : Warning<
7295  "cast between incompatible calling conventions '%0' and '%1'; "
7296  "calls through this pointer may abort at runtime">,
7297  InGroup<DiagGroup<"cast-calling-convention">>;
7298def note_change_calling_conv_fixit : Note<
7299  "consider defining %0 with the '%1' calling convention">;
7300def warn_bad_function_cast : Warning<
7301  "cast from function call of type %0 to non-matching type %1">,
7302  InGroup<BadFunctionCast>, DefaultIgnore;
7303def err_cast_pointer_to_non_pointer_int : Error<
7304  "pointer cannot be cast to type %0">;
7305def err_typecheck_expect_scalar_operand : Error<
7306  "operand of type %0 where arithmetic or pointer type is required">;
7307def err_typecheck_cond_incompatible_operands : Error<
7308  "incompatible operand types%diff{ ($ and $)|}0,1">;
7309def err_cast_selector_expr : Error<
7310  "cannot type cast @selector expression">;
7311def ext_typecheck_cond_incompatible_pointers : ExtWarn<
7312  "pointer type mismatch%diff{ ($ and $)|}0,1">,
7313  InGroup<DiagGroup<"pointer-type-mismatch">>;
7314def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
7315  "pointer/integer type mismatch in conditional expression"
7316  "%diff{ ($ and $)|}0,1">,
7317  InGroup<DiagGroup<"conditional-type-mismatch">>;
7318def err_typecheck_choose_expr_requires_constant : Error<
7319  "'__builtin_choose_expr' requires a constant expression">;
7320def warn_unused_expr : Warning<"expression result unused">,
7321  InGroup<UnusedValue>;
7322def warn_unused_voidptr : Warning<
7323  "expression result unused; should this cast be to 'void'?">,
7324  InGroup<UnusedValue>;
7325def warn_unused_property_expr : Warning<
7326 "property access result unused - getters should not be used for side effects">,
7327  InGroup<UnusedGetterReturnValue>;
7328def warn_unused_container_subscript_expr : Warning<
7329 "container access result unused - container access should not be used for side effects">,
7330  InGroup<UnusedValue>;
7331def warn_unused_call : Warning<
7332  "ignoring return value of function declared with %0 attribute">,
7333  InGroup<UnusedValue>;
7334def warn_side_effects_unevaluated_context : Warning<
7335  "expression with side effects has no effect in an unevaluated context">,
7336  InGroup<UnevaluatedExpression>;
7337def warn_side_effects_typeid : Warning<
7338  "expression with side effects will be evaluated despite being used as an "
7339  "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
7340def warn_unused_result : Warning<
7341  "ignoring return value of function declared with %0 attribute">,
7342  InGroup<UnusedResult>;
7343def warn_unused_volatile : Warning<
7344  "expression result unused; assign into a variable to force a volatile load">,
7345  InGroup<DiagGroup<"unused-volatile-lvalue">>;
7346
7347def ext_cxx14_attr : Extension<
7348  "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
7349def ext_cxx17_attr : Extension<
7350  "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
7351
7352def warn_unused_comparison : Warning<
7353  "%select{equality|inequality|relational|three-way}0 comparison result unused">,
7354  InGroup<UnusedComparison>;
7355def note_inequality_comparison_to_or_assign : Note<
7356  "use '|=' to turn this inequality comparison into an or-assignment">;
7357
7358def err_incomplete_type_used_in_type_trait_expr : Error<
7359  "incomplete type %0 used in type trait expression">;
7360
7361def err_require_constant_init_failed : Error<
7362  "variable does not have a constant initializer">;
7363def note_declared_required_constant_init_here : Note<
7364  "required by 'require_constant_initialization' attribute here">;
7365
7366def err_dimension_expr_not_constant_integer : Error<
7367  "dimension expression does not evaluate to a constant unsigned int">;
7368
7369def err_typecheck_cond_incompatible_operands_null : Error<
7370  "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
7371def ext_empty_struct_union : Extension<
7372  "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
7373def ext_no_named_members_in_struct_union : Extension<
7374  "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
7375def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
7376  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7377  InGroup<CXXCompat>, DefaultIgnore;
7378def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
7379  "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
7380  InGroup<ExternCCompat>;
7381def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
7382  "volatile qualifiers|const qualifier|volatile qualifier}2">,
7383  InGroup<CastQual>, DefaultIgnore;
7384def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
7385  "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
7386def warn_redefine_extname_not_applied : Warning<
7387  "#pragma redefine_extname is applicable to external C declarations only; "
7388  "not applied to %select{function|variable}0 %1">,
7389  InGroup<Pragmas>;
7390} // End of general sema category.
7391
7392// inline asm.
7393let CategoryName = "Inline Assembly Issue" in {
7394  def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
7395  def err_asm_invalid_output_constraint : Error<
7396    "invalid output constraint '%0' in asm">;
7397  def err_asm_invalid_lvalue_in_input : Error<
7398    "invalid lvalue in asm input for constraint '%0'">;
7399  def err_asm_invalid_input_constraint : Error<
7400    "invalid input constraint '%0' in asm">;
7401  def err_asm_immediate_expected : Error<"constraint '%0' expects "
7402    "an integer constant expression">;
7403  def err_asm_tying_incompatible_types : Error<
7404    "unsupported inline asm: input with type "
7405    "%diff{$ matching output with type $|}0,1">;
7406  def err_asm_unexpected_constraint_alternatives : Error<
7407    "asm constraint has an unexpected number of alternatives: %0 vs %1">;
7408  def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
7409  def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
7410  def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
7411    "global register variables on this target">;
7412  def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
7413    "match variable size">;
7414  def err_asm_bad_register_type : Error<"bad type for named register variable">;
7415  def err_asm_invalid_input_size : Error<
7416    "invalid input size for constraint '%0'">;
7417  def err_asm_invalid_output_size : Error<
7418    "invalid output size for constraint '%0'">;
7419  def err_invalid_asm_cast_lvalue : Error<
7420    "invalid use of a cast in a inline asm context requiring an l-value: "
7421    "remove the cast or build with -fheinous-gnu-extensions">;
7422  def err_invalid_asm_value_for_constraint
7423      : Error <"value '%0' out of range for constraint '%1'">;
7424  def err_asm_non_addr_value_in_memory_constraint : Error <
7425    "reference to a %select{bit-field|vector element|global register variable}0"
7426    " in asm %select{input|output}1 with a memory constraint '%2'">;
7427  def err_asm_input_duplicate_match : Error<
7428    "more than one input constraint matches the same output '%0'">;
7429
7430  def warn_asm_label_on_auto_decl : Warning<
7431    "ignored asm label '%0' on automatic variable">;
7432  def warn_invalid_asm_cast_lvalue : Warning<
7433    "invalid use of a cast in an inline asm context requiring an l-value: "
7434    "accepted due to -fheinous-gnu-extensions, but clang may remove support "
7435    "for this in the future">;
7436  def warn_asm_mismatched_size_modifier : Warning<
7437    "value size does not match register size specified by the constraint "
7438    "and modifier">,
7439    InGroup<ASMOperandWidths>;
7440
7441  def note_asm_missing_constraint_modifier : Note<
7442    "use constraint modifier \"%0\"">;
7443  def note_asm_input_duplicate_first : Note<
7444    "constraint '%0' is already present here">;
7445}
7446
7447  def error_inoutput_conflict_with_clobber : Error<
7448    "asm-specifier for input or output variable conflicts with asm"
7449    " clobber list">;
7450
7451let CategoryName = "Semantic Issue" in {
7452
7453def err_invalid_conversion_between_vectors : Error<
7454  "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
7455  "size">;
7456def err_invalid_conversion_between_vector_and_integer : Error<
7457  "invalid conversion between vector type %0 and integer type %1 "
7458  "of different size">;
7459
7460def err_opencl_function_pointer : Error<
7461  "pointers to functions are not allowed">;
7462
7463def err_opencl_taking_address_capture : Error<
7464  "taking address of a capture is not allowed">;
7465
7466def err_invalid_conversion_between_vector_and_scalar : Error<
7467  "invalid conversion between vector type %0 and scalar type %1">;
7468
7469// C++ member initializers.
7470def err_only_constructors_take_base_inits : Error<
7471  "only constructors take base initializers">;
7472
7473def err_multiple_mem_initialization : Error <
7474  "multiple initializations given for non-static member %0">;
7475def err_multiple_mem_union_initialization : Error <
7476  "initializing multiple members of union">;
7477def err_multiple_base_initialization : Error <
7478  "multiple initializations given for base %0">;
7479
7480def err_mem_init_not_member_or_class : Error<
7481  "member initializer %0 does not name a non-static data member or base "
7482  "class">;
7483
7484def warn_initializer_out_of_order : Warning<
7485  "%select{field|base class}0 %1 will be initialized after "
7486  "%select{field|base}2 %3">,
7487  InGroup<Reorder>, DefaultIgnore;
7488def warn_abstract_vbase_init_ignored : Warning<
7489  "initializer for virtual base class %0 of abstract class %1 "
7490  "will never be used">,
7491  InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
7492
7493def err_base_init_does_not_name_class : Error<
7494  "constructor initializer %0 does not name a class">;
7495def err_base_init_direct_and_virtual : Error<
7496  "base class initializer %0 names both a direct base class and an "
7497  "inherited virtual base class">;
7498def err_not_direct_base_or_virtual : Error<
7499  "type %0 is not a direct or virtual base of %1">;
7500
7501def err_in_class_initializer_non_const : Error<
7502  "non-const static data member must be initialized out of line">;
7503def err_in_class_initializer_volatile : Error<
7504  "static const volatile data member must be initialized out of line">;
7505def err_in_class_initializer_bad_type : Error<
7506  "static data member of type %0 must be initialized out of line">;
7507def ext_in_class_initializer_float_type : ExtWarn<
7508  "in-class initializer for static data member of type %0 is a GNU extension">,
7509  InGroup<GNUStaticFloatInit>;
7510def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
7511  "in-class initializer for static data member of type %0 requires "
7512  "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
7513def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
7514def err_in_class_initializer_literal_type : Error<
7515  "in-class initializer for static data member of type %0 requires "
7516  "'constexpr' specifier">;
7517def err_in_class_initializer_non_constant : Error<
7518  "in-class initializer for static data member is not a constant expression">;
7519def err_in_class_initializer_not_yet_parsed : Error<
7520  "default member initializer for %1 needed within definition of enclosing "
7521  "class %0 outside of member functions">;
7522def note_in_class_initializer_not_yet_parsed : Note<
7523  "default member initializer declared here">;
7524def err_in_class_initializer_cycle
7525    : Error<"default member initializer for %0 uses itself">;
7526
7527def ext_in_class_initializer_non_constant : Extension<
7528  "in-class initializer for static data member is not a constant expression; "
7529  "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
7530
7531def err_thread_dynamic_init : Error<
7532  "initializer for thread-local variable must be a constant expression">;
7533def err_thread_nontrivial_dtor : Error<
7534  "type of thread-local variable has non-trivial destruction">;
7535def note_use_thread_local : Note<
7536  "use 'thread_local' to allow this">;
7537
7538// C++ anonymous unions and GNU anonymous structs/unions
7539def ext_anonymous_union : Extension<
7540  "anonymous unions are a C11 extension">, InGroup<C11>;
7541def ext_gnu_anonymous_struct : Extension<
7542  "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
7543def ext_c11_anonymous_struct : Extension<
7544  "anonymous structs are a C11 extension">, InGroup<C11>;
7545def err_anonymous_union_not_static : Error<
7546  "anonymous unions at namespace or global scope must be declared 'static'">;
7547def err_anonymous_union_with_storage_spec : Error<
7548  "anonymous union at class scope must not have a storage specifier">;
7549def err_anonymous_struct_not_member : Error<
7550  "anonymous %select{structs|structs and classes}0 must be "
7551  "%select{struct or union|class}0 members">;
7552def err_anonymous_record_member_redecl : Error<
7553  "member of anonymous %select{struct|union}0 redeclares %1">;
7554def err_anonymous_record_with_type : Error<
7555  "types cannot be declared in an anonymous %select{struct|union}0">;
7556def ext_anonymous_record_with_type : Extension<
7557  "types declared in an anonymous %select{struct|union}0 are a Microsoft "
7558  "extension">, InGroup<MicrosoftAnonTag>;
7559def ext_anonymous_record_with_anonymous_type : Extension<
7560  "anonymous types declared in an anonymous %select{struct|union}0 "
7561  "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
7562def err_anonymous_record_with_function : Error<
7563  "functions cannot be declared in an anonymous %select{struct|union}0">;
7564def err_anonymous_record_with_static : Error<
7565  "static members cannot be declared in an anonymous %select{struct|union}0">;
7566def err_anonymous_record_bad_member : Error<
7567  "anonymous %select{struct|union}0 can only contain non-static data members">;
7568def err_anonymous_record_nonpublic_member : Error<
7569  "anonymous %select{struct|union}0 cannot contain a "
7570  "%select{private|protected}1 data member">;
7571def ext_ms_anonymous_record : ExtWarn<
7572  "anonymous %select{structs|unions}0 are a Microsoft extension">,
7573  InGroup<MicrosoftAnonTag>;
7574
7575// C++ local classes
7576def err_reference_to_local_in_enclosing_context : Error<
7577  "reference to local %select{variable|binding}1 %0 declared in enclosing "
7578  "%select{%3|block literal|lambda expression|context}2">;
7579
7580def err_static_data_member_not_allowed_in_local_class : Error<
7581  "static data member %0 not allowed in local class %1">;
7582
7583// C++ derived classes
7584def err_base_clause_on_union : Error<"unions cannot have base classes">;
7585def err_base_must_be_class : Error<"base specifier must name a class">;
7586def err_union_as_base_class : Error<"unions cannot be base classes">;
7587def err_circular_inheritance : Error<
7588  "circular inheritance between %0 and %1">;
7589def err_base_class_has_flexible_array_member : Error<
7590  "base class %0 has a flexible array member">;
7591def err_incomplete_base_class : Error<"base class has incomplete type">;
7592def err_duplicate_base_class : Error<
7593  "base class %0 specified more than once as a direct base class">;
7594def warn_inaccessible_base_class : Warning<
7595  "direct base %0 is inaccessible due to ambiguity:%1">,
7596  InGroup<DiagGroup<"inaccessible-base">>;
7597// FIXME: better way to display derivation?  Pass entire thing into diagclient?
7598def err_ambiguous_derived_to_base_conv : Error<
7599  "ambiguous conversion from derived class %0 to base class %1:%2">;
7600def err_ambiguous_memptr_conv : Error<
7601  "ambiguous conversion from pointer to member of %select{base|derived}0 "
7602  "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
7603def ext_ms_ambiguous_direct_base : ExtWarn<
7604  "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
7605  InGroup<MicrosoftInaccessibleBase>;
7606
7607def err_memptr_conv_via_virtual : Error<
7608  "conversion from pointer to member of class %0 to pointer to member "
7609  "of class %1 via virtual base %2 is not allowed">;
7610
7611// C++ member name lookup
7612def err_ambiguous_member_multiple_subobjects : Error<
7613  "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
7614def err_ambiguous_member_multiple_subobject_types : Error<
7615  "member %0 found in multiple base classes of different types">;
7616def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
7617def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
7618def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
7619def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
7620  "declaration in a different namespace">;
7621def note_hidden_tag : Note<"type declaration hidden">;
7622def note_hiding_object : Note<"declaration hides type">;
7623
7624// C++ operator overloading
7625def err_operator_overload_needs_class_or_enum : Error<
7626  "overloaded %0 must have at least one parameter of class "
7627  "or enumeration type">;
7628
7629def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
7630def err_operator_overload_static : Error<
7631  "overloaded %0 cannot be a static member function">;
7632def err_operator_overload_default_arg : Error<
7633  "parameter of overloaded %0 cannot have a default argument">;
7634def err_operator_overload_must_be : Error<
7635  "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
7636  "(has %1 parameter%s1)">;
7637
7638def err_operator_overload_must_be_member : Error<
7639  "overloaded %0 must be a non-static member function">;
7640def err_operator_overload_post_incdec_must_be_int : Error<
7641  "parameter of overloaded post-%select{increment|decrement}1 operator must "
7642  "have type 'int' (not %0)">;
7643
7644// C++ allocation and deallocation functions.
7645def err_operator_new_delete_declared_in_namespace : Error<
7646  "%0 cannot be declared inside a namespace">;
7647def err_operator_new_delete_declared_static : Error<
7648  "%0 cannot be declared static in global scope">;
7649def ext_operator_new_delete_declared_inline : ExtWarn<
7650  "replacement function %0 cannot be declared 'inline'">,
7651  InGroup<DiagGroup<"inline-new-delete">>;
7652def err_operator_new_delete_invalid_result_type : Error<
7653  "%0 must return type %1">;
7654def err_operator_new_delete_dependent_result_type : Error<
7655  "%0 cannot have a dependent return type; use %1 instead">;
7656def err_operator_new_delete_too_few_parameters : Error<
7657  "%0 must have at least one parameter">;
7658def err_operator_new_delete_template_too_few_parameters : Error<
7659  "%0 template must have at least two parameters">;
7660def warn_operator_new_returns_null : Warning<
7661  "%0 should not return a null pointer unless it is declared 'throw()'"
7662  "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
7663
7664def err_operator_new_dependent_param_type : Error<
7665  "%0 cannot take a dependent type as first parameter; "
7666  "use size_t (%1) instead">;
7667def err_operator_new_param_type : Error<
7668  "%0 takes type size_t (%1) as first parameter">;
7669def err_operator_new_default_arg: Error<
7670  "parameter of %0 cannot have a default argument">;
7671def err_operator_delete_dependent_param_type : Error<
7672  "%0 cannot take a dependent type as first parameter; use %1 instead">;
7673def err_operator_delete_param_type : Error<
7674  "first parameter of %0 must have type %1">;
7675def err_destroying_operator_delete_not_usual : Error<
7676  "destroying operator delete can have only an optional size and optional "
7677  "alignment parameter">;
7678def note_implicit_delete_this_in_destructor_here : Note<
7679  "while checking implicit 'delete this' for virtual destructor">;
7680def err_builtin_operator_new_delete_not_usual : Error<
7681  "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
7682  "selects non-usual %select{allocation|deallocation}0 function">;
7683def note_non_usual_function_declared_here : Note<
7684  "non-usual %0 declared here">;
7685
7686// C++ literal operators
7687def err_literal_operator_outside_namespace : Error<
7688  "literal operator %0 must be in a namespace or global scope">;
7689def err_literal_operator_id_outside_namespace : Error<
7690  "non-namespace scope '%0' cannot have a literal operator member">;
7691def err_literal_operator_default_argument : Error<
7692  "literal operator cannot have a default argument">;
7693def err_literal_operator_bad_param_count : Error<
7694  "non-template literal operator must have one or two parameters">;
7695def err_literal_operator_invalid_param : Error<
7696  "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
7697def err_literal_operator_param : Error<
7698  "invalid literal operator parameter type %0, did you mean %1?">;
7699def err_literal_operator_template_with_params : Error<
7700  "literal operator template cannot have any parameters">;
7701def err_literal_operator_template : Error<
7702  "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
7703def err_literal_operator_extern_c : Error<
7704  "literal operator must have C++ linkage">;
7705def ext_string_literal_operator_template : ExtWarn<
7706  "string literal operator templates are a GNU extension">,
7707  InGroup<GNUStringLiteralOperatorTemplate>;
7708def warn_user_literal_reserved : Warning<
7709  "user-defined literal suffixes not starting with '_' are reserved"
7710  "%select{; no literal will invoke this operator|}0">,
7711  InGroup<UserDefinedLiterals>;
7712
7713// C++ conversion functions
7714def err_conv_function_not_member : Error<
7715  "conversion function must be a non-static member function">;
7716def err_conv_function_return_type : Error<
7717  "conversion function cannot have a return type">;
7718def err_conv_function_with_params : Error<
7719  "conversion function cannot have any parameters">;
7720def err_conv_function_variadic : Error<
7721  "conversion function cannot be variadic">;
7722def err_conv_function_to_array : Error<
7723  "conversion function cannot convert to an array type">;
7724def err_conv_function_to_function : Error<
7725  "conversion function cannot convert to a function type">;
7726def err_conv_function_with_complex_decl : Error<
7727  "cannot specify any part of a return type in the "
7728  "declaration of a conversion function"
7729  "%select{"
7730  "; put the complete type after 'operator'|"
7731  "; use a typedef to declare a conversion to %1|"
7732  "; use an alias template to declare a conversion to %1|"
7733  "}0">;
7734def err_conv_function_redeclared : Error<
7735  "conversion function cannot be redeclared">;
7736def warn_conv_to_self_not_used : Warning<
7737  "conversion function converting %0 to itself will never be used">;
7738def warn_conv_to_base_not_used : Warning<
7739  "conversion function converting %0 to its base class %1 will never be used">;
7740def warn_conv_to_void_not_used : Warning<
7741  "conversion function converting %0 to %1 will never be used">;
7742
7743def warn_not_compound_assign : Warning<
7744  "use of unary operator that may be intended as compound assignment (%0=)">;
7745
7746// C++11 explicit conversion operators
7747def ext_explicit_conversion_functions : ExtWarn<
7748  "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
7749def warn_cxx98_compat_explicit_conversion_functions : Warning<
7750  "explicit conversion functions are incompatible with C++98">,
7751  InGroup<CXX98Compat>, DefaultIgnore;
7752
7753// C++11 defaulted functions
7754def err_defaulted_special_member_params : Error<
7755  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
7756  "have default arguments">;
7757def err_defaulted_special_member_variadic : Error<
7758  "an explicitly-defaulted %select{|copy |move }0constructor cannot "
7759  "be variadic">;
7760def err_defaulted_special_member_return_type : Error<
7761  "explicitly-defaulted %select{copy|move}0 assignment operator must "
7762  "return %1">;
7763def err_defaulted_special_member_quals : Error<
7764  "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
7765  "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
7766def err_defaulted_special_member_volatile_param : Error<
7767  "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
7768  "may not be volatile">;
7769def err_defaulted_special_member_move_const_param : Error<
7770  "the parameter for an explicitly-defaulted move "
7771  "%select{constructor|assignment operator}0 may not be const">;
7772def err_defaulted_special_member_copy_const_param : Error<
7773  "the parameter for this explicitly-defaulted copy "
7774  "%select{constructor|assignment operator}0 is const, but a member or base "
7775  "requires it to be non-const">;
7776def err_defaulted_copy_assign_not_ref : Error<
7777  "the parameter for an explicitly-defaulted copy assignment operator must be an "
7778  "lvalue reference type">;
7779def err_incorrect_defaulted_exception_spec : Error<
7780  "exception specification of explicitly defaulted "
7781  "%sub{select_special_member_kind}0 does not match the calculated one">;
7782def err_incorrect_defaulted_constexpr : Error<
7783  "defaulted definition of %sub{select_special_member_kind}0 "
7784  "is not constexpr">;
7785def warn_defaulted_method_deleted : Warning<
7786  "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
7787  "deleted">, InGroup<DiagGroup<"defaulted-function-deleted">>;
7788def err_out_of_line_default_deletes : Error<
7789  "defaulting this %sub{select_special_member_kind}0 "
7790  "would delete it after its first declaration">;
7791def note_deleted_type_mismatch : Note<
7792  "function is implicitly deleted because its declared type does not match "
7793  "the type of an implicit %sub{select_special_member_kind}0">;
7794def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
7795  "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
7796  "different from the implicit type is incompatible with C++ standards before "
7797  "C++2a">, InGroup<CXXPre2aCompat>, DefaultIgnore;
7798def warn_vbase_moved_multiple_times : Warning<
7799  "defaulted move assignment operator of %0 will move assign virtual base "
7800  "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
7801def note_vbase_moved_here : Note<
7802  "%select{%1 is a virtual base class of base class %2 declared here|"
7803  "virtual base class %1 declared here}0">;
7804
7805def ext_implicit_exception_spec_mismatch : ExtWarn<
7806  "function previously declared with an %select{explicit|implicit}0 exception "
7807  "specification redeclared with an %select{implicit|explicit}0 exception "
7808  "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
7809
7810def warn_ptr_arith_precedes_bounds : Warning<
7811  "the pointer decremented by %0 refers before the beginning of the array">,
7812  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
7813def warn_ptr_arith_exceeds_bounds : Warning<
7814  "the pointer incremented by %0 refers past the end of the array (that "
7815  "contains %1 element%s2)">,
7816  InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
7817def warn_array_index_precedes_bounds : Warning<
7818  "array index %0 is before the beginning of the array">,
7819  InGroup<ArrayBounds>;
7820def warn_array_index_exceeds_bounds : Warning<
7821  "array index %0 is past the end of the array (which contains %1 "
7822  "element%s2)">, InGroup<ArrayBounds>;
7823def note_array_index_out_of_bounds : Note<
7824  "array %0 declared here">;
7825
7826def warn_printf_insufficient_data_args : Warning<
7827  "more '%%' conversions than data arguments">, InGroup<Format>;
7828def warn_printf_data_arg_not_used : Warning<
7829  "data argument not used by format string">, InGroup<FormatExtraArgs>;
7830def warn_format_invalid_conversion : Warning<
7831  "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
7832def warn_printf_incomplete_specifier : Warning<
7833  "incomplete format specifier">, InGroup<Format>;
7834def warn_missing_format_string : Warning<
7835  "format string missing">, InGroup<Format>;
7836def warn_scanf_nonzero_width : Warning<
7837  "zero field width in scanf format string is unused">,
7838  InGroup<Format>;
7839def warn_format_conversion_argument_type_mismatch : Warning<
7840  "format specifies type %0 but the argument has "
7841  "%select{type|underlying type}2 %1">,
7842  InGroup<Format>;
7843def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
7844  "format specifies type %0 but the argument has "
7845  "%select{type|underlying type}2 %1">,
7846  InGroup<FormatPedantic>;
7847def warn_format_argument_needs_cast : Warning<
7848  "%select{values of type|enum values with underlying type}2 '%0' should not "
7849  "be used as format arguments; add an explicit cast to %1 instead">,
7850  InGroup<Format>;
7851def warn_format_argument_needs_cast_pedantic : Warning<
7852  "%select{values of type|enum values with underlying type}2 '%0' should not "
7853  "be used as format arguments; add an explicit cast to %1 instead">,
7854  InGroup<FormatPedantic>, DefaultIgnore;
7855def warn_printf_positional_arg_exceeds_data_args : Warning <
7856  "data argument position '%0' exceeds the number of data arguments (%1)">,
7857  InGroup<Format>;
7858def warn_format_zero_positional_specifier : Warning<
7859  "position arguments in format strings start counting at 1 (not 0)">,
7860  InGroup<Format>;
7861def warn_format_invalid_positional_specifier : Warning<
7862  "invalid position specified for %select{field width|field precision}0">,
7863  InGroup<Format>;
7864def warn_format_mix_positional_nonpositional_args : Warning<
7865  "cannot mix positional and non-positional arguments in format string">,
7866  InGroup<Format>;
7867def warn_static_array_too_small : Warning<
7868  "array argument is too small; %select{contains %0 elements|is of size %0}2,"
7869  " callee requires at least %1">,
7870  InGroup<ArrayBounds>;
7871def note_callee_static_array : Note<
7872  "callee declares array parameter as static here">;
7873def warn_empty_format_string : Warning<
7874  "format string is empty">, InGroup<FormatZeroLength>;
7875def warn_format_string_is_wide_literal : Warning<
7876  "format string should not be a wide string">, InGroup<Format>;
7877def warn_printf_format_string_contains_null_char : Warning<
7878  "format string contains '\\0' within the string body">, InGroup<Format>;
7879def warn_printf_format_string_not_null_terminated : Warning<
7880  "format string is not null-terminated">, InGroup<Format>;
7881def warn_printf_asterisk_missing_arg : Warning<
7882  "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
7883  InGroup<Format>;
7884def warn_printf_asterisk_wrong_type : Warning<
7885  "field %select{width|precision}0 should have type %1, but argument has type %2">,
7886  InGroup<Format>;
7887def warn_printf_nonsensical_optional_amount: Warning<
7888  "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
7889  InGroup<Format>;
7890def warn_printf_nonsensical_flag: Warning<
7891  "flag '%0' results in undefined behavior with '%1' conversion specifier">,
7892  InGroup<Format>;
7893def warn_format_nonsensical_length: Warning<
7894  "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
7895  InGroup<Format>;
7896def warn_format_non_standard_positional_arg: Warning<
7897  "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
7898def warn_format_non_standard: Warning<
7899  "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
7900  InGroup<FormatNonStandard>, DefaultIgnore;
7901def warn_format_non_standard_conversion_spec: Warning<
7902  "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
7903  InGroup<FormatNonStandard>, DefaultIgnore;
7904def err_invalid_mask_type_size : Error<
7905  "mask type size must be between 1-byte and 8-bytes">;
7906def warn_format_invalid_annotation : Warning<
7907  "using '%0' format specifier annotation outside of os_log()/os_trace()">,
7908  InGroup<Format>;
7909def warn_format_P_no_precision : Warning<
7910  "using '%%P' format specifier without precision">,
7911  InGroup<Format>;
7912def warn_printf_ignored_flag: Warning<
7913  "flag '%0' is ignored when flag '%1' is present">,
7914  InGroup<Format>;
7915def warn_printf_empty_objc_flag: Warning<
7916  "missing object format flag">,
7917  InGroup<Format>;
7918def warn_printf_ObjCflags_without_ObjCConversion: Warning<
7919  "object format flags cannot be used with '%0' conversion specifier">,
7920  InGroup<Format>;
7921def warn_printf_invalid_objc_flag: Warning<
7922    "'%0' is not a valid object format flag">,
7923    InGroup<Format>;
7924def warn_scanf_scanlist_incomplete : Warning<
7925  "no closing ']' for '%%[' in scanf format string">,
7926  InGroup<Format>;
7927def note_format_string_defined : Note<"format string is defined here">;
7928def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
7929def note_printf_c_str: Note<"did you mean to call the %0 method?">;
7930def note_format_security_fixit: Note<
7931  "treat the string as an argument to avoid this">;
7932
7933def warn_null_arg : Warning<
7934  "null passed to a callee that requires a non-null argument">,
7935  InGroup<NonNull>;
7936def warn_null_ret : Warning<
7937  "null returned from %select{function|method}0 that requires a non-null return value">,
7938  InGroup<NonNull>;
7939
7940def err_lifetimebound_no_object_param : Error<
7941  "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
7942  "function has no implicit object parameter">;
7943def err_lifetimebound_ctor_dtor : Error<
7944  "'lifetimebound' attribute cannot be applied to a "
7945  "%select{constructor|destructor}0">;
7946
7947// CHECK: returning address/reference of stack memory
7948def warn_ret_stack_addr_ref : Warning<
7949  "%select{address of|reference to}0 stack memory associated with "
7950  "%select{local variable|parameter}2 %1 returned">,
7951  InGroup<ReturnStackAddress>;
7952def warn_ret_local_temp_addr_ref : Warning<
7953  "returning %select{address of|reference to}0 local temporary object">,
7954  InGroup<ReturnStackAddress>;
7955def warn_ret_addr_label : Warning<
7956  "returning address of label, which is local">,
7957  InGroup<ReturnStackAddress>;
7958def err_ret_local_block : Error<
7959  "returning block that lives on the local stack">;
7960def note_local_var_initializer : Note<
7961  "%select{via initialization of|binding reference}0 variable "
7962  "%select{%2 |}1here">;
7963def note_init_with_default_member_initalizer : Note<
7964  "initializing field %0 with default member initializer">;
7965
7966// Check for initializing a member variable with the address or a reference to
7967// a constructor parameter.
7968def warn_bind_ref_member_to_parameter : Warning<
7969  "binding reference member %0 to stack allocated "
7970  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
7971def warn_init_ptr_member_to_parameter_addr : Warning<
7972  "initializing pointer member %0 with the stack address of "
7973  "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
7974def note_ref_or_ptr_member_declared_here : Note<
7975  "%select{reference|pointer}0 member declared here">;
7976
7977def err_dangling_member : Error<
7978  "%select{reference|backing array for 'std::initializer_list'}2 "
7979  "%select{|subobject of }1member %0 "
7980  "%select{binds to|is}2 a temporary object "
7981  "whose lifetime would be shorter than the lifetime of "
7982  "the constructed object">;
7983def warn_dangling_member : Warning<
7984  "%select{reference|backing array for 'std::initializer_list'}2 "
7985  "%select{|subobject of }1member %0 "
7986  "%select{binds to|is}2 a temporary object "
7987  "whose lifetime is shorter than the lifetime of the constructed object">,
7988  InGroup<DanglingField>;
7989def note_lifetime_extending_member_declared_here : Note<
7990  "%select{%select{reference|'std::initializer_list'}0 member|"
7991  "member with %select{reference|'std::initializer_list'}0 subobject}1 "
7992  "declared here">;
7993def warn_dangling_variable : Warning<
7994  "%select{temporary %select{whose address is used as value of|"
7995  "%select{|implicitly }2bound to}4 "
7996  "%select{%select{|reference }4member of local variable|"
7997  "local %select{variable|reference}4}1|"
7998  "array backing "
7999  "%select{initializer list subobject of local variable|"
8000  "local initializer list}1}0 "
8001  "%select{%3 |}2will be destroyed at the end of the full-expression">,
8002  InGroup<Dangling>;
8003def warn_new_dangling_reference : Warning<
8004  "temporary bound to reference member of allocated object "
8005  "will be destroyed at the end of the full-expression">,
8006  InGroup<DanglingField>;
8007def warn_new_dangling_initializer_list : Warning<
8008  "array backing "
8009  "%select{initializer list subobject of the allocated object|"
8010  "the allocated initializer list}0 "
8011  "will be destroyed at the end of the full-expression">,
8012  InGroup<DanglingInitializerList>;
8013def warn_unsupported_lifetime_extension : Warning<
8014  "sorry, lifetime extension of "
8015  "%select{temporary|backing array of initializer list}0 created "
8016  "by aggregate initialization using default member initializer "
8017  "is not supported; lifetime of %select{temporary|backing array}0 "
8018  "will end at the end of the full-expression">, InGroup<Dangling>;
8019
8020// For non-floating point, expressions of the form x == x or x != x
8021// should result in a warning, since these always evaluate to a constant.
8022// Array comparisons have similar warnings
8023def warn_comparison_always : Warning<
8024  "%select{self-|array }0comparison always evaluates to %select{a constant|%2}1">,
8025  InGroup<TautologicalCompare>;
8026def warn_comparison_bitwise_always : Warning<
8027  "bitwise comparison always evaluates to %select{false|true}0">,
8028  InGroup<TautologicalCompare>;
8029def warn_tautological_overlap_comparison : Warning<
8030  "overlapping comparisons always evaluate to %select{false|true}0">,
8031  InGroup<TautologicalOverlapCompare>, DefaultIgnore;
8032
8033def warn_stringcompare : Warning<
8034  "result of comparison against %select{a string literal|@encode}0 is "
8035  "unspecified (use strncmp instead)">,
8036  InGroup<StringCompare>;
8037
8038def warn_identity_field_assign : Warning<
8039  "assigning %select{field|instance variable}0 to itself">,
8040  InGroup<SelfAssignmentField>;
8041
8042// Type safety attributes
8043def err_type_tag_for_datatype_not_ice : Error<
8044  "'type_tag_for_datatype' attribute requires the initializer to be "
8045  "an %select{integer|integral}0 constant expression">;
8046def err_type_tag_for_datatype_too_large : Error<
8047  "'type_tag_for_datatype' attribute requires the initializer to be "
8048  "an %select{integer|integral}0 constant expression "
8049  "that can be represented by a 64 bit integer">;
8050def err_tag_index_out_of_range : Error<
8051  "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
8052def warn_type_tag_for_datatype_wrong_kind : Warning<
8053  "this type tag was not designed to be used with this function">,
8054  InGroup<TypeSafety>;
8055def warn_type_safety_type_mismatch : Warning<
8056  "argument type %0 doesn't match specified %1 type tag "
8057  "%select{that requires %3|}2">, InGroup<TypeSafety>;
8058def warn_type_safety_null_pointer_required : Warning<
8059  "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
8060
8061// Generic selections.
8062def err_assoc_type_incomplete : Error<
8063  "type %0 in generic association incomplete">;
8064def err_assoc_type_nonobject : Error<
8065  "type %0 in generic association not an object type">;
8066def err_assoc_type_variably_modified : Error<
8067  "type %0 in generic association is a variably modified type">;
8068def err_assoc_compatible_types : Error<
8069  "type %0 in generic association compatible with previously specified type %1">;
8070def note_compat_assoc : Note<
8071  "compatible type %0 specified here">;
8072def err_generic_sel_no_match : Error<
8073  "controlling expression type %0 not compatible with any generic association type">;
8074def err_generic_sel_multi_match : Error<
8075  "controlling expression type %0 compatible with %1 generic association types">;
8076
8077
8078// Blocks
8079def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
8080  " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
8081def err_block_returning_array_function : Error<
8082  "block cannot return %select{array|function}0 type %1">;
8083
8084// Builtin annotation
8085def err_builtin_annotation_first_arg : Error<
8086  "first argument to __builtin_annotation must be an integer">;
8087def err_builtin_annotation_second_arg : Error<
8088  "second argument to __builtin_annotation must be a non-wide string constant">;
8089def err_msvc_annotation_wide_str : Error<
8090  "arguments to __annotation must be wide string constants">;
8091
8092// CFString checking
8093def err_cfstring_literal_not_string_constant : Error<
8094  "CFString literal is not a string constant">;
8095def warn_cfstring_truncated : Warning<
8096  "input conversion stopped due to an input byte that does not "
8097  "belong to the input codeset UTF-8">,
8098  InGroup<DiagGroup<"CFString-literal">>;
8099
8100// os_log checking
8101// TODO: separate diagnostic for os_trace()
8102def err_os_log_format_not_string_constant : Error<
8103  "os_log() format argument is not a string constant">;
8104def err_os_log_argument_too_big : Error<
8105  "os_log() argument %0 is too big (%1 bytes, max %2)">;
8106def warn_os_log_format_narg : Error<
8107 "os_log() '%%n' format specifier is not allowed">, DefaultError;
8108
8109// Statements.
8110def err_continue_not_in_loop : Error<
8111  "'continue' statement not in loop statement">;
8112def err_break_not_in_loop_or_switch : Error<
8113  "'break' statement not in loop or switch statement">;
8114def warn_loop_ctrl_binds_to_inner : Warning<
8115  "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
8116  InGroup<GccCompat>;
8117def warn_break_binds_to_switch : Warning<
8118  "'break' is bound to loop, GCC binds it to switch">,
8119  InGroup<GccCompat>;
8120def err_default_not_in_switch : Error<
8121  "'default' statement not in switch statement">;
8122def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
8123def warn_bool_switch_condition : Warning<
8124  "switch condition has boolean value">, InGroup<SwitchBool>;
8125def warn_case_value_overflow : Warning<
8126  "overflow converting case value to switch condition type (%0 to %1)">,
8127  InGroup<Switch>;
8128def err_duplicate_case : Error<"duplicate case value '%0'">;
8129def err_duplicate_case_differing_expr : Error<
8130  "duplicate case value: '%0' and '%1' both equal '%2'">;
8131def warn_case_empty_range : Warning<"empty case range specified">;
8132def warn_missing_case_for_condition :
8133  Warning<"no case matching constant switch condition '%0'">;
8134
8135def warn_def_missing_case : Warning<"%plural{"
8136  "1:enumeration value %1 not explicitly handled in switch|"
8137  "2:enumeration values %1 and %2 not explicitly handled in switch|"
8138  "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
8139  ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
8140  InGroup<SwitchEnum>, DefaultIgnore;
8141
8142def warn_missing_case : Warning<"%plural{"
8143  "1:enumeration value %1 not handled in switch|"
8144  "2:enumeration values %1 and %2 not handled in switch|"
8145  "3:enumeration values %1, %2, and %3 not handled in switch|"
8146  ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
8147  InGroup<Switch>;
8148
8149def warn_unannotated_fallthrough : Warning<
8150  "unannotated fall-through between switch labels">,
8151  InGroup<ImplicitFallthrough>, DefaultIgnore;
8152def warn_unannotated_fallthrough_per_function : Warning<
8153  "unannotated fall-through between switch labels in partly-annotated "
8154  "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
8155def note_insert_fallthrough_fixit : Note<
8156  "insert '%0;' to silence this warning">;
8157def note_insert_break_fixit : Note<
8158  "insert 'break;' to avoid fall-through">;
8159def err_fallthrough_attr_wrong_target : Error<
8160  "%0 attribute is only allowed on empty statements">;
8161def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
8162def err_fallthrough_attr_outside_switch : Error<
8163  "fallthrough annotation is outside switch statement">;
8164def err_fallthrough_attr_invalid_placement : Error<
8165  "fallthrough annotation does not directly precede switch label">;
8166def warn_fallthrough_attr_unreachable : Warning<
8167  "fallthrough annotation in unreachable code">,
8168  InGroup<ImplicitFallthrough>, DefaultIgnore;
8169
8170def warn_unreachable_default : Warning<
8171  "default label in switch which covers all enumeration values">,
8172  InGroup<CoveredSwitchDefault>, DefaultIgnore;
8173def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
8174  InGroup<Switch>;
8175def warn_not_in_enum_assignment : Warning<"integer constant not in range "
8176  "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
8177def err_typecheck_statement_requires_scalar : Error<
8178  "statement requires expression of scalar type (%0 invalid)">;
8179def err_typecheck_statement_requires_integer : Error<
8180  "statement requires expression of integer type (%0 invalid)">;
8181def err_multiple_default_labels_defined : Error<
8182  "multiple default labels in one switch">;
8183def err_switch_multiple_conversions : Error<
8184  "multiple conversions from switch condition type %0 to an integral or "
8185  "enumeration type">;
8186def note_switch_conversion : Note<
8187  "conversion to %select{integral|enumeration}0 type %1">;
8188def err_switch_explicit_conversion : Error<
8189  "switch condition type %0 requires explicit conversion to %1">;
8190def err_switch_incomplete_class_type : Error<
8191  "switch condition has incomplete class type %0">;
8192
8193def warn_empty_if_body : Warning<
8194  "if statement has empty body">, InGroup<EmptyBody>;
8195def warn_empty_for_body : Warning<
8196  "for loop has empty body">, InGroup<EmptyBody>;
8197def warn_empty_range_based_for_body : Warning<
8198  "range-based for loop has empty body">, InGroup<EmptyBody>;
8199def warn_empty_while_body : Warning<
8200  "while loop has empty body">, InGroup<EmptyBody>;
8201def warn_empty_switch_body : Warning<
8202  "switch statement has empty body">, InGroup<EmptyBody>;
8203def note_empty_body_on_separate_line : Note<
8204  "put the semicolon on a separate line to silence this warning">;
8205
8206def err_va_start_captured_stmt : Error<
8207  "'va_start' cannot be used in a captured statement">;
8208def err_va_start_outside_function : Error<
8209  "'va_start' cannot be used outside a function">;
8210def err_va_start_fixed_function : Error<
8211  "'va_start' used in function with fixed args">;
8212def err_va_start_used_in_wrong_abi_function : Error<
8213  "'va_start' used in %select{System V|Win64}0 ABI function">;
8214def err_ms_va_start_used_in_sysv_function : Error<
8215  "'__builtin_ms_va_start' used in System V ABI function">;
8216def warn_second_arg_of_va_start_not_last_named_param : Warning<
8217  "second argument to 'va_start' is not the last named parameter">,
8218  InGroup<Varargs>;
8219def warn_va_start_type_is_undefined : Warning<
8220  "passing %select{an object that undergoes default argument promotion|"
8221  "an object of reference type|a parameter declared with the 'register' "
8222  "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
8223def err_first_argument_to_va_arg_not_of_type_va_list : Error<
8224  "first argument to 'va_arg' is of type %0 and not 'va_list'">;
8225def err_second_parameter_to_va_arg_incomplete: Error<
8226  "second argument to 'va_arg' is of incomplete type %0">;
8227def err_second_parameter_to_va_arg_abstract: Error<
8228  "second argument to 'va_arg' is of abstract type %0">;
8229def warn_second_parameter_to_va_arg_not_pod : Warning<
8230  "second argument to 'va_arg' is of non-POD type %0">,
8231  InGroup<NonPODVarargs>, DefaultError;
8232def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
8233  "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
8234  InGroup<NonPODVarargs>, DefaultError;
8235def warn_second_parameter_to_va_arg_never_compatible : Warning<
8236  "second argument to 'va_arg' is of promotable type %0; this va_arg has "
8237  "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
8238
8239def warn_return_missing_expr : Warning<
8240  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8241  InGroup<ReturnType>;
8242def ext_return_missing_expr : ExtWarn<
8243  "non-void %select{function|method}1 %0 should return a value">, DefaultError,
8244  InGroup<ReturnType>;
8245def ext_return_has_expr : ExtWarn<
8246  "%select{void function|void method|constructor|destructor}1 %0 "
8247  "should not return a value">,
8248  DefaultError, InGroup<ReturnType>;
8249def ext_return_has_void_expr : Extension<
8250  "void %select{function|method|block}1 %0 should not return void expression">;
8251def err_return_init_list : Error<
8252  "%select{void function|void method|constructor|destructor}1 %0 "
8253  "must not return a value">;
8254def err_ctor_dtor_returns_void : Error<
8255  "%select{constructor|destructor}1 %0 must not return void expression">;
8256def warn_noreturn_function_has_return_expr : Warning<
8257  "function %0 declared 'noreturn' should not return">,
8258  InGroup<InvalidNoreturn>;
8259def warn_falloff_noreturn_function : Warning<
8260  "function declared 'noreturn' should not return">,
8261  InGroup<InvalidNoreturn>;
8262def err_noreturn_block_has_return_expr : Error<
8263  "block declared 'noreturn' should not return">;
8264def err_noreturn_missing_on_first_decl : Error<
8265  "function declared '[[noreturn]]' after its first declaration">;
8266def note_noreturn_missing_first_decl : Note<
8267  "declaration missing '[[noreturn]]' attribute is here">;
8268def err_carries_dependency_missing_on_first_decl : Error<
8269  "%select{function|parameter}0 declared '[[carries_dependency]]' "
8270  "after its first declaration">;
8271def note_carries_dependency_missing_first_decl : Note<
8272  "declaration missing '[[carries_dependency]]' attribute is here">;
8273def err_carries_dependency_param_not_function_decl : Error<
8274  "'[[carries_dependency]]' attribute only allowed on parameter in a function "
8275  "declaration or lambda">;
8276def err_block_on_nonlocal : Error<
8277  "__block attribute not allowed, only allowed on local variables">;
8278def err_block_on_vm : Error<
8279  "__block attribute not allowed on declaration with a variably modified type">;
8280
8281def err_vec_builtin_non_vector : Error<
8282 "first two arguments to %0 must be vectors">;
8283def err_vec_builtin_incompatible_vector : Error<
8284  "first two arguments to %0 must have the same type">;
8285def err_vsx_builtin_nonconstant_argument : Error<
8286  "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
8287
8288def err_shufflevector_nonconstant_argument : Error<
8289  "index for __builtin_shufflevector must be a constant integer">;
8290def err_shufflevector_argument_too_large : Error<
8291  "index for __builtin_shufflevector must be less than the total number "
8292  "of vector elements">;
8293
8294def err_convertvector_non_vector : Error<
8295  "first argument to __builtin_convertvector must be a vector">;
8296def err_convertvector_non_vector_type : Error<
8297  "second argument to __builtin_convertvector must be a vector type">;
8298def err_convertvector_incompatible_vector : Error<
8299  "first two arguments to __builtin_convertvector must have the same number of elements">;
8300
8301def err_first_argument_to_cwsc_not_call : Error<
8302  "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
8303def err_first_argument_to_cwsc_block_call : Error<
8304  "first argument to __builtin_call_with_static_chain must not be a block call">;
8305def err_first_argument_to_cwsc_builtin_call : Error<
8306  "first argument to __builtin_call_with_static_chain must not be a builtin call">;
8307def err_first_argument_to_cwsc_pdtor_call : Error<
8308  "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
8309def err_second_argument_to_cwsc_not_pointer : Error<
8310  "second argument to __builtin_call_with_static_chain must be of pointer type">;
8311
8312def err_vector_incorrect_num_initializers : Error<
8313  "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
8314def err_altivec_empty_initializer : Error<"expected initializer">;
8315
8316def err_invalid_neon_type_code : Error<
8317  "incompatible constant for this __builtin_neon function">;
8318def err_argument_invalid_range : Error<
8319  "argument value %0 is outside the valid range [%1, %2]">;
8320def warn_argument_invalid_range : Warning<
8321  "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
8322  InGroup<DiagGroup<"argument-outside-range">>;
8323def err_argument_not_multiple : Error<
8324  "argument should be a multiple of %0">;
8325def warn_neon_vector_initializer_non_portable : Warning<
8326  "vector initializers are not compatible with NEON intrinsics in big endian "
8327  "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
8328def note_neon_vector_initializer_non_portable : Note<
8329  "consider using vld1_%0%1() to initialize a vector from memory, or "
8330  "vcreate_%0%1() to initialize from an integer constant">;
8331def note_neon_vector_initializer_non_portable_q : Note<
8332  "consider using vld1q_%0%1() to initialize a vector from memory, or "
8333  "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
8334  "constants">;
8335def err_systemz_invalid_tabort_code : Error<
8336  "invalid transaction abort code">;
8337def err_64_bit_builtin_32_bit_tgt : Error<
8338  "this builtin is only available on 64-bit targets">;
8339def err_32_bit_builtin_64_bit_tgt : Error<
8340  "this builtin is only available on 32-bit targets">;
8341def err_builtin_x64_aarch64_only : Error<
8342  "this builtin is only available on x86-64 and aarch64 targets">;
8343def err_ppc_builtin_only_on_pwr7 : Error<
8344  "this builtin is only valid on POWER7 or later CPUs">;
8345def err_x86_builtin_invalid_rounding : Error<
8346  "invalid rounding argument">;
8347def err_x86_builtin_invalid_scale : Error<
8348  "scale argument must be 1, 2, 4, or 8">;
8349def err_hexagon_builtin_unsupported_cpu : Error<
8350  "builtin is not supported on this CPU">;
8351def err_hexagon_builtin_requires_hvx : Error<
8352  "builtin requires HVX">;
8353def err_hexagon_builtin_unsupported_hvx : Error<
8354  "builtin is not supported on this version of HVX">;
8355
8356def err_builtin_target_unsupported : Error<
8357  "builtin is not supported on this target">;
8358def err_builtin_longjmp_unsupported : Error<
8359  "__builtin_longjmp is not supported for the current target">;
8360def err_builtin_setjmp_unsupported : Error<
8361  "__builtin_setjmp is not supported for the current target">;
8362
8363def err_builtin_longjmp_invalid_val : Error<
8364  "argument to __builtin_longjmp must be a constant 1">;
8365def err_builtin_requires_language : Error<"'%0' is only available in %1">;
8366
8367def err_constant_integer_arg_type : Error<
8368  "argument to %0 must be a constant integer">;
8369
8370def ext_mixed_decls_code : Extension<
8371  "ISO C90 forbids mixing declarations and code">,
8372  InGroup<DiagGroup<"declaration-after-statement">>;
8373
8374def err_non_local_variable_decl_in_for : Error<
8375  "declaration of non-local variable in 'for' loop">;
8376def err_non_variable_decl_in_for : Error<
8377  "non-variable declaration in 'for' loop">;
8378def err_toomany_element_decls : Error<
8379  "only one element declaration is allowed">;
8380def err_selector_element_not_lvalue : Error<
8381  "selector element is not a valid lvalue">;
8382def err_selector_element_type : Error<
8383  "selector element type %0 is not a valid object">;
8384def err_selector_element_const_type : Error<
8385  "selector element of type %0 cannot be a constant l-value expression">;
8386def err_collection_expr_type : Error<
8387  "the type %0 is not a pointer to a fast-enumerable object">;
8388def warn_collection_expr_type : Warning<
8389  "collection expression type %0 may not respond to %1">;
8390
8391def err_invalid_conversion_between_ext_vectors : Error<
8392  "invalid conversion between ext-vector type %0 and %1">;
8393
8394def warn_duplicate_attribute_exact : Warning<
8395  "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
8396
8397def warn_duplicate_attribute : Warning<
8398  "attribute %0 is already applied with different parameters">,
8399  InGroup<IgnoredAttributes>;
8400
8401def warn_sync_fetch_and_nand_semantics_change : Warning<
8402  "the semantics of this intrinsic changed with GCC "
8403  "version 4.4 - the newer semantics are provided here">,
8404  InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
8405
8406// Type
8407def ext_invalid_sign_spec : Extension<"'%0' cannot be signed or unsigned">;
8408def warn_receiver_forward_class : Warning<
8409    "receiver %0 is a forward class and corresponding @interface may not exist">,
8410    InGroup<ForwardClassReceiver>;
8411def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
8412def ext_missing_declspec : ExtWarn<
8413  "declaration specifier missing, defaulting to 'int'">;
8414def ext_missing_type_specifier : ExtWarn<
8415  "type specifier missing, defaults to 'int'">,
8416  InGroup<ImplicitInt>;
8417def err_decimal_unsupported : Error<
8418  "GNU decimal type extension not supported">;
8419def err_missing_type_specifier : Error<
8420  "C++ requires a type specifier for all declarations">;
8421def err_objc_array_of_interfaces : Error<
8422  "array of interface %0 is invalid (probably should be an array of pointers)">;
8423def ext_c99_array_usage : Extension<
8424  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
8425  "feature">, InGroup<C99>;
8426def err_c99_array_usage_cxx : Error<
8427  "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
8428  "feature, not permitted in C++">;
8429def err_type_unsupported : Error<
8430  "%0 is not supported on this target">;
8431def err_nsconsumed_attribute_mismatch : Error<
8432  "overriding method has mismatched ns_consumed attribute on its"
8433  " parameter">;
8434def err_nsreturns_retained_attribute_mismatch : Error<
8435  "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
8436  " attributes">;
8437def warn_nsconsumed_attribute_mismatch : Warning<
8438  err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
8439def warn_nsreturns_retained_attribute_mismatch : Warning<
8440  err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
8441
8442def note_getter_unavailable : Note<
8443  "or because setter is declared here, but no getter method %0 is found">;
8444def err_invalid_protocol_qualifiers : Error<
8445  "invalid protocol qualifiers on non-ObjC type">;
8446def warn_ivar_use_hidden : Warning<
8447  "local declaration of %0 hides instance variable">,
8448   InGroup<ShadowIvar>;
8449def warn_direct_initialize_call : Warning<
8450  "explicit call to +initialize results in duplicate call to +initialize">,
8451   InGroup<ExplicitInitializeCall>;
8452def warn_direct_super_initialize_call : Warning<
8453  "explicit call to [super initialize] should only be in implementation "
8454  "of +initialize">,
8455   InGroup<ExplicitInitializeCall>;
8456def err_ivar_use_in_class_method : Error<
8457  "instance variable %0 accessed in class method">;
8458def err_private_ivar_access : Error<"instance variable %0 is private">,
8459  AccessControl;
8460def err_protected_ivar_access : Error<"instance variable %0 is protected">,
8461  AccessControl;
8462def warn_maynot_respond : Warning<"%0 may not respond to %1">;
8463def ext_typecheck_base_super : Warning<
8464  "method parameter type "
8465  "%diff{$ does not match super class method parameter type $|"
8466  "does not match super class method parameter type}0,1">,
8467   InGroup<SuperSubClassMismatch>, DefaultIgnore;
8468def warn_missing_method_return_type : Warning<
8469  "method has no return type specified; defaults to 'id'">,
8470  InGroup<MissingMethodReturnType>, DefaultIgnore;
8471def warn_direct_ivar_access : Warning<"instance variable %0 is being "
8472  "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
8473
8474// Spell-checking diagnostics
8475def err_unknown_typename : Error<
8476  "unknown type name %0">;
8477def err_unknown_type_or_class_name_suggest : Error<
8478  "unknown %select{type|class}1 name %0; did you mean %2?">;
8479def err_unknown_typename_suggest : Error<
8480  "unknown type name %0; did you mean %1?">;
8481def err_unknown_nested_typename_suggest : Error<
8482  "no type named %0 in %1; did you mean %select{|simply }2%3?">;
8483def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
8484def err_undeclared_use_suggest : Error<
8485  "use of undeclared %0; did you mean %1?">;
8486def err_undeclared_var_use_suggest : Error<
8487  "use of undeclared identifier %0; did you mean %1?">;
8488def err_no_template : Error<"no template named %0">;
8489def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
8490def err_no_member_template : Error<"no template named %0 in %1">;
8491def err_no_member_template_suggest : Error<
8492  "no template named %0 in %1; did you mean %select{|simply }2%3?">;
8493def err_non_template_in_template_id : Error<
8494  "%0 does not name a template but is followed by template arguments">;
8495def err_non_template_in_template_id_suggest : Error<
8496  "%0 does not name a template but is followed by template arguments; "
8497  "did you mean %1?">;
8498def err_non_template_in_member_template_id_suggest : Error<
8499  "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
8500def note_non_template_in_template_id_found : Note<
8501  "non-template declaration found by name lookup">;
8502def err_mem_init_not_member_or_class_suggest : Error<
8503  "initializer %0 does not name a non-static data member or base "
8504  "class; did you mean the %select{base class|member}1 %2?">;
8505def err_field_designator_unknown_suggest : Error<
8506  "field designator %0 does not refer to any field in type %1; did you mean "
8507  "%2?">;
8508def err_typecheck_member_reference_ivar_suggest : Error<
8509  "%0 does not have a member named %1; did you mean %2?">;
8510def err_property_not_found_suggest : Error<
8511  "property %0 not found on object of type %1; did you mean %2?">;
8512def err_class_property_found : Error<
8513  "property %0 is a class property; did you mean to access it with class '%1'?">;
8514def err_ivar_access_using_property_syntax_suggest : Error<
8515  "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
8516def warn_property_access_suggest : Warning<
8517"property %0 not found on object of type %1; did you mean to access property %2?">,
8518InGroup<PropertyAccessDotSyntax>;
8519def err_property_found_suggest : Error<
8520  "property %0 found on object of type %1; did you mean to access "
8521  "it with the \".\" operator?">;
8522def err_undef_interface_suggest : Error<
8523  "cannot find interface declaration for %0; did you mean %1?">;
8524def warn_undef_interface_suggest : Warning<
8525  "cannot find interface declaration for %0; did you mean %1?">;
8526def err_undef_superclass_suggest : Error<
8527  "cannot find interface declaration for %0, superclass of %1; did you mean "
8528  "%2?">;
8529def err_undeclared_protocol_suggest : Error<
8530  "cannot find protocol declaration for %0; did you mean %1?">;
8531def note_base_class_specified_here : Note<
8532  "base class %0 specified here">;
8533def err_using_directive_suggest : Error<
8534  "no namespace named %0; did you mean %1?">;
8535def err_using_directive_member_suggest : Error<
8536  "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
8537def note_namespace_defined_here : Note<"namespace %0 defined here">;
8538def err_sizeof_pack_no_pack_name_suggest : Error<
8539  "%0 does not refer to the name of a parameter pack; did you mean %1?">;
8540def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
8541
8542def err_uncasted_use_of_unknown_any : Error<
8543  "%0 has unknown type; cast it to its declared type to use it">;
8544def err_uncasted_call_of_unknown_any : Error<
8545  "%0 has unknown return type; cast the call to its declared return type">;
8546def err_uncasted_send_to_unknown_any_method : Error<
8547  "no known method %select{%objcinstance1|%objcclass1}0; cast the "
8548  "message send to the method's return type">;
8549def err_unsupported_unknown_any_decl : Error<
8550  "%0 has unknown type, which is not supported for this kind of declaration">;
8551def err_unsupported_unknown_any_expr : Error<
8552  "unsupported expression with unknown type">;
8553def err_unsupported_unknown_any_call : Error<
8554  "call to unsupported expression with unknown type">;
8555def err_unknown_any_addrof : Error<
8556  "the address of a declaration with unknown type "
8557  "can only be cast to a pointer type">;
8558def err_unknown_any_addrof_call : Error<
8559  "address-of operator cannot be applied to a call to a function with "
8560  "unknown return type">;
8561def err_unknown_any_var_function_type : Error<
8562  "variable %0 with unknown type cannot be given a function type">;
8563def err_unknown_any_function : Error<
8564  "function %0 with unknown type must be given a function type">;
8565
8566def err_filter_expression_integral : Error<
8567  "filter expression type should be an integral value not %0">;
8568
8569def err_non_asm_stmt_in_naked_function : Error<
8570  "non-ASM statement in naked function is not supported">;
8571def err_asm_naked_this_ref : Error<
8572  "'this' pointer references not allowed in naked functions">;
8573def err_asm_naked_parm_ref : Error<
8574  "parameter references not allowed in naked functions">;
8575
8576// OpenCL warnings and errors.
8577def err_invalid_astype_of_different_size : Error<
8578  "invalid reinterpretation: sizes of %0 and %1 must match">;
8579def err_static_kernel : Error<
8580  "kernel functions cannot be declared static">;
8581def err_opencl_ptrptr_kernel_param : Error<
8582  "kernel parameter cannot be declared as a pointer to a pointer">;
8583def err_kernel_arg_address_space : Error<
8584  "pointer arguments to kernel functions must reside in '__global', "
8585  "'__constant' or '__local' address space">;
8586def err_opencl_ext_vector_component_invalid_length : Error<
8587  "vector component access has invalid length %0.  Supported: 1,2,3,4,8,16.">;
8588def err_opencl_function_variable : Error<
8589  "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
8590def err_opencl_addrspace_scope : Error<
8591  "variables in the %0 address space can only be declared in the outermost "
8592  "scope of a kernel function">;
8593def err_static_function_scope : Error<
8594  "variables in function scope cannot be declared static">;
8595def err_opencl_bitfields : Error<
8596  "bit-fields are not supported in OpenCL">;
8597def err_opencl_vla : Error<
8598  "variable length arrays are not supported in OpenCL">;
8599def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
8600    "scalar operand type has greater rank than the type of the vector "
8601    "element. (%0 and %1)">;
8602def err_bad_kernel_param_type : Error<
8603  "%0 cannot be used as the type of a kernel parameter">;
8604def err_opencl_implicit_function_decl : Error<
8605  "implicit declaration of function %0 is invalid in OpenCL">;
8606def err_record_with_pointers_kernel_param : Error<
8607  "%select{struct|union}0 kernel parameters may not contain pointers">;
8608def note_within_field_of_type : Note<
8609  "within field of type %0 declared here">;
8610def note_illegal_field_declared_here : Note<
8611  "field of illegal %select{type|pointer type}0 %1 declared here">;
8612def err_opencl_type_struct_or_union_field : Error<
8613  "the %0 type cannot be used to declare a structure or union field">;
8614def err_event_t_addr_space_qual : Error<
8615  "the event_t type can only be used with __private address space qualifier">;
8616def err_expected_kernel_void_return_type : Error<
8617  "kernel must have void return type">;
8618def err_sampler_initializer_not_integer : Error<
8619  "sampler_t initialization requires 32-bit integer, not %0">;
8620def warn_sampler_initializer_invalid_bits : Warning<
8621  "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
8622def err_sampler_argument_required : Error<
8623  "sampler_t variable required - got %0">;
8624def err_wrong_sampler_addressspace: Error<
8625  "sampler type cannot be used with the __local and __global address space qualifiers">;
8626def err_opencl_nonconst_global_sampler : Error<
8627  "global sampler requires a const or constant address space qualifier">;
8628def err_opencl_cast_non_zero_to_event_t : Error<
8629  "cannot cast non-zero value '%0' to 'event_t'">;
8630def err_opencl_global_invalid_addr_space : Error<
8631  "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
8632def err_missing_actual_pipe_type : Error<
8633  "missing actual type specifier for pipe">;
8634def err_reference_pipe_type : Error <
8635  "pipes packet types cannot be of reference type">;
8636def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
8637def err_opencl_kernel_attr :
8638  Error<"attribute %0 can only be applied to an OpenCL kernel function">;
8639def err_opencl_return_value_with_address_space : Error<
8640  "return value cannot be qualified with address space">;
8641def err_opencl_constant_no_init : Error<
8642  "variable in constant address space must be initialized">;
8643def err_opencl_atomic_init: Error<
8644  "atomic variable can be %select{assigned|initialized}0 to a variable only "
8645  "in global address space">;
8646def err_opencl_implicit_vector_conversion : Error<
8647  "implicit conversions between vector types (%0 and %1) are not permitted">;
8648def err_opencl_invalid_type_array : Error<
8649  "array of %0 type is invalid in OpenCL">;
8650def err_opencl_ternary_with_block : Error<
8651  "block type cannot be used as expression in ternary expression in OpenCL">;
8652def err_opencl_pointer_to_type : Error<
8653  "pointer to type %0 is invalid in OpenCL">;
8654def err_opencl_type_can_only_be_used_as_function_parameter : Error <
8655  "type %0 can only be used as a function parameter in OpenCL">;
8656def warn_opencl_attr_deprecated_ignored : Warning <
8657  "%0 attribute is deprecated and ignored in OpenCL version %1">,
8658  InGroup<IgnoredAttributes>;
8659def err_opencl_variadic_function : Error<
8660  "invalid prototype, variadic arguments are not allowed in OpenCL">;
8661def err_opencl_requires_extension : Error<
8662  "use of %select{type|declaration}0 %1 requires %2 extension to be enabled">;
8663def warn_opencl_generic_address_space_arg : Warning<
8664  "passing non-generic address space pointer to %0"
8665  " may cause dynamic conversion affecting performance">,
8666  InGroup<Conversion>, DefaultIgnore;
8667
8668// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
8669def err_opencl_builtin_pipe_first_arg : Error<
8670  "first argument to %0 must be a pipe type">;
8671def err_opencl_builtin_pipe_arg_num : Error<
8672  "invalid number of arguments to function: %0">;
8673def err_opencl_builtin_pipe_invalid_arg : Error<
8674  "invalid argument type to function %0 (expecting %1 having %2)">;
8675def err_opencl_builtin_pipe_invalid_access_modifier : Error<
8676  "invalid pipe access modifier (expecting %0)">;
8677
8678// OpenCL access qualifier
8679def err_opencl_invalid_access_qualifier : Error<
8680  "access qualifier can only be used for pipe and image type">;
8681def err_opencl_invalid_read_write : Error<
8682  "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
8683def err_opencl_multiple_access_qualifiers : Error<
8684  "multiple access qualifiers">;
8685def note_opencl_typedef_access_qualifier : Note<
8686  "previously declared '%0' here">;
8687
8688// OpenCL v2.0 s6.12.5 Blocks restrictions
8689def err_opencl_block_storage_type : Error<
8690  "the __block storage type is not permitted">;
8691def err_opencl_invalid_block_declaration : Error<
8692  "invalid block variable declaration - must be %select{const qualified|initialized}0">;
8693def err_opencl_extern_block_declaration : Error<
8694  "invalid block variable declaration - using 'extern' storage class is disallowed">;
8695def err_opencl_block_ref_block : Error<
8696  "cannot refer to a block inside block">;
8697
8698// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
8699def err_opencl_builtin_to_addr_arg_num : Error<
8700  "invalid number of arguments to function: %0">;
8701def err_opencl_builtin_to_addr_invalid_arg : Error<
8702  "invalid argument %0 to function: %1, expecting a generic pointer argument">;
8703
8704// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
8705def err_opencl_enqueue_kernel_incorrect_args : Error<
8706  "illegal call to enqueue_kernel, incorrect argument types">;
8707def err_opencl_enqueue_kernel_local_size_args : Error<
8708  "mismatch in number of block parameters and local size arguments passed">;
8709def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
8710  "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
8711def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
8712  "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
8713def err_opencl_enqueue_kernel_blocks_no_args : Error<
8714  "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
8715
8716def err_opencl_builtin_expected_type : Error<
8717  "illegal call to %0, expected %1 argument type">;
8718
8719// OpenCL v2.2 s2.1.2.3 - Vector Component Access
8720def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
8721  "vector component name '%0' is an OpenCL version 2.2 feature">,
8722  InGroup<OpenCLUnsupportedRGBA>;
8723
8724// MIG routine annotations.
8725def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
8726  "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
8727  InGroup<IgnoredAttributes>;
8728} // end of sema category
8729
8730let CategoryName = "OpenMP Issue" in {
8731// OpenMP support.
8732def err_omp_expected_var_arg : Error<
8733  "%0 is not a global variable, static local variable or static data member">;
8734def err_omp_expected_var_arg_suggest : Error<
8735  "%0 is not a global variable, static local variable or static data member; "
8736  "did you mean %1">;
8737def err_omp_global_var_arg : Error<
8738  "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
8739def err_omp_ref_type_arg : Error<
8740  "arguments of '#pragma omp %0' cannot be of reference type %1">;
8741def err_omp_region_not_file_context : Error<
8742  "directive must be at file or namespace scope">;
8743def err_omp_var_scope : Error<
8744  "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
8745def err_omp_var_used : Error<
8746  "'#pragma omp %0' must precede all references to variable %q1">;
8747def err_omp_var_thread_local : Error<
8748  "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
8749def err_omp_private_incomplete_type : Error<
8750  "a private variable with incomplete type %0">;
8751def err_omp_firstprivate_incomplete_type : Error<
8752  "a firstprivate variable with incomplete type %0">;
8753def err_omp_lastprivate_incomplete_type : Error<
8754  "a lastprivate variable with incomplete type %0">;
8755def err_omp_reduction_incomplete_type : Error<
8756  "a reduction list item with incomplete type %0">;
8757def err_omp_unexpected_clause_value : Error<
8758  "expected %0 in OpenMP clause '%1'">;
8759def err_omp_expected_var_name_member_expr : Error<
8760  "expected variable name%select{| or data member of current class}0">;
8761def err_omp_expected_var_name_member_expr_or_array_item : Error<
8762  "expected variable name%select{|, data member of current class}0, array element or array section">;
8763def err_omp_expected_addressable_lvalue_or_array_item : Error<
8764  "expected addressable lvalue expression, array element or array section">;
8765def err_omp_expected_named_var_member_or_array_expression: Error<
8766  "expected expression containing only member accesses and/or array sections based on named variables">;
8767def err_omp_bit_fields_forbidden_in_clause : Error<
8768  "bit fields cannot be used to specify storage in a '%0' clause">;
8769def err_array_section_does_not_specify_contiguous_storage : Error<
8770  "array section does not specify contiguous storage">;
8771def err_omp_union_type_not_allowed : Error<
8772  "mapping of union members is not allowed">;
8773def err_omp_expected_access_to_data_field : Error<
8774  "expected access to data field">;
8775def err_omp_multiple_array_items_in_map_clause : Error<
8776  "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
8777def err_omp_duplicate_map_type_modifier : Error<
8778  "same map type modifier has been specified more than once">;
8779def err_omp_pointer_mapped_along_with_derived_section : Error<
8780  "pointer cannot be mapped along with a section derived from itself">;
8781def err_omp_original_storage_is_shared_and_does_not_contain : Error<
8782  "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
8783def err_omp_same_pointer_dereferenced : Error<
8784  "same pointer dereferenced in multiple different ways in map clause expressions">;
8785def note_omp_task_predetermined_firstprivate_here : Note<
8786  "predetermined as a firstprivate in a task construct here">;
8787def err_omp_threadprivate_incomplete_type : Error<
8788  "threadprivate variable with incomplete type %0">;
8789def err_omp_no_dsa_for_variable : Error<
8790  "variable %0 must have explicitly specified data sharing attributes">;
8791def err_omp_wrong_dsa : Error<
8792  "%0 variable cannot be %1">;
8793def err_omp_variably_modified_type_not_supported : Error<
8794  "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
8795def note_omp_explicit_dsa : Note<
8796  "defined as %0">;
8797def note_omp_predetermined_dsa : Note<
8798  "%select{static data member is predetermined as shared|"
8799  "variable with static storage duration is predetermined as shared|"
8800  "loop iteration variable is predetermined as private|"
8801  "loop iteration variable is predetermined as linear|"
8802  "loop iteration variable is predetermined as lastprivate|"
8803  "constant variable is predetermined as shared|"
8804  "global variable is predetermined as shared|"
8805  "non-shared variable in a task construct is predetermined as firstprivate|"
8806  "variable with automatic storage duration is predetermined as private}0"
8807  "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
8808def note_omp_implicit_dsa : Note<
8809  "implicitly determined as %0">;
8810def err_omp_loop_var_dsa : Error<
8811  "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
8812def err_omp_not_for : Error<
8813  "%select{statement after '#pragma omp %1' must be a for loop|"
8814  "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
8815def note_omp_collapse_ordered_expr : Note<
8816  "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
8817def err_omp_negative_expression_in_clause : Error<
8818  "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
8819def err_omp_not_integral : Error<
8820  "expression must have integral or unscoped enumeration "
8821  "type, not %0">;
8822def err_omp_threadprivate_in_target : Error<
8823  "threadprivate variables cannot be used in target constructs">;
8824def err_omp_incomplete_type : Error<
8825  "expression has incomplete class type %0">;
8826def err_omp_explicit_conversion : Error<
8827  "expression requires explicit conversion from %0 to %1">;
8828def note_omp_conversion_here : Note<
8829  "conversion to %select{integral|enumeration}0 type %1 declared here">;
8830def err_omp_ambiguous_conversion : Error<
8831  "ambiguous conversion from type %0 to an integral or unscoped "
8832  "enumeration type">;
8833def err_omp_required_access : Error<
8834  "%0 variable must be %1">;
8835def err_omp_const_variable : Error<
8836  "const-qualified variable cannot be %0">;
8837def err_omp_const_not_mutable_variable : Error<
8838  "const-qualified variable without mutable fields cannot be %0">;
8839def err_omp_const_list_item : Error<
8840  "const-qualified list item cannot be %0">;
8841def err_omp_linear_incomplete_type : Error<
8842  "a linear variable with incomplete type %0">;
8843def err_omp_linear_expected_int_or_ptr : Error<
8844  "argument of a linear clause should be of integral or pointer "
8845  "type, not %0">;
8846def warn_omp_linear_step_zero : Warning<
8847  "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
8848  InGroup<OpenMPClauses>;
8849def warn_omp_alignment_not_power_of_two : Warning<
8850  "aligned clause will be ignored because the requested alignment is not a power of 2">,
8851  InGroup<OpenMPClauses>;
8852def err_omp_invalid_target_decl : Error<
8853  "%0 used in declare target directive is not a variable or a function name">;
8854def err_omp_declare_target_multiple : Error<
8855  "%0 appears multiple times in clauses on the same declare target directive">;
8856def err_omp_declare_target_to_and_link : Error<
8857  "%0 must not appear in both clauses 'to' and 'link'">;
8858def warn_omp_not_in_target_context : Warning<
8859  "declaration is not declared in any declare target region">,
8860  InGroup<OpenMPTarget>;
8861def err_omp_function_in_link_clause : Error<
8862  "function name is not allowed in 'link' clause">;
8863def err_omp_aligned_expected_array_or_ptr : Error<
8864  "argument of aligned clause should be array"
8865  "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
8866  ", not %0">;
8867def err_omp_aligned_twice : Error<
8868  "%select{a variable|a parameter|'this'}0 cannot appear in more than one aligned clause">;
8869def err_omp_local_var_in_threadprivate_init : Error<
8870  "variable with local storage in initial value of threadprivate variable">;
8871def err_omp_loop_not_canonical_init : Error<
8872  "initialization clause of OpenMP for loop is not in canonical form "
8873  "('var = init' or 'T var = init')">;
8874def ext_omp_loop_not_canonical_init : ExtWarn<
8875  "initialization clause of OpenMP for loop is not in canonical form "
8876  "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
8877def err_omp_loop_not_canonical_cond : Error<
8878  "condition of OpenMP for loop must be a relational comparison "
8879  "('<', '<=', '>', or '>=') of loop variable %0">;
8880def err_omp_loop_not_canonical_incr : Error<
8881  "increment clause of OpenMP for loop must perform simple addition "
8882  "or subtraction on loop variable %0">;
8883def err_omp_loop_variable_type : Error<
8884  "variable must be of integer or %select{pointer|random access iterator}0 type">;
8885def err_omp_loop_incr_not_compatible : Error<
8886  "increment expression must cause %0 to %select{decrease|increase}1 "
8887  "on each iteration of OpenMP for loop">;
8888def note_omp_loop_cond_requres_compatible_incr : Note<
8889  "loop step is expected to be %select{negative|positive}0 due to this condition">;
8890def err_omp_loop_diff_cxx : Error<
8891  "could not calculate number of iterations calling 'operator-' with "
8892  "upper and lower loop bounds">;
8893def err_omp_loop_cannot_use_stmt : Error<
8894  "'%0' statement cannot be used in OpenMP for loop">;
8895def err_omp_simd_region_cannot_use_stmt : Error<
8896  "'%0' statement cannot be used in OpenMP simd region">;
8897def warn_omp_loop_64_bit_var : Warning<
8898  "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
8899  InGroup<OpenMPLoopForm>;
8900def err_omp_unknown_reduction_identifier : Error<
8901  "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
8902  "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
8903def err_omp_not_resolved_reduction_identifier : Error<
8904  "unable to resolve declare reduction construct for type %0">;
8905def err_omp_reduction_ref_type_arg : Error<
8906  "argument of OpenMP clause '%0' must reference the same object in all threads">;
8907def err_omp_clause_not_arithmetic_type_arg : Error<
8908  "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
8909def err_omp_clause_floating_type_arg : Error<
8910  "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
8911def err_omp_once_referenced : Error<
8912  "variable can appear only once in OpenMP '%0' clause">;
8913def err_omp_once_referenced_in_target_update : Error<
8914  "variable can appear only once in OpenMP 'target update' construct">;
8915def note_omp_referenced : Note<
8916  "previously referenced here">;
8917def err_omp_reduction_in_task : Error<
8918  "reduction variables may not be accessed in an explicit task">;
8919def err_omp_reduction_id_not_compatible : Error<
8920  "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
8921def err_omp_in_reduction_not_task_reduction : Error<
8922  "in_reduction variable must appear in a task_reduction clause">;
8923def err_omp_reduction_identifier_mismatch : Error<
8924  "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
8925def note_omp_previous_reduction_identifier : Note<
8926  "previously marked as task_reduction with different reduction operation">;
8927def err_omp_prohibited_region : Error<
8928  "region cannot be%select{| closely}0 nested inside '%1' region"
8929  "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
8930  "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
8931  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
8932  "; perhaps you forget to enclose 'omp %3' directive into a teams region?}2">;
8933def err_omp_prohibited_region_simd : Error<
8934  "OpenMP constructs may not be nested inside a simd region">;
8935def err_omp_prohibited_region_atomic : Error<
8936  "OpenMP constructs may not be nested inside an atomic region">;
8937def err_omp_prohibited_region_critical_same_name : Error<
8938  "cannot nest 'critical' regions having the same name %0">;
8939def note_omp_previous_critical_region : Note<
8940  "previous 'critical' region starts here">;
8941def err_omp_sections_not_compound_stmt : Error<
8942  "the statement for '#pragma omp sections' must be a compound statement">;
8943def err_omp_parallel_sections_not_compound_stmt : Error<
8944  "the statement for '#pragma omp parallel sections' must be a compound statement">;
8945def err_omp_orphaned_section_directive : Error<
8946  "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
8947  " must be closely nested to a sections region%select{|, not a %1 region}0">;
8948def err_omp_sections_substmt_not_section : Error<
8949  "statement in 'omp sections' directive must be enclosed into a section region">;
8950def err_omp_parallel_sections_substmt_not_section : Error<
8951  "statement in 'omp parallel sections' directive must be enclosed into a section region">;
8952def err_omp_parallel_reduction_in_task_firstprivate : Error<
8953  "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
8954def err_omp_atomic_read_not_expression_statement : Error<
8955  "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
8956  " where v and x are both lvalue expressions with scalar type">;
8957def note_omp_atomic_read_write: Note<
8958  "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
8959def err_omp_atomic_write_not_expression_statement : Error<
8960  "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
8961  " where x is a lvalue expression with scalar type">;
8962def err_omp_atomic_update_not_expression_statement : Error<
8963  "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',"
8964  " where x is an l-value expression with scalar type">;
8965def err_omp_atomic_not_expression_statement : Error<
8966  "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',"
8967  " where x is an l-value expression with scalar type">;
8968def note_omp_atomic_update: Note<
8969  "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
8970  "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
8971  "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
8972def err_omp_atomic_capture_not_expression_statement : Error<
8973  "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',"
8974  " where x and v are both l-value expressions with scalar type">;
8975def err_omp_atomic_capture_not_compound_statement : Error<
8976  "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
8977  " '{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;}',"
8978  " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
8979  " where x is an l-value expression with scalar type">;
8980def note_omp_atomic_capture: Note<
8981  "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
8982def err_omp_atomic_several_clauses : Error<
8983  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
8984def note_omp_atomic_previous_clause : Note<
8985  "'%0' clause used here">;
8986def err_omp_target_contains_not_only_teams : Error<
8987  "target construct with nested teams region contains statements outside of the teams construct">;
8988def note_omp_nested_teams_construct_here : Note<
8989  "nested teams construct here">;
8990def note_omp_nested_statement_here : Note<
8991  "%select{statement|directive}0 outside teams construct here">;
8992def err_omp_single_copyprivate_with_nowait : Error<
8993  "the 'copyprivate' clause must not be used with the 'nowait' clause">;
8994def note_omp_nowait_clause_here : Note<
8995  "'nowait' clause is here">;
8996def err_omp_single_decl_in_declare_simd : Error<
8997  "single declaration is expected after 'declare simd' directive">;
8998def err_omp_function_expected : Error<
8999  "'#pragma omp declare simd' can only be applied to functions">;
9000def err_omp_wrong_cancel_region : Error<
9001  "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
9002def err_omp_parent_cancel_region_nowait : Error<
9003  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
9004def err_omp_parent_cancel_region_ordered : Error<
9005  "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
9006def 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">;
9007def 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">;
9008def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
9009def err_omp_mapper_wrong_type : Error<
9010  "mapper type must be of struct, union or class type">;
9011def err_omp_declare_mapper_wrong_var : Error<
9012  "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
9013def err_omp_declare_mapper_redefinition : Error<
9014  "redefinition of user-defined mapper for type %0 with name %1">;
9015def err_omp_invalid_mapper: Error<
9016  "cannot find a valid user-defined mapper for type %0 with name %1">;
9017def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
9018def err_omp_typecheck_section_value : Error<
9019  "subscripted value is not an array or pointer">;
9020def err_omp_typecheck_section_not_integer : Error<
9021  "array section %select{lower bound|length}0 is not an integer">;
9022def err_omp_section_function_type : Error<
9023  "section of pointer to function type %0">;
9024def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
9025  InGroup<CharSubscript>, DefaultIgnore;
9026def err_omp_section_incomplete_type : Error<
9027  "section of pointer to incomplete type %0">;
9028def err_omp_section_not_subset_of_array : Error<
9029  "array section must be a subset of the original array">;
9030def err_omp_section_length_negative : Error<
9031  "section length is evaluated to a negative value %0">;
9032def err_omp_section_length_undefined : Error<
9033  "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
9034def err_omp_wrong_linear_modifier : Error<
9035  "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
9036def err_omp_wrong_linear_modifier_non_reference : Error<
9037  "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
9038def err_omp_wrong_simdlen_safelen_values : Error<
9039  "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
9040def err_omp_wrong_if_directive_name_modifier : Error<
9041  "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
9042def err_omp_no_more_if_clause : Error<
9043  "no more 'if' clause is allowed">;
9044def err_omp_unnamed_if_clause : Error<
9045  "expected %select{|one of}0 %1 directive name modifier%select{|s}0">;
9046def note_omp_previous_named_if_clause : Note<
9047  "previous clause with directive name modifier specified here">;
9048def err_omp_ordered_directive_with_param : Error<
9049  "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
9050def err_omp_ordered_directive_without_param : Error<
9051  "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
9052def note_omp_ordered_param : Note<
9053  "'ordered' clause with specified parameter">;
9054def err_omp_expected_base_var_name : Error<
9055  "expected variable name as a base of the array %select{subscript|section}0">;
9056def err_omp_map_shared_storage : Error<
9057  "variable already marked as mapped in current construct">;
9058def err_omp_invalid_map_type_for_directive : Error<
9059  "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
9060def err_omp_no_clause_for_directive : Error<
9061  "expected at least one %0 clause for '#pragma omp %1'">;
9062def err_omp_threadprivate_in_clause : Error<
9063  "threadprivate variables are not allowed in '%0' clause">;
9064def err_omp_wrong_ordered_loop_count : Error<
9065  "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
9066def note_collapse_loop_count : Note<
9067  "parameter of the 'collapse' clause">;
9068def err_omp_grainsize_num_tasks_mutually_exclusive : Error<
9069  "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
9070def note_omp_previous_grainsize_num_tasks : Note<
9071  "'%0' clause is specified here">;
9072def err_omp_hint_clause_no_name : Error<
9073  "the name of the construct must be specified in presence of 'hint' clause">;
9074def err_omp_critical_with_hint : Error<
9075  "constructs with the same name must have a 'hint' clause with the same value">;
9076def note_omp_critical_hint_here : Note<
9077  "%select{|previous }0'hint' clause with value '%1'">;
9078def note_omp_critical_no_hint : Note<
9079  "%select{|previous }0directive with no 'hint' clause specified">;
9080def err_omp_depend_clause_thread_simd : Error<
9081  "'depend' clauses cannot be mixed with '%0' clause">;
9082def err_omp_depend_sink_expected_loop_iteration : Error<
9083  "expected%select{| %1}0 loop iteration variable">;
9084def err_omp_depend_sink_unexpected_expr : Error<
9085  "unexpected expression: number of expressions is larger than the number of associated loops">;
9086def err_omp_depend_sink_expected_plus_minus : Error<
9087  "expected '+' or '-' operation">;
9088def err_omp_depend_sink_source_not_allowed : Error<
9089  "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
9090def err_omp_linear_ordered : Error<
9091  "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
9092def err_omp_unexpected_schedule_modifier : Error<
9093  "modifier '%0' cannot be used along with modifier '%1'">;
9094def err_omp_schedule_nonmonotonic_static : Error<
9095  "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
9096def err_omp_schedule_nonmonotonic_ordered : Error<
9097  "'schedule' clause with 'nonmonotonic' modifier cannot be specified if an 'ordered' clause is specified">;
9098def err_omp_ordered_simd : Error<
9099  "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
9100def err_omp_variable_in_given_clause_and_dsa : Error<
9101  "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
9102def err_omp_param_or_this_in_clause : Error<
9103  "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
9104def err_omp_expected_uniform_param : Error<
9105  "expected a reference to a parameter specified in a 'uniform' clause">;
9106def err_omp_expected_int_param : Error<
9107  "expected a reference to an integer-typed parameter">;
9108def err_omp_at_least_one_motion_clause_required : Error<
9109  "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
9110def err_omp_usedeviceptr_not_a_pointer : Error<
9111  "expected pointer or reference to pointer in 'use_device_ptr' clause">;
9112def err_omp_argument_type_isdeviceptr : Error <
9113  "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
9114def warn_omp_nesting_simd : Warning<
9115  "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
9116  InGroup<SourceUsesOpenMP>;
9117def err_omp_orphaned_device_directive : Error<
9118  "orphaned 'omp %0' directives are prohibited"
9119  "; perhaps you forget to enclose the directive into a %select{|||target |teams }1region?">;
9120def err_omp_reduction_non_addressable_expression : Error<
9121  "expected addressable reduction item for the task-based directives">;
9122def err_omp_reduction_with_nogroup : Error<
9123  "'reduction' clause cannot be used with 'nogroup' clause">;
9124def err_omp_reduction_vla_unsupported : Error<
9125  "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
9126def err_omp_linear_distribute_var_non_loop_iteration : Error<
9127  "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
9128def warn_omp_non_trivial_type_mapped : Warning<
9129  "Non-trivial type %0 is mapped, only trivial types are guaranteed to be mapped correctly">,
9130  InGroup<OpenMPTarget>;
9131def err_omp_requires_clause_redeclaration : Error <
9132  "Only one %0 clause can appear on a requires directive in a single translation unit">;
9133def note_omp_requires_previous_clause : Note <
9134  "%0 clause previously used here">;
9135def err_omp_invalid_scope : Error <
9136  "'#pragma omp %0' directive must appear only in file scope">;
9137def note_omp_invalid_length_on_this_ptr_mapping : Note <
9138  "expected length on mapping of 'this' array section expression to be '1'">;
9139def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
9140  "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
9141def note_omp_invalid_subscript_on_this_ptr_map : Note <
9142  "expected 'this' subscript expression on map clause to be 'this[0]'">;
9143def err_omp_invalid_map_this_expr : Error <
9144  "invalid 'this' expression on 'map' clause">;
9145def err_implied_omp_allocator_handle_t_not_found : Error<
9146  "omp_allocator_handle_t type not found; include <omp.h>">;
9147def err_omp_expected_predefined_allocator : Error<
9148  "expected one of the predefined allocators for the variables with the static "
9149  "storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', "
9150  "'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', "
9151  "'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'">;
9152def warn_omp_used_different_allocator : Warning<
9153  "allocate directive specifies %select{default|'%1'}0 allocator while "
9154  "previously used %select{default|'%3'}2">,
9155  InGroup<OpenMPClauses>;
9156def note_omp_previous_allocator : Note<
9157  "previous allocator is specified here">;
9158def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
9159  "inside of the target region; provide an 'allocator' clause or use 'requires'"
9160  " directive with the 'dynamic_allocators' clause">;
9161def warn_omp_allocate_thread_on_task_target_directive : Warning<
9162  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
9163  InGroup<OpenMPClauses>;
9164} // end of OpenMP category
9165
9166let CategoryName = "Related Result Type Issue" in {
9167// Objective-C related result type compatibility
9168def warn_related_result_type_compatibility_class : Warning<
9169  "method is expected to return an instance of its class type "
9170  "%diff{$, but is declared to return $|"
9171  ", but is declared to return different type}0,1">;
9172def warn_related_result_type_compatibility_protocol : Warning<
9173  "protocol method is expected to return an instance of the implementing "
9174  "class, but is declared to return %0">;
9175def note_related_result_type_family : Note<
9176  "%select{overridden|current}0 method is part of the '%select{|alloc|copy|init|"
9177  "mutableCopy|new|autorelease|dealloc|finalize|release|retain|retainCount|"
9178  "self}1' method family%select{| and is expected to return an instance of its "
9179  "class type}0">;
9180def note_related_result_type_overridden : Note<
9181  "overridden method returns an instance of its class type">;
9182def note_related_result_type_inferred : Note<
9183  "%select{class|instance}0 method %1 is assumed to return an instance of "
9184  "its receiver type (%2)">;
9185def note_related_result_type_explicit : Note<
9186  "%select{overridden|current}0 method is explicitly declared 'instancetype'"
9187  "%select{| and is expected to return an instance of its class type}0">;
9188def err_invalid_type_for_program_scope_var : Error<
9189  "the %0 type cannot be used to declare a program scope variable">;
9190
9191}
9192
9193let CategoryName = "Modules Issue" in {
9194def err_module_decl_in_module_map_module : Error<
9195  "'module' declaration found while building module from module map">;
9196def err_module_decl_in_header_module : Error<
9197  "'module' declaration found while building header module">;
9198def err_module_interface_implementation_mismatch : Error<
9199  "missing 'export' specifier in module declaration while "
9200  "building module interface">;
9201def err_current_module_name_mismatch : Error<
9202  "module name '%0' specified on command line does not match name of module">;
9203def err_module_redefinition : Error<
9204  "redefinition of module '%0'">;
9205def note_prev_module_definition : Note<"previously defined here">;
9206def note_prev_module_definition_from_ast_file : Note<"module loaded from '%0'">;
9207def err_module_not_defined : Error<
9208  "definition of module '%0' is not available; use -fmodule-file= to specify "
9209  "path to precompiled module interface">;
9210def err_module_redeclaration : Error<
9211  "translation unit contains multiple module declarations">;
9212def note_prev_module_declaration : Note<"previous module declaration is here">;
9213def err_module_declaration_missing : Error<
9214  "missing 'export module' declaration in module interface unit">;
9215def err_module_private_specialization : Error<
9216  "%select{template|partial|member}0 specialization cannot be "
9217  "declared __module_private__">;
9218def err_module_private_local : Error<
9219  "%select{local variable|parameter|typedef}0 %1 cannot be declared "
9220  "__module_private__">;
9221def err_module_private_local_class : Error<
9222  "local %select{struct|interface|union|class|enum}0 cannot be declared "
9223  "__module_private__">;
9224def err_module_unimported_use : Error<
9225  "%select{declaration|definition|default argument|"
9226  "explicit specialization|partial specialization}0 of %1 must be imported "
9227  "from module '%2' before it is required">;
9228def err_module_unimported_use_header : Error<
9229  "missing '#include %3'; "
9230  "%select{declaration|definition|default argument|"
9231  "explicit specialization|partial specialization}0 of %1 must be imported "
9232  "from module '%2' before it is required">;
9233def err_module_unimported_use_multiple : Error<
9234  "%select{declaration|definition|default argument|"
9235  "explicit specialization|partial specialization}0 of %1 must be imported "
9236  "from one of the following modules before it is required:%2">;
9237def ext_module_import_in_extern_c : ExtWarn<
9238  "import of C++ module '%0' appears within extern \"C\" language linkage "
9239  "specification">, DefaultError,
9240  InGroup<DiagGroup<"module-import-in-extern-c">>;
9241def err_module_import_not_at_top_level_fatal : Error<
9242  "import of module '%0' appears within %1">, DefaultFatal;
9243def ext_module_import_not_at_top_level_noop : ExtWarn<
9244  "redundant #include of module '%0' appears within %1">, DefaultError,
9245  InGroup<DiagGroup<"modules-import-nested-redundant">>;
9246def note_module_import_not_at_top_level : Note<"%0 begins here">;
9247def err_module_self_import : Error<
9248  "import of module '%0' appears within same top-level module '%1'">;
9249def err_module_import_in_implementation : Error<
9250  "@import of module '%0' in implementation of '%1'; use #import">;
9251
9252// C++ Modules TS
9253def err_export_within_export : Error<
9254  "export declaration appears within another export declaration">;
9255def err_export_not_in_module_interface : Error<
9256  "export declaration can only be used within a module interface unit after "
9257  "the module declaration">;
9258
9259def ext_equivalent_internal_linkage_decl_in_modules : ExtWarn<
9260  "ambiguous use of internal linkage declaration %0 defined in multiple modules">,
9261  InGroup<DiagGroup<"modules-ambiguous-internal-linkage">>;
9262def note_equivalent_internal_linkage_decl : Note<
9263  "declared here%select{ in module '%1'|}0">;
9264
9265def note_redefinition_modules_same_file : Note<
9266  "'%0' included multiple times, additional include site in header from module '%1'">;
9267def note_redefinition_include_same_file : Note<
9268  "'%0' included multiple times, additional include site here">;
9269}
9270
9271let CategoryName = "Coroutines Issue" in {
9272def err_return_in_coroutine : Error<
9273  "return statement not allowed in coroutine; did you mean 'co_return'?">;
9274def note_declared_coroutine_here : Note<
9275  "function is a coroutine due to use of '%0' here">;
9276def err_coroutine_objc_method : Error<
9277  "Objective-C methods as coroutines are not yet supported">;
9278def err_coroutine_unevaluated_context : Error<
9279  "'%0' cannot be used in an unevaluated context">;
9280def err_coroutine_within_handler : Error<
9281  "'%0' cannot be used in the handler of a try block">;
9282def err_coroutine_outside_function : Error<
9283  "'%0' cannot be used outside a function">;
9284def err_coroutine_invalid_func_context : Error<
9285  "'%1' cannot be used in %select{a constructor|a destructor"
9286  "|a copy assignment operator|a move assignment operator|the 'main' function"
9287  "|a constexpr function|a function with a deduced return type"
9288  "|a varargs function}0">;
9289def err_implied_coroutine_type_not_found : Error<
9290  "%0 type was not found; include <experimental/coroutine> before defining "
9291  "a coroutine">;
9292def err_implicit_coroutine_std_nothrow_type_not_found : Error<
9293  "std::nothrow was not found; include <new> before defining a coroutine which "
9294  "uses get_return_object_on_allocation_failure()">;
9295def err_malformed_std_nothrow : Error<
9296  "std::nothrow must be a valid variable declaration">;
9297def err_malformed_std_coroutine_handle : Error<
9298  "std::experimental::coroutine_handle must be a class template">;
9299def err_coroutine_handle_missing_member : Error<
9300  "std::experimental::coroutine_handle missing a member named '%0'">;
9301def err_malformed_std_coroutine_traits : Error<
9302  "'std::experimental::coroutine_traits' must be a class template">;
9303def err_implied_std_coroutine_traits_promise_type_not_found : Error<
9304  "this function cannot be a coroutine: %q0 has no member named 'promise_type'">;
9305def err_implied_std_coroutine_traits_promise_type_not_class : Error<
9306  "this function cannot be a coroutine: %0 is not a class">;
9307def err_coroutine_promise_type_incomplete : Error<
9308  "this function cannot be a coroutine: %0 is an incomplete type">;
9309def err_coroutine_type_missing_specialization : Error<
9310  "this function cannot be a coroutine: missing definition of "
9311  "specialization %0">;
9312def err_coroutine_promise_incompatible_return_functions : Error<
9313  "the coroutine promise type %0 declares both 'return_value' and 'return_void'">;
9314def err_coroutine_promise_requires_return_function : Error<
9315  "the coroutine promise type %0 must declare either 'return_value' or 'return_void'">;
9316def note_coroutine_promise_implicit_await_transform_required_here : Note<
9317  "call to 'await_transform' implicitly required by 'co_await' here">;
9318def note_coroutine_promise_suspend_implicitly_required : Note<
9319  "call to '%select{initial_suspend|final_suspend}0' implicitly "
9320  "required by the %select{initial suspend point|final suspend point}0">;
9321def err_coroutine_promise_unhandled_exception_required : Error<
9322  "%0 is required to declare the member 'unhandled_exception()'">;
9323def warn_coroutine_promise_unhandled_exception_required_with_exceptions : Warning<
9324  "%0 is required to declare the member 'unhandled_exception()' when exceptions are enabled">,
9325  InGroup<CoroutineMissingUnhandledException>;
9326def err_coroutine_promise_get_return_object_on_allocation_failure : Error<
9327  "%0: 'get_return_object_on_allocation_failure()' must be a static member function">;
9328def err_seh_in_a_coroutine_with_cxx_exceptions : Error<
9329  "cannot use SEH '__try' in a coroutine when C++ exceptions are enabled">;
9330def err_coroutine_promise_new_requires_nothrow : Error<
9331  "%0 is required to have a non-throwing noexcept specification when the promise "
9332   "type declares 'get_return_object_on_allocation_failure()'">;
9333def note_coroutine_promise_call_implicitly_required : Note<
9334  "call to %0 implicitly required by coroutine function here">;
9335def err_await_suspend_invalid_return_type : Error<
9336  "return type of 'await_suspend' is required to be 'void' or 'bool' (have %0)"
9337>;
9338def note_await_ready_no_bool_conversion : Note<
9339  "return type of 'await_ready' is required to be contextually convertible to 'bool'"
9340>;
9341}
9342
9343let CategoryName = "Documentation Issue" in {
9344def warn_not_a_doxygen_trailing_member_comment : Warning<
9345  "not a Doxygen trailing comment">, InGroup<Documentation>, DefaultIgnore;
9346} // end of documentation issue category
9347
9348let CategoryName = "Nullability Issue" in {
9349
9350def warn_mismatched_nullability_attr : Warning<
9351  "nullability specifier %0 conflicts with existing specifier %1">,
9352  InGroup<Nullability>;
9353
9354def warn_nullability_declspec : Warning<
9355  "nullability specifier %0 cannot be applied "
9356  "to non-pointer type %1; did you mean to apply the specifier to the "
9357  "%select{pointer|block pointer|member pointer|function pointer|"
9358  "member function pointer}2?">,
9359  InGroup<NullabilityDeclSpec>,
9360  DefaultError;
9361
9362def note_nullability_here : Note<"%0 specified here">;
9363
9364def err_nullability_nonpointer : Error<
9365  "nullability specifier %0 cannot be applied to non-pointer type %1">;
9366
9367def warn_nullability_lost : Warning<
9368  "implicit conversion from nullable pointer %0 to non-nullable pointer "
9369  "type %1">,
9370  InGroup<NullableToNonNullConversion>, DefaultIgnore;
9371def warn_zero_as_null_pointer_constant : Warning<
9372  "zero as null pointer constant">,
9373  InGroup<DiagGroup<"zero-as-null-pointer-constant">>, DefaultIgnore;
9374
9375def err_nullability_cs_multilevel : Error<
9376  "nullability keyword %0 cannot be applied to multi-level pointer type %1">;
9377def note_nullability_type_specifier : Note<
9378  "use nullability type specifier %0 to affect the innermost "
9379  "pointer type of %1">;
9380
9381def warn_null_resettable_setter : Warning<
9382  "synthesized setter %0 for null_resettable property %1 does not handle nil">,
9383  InGroup<Nullability>;
9384
9385def warn_nullability_missing : Warning<
9386  "%select{pointer|block pointer|member pointer}0 is missing a nullability "
9387  "type specifier (_Nonnull, _Nullable, or _Null_unspecified)">,
9388  InGroup<NullabilityCompleteness>;
9389def warn_nullability_missing_array : Warning<
9390  "array parameter is missing a nullability type specifier (_Nonnull, "
9391  "_Nullable, or _Null_unspecified)">,
9392  InGroup<NullabilityCompletenessOnArrays>;
9393def note_nullability_fix_it : Note<
9394  "insert '%select{_Nonnull|_Nullable|_Null_unspecified}0' if the "
9395  "%select{pointer|block pointer|member pointer|array parameter}1 "
9396  "%select{should never be null|may be null|should not declare nullability}0">;
9397
9398def warn_nullability_inferred_on_nested_type : Warning<
9399  "inferring '_Nonnull' for pointer type within %select{array|reference}0 is "
9400  "deprecated">,
9401  InGroup<NullabilityInferredOnNestedType>;
9402
9403def err_objc_type_arg_explicit_nullability : Error<
9404  "type argument %0 cannot explicitly specify nullability">;
9405
9406def err_objc_type_param_bound_explicit_nullability : Error<
9407  "type parameter %0 bound %1 cannot explicitly specify nullability">;
9408
9409}
9410
9411let CategoryName = "Generics Issue" in {
9412
9413def err_objc_type_param_bound_nonobject : Error<
9414  "type bound %0 for type parameter %1 is not an Objective-C pointer type">;
9415
9416def err_objc_type_param_bound_missing_pointer : Error<
9417  "missing '*' in type bound %0 for type parameter %1">;
9418def err_objc_type_param_bound_qualified : Error<
9419  "type bound %1 for type parameter %0 cannot be qualified with '%2'">;
9420
9421def err_objc_type_param_redecl : Error<
9422  "redeclaration of type parameter %0">;
9423
9424def err_objc_type_param_arity_mismatch : Error<
9425  "%select{forward class declaration|class definition|category|extension}0 has "
9426  "too %select{few|many}1 type parameters (expected %2, have %3)">;
9427
9428def err_objc_type_param_bound_conflict : Error<
9429  "type bound %0 for type parameter %1 conflicts with "
9430  "%select{implicit|previous}2 bound %3%select{for type parameter %5|}4">;
9431
9432def err_objc_type_param_variance_conflict : Error<
9433  "%select{in|co|contra}0variant type parameter %1 conflicts with previous "
9434  "%select{in|co|contra}2variant type parameter %3">;
9435
9436def note_objc_type_param_here : Note<"type parameter %0 declared here">;
9437
9438def err_objc_type_param_bound_missing : Error<
9439  "missing type bound %0 for type parameter %1 in %select{@interface|@class}2">;
9440
9441def err_objc_parameterized_category_nonclass : Error<
9442  "%select{extension|category}0 of non-parameterized class %1 cannot have type "
9443  "parameters">;
9444
9445def err_objc_parameterized_forward_class : Error<
9446  "forward declaration of non-parameterized class %0 cannot have type "
9447  "parameters">;
9448
9449def err_objc_parameterized_forward_class_first : Error<
9450  "class %0 previously declared with type parameters">;
9451
9452def err_objc_type_arg_missing_star : Error<
9453  "type argument %0 must be a pointer (requires a '*')">;
9454def err_objc_type_arg_qualified : Error<
9455  "type argument %0 cannot be qualified with '%1'">;
9456
9457def err_objc_type_arg_missing : Error<
9458  "no type or protocol named %0">;
9459
9460def err_objc_type_args_and_protocols : Error<
9461  "angle brackets contain both a %select{type|protocol}0 (%1) and a "
9462  "%select{protocol|type}0 (%2)">;
9463
9464def err_objc_type_args_non_class : Error<
9465  "type arguments cannot be applied to non-class type %0">;
9466
9467def err_objc_type_args_non_parameterized_class : Error<
9468  "type arguments cannot be applied to non-parameterized class %0">;
9469
9470def err_objc_type_args_specialized_class : Error<
9471  "type arguments cannot be applied to already-specialized class type %0">;
9472
9473def err_objc_type_args_wrong_arity : Error<
9474  "too %select{many|few}0 type arguments for class %1 (have %2, expected %3)">;
9475}
9476
9477def err_objc_type_arg_not_id_compatible : Error<
9478  "type argument %0 is neither an Objective-C object nor a block type">;
9479
9480def err_objc_type_arg_does_not_match_bound : Error<
9481  "type argument %0 does not satisfy the bound (%1) of type parameter %2">;
9482
9483def warn_objc_redundant_qualified_class_type : Warning<
9484  "parameterized class %0 already conforms to the protocols listed; did you "
9485  "forget a '*'?">, InGroup<ObjCProtocolQualifiers>;
9486
9487def warn_block_literal_attributes_on_omitted_return_type : Warning<
9488  "attribute %0 ignored, because it cannot be applied to omitted return type">,
9489  InGroup<IgnoredAttributes>;
9490
9491def warn_block_literal_qualifiers_on_omitted_return_type : Warning<
9492  "'%0' qualifier on omitted return type %1 has no effect">,
9493  InGroup<IgnoredQualifiers>;
9494
9495def warn_shadow_field : Warning<
9496  "%select{parameter|non-static data member}3 %0 %select{|of %1 }3shadows "
9497  "member inherited from type %2">, InGroup<ShadowField>, DefaultIgnore;
9498def note_shadow_field : Note<"declared here">;
9499
9500def err_multiversion_required_in_redecl : Error<
9501  "function declaration is missing %select{'target'|'cpu_specific' or "
9502  "'cpu_dispatch'}0 attribute in a multiversioned function">;
9503def note_multiversioning_caused_here : Note<
9504  "function multiversioning caused by this declaration">;
9505def err_multiversion_after_used : Error<
9506  "function declaration cannot become a multiversioned function after first "
9507  "usage">;
9508def err_bad_multiversion_option : Error<
9509  "function multiversioning doesn't support %select{feature|architecture}0 "
9510  "'%1'">;
9511def err_multiversion_duplicate : Error<
9512  "multiversioned function redeclarations require identical target attributes">;
9513def err_multiversion_noproto : Error<
9514  "multiversioned function must have a prototype">;
9515def err_multiversion_no_other_attrs : Error<
9516  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioning cannot be combined"
9517  " with other attributes">;
9518def err_multiversion_diff : Error<
9519  "multiversioned function declaration has a different %select{calling convention"
9520  "|return type|constexpr specification|inline specification|storage class|"
9521  "linkage}0">;
9522def err_multiversion_doesnt_support : Error<
9523  "attribute '%select{target|cpu_specific|cpu_dispatch}0' multiversioned functions do not "
9524  "yet support %select{function templates|virtual functions|"
9525  "deduced return types|constructors|destructors|deleted functions|"
9526  "defaulted functions|constexpr functions}1">;
9527def err_multiversion_not_allowed_on_main : Error<
9528  "'main' cannot be a multiversioned function">;
9529def err_multiversion_not_supported : Error<
9530 "function multiversioning is not supported on the current target">;
9531def err_multiversion_types_mixed : Error<
9532  "multiversioning attributes cannot be combined">;
9533def err_cpu_dispatch_mismatch : Error<
9534 "'cpu_dispatch' function redeclared with different CPUs">;
9535def err_cpu_specific_multiple_defs : Error<
9536 "multiple 'cpu_specific' functions cannot specify the same CPU: %0">;
9537def warn_multiversion_duplicate_entries : Warning<
9538 "CPU list contains duplicate entries; attribute ignored">,
9539  InGroup<FunctionMultiVersioning>;
9540def warn_dispatch_body_ignored : Warning<
9541  "body of cpu_dispatch function will be ignored">,
9542  InGroup<FunctionMultiVersioning>;
9543
9544// three-way comparison operator diagnostics
9545def err_implied_comparison_category_type_not_found : Error<
9546  "cannot deduce return type of 'operator<=>' because type '%0' was not found; "
9547  "include <compare>">;
9548def err_spaceship_argument_narrowing : Error<
9549  "argument to 'operator<=>' "
9550  "%select{cannot be narrowed from type %1 to %2|"
9551  "evaluates to %1, which cannot be narrowed to type %2}0">;
9552def err_std_compare_type_not_supported : Error<
9553  "standard library implementation of %0 is not supported; "
9554   "%select{member '%2' does not have expected form|"
9555   "member '%2' is missing|"
9556   "the type is not trivially copyable|"
9557   "the type does not have the expected form}1">;
9558
9559def warn_dereference_of_noderef_type : Warning<
9560  "dereferencing %0; was declared with a 'noderef' type">, InGroup<NoDeref>;
9561def warn_dereference_of_noderef_type_no_decl : Warning<
9562  "dereferencing expression marked as 'noderef'">, InGroup<NoDeref>;
9563def warn_noderef_on_non_pointer_or_array : Warning<
9564  "'noderef' can only be used on an array or pointer type">, InGroup<IgnoredAttributes>;
9565def warn_noderef_to_dereferenceable_pointer : Warning<
9566  "casting to dereferenceable pointer removes 'noderef' attribute">, InGroup<NoDeref>;
9567
9568def err_builtin_launder_invalid_arg : Error<
9569  "%select{non-pointer|function pointer|void pointer}0 argument to "
9570  "'__builtin_launder' is not allowed">;
9571
9572} // end of sema component.
9573