1//==--- DiagnosticSemaKinds.td - libsema diagnostics ----------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9//===----------------------------------------------------------------------===//
10// Semantic Analysis
11//===----------------------------------------------------------------------===//
12
13let Component = "Sema" in {
14let CategoryName = "Semantic Issue" in {
15def note_previous_decl : Note<"%0 declared here">;
16def note_entity_declared_at : Note<"%0 declared here">;
17def note_callee_decl : Note<"%0 declared here">;
18def note_defined_here : Note<"%0 defined here">;
19
20// For loop analysis
21def warn_variables_not_in_loop_body : Warning<
22 "variable%select{s| %1|s %1 and %2|s %1, %2, and %3|s %1, %2, %3, and %4}0 "
23 "used in loop condition not modified in loop body">,
24 InGroup<ForLoopAnalysis>, DefaultIgnore;
25def warn_redundant_loop_iteration : Warning<
26 "variable %0 is %select{decremented|incremented}1 both in the loop header "
27 "and in the loop body">,
28 InGroup<ForLoopAnalysis>, DefaultIgnore;
29def note_loop_iteration_here : Note<"%select{decremented|incremented}0 here">;
30
31def warn_duplicate_enum_values : Warning<
32 "element %0 has been implicitly assigned %1 which another element has "
33 "been assigned">, InGroup<DiagGroup<"duplicate-enum">>, DefaultIgnore;
34def note_duplicate_element : Note<"element %0 also has value %1">;
35
36// Absolute value functions
37def warn_unsigned_abs : Warning<
38 "taking the absolute value of unsigned type %0 has no effect">,
39 InGroup<AbsoluteValue>;
40def note_remove_abs : Note<
41 "remove the call to '%0' since unsigned values cannot be negative">;
42def warn_abs_too_small : Warning<
43 "absolute value function %0 given an argument of type %1 but has parameter "
44 "of type %2 which may cause truncation of value">, InGroup<AbsoluteValue>;
45def warn_wrong_absolute_value_type : Warning<
46 "using %select{integer|floating point|complex}1 absolute value function %0 "
47 "when argument is of %select{integer|floating point|complex}2 type">,
48 InGroup<AbsoluteValue>;
49def note_replace_abs_function : Note<"use function '%0' instead">;
50def warn_pointer_abs : Warning<
51 "taking the absolute value of %select{pointer|function|array}0 type %1 is suspicious">,
52 InGroup<AbsoluteValue>;
53
54def warn_max_unsigned_zero : Warning<
55 "taking the max of "
56 "%select{a value and unsigned zero|unsigned zero and a value}0 "
57 "is always equal to the other value">,
58 InGroup<MaxUnsignedZero>;
59def note_remove_max_call : Note<
60 "remove call to max function and unsigned zero argument">;
61
62def warn_infinite_recursive_function : Warning<
63 "all paths through this function will call itself">,
64 InGroup<InfiniteRecursion>, DefaultIgnore;
65
66def warn_comma_operator : Warning<"possible misuse of comma operator here">,
67 InGroup<DiagGroup<"comma">>, DefaultIgnore;
68def note_cast_to_void : Note<"cast expression to void to silence warning">;
69
70// Constant expressions
71def err_expr_not_ice : Error<
72 "expression is not an %select{integer|integral}0 constant expression">;
73def ext_expr_not_ice : Extension<
74 "expression is not an %select{integer|integral}0 constant expression; "
75 "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
76def err_typecheck_converted_constant_expression : Error<
77 "value of type %0 is not implicitly convertible to %1">;
78def err_typecheck_converted_constant_expression_disallowed : Error<
79 "conversion from %0 to %1 is not allowed in a converted constant expression">;
80def err_typecheck_converted_constant_expression_indirect : Error<
81 "conversion from %0 to %1 in converted constant expression would "
82 "bind reference to a temporary">;
83def err_expr_not_cce : Error<
84 "%select{case value|enumerator value|non-type template argument|"
85 "array size|constexpr if condition|explicit specifier argument}0 "
86 "is not a constant expression">;
87def ext_cce_narrowing : ExtWarn<
88 "%select{case value|enumerator value|non-type template argument|"
89 "array size|constexpr if condition|explicit specifier argument}0 "
90 "%select{cannot be narrowed from type %2 to %3|"
91 "evaluates to %2, which cannot be narrowed to type %3}1">,
92 InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
93def err_ice_not_integral : Error<
94 "%select{integer|integral}1 constant expression must have "
95 "%select{integer|integral or unscoped enumeration}1 type, not %0">;
96def err_ice_incomplete_type : Error<
97 "integral constant expression has incomplete class type %0">;
98def err_ice_explicit_conversion : Error<
99 "integral constant expression requires explicit conversion from %0 to %1">;
100def note_ice_conversion_here : Note<
101 "conversion to %select{integral|enumeration}0 type %1 declared here">;
102def err_ice_ambiguous_conversion : Error<
103 "ambiguous conversion from type %0 to an integral or unscoped "
104 "enumeration type">;
105def err_ice_too_large : Error<
106 "integer constant expression evaluates to value %0 that cannot be "
107 "represented in a %1-bit %select{signed|unsigned}2 integer type">;
108def err_expr_not_string_literal : Error<"expression is not a string literal">;
109
110// Semantic analysis of constant literals.
111def ext_predef_outside_function : Warning<
112 "predefined identifier is only valid inside function">,
113 InGroup<DiagGroup<"predefined-identifier-outside-function">>;
114def warn_float_overflow : Warning<
115 "magnitude of floating-point constant too large for type %0; maximum is %1">,
116 InGroup<LiteralRange>;
117def warn_float_underflow : Warning<
118 "magnitude of floating-point constant too small for type %0; minimum is %1">,
119 InGroup<LiteralRange>;
120def warn_double_const_requires_fp64 : Warning<
121 "double precision constant requires cl_khr_fp64, casting to single precision">;
122def err_half_const_requires_fp16 : Error<
123 "half precision constant requires cl_khr_fp16">;
124
125// C99 variable-length arrays
126def ext_vla : Extension<"variable length arrays are a C99 feature">,
127 InGroup<VLAExtension>;
128def warn_vla_used : Warning<"variable length array used">,
129 InGroup<VLA>, DefaultIgnore;
130def err_vla_in_sfinae : Error<
131 "variable length array cannot be formed during template argument deduction">;
132def err_array_star_in_function_definition : Error<
133 "variable length array must be bound in function definition">;
134def err_vla_decl_in_file_scope : Error<
135 "variable length array declaration not allowed at file scope">;
136def err_vla_decl_has_static_storage : Error<
137 "variable length array declaration cannot have 'static' storage duration">;
138def err_vla_decl_has_extern_linkage : Error<
139 "variable length array declaration cannot have 'extern' linkage">;
140def ext_vla_folded_to_constant : ExtWarn<
141 "variable length array folded to constant array as an extension">,
142 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<C99Designator>;
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_or_sizeless_init : Error<
176 "designator in initializer for %select{scalar|indivisible sizeless}0 "
177 "type %1">;
178def warn_initializer_overrides : Warning<
179 "initializer %select{partially |}0overrides prior initialization of "
180 "this subobject">, InGroup<InitializerOverrides>;
181def ext_initializer_overrides : ExtWarn<warn_initializer_overrides.Text>,
182 InGroup<InitializerOverrides>, SFINAEFailure;
183def err_initializer_overrides_destructed : Error<
184 "initializer would partially override prior initialization of object of "
185 "type %1 with non-trivial destruction">;
186def note_previous_initializer : Note<
187 "previous initialization %select{|with side effects }0is here"
188 "%select{| (side effects will not occur at run time)}0">;
189def err_designator_into_flexible_array_member : Error<
190 "designator into flexible array member subobject">;
191def note_flexible_array_member : Note<
192 "initialized flexible array member %0 is here">;
193def ext_flexible_array_init : Extension<
194 "flexible array initialization is a GNU extension">, InGroup<GNUFlexibleArrayInitializer>;
195
196// C++20 designated initializers
197def ext_cxx_designated_init : Extension<
198 "designated initializers are a C++20 extension">, InGroup<CXX20Designator>;
199def warn_cxx17_compat_designated_init : Warning<
200 "designated initializers are incompatible with C++ standards before C++20">,
201 InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
202def ext_designated_init_mixed : ExtWarn<
203 "mixture of designated and non-designated initializers in the same "
204 "initializer list is a C99 extension">, InGroup<C99Designator>;
205def note_designated_init_mixed : Note<
206 "first non-designated initializer is here">;
207def ext_designated_init_array : ExtWarn<
208 "array designators are a C99 extension">, InGroup<C99Designator>;
209def ext_designated_init_nested : ExtWarn<
210 "nested designators are a C99 extension">, InGroup<C99Designator>;
211def ext_designated_init_reordered : ExtWarn<
212 "ISO C++ requires field designators to be specified in declaration order; "
213 "field %1 will be initialized after field %0">, InGroup<ReorderInitList>,
214 SFINAEFailure;
215def note_previous_field_init : Note<
216 "previous initialization for field %0 is here">;
217def ext_designated_init_brace_elision : ExtWarn<
218 "brace elision for designated initializer is a C99 extension">,
219 InGroup<C99Designator>, SFINAEFailure;
220
221// Declarations.
222def ext_plain_complex : ExtWarn<
223 "plain '_Complex' requires a type specifier; assuming '_Complex double'">;
224def ext_imaginary_constant : Extension<
225 "imaginary constants are a GNU extension">, InGroup<GNUImaginaryConstant>;
226def ext_integer_complex : Extension<
227 "complex integer types are a GNU extension">, InGroup<GNUComplexInteger>;
228
229def err_invalid_saturation_spec : Error<"'_Sat' specifier is only valid on "
230 "'_Fract' or '_Accum', not '%0'">;
231def err_invalid_sign_spec : Error<"'%0' cannot be signed or unsigned">;
232def err_invalid_width_spec : Error<
233 "'%select{|short|long|long long}0 %1' is invalid">;
234def err_invalid_complex_spec : Error<"'_Complex %0' is invalid">;
235
236def ext_auto_type_specifier : ExtWarn<
237 "'auto' type specifier is a C++11 extension">, InGroup<CXX11>;
238def warn_auto_storage_class : Warning<
239 "'auto' storage class specifier is redundant and incompatible with C++11">,
240 InGroup<CXX11Compat>, DefaultIgnore;
241
242def warn_deprecated_register : Warning<
243 "'register' storage class specifier is deprecated "
244 "and incompatible with C++17">, InGroup<DeprecatedRegister>;
245def ext_register_storage_class : ExtWarn<
246 "ISO C++17 does not allow 'register' storage class specifier">,
247 DefaultError, InGroup<Register>;
248
249def err_invalid_decl_spec_combination : Error<
250 "cannot combine with previous '%0' declaration specifier">;
251def err_invalid_vector_decl_spec_combination : Error<
252 "cannot combine with previous '%0' declaration specifier. "
253 "'__vector' must be first">;
254def err_invalid_pixel_decl_spec_combination : Error<
255 "'__pixel' must be preceded by '__vector'. "
256 "'%0' declaration specifier not allowed here">;
257def err_invalid_vector_bool_decl_spec : Error<
258 "cannot use '%0' with '__vector bool'">;
259def err_invalid_vector_long_decl_spec : Error<
260 "cannot use 'long' with '__vector'">;
261def err_invalid_vector_float_decl_spec : Error<
262 "cannot use 'float' with '__vector'">;
263def err_invalid_vector_double_decl_spec : Error <
264 "use of 'double' with '__vector' requires VSX support to be enabled "
265 "(available on POWER7 or later)">;
266def err_invalid_vector_bool_int128_decl_spec : Error <
267 "use of '__int128' with '__vector bool' requires VSX support enabled (on "
268 "POWER10 or later)">;
269def err_invalid_vector_long_long_decl_spec : Error <
270 "use of 'long long' with '__vector bool' requires VSX support (available on "
271 "POWER7 or later) or extended Altivec support (available on POWER8 or later) "
272 "to be enabled">;
273def err_invalid_vector_long_double_decl_spec : Error<
274 "cannot use 'long double' with '__vector'">;
275def warn_vector_long_decl_spec_combination : Warning<
276 "Use of 'long' with '__vector' is deprecated">, InGroup<Deprecated>;
277
278def err_redeclaration_different_type : Error<
279 "redeclaration of %0 with a different type%diff{: $ vs $|}1,2">;
280def err_bad_variable_name : Error<
281 "%0 cannot be the name of a variable or data member">;
282def err_bad_parameter_name : Error<
283 "%0 cannot be the name of a parameter">;
284def err_bad_parameter_name_template_id : Error<
285 "parameter name cannot have template arguments">;
286def ext_parameter_name_omitted_c2x : ExtWarn<
287 "omitting the parameter name in a function definition is a C2x extension">,
288 InGroup<C2x>;
289def err_anyx86_interrupt_attribute : Error<
290 "%select{x86|x86-64}0 'interrupt' attribute only applies to functions that "
291 "have %select{a 'void' return type|"
292 "only a pointer parameter optionally followed by an integer parameter|"
293 "a pointer as the first parameter|a %2 type as the second parameter}1">;
294def err_anyx86_interrupt_called : Error<
295 "interrupt service routine cannot be called directly">;
296def warn_anyx86_interrupt_regsave : Warning<
297 "interrupt service routine should only call a function"
298 " with attribute 'no_caller_saved_registers'">,
299 InGroup<DiagGroup<"interrupt-service-routine">>;
300def warn_arm_interrupt_calling_convention : Warning<
301 "call to function without interrupt attribute could clobber interruptee's VFP registers">,
302 InGroup<Extra>;
303def warn_interrupt_attribute_invalid : Warning<
304 "%select{MIPS|MSP430|RISC-V}0 'interrupt' attribute only applies to "
305 "functions that have %select{no parameters|a 'void' return type}1">,
306 InGroup<IgnoredAttributes>;
307def warn_riscv_repeated_interrupt_attribute : Warning<
308 "repeated RISC-V 'interrupt' attribute">, InGroup<IgnoredAttributes>;
309def note_riscv_repeated_interrupt_attribute : Note<
310 "repeated RISC-V 'interrupt' attribute is here">;
311def warn_unused_parameter : Warning<"unused parameter %0">,
312 InGroup<UnusedParameter>, DefaultIgnore;
313def warn_unused_variable : Warning<"unused variable %0">,
314 InGroup<UnusedVariable>, DefaultIgnore;
315def warn_unused_local_typedef : Warning<
316 "unused %select{typedef|type alias}0 %1">,
317 InGroup<UnusedLocalTypedef>, DefaultIgnore;
318def warn_unused_property_backing_ivar :
319 Warning<"ivar %0 which backs the property is not "
320 "referenced in this property's accessor">,
321 InGroup<UnusedPropertyIvar>, DefaultIgnore;
322def warn_unused_const_variable : Warning<"unused variable %0">,
323 InGroup<UnusedConstVariable>, DefaultIgnore;
324def warn_unused_exception_param : Warning<"unused exception parameter %0">,
325 InGroup<UnusedExceptionParameter>, DefaultIgnore;
326def warn_decl_in_param_list : Warning<
327 "declaration of %0 will not be visible outside of this function">,
328 InGroup<Visibility>;
329def warn_redefinition_in_param_list : Warning<
330 "redefinition of %0 will not be visible outside of this function">,
331 InGroup<Visibility>;
332def warn_empty_parens_are_function_decl : Warning<
333 "empty parentheses interpreted as a function declaration">,
334 InGroup<VexingParse>;
335def warn_parens_disambiguated_as_function_declaration : Warning<
336 "parentheses were disambiguated as a function declaration">,
337 InGroup<VexingParse>;
338def warn_parens_disambiguated_as_variable_declaration : Warning<
339 "parentheses were disambiguated as redundant parentheses around declaration "
340 "of variable named %0">, InGroup<VexingParse>;
341def warn_redundant_parens_around_declarator : Warning<
342 "redundant parentheses surrounding declarator">,
343 InGroup<DiagGroup<"redundant-parens">>, DefaultIgnore;
344def note_additional_parens_for_variable_declaration : Note<
345 "add a pair of parentheses to declare a variable">;
346def note_raii_guard_add_name : Note<
347 "add a variable name to declare a %0 initialized with %1">;
348def note_function_style_cast_add_parentheses : Note<
349 "add enclosing parentheses to perform a function-style cast">;
350def note_remove_parens_for_variable_declaration : Note<
351 "remove parentheses to silence this warning">;
352def note_empty_parens_function_call : Note<
353 "change this ',' to a ';' to call %0">;
354def note_empty_parens_default_ctor : Note<
355 "remove parentheses to declare a variable">;
356def note_empty_parens_zero_initialize : Note<
357 "replace parentheses with an initializer to declare a variable">;
358def warn_unused_function : Warning<"unused function %0">,
359 InGroup<UnusedFunction>, DefaultIgnore;
360def warn_unused_template : Warning<"unused %select{function|variable}0 template %1">,
361 InGroup<UnusedTemplate>, DefaultIgnore;
362def warn_unused_member_function : Warning<"unused member function %0">,
363 InGroup<UnusedMemberFunction>, DefaultIgnore;
364def warn_used_but_marked_unused: Warning<"%0 was marked unused but was used">,
365 InGroup<UsedButMarkedUnused>, DefaultIgnore;
366def warn_unneeded_internal_decl : Warning<
367 "%select{function|variable}0 %1 is not needed and will not be emitted">,
368 InGroup<UnneededInternalDecl>, DefaultIgnore;
369def warn_unneeded_static_internal_decl : Warning<
370 "'static' function %0 declared in header file "
371 "should be declared 'static inline'">,
372 InGroup<UnneededInternalDecl>, DefaultIgnore;
373def warn_unneeded_member_function : Warning<
374 "member function %0 is not needed and will not be emitted">,
375 InGroup<UnneededMemberFunction>, DefaultIgnore;
376def warn_unused_private_field: Warning<"private field %0 is not used">,
377 InGroup<UnusedPrivateField>, DefaultIgnore;
378def warn_unused_lambda_capture: Warning<"lambda capture %0 is not "
379 "%select{used|required to be captured for this use}1">,
380 InGroup<UnusedLambdaCapture>, DefaultIgnore;
381
382def warn_reserved_extern_symbol: Warning<
383 "identifier %0 is reserved because %select{"
384 "<ERROR>|" // ReservedIdentifierStatus::NotReserved
385 "it starts with '_' at global scope|"
386 "it starts with '__'|"
387 "it starts with '_' followed by a capital letter|"
388 "it contains '__'}1">,
389 InGroup<ReservedIdentifier>, DefaultIgnore;
390
391def warn_parameter_size: Warning<
392 "%0 is a large (%1 bytes) pass-by-value argument; "
393 "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
394def warn_return_value_size: Warning<
395 "return value of %0 is a large (%1 bytes) pass-by-value object; "
396 "pass it by reference instead ?">, InGroup<LargeByValueCopy>;
397def warn_return_value_udt: Warning<
398 "%0 has C-linkage specified, but returns user-defined type %1 which is "
399 "incompatible with C">, InGroup<ReturnTypeCLinkage>;
400def warn_return_value_udt_incomplete: Warning<
401 "%0 has C-linkage specified, but returns incomplete type %1 which could be "
402 "incompatible with C">, InGroup<ReturnTypeCLinkage>;
403def warn_implicit_function_decl : Warning<
404 "implicit declaration of function %0">,
405 InGroup<ImplicitFunctionDeclare>, DefaultIgnore;
406def ext_implicit_function_decl : ExtWarn<
407 "implicit declaration of function %0 is invalid in C99">,
408 InGroup<ImplicitFunctionDeclare>;
409def note_function_suggestion : Note<"did you mean %0?">;
410
411def err_ellipsis_first_param : Error<
412 "ISO C requires a named parameter before '...'">;
413def err_declarator_need_ident : Error<"declarator requires an identifier">;
414def err_language_linkage_spec_unknown : Error<"unknown linkage language">;
415def err_language_linkage_spec_not_ascii : Error<
416 "string literal in language linkage specifier cannot have an "
417 "encoding-prefix">;
418def ext_use_out_of_scope_declaration : ExtWarn<
419 "use of out-of-scope declaration of %0%select{| whose type is not "
420 "compatible with that of an implicit declaration}1">,
421 InGroup<DiagGroup<"out-of-scope-function">>;
422def err_inline_non_function : Error<
423 "'inline' can only appear on functions%select{| and non-local variables}0">;
424def err_noreturn_non_function : Error<
425 "'_Noreturn' can only appear on functions">;
426def warn_qual_return_type : Warning<
427 "'%0' type qualifier%s1 on return type %plural{1:has|:have}1 no effect">,
428 InGroup<IgnoredQualifiers>, DefaultIgnore;
429def warn_deprecated_redundant_constexpr_static_def : Warning<
430 "out-of-line definition of constexpr static data member is redundant "
431 "in C++17 and is deprecated">,
432 InGroup<Deprecated>, DefaultIgnore;
433
434def warn_decl_shadow :
435 Warning<"declaration shadows a %select{"
436 "local variable|"
437 "variable in %2|"
438 "static data member of %2|"
439 "field of %2|"
440 "typedef in %2|"
441 "type alias in %2|"
442 "structured binding}1">,
443 InGroup<Shadow>, DefaultIgnore;
444def warn_decl_shadow_uncaptured_local :
445 Warning<warn_decl_shadow.Text>,
446 InGroup<ShadowUncapturedLocal>, DefaultIgnore;
447def warn_ctor_parm_shadows_field:
448 Warning<"constructor parameter %0 shadows the field %1 of %2">,
449 InGroup<ShadowFieldInConstructor>, DefaultIgnore;
450def warn_modifying_shadowing_decl :
451 Warning<"modifying constructor parameter %0 that shadows a "
452 "field of %1">,
453 InGroup<ShadowFieldInConstructorModified>, DefaultIgnore;
454
455// C++ decomposition declarations
456def err_decomp_decl_context : Error<
457 "decomposition declaration not permitted in this context">;
458def warn_cxx14_compat_decomp_decl : Warning<
459 "decomposition declarations are incompatible with "
460 "C++ standards before C++17">, DefaultIgnore, InGroup<CXXPre17Compat>;
461def ext_decomp_decl : ExtWarn<
462 "decomposition declarations are a C++17 extension">, InGroup<CXX17>;
463def ext_decomp_decl_cond : ExtWarn<
464 "ISO C++17 does not permit structured binding declaration in a condition">,
465 InGroup<DiagGroup<"binding-in-condition">>;
466def err_decomp_decl_spec : Error<
467 "decomposition declaration cannot be declared "
468 "%plural{1:'%1'|:with '%1' specifiers}0">;
469def ext_decomp_decl_spec : ExtWarn<
470 "decomposition declaration declared "
471 "%plural{1:'%1'|:with '%1' specifiers}0 is a C++20 extension">,
472 InGroup<CXX20>;
473def warn_cxx17_compat_decomp_decl_spec : Warning<
474 "decomposition declaration declared "
475 "%plural{1:'%1'|:with '%1' specifiers}0 "
476 "is incompatible with C++ standards before C++20">,
477 InGroup<CXXPre20Compat>, DefaultIgnore;
478def err_decomp_decl_type : Error<
479 "decomposition declaration cannot be declared with type %0; "
480 "declared type must be 'auto' or reference to 'auto'">;
481def err_decomp_decl_parens : Error<
482 "decomposition declaration cannot be declared with parentheses">;
483def err_decomp_decl_template : Error<
484 "decomposition declaration template not supported">;
485def err_decomp_decl_not_alone : Error<
486 "decomposition declaration must be the only declaration in its group">;
487def err_decomp_decl_requires_init : Error<
488 "decomposition declaration %0 requires an initializer">;
489def err_decomp_decl_wrong_number_bindings : Error<
490 "type %0 decomposes into %3 %plural{1:element|:elements}2, but "
491 "%select{%plural{0:no|:only %1}1|%1}4 "
492 "%plural{1:name was|:names were}1 provided">;
493def err_decomp_decl_unbindable_type : Error<
494 "cannot decompose %select{union|non-class, non-array}1 type %2">;
495def err_decomp_decl_multiple_bases_with_members : Error<
496 "cannot decompose class type %1: "
497 "%select{its base classes %2 and|both it and its base class}0 %3 "
498 "have non-static data members">;
499def err_decomp_decl_ambiguous_base : Error<
500 "cannot decompose members of ambiguous base class %1 of %0:%2">;
501def err_decomp_decl_inaccessible_base : Error<
502 "cannot decompose members of inaccessible base class %1 of %0">,
503 AccessControl;
504def err_decomp_decl_inaccessible_field : Error<
505 "cannot decompose %select{private|protected}0 member %1 of %3">,
506 AccessControl;
507def err_decomp_decl_lambda : Error<
508 "cannot decompose lambda closure type">;
509def err_decomp_decl_anon_union_member : Error<
510 "cannot decompose class type %0 because it has an anonymous "
511 "%select{struct|union}1 member">;
512def err_decomp_decl_std_tuple_element_not_specialized : Error<
513 "cannot decompose this type; 'std::tuple_element<%0>::type' "
514 "does not name a type">;
515def err_decomp_decl_std_tuple_size_not_constant : Error<
516 "cannot decompose this type; 'std::tuple_size<%0>::value' "
517 "is not a valid integral constant expression">;
518def note_in_binding_decl_init : Note<
519 "in implicit initialization of binding declaration %0">;
520
521def err_std_type_trait_not_class_template : Error<
522 "unsupported standard library implementation: "
523 "'std::%0' is not a class template">;
524
525// C++ using declarations
526def err_using_requires_qualname : Error<
527 "using declaration requires a qualified name">;
528def err_using_typename_non_type : Error<
529 "'typename' keyword used on a non-type">;
530def err_using_dependent_value_is_type : Error<
531 "dependent using declaration resolved to type without 'typename'">;
532def err_using_decl_nested_name_specifier_is_not_class : Error<
533 "using declaration in class refers into '%0', which is not a class">;
534def err_using_decl_nested_name_specifier_is_current_class : Error<
535 "using declaration refers to its own class">;
536def err_using_decl_nested_name_specifier_is_not_base_class : Error<
537 "using declaration refers into '%0', which is not a base class of %1">;
538def err_using_decl_constructor_not_in_direct_base : Error<
539 "%0 is not a direct base of %1, cannot inherit constructors">;
540def err_using_decl_can_not_refer_to_class_member : Error<
541 "using declaration cannot refer to class member">;
542def err_ambiguous_inherited_constructor : Error<
543 "constructor of %0 inherited from multiple base class subobjects">;
544def note_ambiguous_inherited_constructor_using : Note<
545 "inherited from base class %0 here">;
546def note_using_decl_class_member_workaround : Note<
547 "use %select{an alias declaration|a typedef declaration|a reference|"
548 "a const variable|a constexpr variable}0 instead">;
549def err_using_decl_can_not_refer_to_namespace : Error<
550 "using declaration cannot refer to a namespace">;
551def err_using_decl_can_not_refer_to_scoped_enum : Error<
552 "using declaration cannot refer to a scoped enumerator">;
553def err_using_decl_constructor : Error<
554 "using declaration cannot refer to a constructor">;
555def warn_cxx98_compat_using_decl_constructor : Warning<
556 "inheriting constructors are incompatible with C++98">,
557 InGroup<CXX98Compat>, DefaultIgnore;
558def err_using_decl_destructor : Error<
559 "using declaration cannot refer to a destructor">;
560def err_using_decl_template_id : Error<
561 "using declaration cannot refer to a template specialization">;
562def note_using_decl_target : Note<"target of using declaration">;
563def note_using_decl_conflict : Note<"conflicting declaration">;
564def err_using_decl_redeclaration : Error<"redeclaration of using declaration">;
565def err_using_decl_conflict : Error<
566 "target of using declaration conflicts with declaration already in scope">;
567def err_using_decl_conflict_reverse : Error<
568 "declaration conflicts with target of using declaration already in scope">;
569def note_using_decl : Note<"%select{|previous }0using declaration">;
570def err_using_decl_redeclaration_expansion : Error<
571 "using declaration pack expansion at block scope produces multiple values">;
572
573def warn_access_decl_deprecated : Warning<
574 "access declarations are deprecated; use using declarations instead">,
575 InGroup<Deprecated>;
576def err_access_decl : Error<
577 "ISO C++11 does not allow access declarations; "
578 "use using declarations instead">;
579def warn_deprecated_copy : Warning<
580 "definition of implicit copy %select{constructor|assignment operator}1 "
581 "for %0 is deprecated because it has a user-declared copy "
582 "%select{assignment operator|constructor}1">,
583 InGroup<DeprecatedCopy>, DefaultIgnore;
584def warn_deprecated_copy_with_dtor : Warning<
585 "definition of implicit copy %select{constructor|assignment operator}1 "
586 "for %0 is deprecated because it has a user-declared destructor">,
587 InGroup<DeprecatedCopyWithDtor>, DefaultIgnore;
588def warn_deprecated_copy_with_user_provided_copy: Warning<
589 "definition of implicit copy %select{constructor|assignment operator}1 "
590 "for %0 is deprecated because it has a user-provided copy "
591 "%select{assignment operator|constructor}1">,
592 InGroup<DeprecatedCopyWithUserProvidedCopy>, DefaultIgnore;
593def warn_deprecated_copy_with_user_provided_dtor : Warning<
594 "definition of implicit copy %select{constructor|assignment operator}1 "
595 "for %0 is deprecated because it has a user-provided destructor">,
596 InGroup<DeprecatedCopyWithUserProvidedDtor>, DefaultIgnore;
597def warn_cxx17_compat_exception_spec_in_signature : Warning<
598 "mangled name of %0 will change in C++17 due to non-throwing exception "
599 "specification in function signature">, InGroup<CXX17CompatMangling>;
600
601def warn_global_constructor : Warning<
602 "declaration requires a global constructor">,
603 InGroup<GlobalConstructors>, DefaultIgnore;
604def warn_global_destructor : Warning<
605 "declaration requires a global destructor">,
606 InGroup<GlobalConstructors>, DefaultIgnore;
607def warn_exit_time_destructor : Warning<
608 "declaration requires an exit-time destructor">,
609 InGroup<ExitTimeDestructors>, DefaultIgnore;
610
611def err_invalid_thread : Error<
612 "'%0' is only allowed on variable declarations">;
613def err_thread_non_global : Error<
614 "'%0' variables must have global storage">;
615def err_thread_unsupported : Error<
616 "thread-local storage is not supported for the current target">;
617
618// FIXME: Combine fallout warnings to just one warning.
619def warn_maybe_falloff_nonvoid_function : Warning<
620 "non-void function does not return a value in all control paths">,
621 InGroup<ReturnType>;
622def warn_falloff_nonvoid_function : Warning<
623 "non-void function does not return a value">,
624 InGroup<ReturnType>;
625def err_maybe_falloff_nonvoid_block : Error<
626 "non-void block does not return a value in all control paths">;
627def err_falloff_nonvoid_block : Error<
628 "non-void block does not return a value">;
629def warn_maybe_falloff_nonvoid_coroutine : Warning<
630 "non-void coroutine does not return a value in all control paths">,
631 InGroup<ReturnType>;
632def warn_falloff_nonvoid_coroutine : Warning<
633 "non-void coroutine does not return a value">,
634 InGroup<ReturnType>;
635def warn_suggest_noreturn_function : Warning<
636 "%select{function|method}0 %1 could be declared with attribute 'noreturn'">,
637 InGroup<MissingNoreturn>, DefaultIgnore;
638def warn_suggest_noreturn_block : Warning<
639 "block could be declared with attribute 'noreturn'">,
640 InGroup<MissingNoreturn>, DefaultIgnore;
641
642// Unreachable code.
643def warn_unreachable : Warning<
644 "code will never be executed">,
645 InGroup<UnreachableCode>, DefaultIgnore;
646def warn_unreachable_break : Warning<
647 "'break' will never be executed">,
648 InGroup<UnreachableCodeBreak>, DefaultIgnore;
649def warn_unreachable_return : Warning<
650 "'return' will never be executed">,
651 InGroup<UnreachableCodeReturn>, DefaultIgnore;
652def warn_unreachable_loop_increment : Warning<
653 "loop will run at most once (loop increment never executed)">,
654 InGroup<UnreachableCodeLoopIncrement>, DefaultIgnore;
655def note_unreachable_silence : Note<
656 "silence by adding parentheses to mark code as explicitly dead">;
657
658/// Built-in functions.
659def ext_implicit_lib_function_decl : ExtWarn<
660 "implicitly declaring library function '%0' with type %1">,
661 InGroup<ImplicitFunctionDeclare>;
662def note_include_header_or_declare : Note<
663 "include the header <%0> or explicitly provide a declaration for '%1'">;
664def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;
665def warn_implicit_decl_no_jmp_buf
666 : Warning<"declaration of built-in function '%0' requires the declaration"
667 " of the 'jmp_buf' type, commonly provided in the header <setjmp.h>.">,
668 InGroup<DiagGroup<"incomplete-setjmp-declaration">>;
669def warn_implicit_decl_requires_sysheader : Warning<
670 "declaration of built-in function '%1' requires inclusion of the header <%0>">,
671 InGroup<BuiltinRequiresHeader>;
672def warn_redecl_library_builtin : Warning<
673 "incompatible redeclaration of library function %0">,
674 InGroup<DiagGroup<"incompatible-library-redeclaration">>;
675def err_builtin_definition : Error<"definition of builtin function %0">;
676def err_builtin_redeclare : Error<"cannot redeclare builtin function %0">;
677def err_arm_invalid_specialreg : Error<"invalid special register for builtin">;
678def err_arm_invalid_coproc : Error<"coprocessor %0 must be configured as "
679 "%select{GCP|CDE}1">;
680def err_invalid_cpu_supports : Error<"invalid cpu feature string for builtin">;
681def err_invalid_cpu_is : Error<"invalid cpu name for builtin">;
682def err_invalid_cpu_specific_dispatch_value : Error<
683"invalid option '%0' for %select{cpu_specific|cpu_dispatch}1">;
684def warn_builtin_unknown : Warning<"use of unknown builtin %0">,
685 InGroup<ImplicitFunctionDeclare>, DefaultError;
686def warn_cstruct_memaccess : Warning<
687 "%select{destination for|source of|first operand of|second operand of}0 this "
688 "%1 call is a pointer to record %2 that is not trivial to "
689 "%select{primitive-default-initialize|primitive-copy}3">,
690 InGroup<NonTrivialMemaccess>;
691def note_nontrivial_field : Note<
692 "field is non-trivial to %select{copy|default-initialize}0">;
693def err_non_trivial_c_union_in_invalid_context : Error<
694 "cannot %select{"
695 "use type %1 for a function/method parameter|"
696 "use type %1 for function/method return|"
697 "default-initialize an object of type %1|"
698 "declare an automatic variable of type %1|"
699 "copy-initialize an object of type %1|"
700 "assign to a variable of type %1|"
701 "construct an automatic compound literal of type %1|"
702 "capture a variable of type %1|"
703 "cannot use volatile type %1 where it causes an lvalue-to-rvalue conversion"
704 "}3 "
705 "since it %select{contains|is}2 a union that is non-trivial to "
706 "%select{default-initialize|destruct|copy}0">;
707def note_non_trivial_c_union : Note<
708 "%select{%2 has subobjects that are|%3 has type %2 that is}0 "
709 "non-trivial to %select{default-initialize|destruct|copy}1">;
710def warn_dyn_class_memaccess : Warning<
711 "%select{destination for|source of|first operand of|second operand of}0 this "
712 "%1 call is a pointer to %select{|class containing a }2dynamic class %3; "
713 "vtable pointer will be %select{overwritten|copied|moved|compared}4">,
714 InGroup<DynamicClassMemaccess>;
715def note_bad_memaccess_silence : Note<
716 "explicitly cast the pointer to silence this warning">;
717def warn_sizeof_pointer_expr_memaccess : Warning<
718 "'%0' call operates on objects of type %1 while the size is based on a "
719 "different type %2">,
720 InGroup<SizeofPointerMemaccess>;
721def warn_sizeof_pointer_expr_memaccess_note : Note<
722 "did you mean to %select{dereference the argument to 'sizeof' (and multiply "
723 "it by the number of elements)|remove the addressof in the argument to "
724 "'sizeof' (and multiply it by the number of elements)|provide an explicit "
725 "length}0?">;
726def warn_sizeof_pointer_type_memaccess : Warning<
727 "argument to 'sizeof' in %0 call is the same pointer type %1 as the "
728 "%select{destination|source}2; expected %3 or an explicit length">,
729 InGroup<SizeofPointerMemaccess>;
730def warn_strlcpycat_wrong_size : Warning<
731 "size argument in %0 call appears to be size of the source; "
732 "expected the size of the destination">,
733 InGroup<DiagGroup<"strlcpy-strlcat-size">>;
734def note_strlcpycat_wrong_size : Note<
735 "change size argument to be the size of the destination">;
736def warn_memsize_comparison : Warning<
737 "size argument in %0 call is a comparison">,
738 InGroup<DiagGroup<"memsize-comparison">>;
739def note_memsize_comparison_paren : Note<
740 "did you mean to compare the result of %0 instead?">;
741def note_memsize_comparison_cast_silence : Note<
742 "explicitly cast the argument to size_t to silence this warning">;
743def warn_suspicious_sizeof_memset : Warning<
744 "%select{'size' argument to memset is '0'|"
745 "setting buffer to a 'sizeof' expression}0"
746 "; did you mean to transpose the last two arguments?">,
747 InGroup<MemsetTransposedArgs>;
748def note_suspicious_sizeof_memset_silence : Note<
749 "%select{parenthesize the third argument|"
750 "cast the second argument to 'int'}0 to silence">;
751def warn_suspicious_bzero_size : Warning<"'size' argument to bzero is '0'">,
752 InGroup<SuspiciousBzero>;
753def note_suspicious_bzero_size_silence : Note<
754 "parenthesize the second argument to silence">;
755
756def warn_strncat_large_size : Warning<
757 "the value of the size argument in 'strncat' is too large, might lead to a "
758 "buffer overflow">, InGroup<StrncatSize>;
759def warn_strncat_src_size : Warning<"size argument in 'strncat' call appears "
760 "to be size of the source">, InGroup<StrncatSize>;
761def warn_strncat_wrong_size : Warning<
762 "the value of the size argument to 'strncat' is wrong">, InGroup<StrncatSize>;
763def note_strncat_wrong_size : Note<
764 "change the argument to be the free space in the destination buffer minus "
765 "the terminating null byte">;
766
767def warn_assume_side_effects : Warning<
768 "the argument to %0 has side effects that will be discarded">,
769 InGroup<DiagGroup<"assume">>;
770def warn_assume_attribute_string_unknown : Warning<
771 "unknown assumption string '%0'; attribute is potentially ignored">,
772 InGroup<UnknownAssumption>;
773def warn_assume_attribute_string_unknown_suggested : Warning<
774 "unknown assumption string '%0' may be misspelled; attribute is potentially "
775 "ignored, did you mean '%1'?">,
776 InGroup<MisspelledAssumption>;
777
778def warn_builtin_chk_overflow : Warning<
779 "'%0' will always overflow; destination buffer has size %1,"
780 " but size argument is %2">,
781 InGroup<DiagGroup<"builtin-memcpy-chk-size">>;
782
783def warn_fortify_source_overflow
784 : Warning<warn_builtin_chk_overflow.Text>, InGroup<FortifySource>;
785def warn_fortify_source_size_mismatch : Warning<
786 "'%0' size argument is too large; destination buffer has size %1,"
787 " but size argument is %2">, InGroup<FortifySource>;
788
789def warn_fortify_source_format_overflow : Warning<
790 "'%0' will always overflow; destination buffer has size %1,"
791 " but format string expands to at least %2">,
792 InGroup<FortifySource>;
793
794
795/// main()
796// static main() is not an error in C, just in C++.
797def warn_static_main : Warning<"'main' should not be declared static">,
798 InGroup<Main>;
799def err_static_main : Error<"'main' is not allowed to be declared static">;
800def err_inline_main : Error<"'main' is not allowed to be declared inline">;
801def ext_variadic_main : ExtWarn<
802 "'main' is not allowed to be declared variadic">, InGroup<Main>;
803def ext_noreturn_main : ExtWarn<
804 "'main' is not allowed to be declared _Noreturn">, InGroup<Main>;
805def note_main_remove_noreturn : Note<"remove '_Noreturn'">;
806def err_constexpr_main : Error<
807 "'main' is not allowed to be declared %select{constexpr|consteval}0">;
808def err_deleted_main : Error<"'main' is not allowed to be deleted">;
809def err_mainlike_template_decl : Error<"%0 cannot be a template">;
810def err_main_returns_nonint : Error<"'main' must return 'int'">;
811def ext_main_returns_nonint : ExtWarn<"return type of 'main' is not 'int'">,
812 InGroup<MainReturnType>;
813def note_main_change_return_type : Note<"change return type to 'int'">;
814def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
815 "must be 0, 2, or 3">;
816def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
817 InGroup<Main>;
818def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
819 "parameter of 'main' (%select{argument count|argument array|environment|"
820 "platform-specific data}0) must be of type %1">;
821def warn_main_returns_bool_literal : Warning<"bool literal returned from "
822 "'main'">, InGroup<Main>;
823def err_main_global_variable :
824 Error<"main cannot be declared as global variable">;
825def warn_main_redefined : Warning<"variable named 'main' with external linkage "
826 "has undefined behavior">, InGroup<Main>;
827def ext_main_used : Extension<
828 "ISO C++ does not allow 'main' to be used by a program">, InGroup<Main>;
829
830/// parser diagnostics
831def ext_no_declarators : ExtWarn<"declaration does not declare anything">,
832 InGroup<MissingDeclarations>;
833def err_no_declarators : Error<"declaration does not declare anything">;
834def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
835 InGroup<MissingDeclarations>;
836def err_typedef_not_identifier : Error<"typedef name must be an identifier">;
837
838def ext_non_c_like_anon_struct_in_typedef : ExtWarn<
839 "anonymous non-C-compatible type given name for linkage purposes "
840 "by %select{typedef|alias}0 declaration; "
841 "add a tag name here">, InGroup<DiagGroup<"non-c-typedef-for-linkage">>;
842def err_non_c_like_anon_struct_in_typedef : Error<
843 "anonymous non-C-compatible type given name for linkage purposes "
844 "by %select{typedef|alias}0 declaration after its linkage was computed; "
845 "add a tag name here to establish linkage prior to definition">;
846def err_typedef_changes_linkage : Error<
847 "unsupported: anonymous type given name for linkage purposes "
848 "by %select{typedef|alias}0 declaration after its linkage was computed; "
849 "add a tag name here to establish linkage prior to definition">;
850def note_non_c_like_anon_struct : Note<
851 "type is not C-compatible due to this "
852 "%select{base class|default member initializer|lambda expression|"
853 "friend declaration|member declaration}0">;
854def note_typedef_for_linkage_here : Note<
855 "type is given name %0 for linkage purposes by this "
856 "%select{typedef|alias}1 declaration">;
857
858def err_statically_allocated_object : Error<
859 "interface type cannot be statically allocated">;
860def err_object_cannot_be_passed_returned_by_value : Error<
861 "interface type %1 cannot be %select{returned|passed}0 by value"
862 "; did you forget * in %1?">;
863def err_parameters_retval_cannot_have_fp16_type : Error<
864 "%select{parameters|function return value}0 cannot have __fp16 type; did you forget * ?">;
865def err_opencl_half_load_store : Error<
866 "%select{loading directly from|assigning directly to}0 pointer to type %1 requires "
867 "cl_khr_fp16. Use vector data %select{load|store}0 builtin functions instead">;
868def err_opencl_cast_to_half : Error<"casting to type %0 is not allowed">;
869def err_opencl_half_declaration : Error<
870 "declaring variable of type %0 is not allowed">;
871def err_opencl_invalid_param : Error<
872 "declaring function parameter of type %0 is not allowed%select{; did you forget * ?|}1">;
873def err_opencl_invalid_return : Error<
874 "declaring function return value of type %0 is not allowed %select{; did you forget * ?|}1">;
875def warn_enum_value_overflow : Warning<"overflow in enumeration value">;
876def warn_pragma_options_align_reset_failed : Warning<
877 "#pragma options align=reset failed: %0">,
878 InGroup<IgnoredPragmas>;
879def err_pragma_options_align_mac68k_target_unsupported : Error<
880 "mac68k alignment pragma is not supported on this target">;
881def warn_pragma_pack_invalid_alignment : Warning<
882 "expected #pragma pack parameter to be '1', '2', '4', '8', or '16'">,
883 InGroup<IgnoredPragmas>;
884def err_pragma_pack_invalid_alignment : Error<
885 warn_pragma_pack_invalid_alignment.Text>;
886def warn_pragma_pack_non_default_at_include : Warning<
887 "non-default #pragma pack value changes the alignment of struct or union "
888 "members in the included file">, InGroup<PragmaPackSuspiciousInclude>,
889 DefaultIgnore;
890def warn_pragma_pack_modified_after_include : Warning<
891 "the current #pragma pack alignment value is modified in the included "
892 "file">, InGroup<PragmaPack>;
893def warn_pragma_pack_no_pop_eof : Warning<"unterminated "
894 "'#pragma pack (push, ...)' at end of file">, InGroup<PragmaPack>;
895def note_pragma_pack_here : Note<
896 "previous '#pragma pack' directive that modifies alignment is here">;
897def note_pragma_pack_pop_instead_reset : Note<
898 "did you intend to use '#pragma pack (pop)' instead of '#pragma pack()'?">;
899// Follow the Microsoft implementation.
900def warn_pragma_pack_show : Warning<"value of #pragma pack(show) == %0">;
901def warn_pragma_pack_pop_identifier_and_alignment : Warning<
902 "specifying both a name and alignment to 'pop' is undefined">;
903def warn_pragma_pop_failed : Warning<"#pragma %0(pop, ...) failed: %1">,
904 InGroup<IgnoredPragmas>;
905def err_pragma_fc_pp_scope : Error<
906 "'#pragma float_control push/pop' can only appear at file scope or namespace scope">;
907def err_pragma_fc_noprecise_requires_nofenv : Error<
908 "'#pragma float_control(precise, off)' is illegal when fenv_access is enabled">;
909def err_pragma_fc_except_requires_precise : Error<
910 "'#pragma float_control(except, on)' is illegal when precise is disabled">;
911def err_pragma_fc_noprecise_requires_noexcept : Error<
912 "'#pragma float_control(precise, off)' is illegal when except is enabled">;
913def err_pragma_fenv_requires_precise : Error<
914 "'#pragma STDC FENV_ACCESS ON' is illegal when precise is disabled">;
915def warn_cxx_ms_struct :
916 Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
917 "with base classes or virtual functions">,
918 DefaultError, InGroup<IncompatibleMSStruct>;
919def err_pragma_pack_identifer_not_supported : Error<
920 "specifying an identifier within `#pragma pack` is not supported on this target">;
921def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
922def err_no_base_classes : Error<"invalid use of '__super', %0 has no base classes">;
923def err_invalid_super_scope : Error<"invalid use of '__super', "
924 "this keyword can only be used inside class or member function scope">;
925def err_super_in_lambda_unsupported : Error<
926 "use of '__super' inside a lambda is unsupported">;
927
928def warn_pragma_unused_undeclared_var : Warning<
929 "undeclared variable %0 used as an argument for '#pragma unused'">,
930 InGroup<IgnoredPragmas>;
931def warn_atl_uuid_deprecated : Warning<
932 "specifying 'uuid' as an ATL attribute is deprecated; use __declspec instead">,
933 InGroup<DeprecatedDeclarations>;
934def warn_pragma_unused_expected_var_arg : Warning<
935 "only variables can be arguments to '#pragma unused'">,
936 InGroup<IgnoredPragmas>;
937def err_pragma_push_visibility_mismatch : Error<
938 "#pragma visibility push with no matching #pragma visibility pop">;
939def note_surrounding_namespace_ends_here : Note<
940 "surrounding namespace with visibility attribute ends here">;
941def err_pragma_pop_visibility_mismatch : Error<
942 "#pragma visibility pop with no matching #pragma visibility push">;
943def note_surrounding_namespace_starts_here : Note<
944 "surrounding namespace with visibility attribute starts here">;
945def err_pragma_loop_invalid_argument_type : Error<
946 "invalid argument of type %0; expected an integer type">;
947def err_pragma_loop_invalid_argument_value : Error<
948 "%select{invalid value '%0'; must be positive|value '%0' is too large}1">;
949def err_pragma_loop_compatibility : Error<
950 "%select{incompatible|duplicate}0 directives '%1' and '%2'">;
951def err_pragma_loop_precedes_nonloop : Error<
952 "expected a for, while, or do-while loop to follow '%0'">;
953
954def err_pragma_attribute_matcher_subrule_contradicts_rule : Error<
955 "redundant attribute subject matcher sub-rule '%0'; '%1' already matches "
956 "those declarations">;
957def err_pragma_attribute_matcher_negated_subrule_contradicts_subrule : Error<
958 "negated attribute subject matcher sub-rule '%0' contradicts sub-rule '%1'">;
959def err_pragma_attribute_invalid_matchers : Error<
960 "attribute %0 can't be applied to %1">;
961def err_pragma_attribute_stack_mismatch : Error<
962 "'#pragma clang attribute %select{%1.|}0pop' with no matching"
963 " '#pragma clang attribute %select{%1.|}0push'">;
964def warn_pragma_attribute_unused : Warning<
965 "unused attribute %0 in '#pragma clang attribute push' region">,
966 InGroup<PragmaClangAttribute>;
967def note_pragma_attribute_region_ends_here : Note<
968 "'#pragma clang attribute push' regions ends here">;
969def err_pragma_attribute_no_pop_eof : Error<"unterminated "
970 "'#pragma clang attribute push' at end of file">;
971def note_pragma_attribute_applied_decl_here : Note<
972 "when applied to this declaration">;
973def err_pragma_attr_attr_no_push : Error<
974 "'#pragma clang attribute' attribute with no matching "
975 "'#pragma clang attribute push'">;
976
977/// Objective-C parser diagnostics
978def err_duplicate_class_def : Error<
979 "duplicate interface definition for class %0">;
980def err_undef_superclass : Error<
981 "cannot find interface declaration for %0, superclass of %1">;
982def err_forward_superclass : Error<
983 "attempting to use the forward class %0 as superclass of %1">;
984def err_no_nsconstant_string_class : Error<
985 "cannot find interface declaration for %0">;
986def err_recursive_superclass : Error<
987 "trying to recursively use %0 as superclass of %1">;
988def err_conflicting_aliasing_type : Error<"conflicting types for alias %0">;
989def warn_undef_interface : Warning<"cannot find interface declaration for %0">;
990def warn_duplicate_protocol_def : Warning<
991 "duplicate protocol definition of %0 is ignored">,
992 InGroup<DiagGroup<"duplicate-protocol">>;
993def err_protocol_has_circular_dependency : Error<
994 "protocol has circular dependency">;
995def err_undeclared_protocol : Error<"cannot find protocol declaration for %0">;
996def warn_undef_protocolref : Warning<"cannot find protocol definition for %0">;
997def err_atprotocol_protocol : Error<
998 "@protocol is using a forward protocol declaration of %0">;
999def warn_readonly_property : Warning<
1000 "attribute 'readonly' of property %0 restricts attribute "
1001 "'readwrite' of property inherited from %1">,
1002 InGroup<PropertyAttr>;
1003
1004def warn_property_attribute : Warning<
1005 "'%1' attribute on property %0 does not match the property inherited from %2">,
1006 InGroup<PropertyAttr>;
1007def warn_property_types_are_incompatible : Warning<
1008 "property type %0 is incompatible with type %1 inherited from %2">,
1009 InGroup<DiagGroup<"incompatible-property-type">>;
1010def warn_protocol_property_mismatch : Warning<
1011 "property %select{of type %1|with attribute '%1'|without attribute '%1'|with "
1012 "getter %1|with setter %1}0 was selected for synthesis">,
1013 InGroup<DiagGroup<"protocol-property-synthesis-ambiguity">>;
1014def err_protocol_property_mismatch: Error<warn_protocol_property_mismatch.Text>;
1015def err_undef_interface : Error<"cannot find interface declaration for %0">;
1016def err_category_forward_interface : Error<
1017 "cannot define %select{category|class extension}0 for undefined class %1">;
1018def err_class_extension_after_impl : Error<
1019 "cannot declare class extension for %0 after class implementation">;
1020def note_implementation_declared : Note<
1021 "class implementation is declared here">;
1022def note_while_in_implementation : Note<
1023 "detected while default synthesizing properties in class implementation">;
1024def note_class_declared : Note<
1025 "class is declared here">;
1026def note_receiver_class_declared : Note<
1027 "receiver is instance of class declared here">;
1028def note_receiver_expr_here : Note<
1029 "receiver expression is here">;
1030def note_receiver_is_id : Note<
1031 "receiver is treated with 'id' type for purpose of method lookup">;
1032def note_suppressed_class_declare : Note<
1033 "class with specified objc_requires_property_definitions attribute is declared here">;
1034def err_objc_root_class_subclass : Error<
1035 "objc_root_class attribute may only be specified on a root class declaration">;
1036def err_restricted_superclass_mismatch : Error<
1037 "cannot subclass a class that was declared with the "
1038 "'objc_subclassing_restricted' attribute">;
1039def err_class_stub_subclassing_mismatch : Error<
1040 "'objc_class_stub' attribute cannot be specified on a class that does not "
1041 "have the 'objc_subclassing_restricted' attribute">;
1042def err_implementation_of_class_stub : Error<
1043 "cannot declare implementation of a class declared with the "
1044 "'objc_class_stub' attribute">;
1045def warn_objc_root_class_missing : Warning<
1046 "class %0 defined without specifying a base class">,
1047 InGroup<ObjCRootClass>;
1048def err_objc_runtime_visible_category : Error<
1049 "cannot implement a category for class %0 that is only visible via the "
1050 "Objective-C runtime">;
1051def err_objc_runtime_visible_subclass : Error<
1052 "cannot implement subclass %0 of a superclass %1 that is only visible via the "
1053 "Objective-C runtime">;
1054def note_objc_needs_superclass : Note<
1055 "add a super class to fix this problem">;
1056def err_conflicting_super_class : Error<"conflicting super class name %0">;
1057def err_dup_implementation_class : Error<"reimplementation of class %0">;
1058def err_dup_implementation_category : Error<
1059 "reimplementation of category %1 for class %0">;
1060def err_conflicting_ivar_type : Error<
1061 "instance variable %0 has conflicting type%diff{: $ vs $|}1,2">;
1062def err_duplicate_ivar_declaration : Error<
1063 "instance variable is already declared">;
1064def warn_on_superclass_use : Warning<
1065 "class implementation may not have super class">;
1066def err_conflicting_ivar_bitwidth : Error<
1067 "instance variable %0 has conflicting bit-field width">;
1068def err_conflicting_ivar_name : Error<
1069 "conflicting instance variable names: %0 vs %1">;
1070def err_inconsistent_ivar_count : Error<
1071 "inconsistent number of instance variables specified">;
1072def warn_undef_method_impl : Warning<"method definition for %0 not found">,
1073 InGroup<DiagGroup<"incomplete-implementation">>;
1074def warn_objc_boxing_invalid_utf8_string : Warning<
1075 "string is ill-formed as UTF-8 and will become a null %0 when boxed">,
1076 InGroup<ObjCBoxing>;
1077
1078def err_objc_non_runtime_protocol_in_protocol_expr : Error<
1079 "cannot use a protocol declared 'objc_non_runtime_protocol' in a @protocol expression">;
1080def err_objc_direct_on_protocol : Error<
1081 "'objc_direct' attribute cannot be applied to %select{methods|properties}0 "
1082 "declared in an Objective-C protocol">;
1083def err_objc_direct_duplicate_decl : Error<
1084 "%select{|direct }0%select{method|property}1 declaration conflicts "
1085 "with previous %select{|direct }2declaration of %select{method|property}1 %3">;
1086def err_objc_direct_impl_decl_mismatch : Error<
1087 "direct method was declared in %select{the primary interface|an extension|a category}0 "
1088 "but is implemented in %select{the primary interface|a category|a different category}1">;
1089def err_objc_direct_missing_on_decl : Error<
1090 "direct method implementation was previously declared not direct">;
1091def err_objc_direct_on_override : Error<
1092 "methods that %select{override superclass methods|implement protocol requirements}0 cannot be direct">;
1093def err_objc_override_direct_method : Error<
1094 "cannot override a method that is declared direct by a superclass">;
1095def warn_objc_direct_ignored : Warning<
1096 "%0 attribute isn't implemented by this Objective-C runtime">,
1097 InGroup<IgnoredAttributes>;
1098def warn_objc_direct_property_ignored : Warning<
1099 "direct attribute on property %0 ignored (not implemented by this Objective-C runtime)">,
1100 InGroup<IgnoredAttributes>;
1101def err_objc_direct_dynamic_property : Error<
1102 "direct property cannot be @dynamic">;
1103def err_objc_direct_protocol_conformance : Error<
1104 "%select{category %1|class extension}0 cannot conform to protocol %2 because "
1105 "of direct members declared in interface %3">;
1106def note_direct_member_here : Note<"direct member declared here">;
1107
1108def warn_conflicting_overriding_ret_types : Warning<
1109 "conflicting return type in "
1110 "declaration of %0%diff{: $ vs $|}1,2">,
1111 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1112
1113def warn_conflicting_ret_types : Warning<
1114 "conflicting return type in "
1115 "implementation of %0%diff{: $ vs $|}1,2">,
1116 InGroup<MismatchedReturnTypes>;
1117
1118def warn_conflicting_overriding_ret_type_modifiers : Warning<
1119 "conflicting distributed object modifiers on return type "
1120 "in declaration of %0">,
1121 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1122
1123def warn_conflicting_ret_type_modifiers : Warning<
1124 "conflicting distributed object modifiers on return type "
1125 "in implementation of %0">,
1126 InGroup<DistributedObjectModifiers>;
1127
1128def warn_non_covariant_overriding_ret_types : Warning<
1129 "conflicting return type in "
1130 "declaration of %0: %1 vs %2">,
1131 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1132
1133def warn_non_covariant_ret_types : Warning<
1134 "conflicting return type in "
1135 "implementation of %0: %1 vs %2">,
1136 InGroup<MethodSignatures>, DefaultIgnore;
1137
1138def warn_conflicting_overriding_param_types : Warning<
1139 "conflicting parameter types in "
1140 "declaration of %0%diff{: $ vs $|}1,2">,
1141 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1142
1143def warn_conflicting_param_types : Warning<
1144 "conflicting parameter types in "
1145 "implementation of %0%diff{: $ vs $|}1,2">,
1146 InGroup<MismatchedParameterTypes>;
1147
1148def warn_conflicting_param_modifiers : Warning<
1149 "conflicting distributed object modifiers on parameter type "
1150 "in implementation of %0">,
1151 InGroup<DistributedObjectModifiers>;
1152
1153def warn_conflicting_overriding_param_modifiers : Warning<
1154 "conflicting distributed object modifiers on parameter type "
1155 "in declaration of %0">,
1156 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1157
1158def warn_non_contravariant_overriding_param_types : Warning<
1159 "conflicting parameter types in "
1160 "declaration of %0: %1 vs %2">,
1161 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1162
1163def warn_non_contravariant_param_types : Warning<
1164 "conflicting parameter types in "
1165 "implementation of %0: %1 vs %2">,
1166 InGroup<MethodSignatures>, DefaultIgnore;
1167
1168def warn_conflicting_overriding_variadic :Warning<
1169 "conflicting variadic declaration of method and its "
1170 "implementation">,
1171 InGroup<OverridingMethodMismatch>, DefaultIgnore;
1172
1173def warn_conflicting_variadic :Warning<
1174 "conflicting variadic declaration of method and its "
1175 "implementation">;
1176
1177def warn_category_method_impl_match:Warning<
1178 "category is implementing a method which will also be implemented"
1179 " by its primary class">, InGroup<ObjCProtocolMethodImpl>;
1180
1181def warn_implements_nscopying : Warning<
1182"default assign attribute on property %0 which implements "
1183"NSCopying protocol is not appropriate with -fobjc-gc[-only]">;
1184
1185def warn_multiple_method_decl : Warning<"multiple methods named %0 found">,
1186 InGroup<ObjCMultipleMethodNames>;
1187def warn_strict_multiple_method_decl : Warning<
1188 "multiple methods named %0 found">, InGroup<StrictSelector>, DefaultIgnore;
1189def warn_accessor_property_type_mismatch : Warning<
1190 "type of property %0 does not match type of accessor %1">;
1191def note_conv_function_declared_at : Note<"type conversion function declared here">;
1192def note_method_declared_at : Note<"method %0 declared here">;
1193def note_direct_method_declared_at : Note<"direct method %0 declared here">;
1194def note_property_attribute : Note<"property %0 is declared "
1195 "%select{deprecated|unavailable|partial}1 here">;
1196def err_setter_type_void : Error<"type of setter must be void">;
1197def err_duplicate_method_decl : Error<"duplicate declaration of method %0">;
1198def warn_duplicate_method_decl :
1199 Warning<"multiple declarations of method %0 found and ignored">,
1200 InGroup<MethodDuplicate>, DefaultIgnore;
1201def warn_objc_cdirective_format_string :
1202 Warning<"using %0 directive in %select{NSString|CFString}1 "
1203 "which is being passed as a formatting argument to the formatting "
1204 "%select{method|CFfunction}2">,
1205 InGroup<ObjCCStringFormat>, DefaultIgnore;
1206def err_objc_var_decl_inclass :
1207 Error<"cannot declare variable inside @interface or @protocol">;
1208def err_missing_method_context : Error<
1209 "missing context for method declaration">;
1210def err_objc_property_attr_mutually_exclusive : Error<
1211 "property attributes '%0' and '%1' are mutually exclusive">;
1212def err_objc_property_requires_object : Error<
1213 "property with '%0' attribute must be of object type">;
1214def warn_objc_property_assign_on_object : Warning<
1215 "'assign' property of object type may become a dangling reference; consider using 'unsafe_unretained'">,
1216 InGroup<ObjCPropertyAssignOnObjectType>, DefaultIgnore;
1217def warn_objc_property_no_assignment_attribute : Warning<
1218 "no 'assign', 'retain', or 'copy' attribute is specified - "
1219 "'assign' is assumed">,
1220 InGroup<ObjCPropertyNoAttribute>;
1221def warn_objc_isa_use : Warning<
1222 "direct access to Objective-C's isa is deprecated in favor of "
1223 "object_getClass()">, InGroup<DeprecatedObjCIsaUsage>;
1224def warn_objc_isa_assign : Warning<
1225 "assignment to Objective-C's isa is deprecated in favor of "
1226 "object_setClass()">, InGroup<DeprecatedObjCIsaUsage>;
1227def warn_objc_pointer_masking : Warning<
1228 "bitmasking for introspection of Objective-C object pointers is strongly "
1229 "discouraged">,
1230 InGroup<ObjCPointerIntrospect>;
1231def warn_objc_pointer_masking_performSelector : Warning<warn_objc_pointer_masking.Text>,
1232 InGroup<ObjCPointerIntrospectPerformSelector>;
1233def warn_objc_property_default_assign_on_object : Warning<
1234 "default property attribute 'assign' not appropriate for object">,
1235 InGroup<ObjCPropertyNoAttribute>;
1236def warn_property_attr_mismatch : Warning<
1237 "property attribute in class extension does not match the primary class">,
1238 InGroup<PropertyAttr>;
1239def warn_property_implicitly_mismatched : Warning <
1240 "primary property declaration is implicitly strong while redeclaration "
1241 "in class extension is weak">,
1242 InGroup<DiagGroup<"objc-property-implicit-mismatch">>;
1243def warn_objc_property_copy_missing_on_block : Warning<
1244 "'copy' attribute must be specified for the block property "
1245 "when -fobjc-gc-only is specified">;
1246def warn_objc_property_retain_of_block : Warning<
1247 "retain'ed block property does not copy the block "
1248 "- use copy attribute instead">, InGroup<ObjCRetainBlockProperty>;
1249def warn_objc_readonly_property_has_setter : Warning<
1250 "setter cannot be specified for a readonly property">,
1251 InGroup<ObjCReadonlyPropertyHasSetter>;
1252def warn_atomic_property_rule : Warning<
1253 "writable atomic property %0 cannot pair a synthesized %select{getter|setter}1 "
1254 "with a user defined %select{getter|setter}2">,
1255 InGroup<DiagGroup<"atomic-property-with-user-defined-accessor">>;
1256def note_atomic_property_fixup_suggest : Note<"setter and getter must both be "
1257 "synthesized, or both be user defined,or the property must be nonatomic">;
1258def err_atomic_property_nontrivial_assign_op : Error<
1259 "atomic property of reference type %0 cannot have non-trivial assignment"
1260 " operator">;
1261def warn_cocoa_naming_owned_rule : Warning<
1262 "property follows Cocoa naming"
1263 " convention for returning 'owned' objects">,
1264 InGroup<DiagGroup<"objc-property-matches-cocoa-ownership-rule">>;
1265def err_cocoa_naming_owned_rule : Error<
1266 "property follows Cocoa naming"
1267 " convention for returning 'owned' objects">;
1268def note_cocoa_naming_declare_family : Note<
1269 "explicitly declare getter %objcinstance0 with '%1' to return an 'unowned' "
1270 "object">;
1271def warn_auto_synthesizing_protocol_property :Warning<
1272 "auto property synthesis will not synthesize property %0"
1273 " declared in protocol %1">,
1274 InGroup<DiagGroup<"objc-protocol-property-synthesis">>;
1275def note_add_synthesize_directive : Note<
1276 "add a '@synthesize' directive">;
1277def warn_no_autosynthesis_shared_ivar_property : Warning <
1278 "auto property synthesis will not synthesize property "
1279 "%0 because it cannot share an ivar with another synthesized property">,
1280 InGroup<ObjCNoPropertyAutoSynthesis>;
1281def warn_no_autosynthesis_property : Warning<
1282 "auto property synthesis will not synthesize property "
1283 "%0 because it is 'readwrite' but it will be synthesized 'readonly' "
1284 "via another property">,
1285 InGroup<ObjCNoPropertyAutoSynthesis>;
1286def warn_autosynthesis_property_in_superclass : Warning<
1287 "auto property synthesis will not synthesize property "
1288 "%0; it will be implemented by its superclass, use @dynamic to "
1289 "acknowledge intention">,
1290 InGroup<ObjCNoPropertyAutoSynthesis>;
1291def warn_autosynthesis_property_ivar_match :Warning<
1292 "autosynthesized property %0 will use %select{|synthesized}1 instance variable "
1293 "%2, not existing instance variable %3">,
1294 InGroup<DiagGroup<"objc-autosynthesis-property-ivar-name-match">>;
1295def warn_missing_explicit_synthesis : Warning <
1296 "auto property synthesis is synthesizing property not explicitly synthesized">,
1297 InGroup<DiagGroup<"objc-missing-property-synthesis">>, DefaultIgnore;
1298def warn_property_getter_owning_mismatch : Warning<
1299 "property declared as returning non-retained objects"
1300 "; getter returning retained objects">;
1301def warn_property_redecl_getter_mismatch : Warning<
1302 "getter name mismatch between property redeclaration (%1) and its original "
1303 "declaration (%0)">, InGroup<PropertyAttr>;
1304def err_property_setter_ambiguous_use : Error<
1305 "synthesized properties %0 and %1 both claim setter %2 -"
1306 " use of this setter will cause unexpected behavior">;
1307def warn_default_atomic_custom_getter_setter : Warning<
1308 "atomic by default property %0 has a user defined %select{getter|setter}1 "
1309 "(property should be marked 'atomic' if this is intended)">,
1310 InGroup<CustomAtomic>, DefaultIgnore;
1311def err_use_continuation_class : Error<
1312 "illegal redeclaration of property in class extension %0"
1313 " (attribute must be 'readwrite', while its primary must be 'readonly')">;
1314def err_type_mismatch_continuation_class : Error<
1315 "type of property %0 in class extension does not match "
1316 "property type in primary class">;
1317def err_use_continuation_class_redeclaration_readwrite : Error<
1318 "illegal redeclaration of 'readwrite' property in class extension %0"
1319 " (perhaps you intended this to be a 'readwrite' redeclaration of a "
1320 "'readonly' public property?)">;
1321def err_continuation_class : Error<"class extension has no primary class">;
1322def err_property_type : Error<"property cannot have array or function type %0">;
1323def err_missing_property_context : Error<
1324 "missing context for property implementation declaration">;
1325def err_bad_property_decl : Error<
1326 "property implementation must have its declaration in interface %0 or one of "
1327 "its extensions">;
1328def err_category_property : Error<
1329 "property declared in category %0 cannot be implemented in "
1330 "class implementation">;
1331def note_property_declare : Note<
1332 "property declared here">;
1333def note_protocol_property_declare : Note<
1334 "it could also be property "
1335 "%select{of type %1|without attribute '%1'|with attribute '%1'|with getter "
1336 "%1|with setter %1}0 declared here">;
1337def note_property_synthesize : Note<
1338 "property synthesized here">;
1339def err_synthesize_category_decl : Error<
1340 "@synthesize not allowed in a category's implementation">;
1341def err_synthesize_on_class_property : Error<
1342 "@synthesize not allowed on a class property %0">;
1343def err_missing_property_interface : Error<
1344 "property implementation in a category with no category declaration">;
1345def err_bad_category_property_decl : Error<
1346 "property implementation must have its declaration in the category %0">;
1347def err_bad_property_context : Error<
1348 "property implementation must be in a class or category implementation">;
1349def err_missing_property_ivar_decl : Error<
1350 "synthesized property %0 must either be named the same as a compatible"
1351 " instance variable or must explicitly name an instance variable">;
1352def err_arc_perform_selector_retains : Error<
1353 "performSelector names a selector which retains the object">;
1354def warn_arc_perform_selector_leaks : Warning<
1355 "performSelector may cause a leak because its selector is unknown">,
1356 InGroup<DiagGroup<"arc-performSelector-leaks">>;
1357def warn_dealloc_in_category : Warning<
1358"-dealloc is being overridden in a category">,
1359InGroup<DeallocInCategory>;
1360def err_gc_weak_property_strong_type : Error<
1361 "weak attribute declared on a __strong type property in GC mode">;
1362def warn_arc_repeated_use_of_weak : Warning <
1363 "weak %select{variable|property|implicit property|instance variable}0 %1 is "
1364 "accessed multiple times in this %select{function|method|block|lambda}2 "
1365 "but may be unpredictably set to nil; assign to a strong variable to keep "
1366 "the object alive">,
1367 InGroup<ARCRepeatedUseOfWeak>, DefaultIgnore;
1368def warn_implicitly_retains_self : Warning <
1369 "block implicitly retains 'self'; explicitly mention 'self' to indicate "
1370 "this is intended behavior">,
1371 InGroup<DiagGroup<"implicit-retain-self">>, DefaultIgnore;
1372def warn_arc_possible_repeated_use_of_weak : Warning <
1373 "weak %select{variable|property|implicit property|instance variable}0 %1 may "
1374 "be accessed multiple times in this %select{function|method|block|lambda}2 "
1375 "and may be unpredictably set to nil; assign to a strong variable to keep "
1376 "the object alive">,
1377 InGroup<ARCRepeatedUseOfWeakMaybe>, DefaultIgnore;
1378def note_arc_weak_also_accessed_here : Note<
1379 "also accessed here">;
1380def err_incomplete_synthesized_property : Error<
1381 "cannot synthesize property %0 with incomplete type %1">;
1382
1383def err_property_ivar_type : Error<
1384 "type of property %0 (%1) does not match type of instance variable %2 (%3)">;
1385def err_property_accessor_type : Error<
1386 "type of property %0 (%1) does not match type of accessor %2 (%3)">;
1387def err_ivar_in_superclass_use : Error<
1388 "property %0 attempting to use instance variable %1 declared in super class %2">;
1389def err_weak_property : Error<
1390 "existing instance variable %1 for __weak property %0 must be __weak">;
1391def err_strong_property : Error<
1392 "existing instance variable %1 for strong property %0 may not be __weak">;
1393def err_dynamic_property_ivar_decl : Error<
1394 "dynamic property cannot have instance variable specification">;
1395def err_duplicate_ivar_use : Error<
1396 "synthesized properties %0 and %1 both claim instance variable %2">;
1397def err_property_implemented : Error<"property %0 is already implemented">;
1398def warn_objc_missing_super_call : Warning<
1399 "method possibly missing a [super %0] call">,
1400 InGroup<ObjCMissingSuperCalls>;
1401def err_dealloc_bad_result_type : Error<
1402 "dealloc return type must be correctly specified as 'void' under ARC, "
1403 "instead of %0">;
1404def warn_undeclared_selector : Warning<
1405 "undeclared selector %0">, InGroup<UndeclaredSelector>, DefaultIgnore;
1406def warn_undeclared_selector_with_typo : Warning<
1407 "undeclared selector %0; did you mean %1?">,
1408 InGroup<UndeclaredSelector>, DefaultIgnore;
1409def warn_implicit_atomic_property : Warning<
1410 "property is assumed atomic by default">, InGroup<ImplicitAtomic>, DefaultIgnore;
1411def note_auto_readonly_iboutlet_fixup_suggest : Note<
1412 "property should be changed to be readwrite">;
1413def warn_auto_readonly_iboutlet_property : Warning<
1414 "readonly IBOutlet property %0 when auto-synthesized may "
1415 "not work correctly with 'nib' loader">,
1416 InGroup<DiagGroup<"readonly-iboutlet-property">>;
1417def warn_auto_implicit_atomic_property : Warning<
1418 "property is assumed atomic when auto-synthesizing the property">,
1419 InGroup<ImplicitAtomic>, DefaultIgnore;
1420def warn_unimplemented_selector: Warning<
1421 "no method with selector %0 is implemented in this translation unit">,
1422 InGroup<Selector>, DefaultIgnore;
1423def warn_unimplemented_protocol_method : Warning<
1424 "method %0 in protocol %1 not implemented">, InGroup<Protocol>;
1425def warn_multiple_selectors: Warning<
1426 "several methods with selector %0 of mismatched types are found "
1427 "for the @selector expression">,
1428 InGroup<SelectorTypeMismatch>, DefaultIgnore;
1429def err_direct_selector_expression : Error<
1430 "@selector expression formed with direct selector %0">;
1431def warn_potentially_direct_selector_expression : Warning<
1432 "@selector expression formed with potentially direct selector %0">,
1433 InGroup<ObjCPotentiallyDirectSelector>;
1434def warn_strict_potentially_direct_selector_expression : Warning<
1435 warn_potentially_direct_selector_expression.Text>,
1436 InGroup<ObjCStrictPotentiallyDirectSelector>, DefaultIgnore;
1437
1438def err_objc_kindof_nonobject : Error<
1439 "'__kindof' specifier cannot be applied to non-object type %0">;
1440def err_objc_kindof_wrong_position : Error<
1441 "'__kindof' type specifier must precede the declarator">;
1442
1443def err_objc_method_unsupported_param_ret_type : Error<
1444 "%0 %select{parameter|return}1 type is unsupported; "
1445 "support for vector types for this target is introduced in %2">;
1446
1447def warn_messaging_unqualified_id : Warning<
1448 "messaging unqualified id">, DefaultIgnore,
1449 InGroup<DiagGroup<"objc-messaging-id">>;
1450def err_messaging_unqualified_id_with_direct_method : Error<
1451 "messaging unqualified id with a method that is possibly direct">;
1452def err_messaging_super_with_direct_method : Error<
1453 "messaging super with a direct method">;
1454def err_messaging_class_with_direct_method : Error<
1455 "messaging a Class with a method that is possibly direct">;
1456
1457// C++ declarations
1458def err_static_assert_expression_is_not_constant : Error<
1459 "static_assert expression is not an integral constant expression">;
1460def err_static_assert_failed : Error<"static_assert failed%select{ %1|}0">;
1461def err_static_assert_requirement_failed : Error<
1462 "static_assert failed due to requirement '%0'%select{ %2|}1">;
1463
1464def ext_inline_variable : ExtWarn<
1465 "inline variables are a C++17 extension">, InGroup<CXX17>;
1466def warn_cxx14_compat_inline_variable : Warning<
1467 "inline variables are incompatible with C++ standards before C++17">,
1468 DefaultIgnore, InGroup<CXXPre17Compat>;
1469
1470def warn_inline_namespace_reopened_noninline : Warning<
1471 "inline namespace reopened as a non-inline namespace">,
1472 InGroup<InlineNamespaceReopenedNoninline>;
1473def err_inline_namespace_mismatch : Error<
1474 "non-inline namespace cannot be reopened as inline">;
1475
1476def err_unexpected_friend : Error<
1477 "friends can only be classes or functions">;
1478def ext_enum_friend : ExtWarn<
1479 "befriending enumeration type %0 is a C++11 extension">, InGroup<CXX11>;
1480def warn_cxx98_compat_enum_friend : Warning<
1481 "befriending enumeration type %0 is incompatible with C++98">,
1482 InGroup<CXX98Compat>, DefaultIgnore;
1483def ext_nonclass_type_friend : ExtWarn<
1484 "non-class friend type %0 is a C++11 extension">, InGroup<CXX11>;
1485def warn_cxx98_compat_nonclass_type_friend : Warning<
1486 "non-class friend type %0 is incompatible with C++98">,
1487 InGroup<CXX98Compat>, DefaultIgnore;
1488def err_friend_is_member : Error<
1489 "friends cannot be members of the declaring class">;
1490def warn_cxx98_compat_friend_is_member : Warning<
1491 "friend declaration naming a member of the declaring class is incompatible "
1492 "with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1493def ext_unelaborated_friend_type : ExtWarn<
1494 "unelaborated friend declaration is a C++11 extension; specify "
1495 "'%select{struct|interface|union|class|enum}0' to befriend %1">,
1496 InGroup<CXX11>;
1497def warn_cxx98_compat_unelaborated_friend_type : Warning<
1498 "befriending %1 without '%select{struct|interface|union|class|enum}0' "
1499 "keyword is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
1500def err_qualified_friend_no_match : Error<
1501 "friend declaration of %0 does not match any declaration in %1">;
1502def err_introducing_special_friend : Error<
1503 "%plural{[0,2]:must use a qualified name when declaring|3:cannot declare}0"
1504 " a %select{constructor|destructor|conversion operator|deduction guide}0 "
1505 "as a friend">;
1506def err_tagless_friend_type_template : Error<
1507 "friend type templates must use an elaborated type">;
1508def err_no_matching_local_friend : Error<
1509 "no matching function found in local scope">;
1510def err_no_matching_local_friend_suggest : Error<
1511 "no matching function %0 found in local scope; did you mean %3?">;
1512def err_partial_specialization_friend : Error<
1513 "partial specialization cannot be declared as a friend">;
1514def err_qualified_friend_def : Error<
1515 "friend function definition cannot be qualified with '%0'">;
1516def err_friend_def_in_local_class : Error<
1517 "friend function cannot be defined in a local class">;
1518def err_friend_not_first_in_declaration : Error<
1519 "'friend' must appear first in a non-function declaration">;
1520def err_using_decl_friend : Error<
1521 "cannot befriend target of using declaration">;
1522def warn_template_qualified_friend_unsupported : Warning<
1523 "dependent nested name specifier '%0' for friend class declaration is "
1524 "not supported; turning off access control for %1">,
1525 InGroup<UnsupportedFriend>;
1526def warn_template_qualified_friend_ignored : Warning<
1527 "dependent nested name specifier '%0' for friend template declaration is "
1528 "not supported; ignoring this friend declaration">,
1529 InGroup<UnsupportedFriend>;
1530def ext_friend_tag_redecl_outside_namespace : ExtWarn<
1531 "unqualified friend declaration referring to type outside of the nearest "
1532 "enclosing namespace is a Microsoft extension; add a nested name specifier">,
1533 InGroup<MicrosoftUnqualifiedFriend>;
1534def err_pure_friend : Error<"friend declaration cannot have a pure-specifier">;
1535
1536def err_invalid_base_in_interface : Error<
1537 "interface type cannot inherit from "
1538 "%select{struct|non-public interface|class}0 %1">;
1539
1540def err_abstract_type_in_decl : Error<
1541 "%select{return|parameter|variable|field|instance variable|"
1542 "synthesized instance variable}0 type %1 is an abstract class">;
1543def err_allocation_of_abstract_type : Error<
1544 "allocating an object of abstract class type %0">;
1545def err_throw_abstract_type : Error<
1546 "cannot throw an object of abstract type %0">;
1547def err_array_of_abstract_type : Error<"array of abstract class type %0">;
1548def err_capture_of_abstract_type : Error<
1549 "by-copy capture of value of abstract type %0">;
1550def err_capture_of_incomplete_or_sizeless_type : Error<
1551 "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
1552def err_capture_default_non_local : Error<
1553 "non-local lambda expression cannot have a capture-default">;
1554
1555def err_multiple_final_overriders : Error<
1556 "virtual function %q0 has more than one final overrider in %1">;
1557def note_final_overrider : Note<"final overrider of %q0 in %1">;
1558
1559def err_type_defined_in_type_specifier : Error<
1560 "%0 cannot be defined in a type specifier">;
1561def err_type_defined_in_result_type : Error<
1562 "%0 cannot be defined in the result type of a function">;
1563def err_type_defined_in_param_type : Error<
1564 "%0 cannot be defined in a parameter type">;
1565def err_type_defined_in_alias_template : Error<
1566 "%0 cannot be defined in a type alias template">;
1567def err_type_defined_in_condition : Error<
1568 "%0 cannot be defined in a condition">;
1569def err_type_defined_in_enum : Error<
1570 "%0 cannot be defined in an enumeration">;
1571
1572def note_pure_virtual_function : Note<
1573 "unimplemented pure virtual method %0 in %1">;
1574
1575def note_pure_qualified_call_kext : Note<
1576 "qualified call to %0::%1 is treated as a virtual call to %1 due to -fapple-kext">;
1577
1578def err_deleted_decl_not_first : Error<
1579 "deleted definition must be first declaration">;
1580
1581def err_deleted_override : Error<
1582 "deleted function %0 cannot override a non-deleted function">;
1583def err_non_deleted_override : Error<
1584 "non-deleted function %0 cannot override a deleted function">;
1585def err_consteval_override : Error<
1586 "consteval function %0 cannot override a non-consteval function">;
1587def err_non_consteval_override : Error<
1588 "non-consteval function %0 cannot override a consteval function">;
1589
1590def warn_weak_vtable : Warning<
1591 "%0 has no out-of-line virtual method definitions; its vtable will be "
1592 "emitted in every translation unit">,
1593 InGroup<DiagGroup<"weak-vtables">>, DefaultIgnore;
1594def warn_weak_template_vtable : Warning<
1595 "explicit template instantiation %0 will emit a vtable in every "
1596 "translation unit">,
1597 InGroup<DiagGroup<"weak-template-vtables">>, DefaultIgnore;
1598
1599def ext_using_undefined_std : ExtWarn<
1600 "using directive refers to implicitly-defined namespace 'std'">;
1601
1602// C++ exception specifications
1603def err_exception_spec_in_typedef : Error<
1604 "exception specifications are not allowed in %select{typedefs|type aliases}0">;
1605def err_distant_exception_spec : Error<
1606 "exception specifications are not allowed beyond a single level "
1607 "of indirection">;
1608def err_incomplete_in_exception_spec : Error<
1609 "%select{|pointer to |reference to }0incomplete type %1 is not allowed "
1610 "in exception specification">;
1611def err_sizeless_in_exception_spec : Error<
1612 "%select{|reference to }0sizeless type %1 is not allowed "
1613 "in exception specification">;
1614def ext_incomplete_in_exception_spec : ExtWarn<err_incomplete_in_exception_spec.Text>,
1615 InGroup<MicrosoftExceptionSpec>;
1616def err_rref_in_exception_spec : Error<
1617 "rvalue reference type %0 is not allowed in exception specification">;
1618def err_mismatched_exception_spec : Error<
1619 "exception specification in declaration does not match previous declaration">;
1620def ext_mismatched_exception_spec : ExtWarn<err_mismatched_exception_spec.Text>,
1621 InGroup<MicrosoftExceptionSpec>;
1622def err_override_exception_spec : Error<
1623 "exception specification of overriding function is more lax than "
1624 "base version">;
1625def ext_override_exception_spec : ExtWarn<err_override_exception_spec.Text>,
1626 InGroup<MicrosoftExceptionSpec>;
1627def err_incompatible_exception_specs : Error<
1628 "target exception specification is not superset of source">;
1629def warn_incompatible_exception_specs : Warning<
1630 err_incompatible_exception_specs.Text>, InGroup<IncompatibleExceptionSpec>;
1631def err_deep_exception_specs_differ : Error<
1632 "exception specifications of %select{return|argument}0 types differ">;
1633def warn_deep_exception_specs_differ : Warning<
1634 err_deep_exception_specs_differ.Text>, InGroup<IncompatibleExceptionSpec>;
1635def err_missing_exception_specification : Error<
1636 "%0 is missing exception specification '%1'">;
1637def ext_missing_exception_specification : ExtWarn<
1638 err_missing_exception_specification.Text>,
1639 InGroup<DiagGroup<"missing-exception-spec">>;
1640def ext_ms_missing_exception_specification : ExtWarn<
1641 err_missing_exception_specification.Text>,
1642 InGroup<MicrosoftExceptionSpec>;
1643def err_noexcept_needs_constant_expression : Error<
1644 "argument to noexcept specifier must be a constant expression">;
1645def err_exception_spec_not_parsed : Error<
1646 "exception specification is not available until end of class definition">;
1647def err_exception_spec_cycle : Error<
1648 "exception specification of %0 uses itself">;
1649def err_exception_spec_incomplete_type : Error<
1650 "exception specification needed for member of incomplete class %0">;
1651def warn_wasm_dynamic_exception_spec_ignored : ExtWarn<
1652 "dynamic exception specifications with types are currently ignored in wasm">,
1653 InGroup<WebAssemblyExceptionSpec>;
1654
1655// C++ access checking
1656def err_class_redeclared_with_different_access : Error<
1657 "%0 redeclared with '%1' access">;
1658def err_access : Error<
1659 "%1 is a %select{private|protected}0 member of %3">, AccessControl;
1660def ext_ms_using_declaration_inaccessible : ExtWarn<
1661 "using declaration referring to inaccessible member '%0' (which refers "
1662 "to accessible member '%1') is a Microsoft compatibility extension">,
1663 AccessControl, InGroup<MicrosoftUsingDecl>;
1664def err_access_ctor : Error<
1665 "calling a %select{private|protected}0 constructor of class %2">,
1666 AccessControl;
1667def ext_rvalue_to_reference_access_ctor : Extension<
1668 "C++98 requires an accessible copy constructor for class %2 when binding "
1669 "a reference to a temporary; was %select{private|protected}0">,
1670 AccessControl, InGroup<BindToTemporaryCopy>;
1671def err_access_base_ctor : Error<
1672 // The ERRORs represent other special members that aren't constructors, in
1673 // hopes that someone will bother noticing and reporting if they appear
1674 "%select{base class|inherited virtual base class}0 %1 has %select{private|"
1675 "protected}3 %select{default |copy |move |*ERROR* |*ERROR* "
1676 "|*ERROR*|}2constructor">, AccessControl;
1677def err_access_field_ctor : Error<
1678 // The ERRORs represent other special members that aren't constructors, in
1679 // hopes that someone will bother noticing and reporting if they appear
1680 "field of type %0 has %select{private|protected}2 "
1681 "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}1constructor">,
1682 AccessControl;
1683def err_access_friend_function : Error<
1684 "friend function %1 is a %select{private|protected}0 member of %3">,
1685 AccessControl;
1686
1687def err_access_dtor : Error<
1688 "calling a %select{private|protected}1 destructor of class %0">,
1689 AccessControl;
1690def err_access_dtor_base :
1691 Error<"base class %0 has %select{private|protected}1 destructor">,
1692 AccessControl;
1693def err_access_dtor_vbase :
1694 Error<"inherited virtual base class %1 has "
1695 "%select{private|protected}2 destructor">,
1696 AccessControl;
1697def err_access_dtor_temp :
1698 Error<"temporary of type %0 has %select{private|protected}1 destructor">,
1699 AccessControl;
1700def err_access_dtor_exception :
1701 Error<"exception object of type %0 has %select{private|protected}1 "
1702 "destructor">, AccessControl;
1703def err_access_dtor_field :
1704 Error<"field of type %1 has %select{private|protected}2 destructor">,
1705 AccessControl;
1706def err_access_dtor_var :
1707 Error<"variable of type %1 has %select{private|protected}2 destructor">,
1708 AccessControl;
1709def err_access_dtor_ivar :
1710 Error<"instance variable of type %0 has %select{private|protected}1 "
1711 "destructor">,
1712 AccessControl;
1713def note_previous_access_declaration : Note<
1714 "previously declared '%1' here">;
1715def note_access_natural : Note<
1716 "%select{|implicitly }1declared %select{private|protected}0 here">;
1717def note_access_constrained_by_path : Note<
1718 "constrained by %select{|implicitly }1%select{private|protected}0"
1719 " inheritance here">;
1720def note_access_protected_restricted_noobject : Note<
1721 "must name member using the type of the current context %0">;
1722def note_access_protected_restricted_ctordtor : Note<
1723 "protected %select{constructor|destructor}0 can only be used to "
1724 "%select{construct|destroy}0 a base class subobject">;
1725def note_access_protected_restricted_object : Note<
1726 "can only access this member on an object of type %0">;
1727def warn_cxx98_compat_sfinae_access_control : Warning<
1728 "substitution failure due to access control is incompatible with C++98">,
1729 InGroup<CXX98Compat>, DefaultIgnore, NoSFINAE;
1730
1731// C++ name lookup
1732def err_incomplete_nested_name_spec : Error<
1733 "incomplete type %0 named in nested name specifier">;
1734def err_dependent_nested_name_spec : Error<
1735 "nested name specifier for a declaration cannot depend on a template "
1736 "parameter">;
1737def err_nested_name_member_ref_lookup_ambiguous : Error<
1738 "lookup of %0 in member access expression is ambiguous">;
1739def ext_nested_name_member_ref_lookup_ambiguous : ExtWarn<
1740 "lookup of %0 in member access expression is ambiguous; using member of %1">,
1741 InGroup<AmbigMemberTemplate>;
1742def note_ambig_member_ref_object_type : Note<
1743 "lookup in the object type %0 refers here">;
1744def note_ambig_member_ref_scope : Note<
1745 "lookup from the current scope refers here">;
1746def err_qualified_member_nonclass : Error<
1747 "qualified member access refers to a member in %0">;
1748def err_incomplete_member_access : Error<
1749 "member access into incomplete type %0">;
1750def err_incomplete_type : Error<
1751 "incomplete type %0 where a complete type is required">;
1752def warn_cxx98_compat_enum_nested_name_spec : Warning<
1753 "enumeration type in nested name specifier is incompatible with C++98">,
1754 InGroup<CXX98Compat>, DefaultIgnore;
1755def err_nested_name_spec_is_not_class : Error<
1756 "%0 cannot appear before '::' because it is not a class"
1757 "%select{ or namespace|, namespace, or enumeration}1; did you mean ':'?">;
1758def ext_nested_name_spec_is_enum : ExtWarn<
1759 "use of enumeration in a nested name specifier is a C++11 extension">,
1760 InGroup<CXX11>;
1761def err_out_of_line_qualified_id_type_names_constructor : Error<
1762 "qualified reference to %0 is a constructor name rather than a "
1763 "%select{template name|type}1 in this context">;
1764def ext_out_of_line_qualified_id_type_names_constructor : ExtWarn<
1765 "ISO C++ specifies that "
1766 "qualified reference to %0 is a constructor name rather than a "
1767 "%select{template name|type}1 in this context, despite preceding "
1768 "%select{'typename'|'template'}2 keyword">, SFINAEFailure,
1769 InGroup<DiagGroup<"injected-class-name">>;
1770
1771// C++ class members
1772def err_storageclass_invalid_for_member : Error<
1773 "storage class specified for a member declaration">;
1774def err_mutable_function : Error<"'mutable' cannot be applied to functions">;
1775def err_mutable_reference : Error<"'mutable' cannot be applied to references">;
1776def ext_mutable_reference : ExtWarn<
1777 "'mutable' on a reference type is a Microsoft extension">,
1778 InGroup<MicrosoftMutableReference>;
1779def err_mutable_const : Error<"'mutable' and 'const' cannot be mixed">;
1780def err_mutable_nonmember : Error<
1781 "'mutable' can only be applied to member variables">;
1782def err_virtual_in_union : Error<
1783 "unions cannot have virtual functions">;
1784def err_virtual_non_function : Error<
1785 "'virtual' can only appear on non-static member functions">;
1786def err_virtual_out_of_class : Error<
1787 "'virtual' can only be specified inside the class definition">;
1788def err_virtual_member_function_template : Error<
1789 "'virtual' cannot be specified on member function templates">;
1790def err_static_overrides_virtual : Error<
1791 "'static' member function %0 overrides a virtual function in a base class">;
1792def err_explicit_non_function : Error<
1793 "'explicit' can only appear on non-static member functions">;
1794def err_explicit_out_of_class : Error<
1795 "'explicit' can only be specified inside the class definition">;
1796def err_explicit_non_ctor_or_conv_function : Error<
1797 "'explicit' can only be applied to a constructor or conversion function">;
1798def err_static_not_bitfield : Error<"static member %0 cannot be a bit-field">;
1799def err_static_out_of_line : Error<
1800 "'static' can only be specified inside the class definition">;
1801def ext_static_out_of_line : ExtWarn<
1802 err_static_out_of_line.Text>,
1803 InGroup<MicrosoftTemplate>;
1804def err_storage_class_for_static_member : Error<
1805 "static data member definition cannot specify a storage class">;
1806def err_typedef_not_bitfield : Error<"typedef member %0 cannot be a bit-field">;
1807def err_not_integral_type_bitfield : Error<
1808 "bit-field %0 has non-integral type %1">;
1809def err_not_integral_type_anon_bitfield : Error<
1810 "anonymous bit-field has non-integral type %0">;
1811def err_anon_bitfield_qualifiers : Error<
1812 "anonymous bit-field cannot have qualifiers">;
1813def err_member_function_initialization : Error<
1814 "initializer on function does not look like a pure-specifier">;
1815def err_non_virtual_pure : Error<
1816 "%0 is not virtual and cannot be declared pure">;
1817def ext_pure_function_definition : ExtWarn<
1818 "function definition with pure-specifier is a Microsoft extension">,
1819 InGroup<MicrosoftPureDefinition>;
1820def err_qualified_member_of_unrelated : Error<
1821 "%q0 is not a member of class %1">;
1822
1823def err_member_function_call_bad_cvr : Error<
1824 "'this' argument to member function %0 has type %1, but function is not marked "
1825 "%select{const|restrict|const or restrict|volatile|const or volatile|"
1826 "volatile or restrict|const, volatile, or restrict}2">;
1827def err_member_function_call_bad_ref : Error<
1828 "'this' argument to member function %0 is an %select{lvalue|rvalue}1, "
1829 "but function has %select{non-const lvalue|rvalue}2 ref-qualifier">;
1830def err_member_function_call_bad_type : Error<
1831 "cannot initialize object parameter of type %0 with an expression "
1832 "of type %1">;
1833
1834def warn_call_to_pure_virtual_member_function_from_ctor_dtor : Warning<
1835 "call to pure virtual member function %0 has undefined behavior; "
1836 "overrides of %0 in subclasses are not available in the "
1837 "%select{constructor|destructor}1 of %2">, InGroup<PureVirtualCallFromCtorDtor>;
1838
1839def select_special_member_kind : TextSubstitution<
1840 "%select{default constructor|copy constructor|move constructor|"
1841 "copy assignment operator|move assignment operator|destructor}0">;
1842
1843def note_member_declared_at : Note<"member is declared here">;
1844def note_ivar_decl : Note<"instance variable is declared here">;
1845def note_bitfield_decl : Note<"bit-field is declared here">;
1846def note_implicit_param_decl : Note<"%0 is an implicit parameter">;
1847def note_member_synthesized_at : Note<
1848 "in %select{implicit|defaulted}0 %sub{select_special_member_kind}1 for %2 "
1849 "first required here">;
1850def note_comparison_synthesized_at : Note<
1851 "in defaulted %sub{select_defaulted_comparison_kind}0 for %1 "
1852 "first required here">;
1853def err_missing_default_ctor : Error<
1854 "%select{constructor for %1 must explicitly initialize the|"
1855 "implicit default constructor for %1 must explicitly initialize the|"
1856 "cannot use constructor inherited from base class %4;}0 "
1857 "%select{base class|member}2 %3 %select{which|which|of %1}0 "
1858 "does not have a default constructor">;
1859def note_due_to_dllexported_class : Note<
1860 "due to %0 being dllexported%select{|; try compiling in C++11 mode}1">;
1861
1862def err_illegal_union_or_anon_struct_member : Error<
1863 "%select{anonymous struct|union}0 member %1 has a non-trivial "
1864 "%sub{select_special_member_kind}2">;
1865
1866def warn_frame_address : Warning<
1867 "calling '%0' with a nonzero argument is unsafe">,
1868 InGroup<FrameAddress>, DefaultIgnore;
1869
1870def warn_cxx98_compat_nontrivial_union_or_anon_struct_member : Warning<
1871 "%select{anonymous struct|union}0 member %1 with a non-trivial "
1872 "%sub{select_special_member_kind}2 is incompatible with C++98">,
1873 InGroup<CXX98Compat>, DefaultIgnore;
1874
1875def note_nontrivial_virtual_dtor : Note<
1876 "destructor for %0 is not trivial because it is virtual">;
1877def note_nontrivial_has_virtual : Note<
1878 "because type %0 has a virtual %select{member function|base class}1">;
1879def note_nontrivial_no_def_ctor : Note<
1880 "because %select{base class of |field of |}0type %1 has no "
1881 "default constructor">;
1882def note_user_declared_ctor : Note<
1883 "implicit default constructor suppressed by user-declared constructor">;
1884def note_nontrivial_no_copy : Note<
1885 "because no %select{<<ERROR>>|constructor|constructor|assignment operator|"
1886 "assignment operator|<<ERROR>>}2 can be used to "
1887 "%select{<<ERROR>>|copy|move|copy|move|<<ERROR>>}2 "
1888 "%select{base class|field|an object}0 of type %3">;
1889def note_nontrivial_user_provided : Note<
1890 "because %select{base class of |field of |}0type %1 has a user-provided "
1891 "%sub{select_special_member_kind}2">;
1892def note_nontrivial_default_member_init : Note<
1893 "because field %0 has an initializer">;
1894def note_nontrivial_param_type : Note<
1895 "because its parameter is %diff{of type $, not $|of the wrong type}2,3">;
1896def note_nontrivial_default_arg : Note<"because it has a default argument">;
1897def note_nontrivial_variadic : Note<"because it is a variadic function">;
1898def note_nontrivial_subobject : Note<
1899 "because the function selected to %select{construct|copy|move|copy|move|"
1900 "destroy}2 %select{base class|field}0 of type %1 is not trivial">;
1901def note_nontrivial_objc_ownership : Note<
1902 "because type %0 has a member with %select{no|no|__strong|__weak|"
1903 "__autoreleasing}1 ownership">;
1904
1905/// Selector for a TagTypeKind value.
1906def select_tag_type_kind : TextSubstitution<
1907 "%select{struct|interface|union|class|enum}0">;
1908
1909def err_static_data_member_not_allowed_in_anon_struct : Error<
1910 "static data member %0 not allowed in anonymous "
1911 "%sub{select_tag_type_kind}1">;
1912def ext_static_data_member_in_union : ExtWarn<
1913 "static data member %0 in union is a C++11 extension">, InGroup<CXX11>;
1914def warn_cxx98_compat_static_data_member_in_union : Warning<
1915 "static data member %0 in union is incompatible with C++98">,
1916 InGroup<CXX98Compat>, DefaultIgnore;
1917def ext_union_member_of_reference_type : ExtWarn<
1918 "union member %0 has reference type %1, which is a Microsoft extension">,
1919 InGroup<MicrosoftUnionMemberReference>;
1920def err_union_member_of_reference_type : Error<
1921 "union member %0 has reference type %1">;
1922def ext_anonymous_struct_union_qualified : Extension<
1923 "anonymous %select{struct|union}0 cannot be '%1'">;
1924def err_different_return_type_for_overriding_virtual_function : Error<
1925 "virtual function %0 has a different return type "
1926 "%diff{($) than the function it overrides (which has return type $)|"
1927 "than the function it overrides}1,2">;
1928def note_overridden_virtual_function : Note<
1929 "overridden virtual function is here">;
1930def err_conflicting_overriding_cc_attributes : Error<
1931 "virtual function %0 has different calling convention attributes "
1932 "%diff{($) than the function it overrides (which has calling convention $)|"
1933 "than the function it overrides}1,2">;
1934def warn_overriding_method_missing_noescape : Warning<
1935 "parameter of overriding method should be annotated with "
1936 "__attribute__((noescape))">, InGroup<MissingNoEscape>;
1937def note_overridden_marked_noescape : Note<
1938 "parameter of overridden method is annotated with __attribute__((noescape))">;
1939def note_cat_conform_to_noescape_prot : Note<
1940 "%select{category|class extension}0 conforms to protocol %1 which defines method %2">;
1941
1942def err_covariant_return_inaccessible_base : Error<
1943 "invalid covariant return for virtual function: %1 is a "
1944 "%select{private|protected}2 base class of %0">, AccessControl;
1945def err_covariant_return_ambiguous_derived_to_base_conv : Error<
1946 "return type of virtual function %3 is not covariant with the return type of "
1947 "the function it overrides (ambiguous conversion from derived class "
1948 "%0 to base class %1:%2)">;
1949def err_covariant_return_not_derived : Error<
1950 "return type of virtual function %0 is not covariant with the return type of "
1951 "the function it overrides (%1 is not derived from %2)">;
1952def err_covariant_return_incomplete : Error<
1953 "return type of virtual function %0 is not covariant with the return type of "
1954 "the function it overrides (%1 is incomplete)">;
1955def err_covariant_return_type_different_qualifications : Error<
1956 "return type of virtual function %0 is not covariant with the return type of "
1957 "the function it overrides (%1 has different qualifiers than %2)">;
1958def err_covariant_return_type_class_type_more_qualified : Error<
1959 "return type of virtual function %0 is not covariant with the return type of "
1960 "the function it overrides (class type %1 is more qualified than class "
1961 "type %2">;
1962
1963// C++ implicit special member functions
1964def note_in_declaration_of_implicit_special_member : Note<
1965 "while declaring the implicit %sub{select_special_member_kind}1"
1966 " for %0">;
1967
1968// C++ constructors
1969def err_constructor_cannot_be : Error<"constructor cannot be declared '%0'">;
1970def err_invalid_qualified_constructor : Error<
1971 "'%0' qualifier is not allowed on a constructor">;
1972def err_ref_qualifier_constructor : Error<
1973 "ref-qualifier '%select{&&|&}0' is not allowed on a constructor">;
1974
1975def err_constructor_return_type : Error<
1976 "constructor cannot have a return type">;
1977def err_constructor_redeclared : Error<"constructor cannot be redeclared">;
1978def err_constructor_byvalue_arg : Error<
1979 "copy constructor must pass its first argument by reference">;
1980def warn_no_constructor_for_refconst : Warning<
1981 "%select{struct|interface|union|class|enum}0 %1 does not declare any "
1982 "constructor to initialize its non-modifiable members">;
1983def note_refconst_member_not_initialized : Note<
1984 "%select{const|reference}0 member %1 will never be initialized">;
1985def ext_ms_explicit_constructor_call : ExtWarn<
1986 "explicit constructor calls are a Microsoft extension">,
1987 InGroup<MicrosoftExplicitConstructorCall>;
1988
1989// C++ destructors
1990def err_destructor_not_member : Error<
1991 "destructor must be a non-static member function">;
1992def err_destructor_cannot_be : Error<"destructor cannot be declared '%0'">;
1993def err_invalid_qualified_destructor : Error<
1994 "'%0' qualifier is not allowed on a destructor">;
1995def err_ref_qualifier_destructor : Error<
1996 "ref-qualifier '%select{&&|&}0' is not allowed on a destructor">;
1997def err_destructor_return_type : Error<"destructor cannot have a return type">;
1998def err_destructor_redeclared : Error<"destructor cannot be redeclared">;
1999def err_destructor_with_params : Error<"destructor cannot have any parameters">;
2000def err_destructor_variadic : Error<"destructor cannot be variadic">;
2001def ext_destructor_typedef_name : ExtWarn<
2002 "destructor cannot be declared using a %select{typedef|type alias}1 %0 "
2003 "of the class name">, DefaultError, InGroup<DiagGroup<"dtor-typedef">>;
2004def err_undeclared_destructor_name : Error<
2005 "undeclared identifier %0 in destructor name">;
2006def err_destructor_name : Error<
2007 "expected the class name after '~' to name the enclosing class">;
2008def err_destructor_name_nontype : Error<
2009 "identifier %0 after '~' in destructor name does not name a type">;
2010def err_destructor_expr_mismatch : Error<
2011 "identifier %0 in object destruction expression does not name the type "
2012 "%1 of the object being destroyed">;
2013def err_destructor_expr_nontype : Error<
2014 "identifier %0 in object destruction expression does not name a type">;
2015def err_destructor_expr_type_mismatch : Error<
2016 "destructor type %0 in object destruction expression does not match the "
2017 "type %1 of the object being destroyed">;
2018def note_destructor_type_here : Note<
2019 "type %0 found by destructor name lookup">;
2020def note_destructor_nontype_here : Note<
2021 "non-type declaration found by destructor name lookup">;
2022def ext_dtor_named_in_wrong_scope : Extension<
2023 "ISO C++ requires the name after '::~' to be found in the same scope as "
2024 "the name before '::~'">, InGroup<DtorName>;
2025def ext_qualified_dtor_named_in_lexical_scope : ExtWarn<
2026 "qualified destructor name only found in lexical scope; omit the qualifier "
2027 "to find this type name by unqualified lookup">, InGroup<DtorName>;
2028def ext_dtor_name_ambiguous : Extension<
2029 "ISO C++ considers this destructor name lookup to be ambiguous">,
2030 InGroup<DtorName>;
2031
2032def err_destroy_attr_on_non_static_var : Error<
2033 "%select{no_destroy|always_destroy}0 attribute can only be applied to a"
2034 " variable with static or thread storage duration">;
2035
2036def err_destructor_template : Error<
2037 "destructor cannot be declared as a template">;
2038
2039// C++ initialization
2040def err_init_conversion_failed : Error<
2041 "cannot initialize %select{a variable|a parameter|template parameter|"
2042 "return object|statement expression result|an "
2043 "exception object|a member subobject|an array element|a new value|a value|a "
2044 "base class|a constructor delegation|a vector element|a block element|a "
2045 "block element|a complex element|a lambda capture|a compound literal "
2046 "initializer|a related result|a parameter of CF audited function}0 "
2047 "%diff{of type $ with an %select{rvalue|lvalue}2 of type $|"
2048 "with an %select{rvalue|lvalue}2 of incompatible type}1,3"
2049 "%select{|: different classes%diff{ ($ vs $)|}5,6"
2050 "|: different number of parameters (%5 vs %6)"
2051 "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
2052 "|: different return type%diff{ ($ vs $)|}5,6"
2053 "|: different qualifiers (%5 vs %6)"
2054 "|: different exception specifications}4">;
2055def note_forward_class_conversion : Note<"%0 is not defined, but forward "
2056 "declared here; conversion would be valid if it was derived from %1">;
2057
2058def err_lvalue_to_rvalue_ref : Error<"rvalue reference %diff{to type $ cannot "
2059 "bind to lvalue of type $|cannot bind to incompatible lvalue}0,1">;
2060def err_lvalue_reference_bind_to_initlist : Error<
2061 "%select{non-const|volatile}0 lvalue reference to type %1 cannot bind to an "
2062 "initializer list temporary">;
2063def err_lvalue_reference_bind_to_temporary : Error<
2064 "%select{non-const|volatile}0 lvalue reference %diff{to type $ cannot bind "
2065 "to a temporary of type $|cannot bind to incompatible temporary}1,2">;
2066def err_lvalue_reference_bind_to_unrelated : Error<
2067 "%select{non-const|volatile}0 lvalue reference "
2068 "%diff{to type $ cannot bind to a value of unrelated type $|"
2069 "cannot bind to a value of unrelated type}1,2">;
2070def err_reference_bind_drops_quals : Error<
2071 "binding reference %diff{of type $ to value of type $|to value}0,1 "
2072 "%select{drops %3 qualifier%plural{1:|2:|4:|:s}4|changes address space|"
2073 "not permitted due to incompatible qualifiers}2">;
2074def err_reference_bind_failed : Error<
2075 "reference %diff{to %select{type|incomplete type}1 $ could not bind to an "
2076 "%select{rvalue|lvalue}2 of type $|could not bind to %select{rvalue|lvalue}2 of "
2077 "incompatible type}0,3">;
2078def err_reference_bind_temporary_addrspace : Error<
2079 "reference of type %0 cannot bind to a temporary object because of "
2080 "address space mismatch">;
2081def err_reference_bind_init_list : Error<
2082 "reference to type %0 cannot bind to an initializer list">;
2083def err_init_list_bad_dest_type : Error<
2084 "%select{|non-aggregate }0type %1 cannot be initialized with an initializer "
2085 "list">;
2086def warn_cxx20_compat_aggregate_init_with_ctors : Warning<
2087 "aggregate initialization of type %0 with user-declared constructors "
2088 "is incompatible with C++20">, DefaultIgnore, InGroup<CXX20Compat>;
2089
2090def err_reference_bind_to_bitfield : Error<
2091 "%select{non-const|volatile}0 reference cannot bind to "
2092 "bit-field%select{| %1}2">;
2093def err_reference_bind_to_vector_element : Error<
2094 "%select{non-const|volatile}0 reference cannot bind to vector element">;
2095def err_reference_bind_to_matrix_element : Error<
2096 "%select{non-const|volatile}0 reference cannot bind to matrix element">;
2097def err_reference_var_requires_init : Error<
2098 "declaration of reference variable %0 requires an initializer">;
2099def err_reference_without_init : Error<
2100 "reference to type %0 requires an initializer">;
2101def note_value_initialization_here : Note<
2102 "in value-initialization of type %0 here">;
2103def err_reference_has_multiple_inits : Error<
2104 "reference cannot be initialized with multiple values">;
2105def err_init_non_aggr_init_list : Error<
2106 "initialization of non-aggregate type %0 with an initializer list">;
2107def err_init_reference_member_uninitialized : Error<
2108 "reference member of type %0 uninitialized">;
2109def note_uninit_reference_member : Note<
2110 "uninitialized reference member is here">;
2111def warn_field_is_uninit : Warning<"field %0 is uninitialized when used here">,
2112 InGroup<Uninitialized>;
2113def warn_base_class_is_uninit : Warning<
2114 "base class %0 is uninitialized when used here to access %q1">,
2115 InGroup<Uninitialized>;
2116def warn_reference_field_is_uninit : Warning<
2117 "reference %0 is not yet bound to a value when used here">,
2118 InGroup<Uninitialized>;
2119def note_uninit_in_this_constructor : Note<
2120 "during field initialization in %select{this|the implicit default}0 "
2121 "constructor">;
2122def warn_static_self_reference_in_init : Warning<
2123 "static variable %0 is suspiciously used within its own initialization">,
2124 InGroup<UninitializedStaticSelfInit>;
2125def warn_uninit_self_reference_in_init : Warning<
2126 "variable %0 is uninitialized when used within its own initialization">,
2127 InGroup<Uninitialized>;
2128def warn_uninit_self_reference_in_reference_init : Warning<
2129 "reference %0 is not yet bound to a value when used within its own"
2130 " initialization">,
2131 InGroup<Uninitialized>;
2132def warn_uninit_var : Warning<
2133 "variable %0 is uninitialized when %select{used here|captured by block}1">,
2134 InGroup<Uninitialized>, DefaultIgnore;
2135def warn_sometimes_uninit_var : Warning<
2136 "variable %0 is %select{used|captured}1 uninitialized whenever "
2137 "%select{'%3' condition is %select{true|false}4|"
2138 "'%3' loop %select{is entered|exits because its condition is false}4|"
2139 "'%3' loop %select{condition is true|exits because its condition is false}4|"
2140 "switch %3 is taken|"
2141 "its declaration is reached|"
2142 "%3 is called}2">,
2143 InGroup<UninitializedSometimes>, DefaultIgnore;
2144def warn_maybe_uninit_var : Warning<
2145 "variable %0 may be uninitialized when "
2146 "%select{used here|captured by block}1">,
2147 InGroup<UninitializedMaybe>, DefaultIgnore;
2148def note_var_declared_here : Note<"variable %0 is declared here">;
2149def note_uninit_var_use : Note<
2150 "%select{uninitialized use occurs|variable is captured by block}0 here">;
2151def warn_uninit_byref_blockvar_captured_by_block : Warning<
2152 "block pointer variable %0 is %select{uninitialized|null}1 when captured by "
2153 "block">, InGroup<Uninitialized>, DefaultIgnore;
2154def note_block_var_fixit_add_initialization : Note<
2155 "did you mean to use __block %0?">;
2156def note_in_omitted_aggregate_initializer : Note<
2157 "in implicit initialization of %select{"
2158 "array element %1 with omitted initializer|"
2159 "field %1 with omitted initializer|"
2160 "trailing array elements in runtime-sized array new}0">;
2161def note_in_reference_temporary_list_initializer : Note<
2162 "in initialization of temporary of type %0 created to "
2163 "list-initialize this reference">;
2164def note_var_fixit_add_initialization : Note<
2165 "initialize the variable %0 to silence this warning">;
2166def note_uninit_fixit_remove_cond : Note<
2167 "remove the %select{'%1' if its condition|condition if it}0 "
2168 "is always %select{false|true}2">;
2169def err_init_incomplete_type : Error<"initialization of incomplete type %0">;
2170def err_list_init_in_parens : Error<
2171 "cannot initialize %select{non-class|reference}0 type %1 with a "
2172 "parenthesized initializer list">;
2173
2174def warn_uninit_const_reference : Warning<
2175 "variable %0 is uninitialized when passed as a const reference argument "
2176 "here">, InGroup<UninitializedConstReference>, DefaultIgnore;
2177
2178def warn_unsequenced_mod_mod : Warning<
2179 "multiple unsequenced modifications to %0">, InGroup<Unsequenced>;
2180def warn_unsequenced_mod_use : Warning<
2181 "unsequenced modification and access to %0">, InGroup<Unsequenced>;
2182
2183def select_initialized_entity_kind : TextSubstitution<
2184 "%select{copying variable|copying parameter|initializing template parameter|"
2185 "returning object|initializing statement expression result|"
2186 "throwing object|copying member subobject|copying array element|"
2187 "allocating object|copying temporary|initializing base subobject|"
2188 "initializing vector element|capturing value}0">;
2189
2190def err_temp_copy_no_viable : Error<
2191 "no viable constructor %sub{select_initialized_entity_kind}0 of type %1">;
2192def ext_rvalue_to_reference_temp_copy_no_viable : Extension<
2193 "no viable constructor %sub{select_initialized_entity_kind}0 of type %1; "
2194 "C++98 requires a copy constructor when binding a reference to a temporary">,
2195 InGroup<BindToTemporaryCopy>;
2196def err_temp_copy_ambiguous : Error<
2197 "ambiguous constructor call when %sub{select_initialized_entity_kind}0 "
2198 "of type %1">;
2199def err_temp_copy_deleted : Error<
2200 "%sub{select_initialized_entity_kind}0 of type %1 "
2201 "invokes deleted constructor">;
2202def err_temp_copy_incomplete : Error<
2203 "copying a temporary object of incomplete type %0">;
2204def warn_cxx98_compat_temp_copy : Warning<
2205 "%sub{select_initialized_entity_kind}1 "
2206 "of type %2 when binding a reference to a temporary would %select{invoke "
2207 "an inaccessible constructor|find no viable constructor|find ambiguous "
2208 "constructors|invoke a deleted constructor}0 in C++98">,
2209 InGroup<CXX98CompatBindToTemporaryCopy>, DefaultIgnore;
2210def err_selected_explicit_constructor : Error<
2211 "chosen constructor is explicit in copy-initialization">;
2212def note_explicit_ctor_deduction_guide_here : Note<
2213 "explicit %select{constructor|deduction guide}0 declared here">;
2214
2215// C++11 decltype
2216def err_decltype_in_declarator : Error<
2217 "'decltype' cannot be used to name a declaration">;
2218
2219// C++11 auto
2220def warn_cxx98_compat_auto_type_specifier : Warning<
2221 "'auto' type specifier is incompatible with C++98">,
2222 InGroup<CXX98Compat>, DefaultIgnore;
2223def err_auto_variable_cannot_appear_in_own_initializer : Error<
2224 "variable %0 declared with deduced type %1 "
2225 "cannot appear in its own initializer">;
2226def err_binding_cannot_appear_in_own_initializer : Error<
2227 "binding %0 cannot appear in the initializer of its own "
2228 "decomposition declaration">;
2229def err_illegal_decl_array_of_auto : Error<
2230 "'%0' declared as array of %1">;
2231def err_new_array_of_auto : Error<
2232 "cannot allocate array of 'auto'">;
2233def err_auto_not_allowed : Error<
2234 "%select{'auto'|'decltype(auto)'|'__auto_type'|"
2235 "use of "
2236 "%select{class template|function template|variable template|alias template|"
2237 "template template parameter|concept|template}2 %3 requires template "
2238 "arguments; argument deduction}0 not allowed "
2239 "%select{in function prototype"
2240 "|in non-static struct member|in struct member"
2241 "|in non-static union member|in union member"
2242 "|in non-static class member|in interface member"
2243 "|in exception declaration|in template parameter until C++17|in block literal"
2244 "|in template argument|in typedef|in type alias|in function return type"
2245 "|in conversion function type|here|in lambda parameter"
2246 "|in type allocated by 'new'|in K&R-style function parameter"
2247 "|in template parameter|in friend declaration|in function prototype that is "
2248 "not a function declaration|in requires expression parameter}1">;
2249def err_dependent_deduced_tst : Error<
2250 "typename specifier refers to "
2251 "%select{class template|function template|variable template|alias template|"
2252 "template template parameter|template}0 member in %1; "
2253 "argument deduction not allowed here">;
2254def err_deduced_tst : Error<
2255 "typename specifier refers to "
2256 "%select{class template|function template|variable template|alias template|"
2257 "template template parameter|template}0; argument deduction not allowed "
2258 "here">;
2259def err_auto_not_allowed_var_inst : Error<
2260 "'auto' variable template instantiation is not allowed">;
2261def err_auto_var_requires_init : Error<
2262 "declaration of variable %0 with deduced type %1 requires an initializer">;
2263def err_auto_new_requires_ctor_arg : Error<
2264 "new expression for type %0 requires a constructor argument">;
2265def ext_auto_new_list_init : Extension<
2266 "ISO C++ standards before C++17 do not allow new expression for "
2267 "type %0 to use list-initialization">, InGroup<CXX17>;
2268def err_auto_var_init_no_expression : Error<
2269 "initializer for variable %0 with type %1 is empty">;
2270def err_auto_var_init_multiple_expressions : Error<
2271 "initializer for variable %0 with type %1 contains multiple expressions">;
2272def err_auto_var_init_paren_braces : Error<
2273 "cannot deduce type for variable %1 with type %2 from "
2274 "%select{parenthesized|nested}0 initializer list">;
2275def err_auto_new_ctor_multiple_expressions : Error<
2276 "new expression for type %0 contains multiple constructor arguments">;
2277def err_auto_missing_trailing_return : Error<
2278 "'auto' return without trailing return type; deduced return types are a "
2279 "C++14 extension">;
2280def err_deduced_return_type : Error<
2281 "deduced return types are a C++14 extension">;
2282def err_trailing_return_without_auto : Error<
2283 "function with trailing return type must specify return type 'auto', not %0">;
2284def err_trailing_return_in_parens : Error<
2285 "trailing return type may not be nested within parentheses">;
2286def err_auto_var_deduction_failure : Error<
2287 "variable %0 with type %1 has incompatible initializer of type %2">;
2288def err_auto_var_deduction_failure_from_init_list : Error<
2289 "cannot deduce actual type for variable %0 with type %1 from initializer list">;
2290def err_auto_new_deduction_failure : Error<
2291 "new expression for type %0 has incompatible constructor argument of type %1">;
2292def err_auto_inconsistent_deduction : Error<
2293 "deduced conflicting types %diff{($ vs $) |}0,1"
2294 "for initializer list element type">;
2295def err_auto_different_deductions : Error<
2296 "%select{'auto'|'decltype(auto)'|'__auto_type'|template arguments}0 "
2297 "deduced as %1 in declaration of %2 and "
2298 "deduced as %3 in declaration of %4">;
2299def err_auto_non_deduced_not_alone : Error<
2300 "%select{function with deduced return type|"
2301 "declaration with trailing return type}0 "
2302 "must be the only declaration in its group">;
2303def err_implied_std_initializer_list_not_found : Error<
2304 "cannot deduce type of initializer list because std::initializer_list was "
2305 "not found; include <initializer_list>">;
2306def err_malformed_std_initializer_list : Error<
2307 "std::initializer_list must be a class template with a single type parameter">;
2308def err_auto_init_list_from_c : Error<
2309 "cannot use __auto_type with initializer list in C">;
2310def err_auto_bitfield : Error<
2311 "cannot pass bit-field as __auto_type initializer in C">;
2312
2313// C++1y decltype(auto) type
2314def err_decltype_auto_invalid : Error<
2315 "'decltype(auto)' not allowed here">;
2316def err_decltype_auto_cannot_be_combined : Error<
2317 "'decltype(auto)' cannot be combined with other type specifiers">;
2318def err_decltype_auto_function_declarator_not_declaration : Error<
2319 "'decltype(auto)' can only be used as a return type "
2320 "in a function declaration">;
2321def err_decltype_auto_compound_type : Error<
2322 "cannot form %select{pointer to|reference to|array of}0 'decltype(auto)'">;
2323def err_decltype_auto_initializer_list : Error<
2324 "cannot deduce 'decltype(auto)' from initializer list">;
2325
2326// C++17 deduced class template specialization types
2327def err_deduced_class_template_compound_type : Error<
2328 "cannot %select{form pointer to|form reference to|form array of|"
2329 "form function returning|use parentheses when declaring variable with}0 "
2330 "deduced class template specialization type">;
2331def err_deduced_non_class_template_specialization_type : Error<
2332 "%select{<error>|function template|variable template|alias template|"
2333 "template template parameter|concept|template}0 %1 requires template "
2334 "arguments; argument deduction only allowed for class templates">;
2335def err_deduced_class_template_ctor_ambiguous : Error<
2336 "ambiguous deduction for template arguments of %0">;
2337def err_deduced_class_template_ctor_no_viable : Error<
2338 "no viable constructor or deduction guide for deduction of "
2339 "template arguments of %0">;
2340def err_deduced_class_template_incomplete : Error<
2341 "template %0 has no definition and no %select{|viable }1deduction guides "
2342 "for deduction of template arguments">;
2343def err_deduced_class_template_deleted : Error<
2344 "class template argument deduction for %0 selected a deleted constructor">;
2345def err_deduced_class_template_explicit : Error<
2346 "class template argument deduction for %0 selected an explicit "
2347 "%select{constructor|deduction guide}1 for copy-list-initialization">;
2348def err_deduction_guide_no_trailing_return_type : Error<
2349 "deduction guide declaration without trailing return type">;
2350def err_deduction_guide_bad_trailing_return_type : Error<
2351 "deduced type %1 of deduction guide is not %select{|written as }2"
2352 "a specialization of template %0">;
2353def err_deduction_guide_with_complex_decl : Error<
2354 "cannot specify any part of a return type in the "
2355 "declaration of a deduction guide">;
2356def err_deduction_guide_invalid_specifier : Error<
2357 "deduction guide cannot be declared '%0'">;
2358def err_deduction_guide_name_not_class_template : Error<
2359 "cannot specify deduction guide for "
2360 "%select{<error>|function template|variable template|alias template|"
2361 "template template parameter|concept|dependent template name}0 %1">;
2362def err_deduction_guide_wrong_scope : Error<
2363 "deduction guide must be declared in the same scope as template %q0">;
2364def err_deduction_guide_defines_function : Error<
2365 "deduction guide cannot have a function definition">;
2366def err_deduction_guide_redeclared : Error<
2367 "redeclaration of deduction guide">;
2368def err_deduction_guide_specialized : Error<"deduction guide cannot be "
2369 "%select{explicitly instantiated|explicitly specialized}0">;
2370def err_deduction_guide_template_not_deducible : Error<
2371 "deduction guide template contains "
2372 "%select{a template parameter|template parameters}0 that cannot be "
2373 "deduced">;
2374def err_deduction_guide_wrong_access : Error<
2375 "deduction guide has different access from the corresponding "
2376 "member template">;
2377def note_deduction_guide_template_access : Note<
2378 "member template declared %0 here">;
2379def note_deduction_guide_access : Note<
2380 "deduction guide declared %0 by intervening access specifier">;
2381def warn_cxx14_compat_class_template_argument_deduction : Warning<
2382 "class template argument deduction is incompatible with C++ standards "
2383 "before C++17%select{|; for compatibility, use explicit type name %1}0">,
2384 InGroup<CXXPre17Compat>, DefaultIgnore;
2385def warn_ctad_maybe_unsupported : Warning<
2386 "%0 may not intend to support class template argument deduction">,
2387 InGroup<CTADMaybeUnsupported>, DefaultIgnore;
2388def note_suppress_ctad_maybe_unsupported : Note<
2389 "add a deduction guide to suppress this warning">;
2390
2391
2392// C++14 deduced return types
2393def err_auto_fn_deduction_failure : Error<
2394 "cannot deduce return type %0 from returned value of type %1">;
2395def err_auto_fn_different_deductions : Error<
2396 "'%select{auto|decltype(auto)}0' in return type deduced as %1 here but "
2397 "deduced as %2 in earlier return statement">;
2398def err_auto_fn_used_before_defined : Error<
2399 "function %0 with deduced return type cannot be used before it is defined">;
2400def err_auto_fn_no_return_but_not_auto : Error<
2401 "cannot deduce return type %0 for function with no return statements">;
2402def err_auto_fn_return_void_but_not_auto : Error<
2403 "cannot deduce return type %0 from omitted return expression">;
2404def err_auto_fn_return_init_list : Error<
2405 "cannot deduce return type from initializer list">;
2406def err_auto_fn_virtual : Error<
2407 "function with deduced return type cannot be virtual">;
2408def warn_cxx11_compat_deduced_return_type : Warning<
2409 "return type deduction is incompatible with C++ standards before C++14">,
2410 InGroup<CXXPre14Compat>, DefaultIgnore;
2411
2412// C++11 override control
2413def override_keyword_only_allowed_on_virtual_member_functions : Error<
2414 "only virtual member functions can be marked '%0'">;
2415def override_keyword_hides_virtual_member_function : Error<
2416 "non-virtual member function marked '%0' hides virtual member "
2417 "%select{function|functions}1">;
2418def err_function_marked_override_not_overriding : Error<
2419 "%0 marked 'override' but does not override any member functions">;
2420def warn_destructor_marked_not_override_overriding : TextSubstitution <
2421 "%0 overrides a destructor but is not marked 'override'">;
2422def warn_function_marked_not_override_overriding : TextSubstitution <
2423 "%0 overrides a member function but is not marked 'override'">;
2424def warn_inconsistent_destructor_marked_not_override_overriding : Warning <
2425 "%sub{warn_destructor_marked_not_override_overriding}0">,
2426 InGroup<CXX11WarnInconsistentOverrideDestructor>, DefaultIgnore;
2427def warn_inconsistent_function_marked_not_override_overriding : Warning <
2428 "%sub{warn_function_marked_not_override_overriding}0">,
2429 InGroup<CXX11WarnInconsistentOverrideMethod>;
2430def warn_suggest_destructor_marked_not_override_overriding : Warning <
2431 "%sub{warn_destructor_marked_not_override_overriding}0">,
2432 InGroup<CXX11WarnSuggestOverrideDestructor>, DefaultIgnore;
2433def warn_suggest_function_marked_not_override_overriding : Warning <
2434 "%sub{warn_function_marked_not_override_overriding}0">,
2435 InGroup<CXX11WarnSuggestOverride>, DefaultIgnore;
2436def err_class_marked_final_used_as_base : Error<
2437 "base %0 is marked '%select{final|sealed}1'">;
2438def warn_abstract_final_class : Warning<
2439 "abstract class is marked '%select{final|sealed}0'">, InGroup<AbstractFinalClass>;
2440def warn_final_dtor_non_final_class : Warning<
2441 "class with destructor marked '%select{final|sealed}0' cannot be inherited from">,
2442 InGroup<FinalDtorNonFinalClass>;
2443def note_final_dtor_non_final_class_silence : Note<
2444 "mark %0 as '%select{final|sealed}1' to silence this warning">;
2445
2446// C++11 attributes
2447def err_repeat_attribute : Error<"%0 attribute cannot be repeated">;
2448
2449// C++11 final
2450def err_final_function_overridden : Error<
2451 "declaration of %0 overrides a '%select{final|sealed}1' function">;
2452
2453// C++11 scoped enumerations
2454def err_enum_invalid_underlying : Error<
2455 "non-integral type %0 is an invalid underlying type">;
2456def err_enumerator_too_large : Error<
2457 "enumerator value is not representable in the underlying type %0">;
2458def ext_enumerator_too_large : Extension<
2459 "enumerator value is not representable in the underlying type %0">,
2460 InGroup<MicrosoftEnumValue>;
2461def err_enumerator_wrapped : Error<
2462 "enumerator value %0 is not representable in the underlying type %1">;
2463def err_enum_redeclare_type_mismatch : Error<
2464 "enumeration redeclared with different underlying type %0 (was %1)">;
2465def err_enum_redeclare_fixed_mismatch : Error<
2466 "enumeration previously declared with %select{non|}0fixed underlying type">;
2467def err_enum_redeclare_scoped_mismatch : Error<
2468 "enumeration previously declared as %select{un|}0scoped">;
2469def err_only_enums_have_underlying_types : Error<
2470 "only enumeration types have underlying types">;
2471def err_underlying_type_of_incomplete_enum : Error<
2472 "cannot determine underlying type of incomplete enumeration type %0">;
2473
2474// C++11 delegating constructors
2475def err_delegating_ctor : Error<
2476 "delegating constructors are permitted only in C++11">;
2477def warn_cxx98_compat_delegating_ctor : Warning<
2478 "delegating constructors are incompatible with C++98">,
2479 InGroup<CXX98Compat>, DefaultIgnore;
2480def err_delegating_initializer_alone : Error<
2481 "an initializer for a delegating constructor must appear alone">;
2482def warn_delegating_ctor_cycle : Warning<
2483 "constructor for %0 creates a delegation cycle">, DefaultError,
2484 InGroup<DelegatingCtorCycles>;
2485def note_it_delegates_to : Note<"it delegates to">;
2486def note_which_delegates_to : Note<"which delegates to">;
2487
2488// C++11 range-based for loop
2489def err_for_range_decl_must_be_var : Error<
2490 "for range declaration must declare a variable">;
2491def err_for_range_storage_class : Error<
2492 "loop variable %0 may not be declared %select{'extern'|'static'|"
2493 "'__private_extern__'|'auto'|'register'|'constexpr'|'thread_local'}1">;
2494def err_type_defined_in_for_range : Error<
2495 "types may not be defined in a for range declaration">;
2496def err_for_range_deduction_failure : Error<
2497 "cannot use type %0 as a range">;
2498def err_for_range_incomplete_type : Error<
2499 "cannot use incomplete type %0 as a range">;
2500def err_for_range_iter_deduction_failure : Error<
2501 "cannot use type %0 as an iterator">;
2502def ext_for_range_begin_end_types_differ : ExtWarn<
2503 "'begin' and 'end' returning different types (%0 and %1) is a C++17 extension">,
2504 InGroup<CXX17>;
2505def warn_for_range_begin_end_types_differ : Warning<
2506 "'begin' and 'end' returning different types (%0 and %1) is incompatible "
2507 "with C++ standards before C++17">, InGroup<CXXPre17Compat>, DefaultIgnore;
2508def note_in_for_range: Note<
2509 "when looking up '%select{begin|end}0' function for range expression "
2510 "of type %1">;
2511def err_for_range_invalid: Error<
2512 "invalid range expression of type %0; no viable '%select{begin|end}1' "
2513 "function available">;
2514def note_for_range_member_begin_end_ignored : Note<
2515 "member is not a candidate because range type %0 has no '%select{end|begin}1' member">;
2516def err_range_on_array_parameter : Error<
2517 "cannot build range expression with array function parameter %0 since "
2518 "parameter with array type %1 is treated as pointer type %2">;
2519def err_for_range_dereference : Error<
2520 "invalid range expression of type %0; did you mean to dereference it "
2521 "with '*'?">;
2522def note_for_range_invalid_iterator : Note <
2523 "in implicit call to 'operator%select{!=|*|++}0' for iterator of type %1">;
2524def note_for_range_begin_end : Note<
2525 "selected '%select{begin|end}0' %select{function|template }1%2 with iterator type %3">;
2526def warn_for_range_const_ref_binds_temp_built_from_ref : Warning<
2527 "loop variable %0 "
2528 "%diff{of type $ binds to a temporary constructed from type $"
2529 "|binds to a temporary constructed from a different type}1,2">,
2530 InGroup<RangeLoopConstruct>, DefaultIgnore;
2531def note_use_type_or_non_reference : Note<
2532 "use non-reference type %0 to make construction explicit or type %1 to prevent copying">;
2533def warn_for_range_ref_binds_ret_temp : Warning<
2534 "loop variable %0 binds to a temporary value produced by a range of type %1">,
2535 InGroup<RangeLoopBindReference>, DefaultIgnore;
2536def note_use_non_reference_type : Note<"use non-reference type %0">;
2537def warn_for_range_copy : Warning<
2538 "loop variable %0 creates a copy from type %1">,
2539 InGroup<RangeLoopConstruct>, DefaultIgnore;
2540def note_use_reference_type : Note<"use reference type %0 to prevent copying">;
2541def err_objc_for_range_init_stmt : Error<
2542 "initialization statement is not supported when iterating over Objective-C "
2543 "collection">;
2544
2545// C++11 constexpr
2546def warn_cxx98_compat_constexpr : Warning<
2547 "'constexpr' specifier is incompatible with C++98">,
2548 InGroup<CXX98Compat>, DefaultIgnore;
2549// FIXME: Maybe this should also go in -Wc++14-compat?
2550def warn_cxx14_compat_constexpr_not_const : Warning<
2551 "'constexpr' non-static member function will not be implicitly 'const' "
2552 "in C++14; add 'const' to avoid a change in behavior">,
2553 InGroup<DiagGroup<"constexpr-not-const">>;
2554def err_invalid_consteval_take_address : Error<
2555 "cannot take address of consteval function %0 outside"
2556 " of an immediate invocation">;
2557def err_invalid_consteval_call : Error<
2558 "call to consteval function %q0 is not a constant expression">;
2559def err_invalid_consteval_decl_kind : Error<
2560 "%0 cannot be declared consteval">;
2561def err_invalid_constexpr : Error<
2562 "%select{function parameter|typedef}0 "
2563 "cannot be %sub{select_constexpr_spec_kind}1">;
2564def err_invalid_constexpr_member : Error<"non-static data member cannot be "
2565 "constexpr%select{; did you intend to make it %select{const|static}0?|}1">;
2566def err_constexpr_tag : Error<
2567 "%select{class|struct|interface|union|enum}0 "
2568 "cannot be marked %sub{select_constexpr_spec_kind}1">;
2569def err_constexpr_dtor : Error<
2570 "destructor cannot be declared %sub{select_constexpr_spec_kind}0">;
2571def err_constexpr_dtor_subobject : Error<
2572 "destructor cannot be declared %sub{select_constexpr_spec_kind}0 because "
2573 "%select{data member %2|base class %3}1 does not have a "
2574 "constexpr destructor">;
2575def note_constexpr_dtor_subobject : Note<
2576 "%select{data member %1|base class %2}0 declared here">;
2577def err_constexpr_wrong_decl_kind : Error<
2578 "%sub{select_constexpr_spec_kind}0 can only be used "
2579 "in %select{|variable and function|function|variable}0 declarations">;
2580def err_invalid_constexpr_var_decl : Error<
2581 "constexpr variable declaration must be a definition">;
2582def err_constexpr_static_mem_var_requires_init : Error<
2583 "declaration of constexpr static data member %0 requires an initializer">;
2584def err_constexpr_var_non_literal : Error<
2585 "constexpr variable cannot have non-literal type %0">;
2586def err_constexpr_var_requires_const_init : Error<
2587 "constexpr variable %0 must be initialized by a constant expression">;
2588def err_constexpr_var_requires_const_destruction : Error<
2589 "constexpr variable %0 must have constant destruction">;
2590def err_constexpr_redecl_mismatch : Error<
2591 "%select{non-constexpr|constexpr|consteval}1 declaration of %0"
2592 " follows %select{non-constexpr|constexpr|consteval}2 declaration">;
2593def err_constexpr_virtual : Error<"virtual function cannot be constexpr">;
2594def warn_cxx17_compat_constexpr_virtual : Warning<
2595 "virtual constexpr functions are incompatible with "
2596 "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
2597def err_constexpr_virtual_base : Error<
2598 "constexpr %select{member function|constructor}0 not allowed in "
2599 "%select{struct|interface|class}1 with virtual base "
2600 "%plural{1:class|:classes}2">;
2601def note_non_literal_incomplete : Note<
2602 "incomplete type %0 is not a literal type">;
2603def note_non_literal_virtual_base : Note<"%select{struct|interface|class}0 "
2604 "with virtual base %plural{1:class|:classes}1 is not a literal type">;
2605def note_constexpr_virtual_base_here : Note<"virtual base class declared here">;
2606def err_constexpr_non_literal_return : Error<
2607 "%select{constexpr|consteval}0 function's return type %1 is not a literal type">;
2608def err_constexpr_non_literal_param : Error<
2609 "%select{constexpr|consteval}2 %select{function|constructor}1's %ordinal0 parameter type %3 is "
2610 "not a literal type">;
2611def err_constexpr_body_invalid_stmt : Error<
2612 "statement not allowed in %select{constexpr|consteval}1 %select{function|constructor}0">;
2613def ext_constexpr_body_invalid_stmt : ExtWarn<
2614 "use of this statement in a constexpr %select{function|constructor}0 "
2615 "is a C++14 extension">, InGroup<CXX14>;
2616def warn_cxx11_compat_constexpr_body_invalid_stmt : Warning<
2617 "use of this statement in a constexpr %select{function|constructor}0 "
2618 "is incompatible with C++ standards before C++14">,
2619 InGroup<CXXPre14Compat>, DefaultIgnore;
2620def ext_constexpr_body_invalid_stmt_cxx20 : ExtWarn<
2621 "use of this statement in a constexpr %select{function|constructor}0 "
2622 "is a C++20 extension">, InGroup<CXX20>;
2623def warn_cxx17_compat_constexpr_body_invalid_stmt : Warning<
2624 "use of this statement in a constexpr %select{function|constructor}0 "
2625 "is incompatible with C++ standards before C++20">,
2626 InGroup<CXXPre20Compat>, DefaultIgnore;
2627def ext_constexpr_type_definition : ExtWarn<
2628 "type definition in a constexpr %select{function|constructor}0 "
2629 "is a C++14 extension">, InGroup<CXX14>;
2630def warn_cxx11_compat_constexpr_type_definition : Warning<
2631 "type definition in a constexpr %select{function|constructor}0 "
2632 "is incompatible with C++ standards before C++14">,
2633 InGroup<CXXPre14Compat>, DefaultIgnore;
2634def err_constexpr_vla : Error<
2635 "variably-modified type %0 cannot be used in a constexpr "
2636 "%select{function|constructor}1">;
2637def ext_constexpr_local_var : ExtWarn<
2638 "variable declaration in a constexpr %select{function|constructor}0 "
2639 "is a C++14 extension">, InGroup<CXX14>;
2640def warn_cxx11_compat_constexpr_local_var : Warning<
2641 "variable declaration in a constexpr %select{function|constructor}0 "
2642 "is incompatible with C++ standards before C++14">,
2643 InGroup<CXXPre14Compat>, DefaultIgnore;
2644def err_constexpr_local_var_static : Error<
2645 "%select{static|thread_local}1 variable not permitted in a constexpr "
2646 "%select{function|constructor}0">;
2647def err_constexpr_local_var_non_literal_type : Error<
2648 "variable of non-literal type %1 cannot be defined in a constexpr "
2649 "%select{function|constructor}0">;
2650def ext_constexpr_local_var_no_init : ExtWarn<
2651 "uninitialized variable in a constexpr %select{function|constructor}0 "
2652 "is a C++20 extension">, InGroup<CXX20>;
2653def warn_cxx17_compat_constexpr_local_var_no_init : Warning<
2654 "uninitialized variable in a constexpr %select{function|constructor}0 "
2655 "is incompatible with C++ standards before C++20">,
2656 InGroup<CXXPre20Compat>, DefaultIgnore;
2657def ext_constexpr_function_never_constant_expr : ExtWarn<
2658 "%select{constexpr|consteval}1 %select{function|constructor}0 never produces a "
2659 "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
2660def err_attr_cond_never_constant_expr : Error<
2661 "%0 attribute expression never produces a constant expression">;
2662def err_diagnose_if_invalid_diagnostic_type : Error<
2663 "invalid diagnostic type for 'diagnose_if'; use \"error\" or \"warning\" "
2664 "instead">;
2665def err_constexpr_body_no_return : Error<
2666 "no return statement in %select{constexpr|consteval}0 function">;
2667def err_constexpr_return_missing_expr : Error<
2668 "non-void %select{constexpr|consteval}1 function %0 should return a value">;
2669def warn_cxx11_compat_constexpr_body_no_return : Warning<
2670 "constexpr function with no return statements is incompatible with C++ "
2671 "standards before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
2672def ext_constexpr_body_multiple_return : ExtWarn<
2673 "multiple return statements in constexpr function is a C++14 extension">,
2674 InGroup<CXX14>;
2675def warn_cxx11_compat_constexpr_body_multiple_return : Warning<
2676 "multiple return statements in constexpr function "
2677 "is incompatible with C++ standards before C++14">,
2678 InGroup<CXXPre14Compat>, DefaultIgnore;
2679def note_constexpr_body_previous_return : Note<
2680 "previous return statement is here">;
2681
2682// C++20 function try blocks in constexpr
2683def ext_constexpr_function_try_block_cxx20 : ExtWarn<
2684 "function try block in constexpr %select{function|constructor}0 is "
2685 "a C++20 extension">, InGroup<CXX20>;
2686def warn_cxx17_compat_constexpr_function_try_block : Warning<
2687 "function try block in constexpr %select{function|constructor}0 is "
2688 "incompatible with C++ standards before C++20">,
2689 InGroup<CXXPre20Compat>, DefaultIgnore;
2690
2691def ext_constexpr_union_ctor_no_init : ExtWarn<
2692 "constexpr union constructor that does not initialize any member "
2693 "is a C++20 extension">, InGroup<CXX20>;
2694def warn_cxx17_compat_constexpr_union_ctor_no_init : Warning<
2695 "constexpr union constructor that does not initialize any member "
2696 "is incompatible with C++ standards before C++20">,
2697 InGroup<CXXPre20Compat>, DefaultIgnore;
2698def ext_constexpr_ctor_missing_init : ExtWarn<
2699 "constexpr constructor that does not initialize all members "
2700 "is a C++20 extension">, InGroup<CXX20>;
2701def warn_cxx17_compat_constexpr_ctor_missing_init : Warning<
2702 "constexpr constructor that does not initialize all members "
2703 "is incompatible with C++ standards before C++20">,
2704 InGroup<CXXPre20Compat>, DefaultIgnore;
2705def note_constexpr_ctor_missing_init : Note<
2706 "member not initialized by constructor">;
2707def note_non_literal_no_constexpr_ctors : Note<
2708 "%0 is not literal because it is not an aggregate and has no constexpr "
2709 "constructors other than copy or move constructors">;
2710def note_non_literal_base_class : Note<
2711 "%0 is not literal because it has base class %1 of non-literal type">;
2712def note_non_literal_field : Note<
2713 "%0 is not literal because it has data member %1 of "
2714 "%select{non-literal|volatile}3 type %2">;
2715def note_non_literal_user_provided_dtor : Note<
2716 "%0 is not literal because it has a user-provided destructor">;
2717def note_non_literal_nontrivial_dtor : Note<
2718 "%0 is not literal because it has a non-trivial destructor">;
2719def note_non_literal_non_constexpr_dtor : Note<
2720 "%0 is not literal because its destructor is not constexpr">;
2721def note_non_literal_lambda : Note<
2722 "lambda closure types are non-literal types before C++17">;
2723def warn_private_extern : Warning<
2724 "use of __private_extern__ on a declaration may not produce external symbol "
2725 "private to the linkage unit and is deprecated">, InGroup<PrivateExtern>;
2726def note_private_extern : Note<
2727 "use __attribute__((visibility(\"hidden\"))) attribute instead">;
2728
2729// C++ Concepts
2730def err_concept_decls_may_only_appear_in_global_namespace_scope : Error<
2731 "concept declarations may only appear in global or namespace scope">;
2732def err_concept_no_parameters : Error<
2733 "concept template parameter list must have at least one parameter; explicit "
2734 "specialization of concepts is not allowed">;
2735def err_concept_extra_headers : Error<
2736 "extraneous template parameter list in concept definition">;
2737def err_concept_no_associated_constraints : Error<
2738 "concept cannot have associated constraints">;
2739def err_non_constant_constraint_expression : Error<
2740 "substitution into constraint expression resulted in a non-constant "
2741 "expression">;
2742def err_non_bool_atomic_constraint : Error<
2743 "atomic constraint must be of type 'bool' (found %0)">;
2744def err_template_arg_list_constraints_not_satisfied : Error<
2745 "constraints not satisfied for %select{class template|function template|variable template|alias template|"
2746 "template template parameter|template}0 %1%2">;
2747def note_substituted_constraint_expr_is_ill_formed : Note<
2748 "because substituted constraint expression is ill-formed%0">;
2749def note_atomic_constraint_evaluated_to_false : Note<
2750 "%select{and|because}0 '%1' evaluated to false">;
2751def note_concept_specialization_constraint_evaluated_to_false : Note<
2752 "%select{and|because}0 '%1' evaluated to false">;
2753def note_single_arg_concept_specialization_constraint_evaluated_to_false : Note<
2754 "%select{and|because}0 %1 does not satisfy %2">;
2755def note_atomic_constraint_evaluated_to_false_elaborated : Note<
2756 "%select{and|because}0 '%1' (%2 %3 %4) evaluated to false">;
2757def err_constrained_virtual_method : Error<
2758 "virtual function cannot have a requires clause">;
2759def err_trailing_requires_clause_on_deduction_guide : Error<
2760 "deduction guide cannot have a requires clause">;
2761def err_reference_to_function_with_unsatisfied_constraints : Error<
2762 "invalid reference to function %0: constraints not satisfied">;
2763def err_requires_expr_local_parameter_default_argument : Error<
2764 "default arguments not allowed for parameters of a requires expression">;
2765def err_requires_expr_parameter_referenced_in_evaluated_context : Error<
2766 "constraint variable %0 cannot be used in an evaluated context">;
2767def note_expr_requirement_expr_substitution_error : Note<
2768 "%select{and|because}0 '%1' would be invalid: %2">;
2769def note_expr_requirement_expr_unknown_substitution_error : Note<
2770 "%select{and|because}0 '%1' would be invalid">;
2771def note_expr_requirement_noexcept_not_met : Note<
2772 "%select{and|because}0 '%1' may throw an exception">;
2773def note_expr_requirement_type_requirement_substitution_error : Note<
2774 "%select{and|because}0 '%1' would be invalid: %2">;
2775def note_expr_requirement_type_requirement_unknown_substitution_error : Note<
2776 "%select{and|because}0 '%1' would be invalid">;
2777def note_expr_requirement_constraints_not_satisfied : Note<
2778 "%select{and|because}0 type constraint '%1' was not satisfied:">;
2779def note_expr_requirement_constraints_not_satisfied_simple : Note<
2780 "%select{and|because}0 %1 does not satisfy %2:">;
2781def note_type_requirement_substitution_error : Note<
2782 "%select{and|because}0 '%1' would be invalid: %2">;
2783def note_type_requirement_unknown_substitution_error : Note<
2784 "%select{and|because}0 '%1' would be invalid">;
2785def note_nested_requirement_substitution_error : Note<
2786 "%select{and|because}0 '%1' would be invalid: %2">;
2787def note_nested_requirement_unknown_substitution_error : Note<
2788 "%select{and|because}0 '%1' would be invalid">;
2789def note_ambiguous_atomic_constraints : Note<
2790 "similar constraint expressions not considered equivalent; constraint "
2791 "expressions cannot be considered equivalent unless they originate from the "
2792 "same concept">;
2793def note_ambiguous_atomic_constraints_similar_expression : Note<
2794 "similar constraint expression here">;
2795def err_unsupported_placeholder_constraint : Error<
2796 "constrained placeholder types other than simple 'auto' on non-type template "
2797 "parameters not supported yet">;
2798
2799def err_template_different_requires_clause : Error<
2800 "requires clause differs in template redeclaration">;
2801def err_template_different_type_constraint : Error<
2802 "type constraint differs in template redeclaration">;
2803def err_template_template_parameter_not_at_least_as_constrained : Error<
2804 "template template argument %0 is more constrained than template template "
2805 "parameter %1">;
2806
2807def err_type_constraint_non_type_concept : Error<
2808 "concept named in type constraint is not a type concept">;
2809def err_type_constraint_missing_arguments : Error<
2810 "%0 requires more than 1 template argument; provide the remaining arguments "
2811 "explicitly to use it here">;
2812def err_placeholder_constraints_not_satisfied : Error<
2813 "deduced type %0 does not satisfy %1">;
2814
2815// C++11 char16_t/char32_t
2816def warn_cxx98_compat_unicode_type : Warning<
2817 "'%0' type specifier is incompatible with C++98">,
2818 InGroup<CXX98Compat>, DefaultIgnore;
2819def warn_cxx17_compat_unicode_type : Warning<
2820 "'char8_t' type specifier is incompatible with C++ standards before C++20">,
2821 InGroup<CXXPre20Compat>, DefaultIgnore;
2822
2823// __make_integer_seq
2824def err_integer_sequence_negative_length : Error<
2825 "integer sequences must have non-negative sequence length">;
2826def err_integer_sequence_integral_element_type : Error<
2827 "integer sequences must have integral element type">;
2828
2829// __type_pack_element
2830def err_type_pack_element_out_of_bounds : Error<
2831 "a parameter pack may not be accessed at an out of bounds index">;
2832
2833// Objective-C++
2834def err_objc_decls_may_only_appear_in_global_scope : Error<
2835 "Objective-C declarations may only appear in global scope">;
2836def warn_auto_var_is_id : Warning<
2837 "'auto' deduced as 'id' in declaration of %0">,
2838 InGroup<DiagGroup<"auto-var-id">>;
2839
2840// Attributes
2841def warn_nomerge_attribute_ignored_in_stmt: Warning<
2842 "%0 attribute is ignored because there exists no call expression inside the "
2843 "statement">,
2844 InGroup<IgnoredAttributes>;
2845
2846def err_musttail_needs_trivial_args : Error<
2847 "tail call requires that the return value, all parameters, and any "
2848 "temporaries created by the expression are trivially destructible">;
2849def err_musttail_needs_call : Error<
2850 "%0 attribute requires that the return value is the result of a function call"
2851 >;
2852def err_musttail_needs_prototype : Error<
2853 "%0 attribute requires that both caller and callee functions have a "
2854 "prototype">;
2855def note_musttail_fix_non_prototype : Note<
2856 "add 'void' to the parameter list to turn an old-style K&R function "
2857 "declaration into a prototype">;
2858def err_musttail_structors_forbidden : Error<"cannot perform a tail call "
2859 "%select{from|to}0 a %select{constructor|destructor}1">;
2860def note_musttail_structors_forbidden : Note<"target "
2861 "%select{constructor|destructor}0 is declared here">;
2862def err_musttail_forbidden_from_this_context : Error<
2863 "%0 attribute cannot be used from "
2864 "%select{a block|an Objective-C function|this context}1">;
2865def err_musttail_member_mismatch : Error<
2866 "%select{non-member|static member|non-static member}0 "
2867 "function cannot perform a tail call to "
2868 "%select{non-member|static member|non-static member|pointer-to-member}1 "
2869 "function%select{| %3}2">;
2870def note_musttail_callee_defined_here : Note<"%0 declared here">;
2871def note_tail_call_required : Note<"tail call required by %0 attribute here">;
2872def err_musttail_mismatch : Error<
2873 "cannot perform a tail call to function%select{| %1}0 because its signature "
2874 "is incompatible with the calling function">;
2875def note_musttail_mismatch : Note<
2876 "target function "
2877 "%select{is a member of different class%diff{ (expected $ but has $)|}1,2"
2878 "|has different number of parameters (expected %1 but has %2)"
2879 "|has type mismatch at %ordinal3 parameter"
2880 "%diff{ (expected $ but has $)|}1,2"
2881 "|has different return type%diff{ ($ expected but has $)|}1,2}0">;
2882def err_musttail_callconv_mismatch : Error<
2883 "cannot perform a tail call to function%select{| %1}0 because it uses an "
2884 "incompatible calling convention">;
2885def note_musttail_callconv_mismatch : Note<
2886 "target function has calling convention %1 (expected %0)">;
2887def err_musttail_scope : Error<
2888 "cannot perform a tail call from this return statement">;
2889def err_musttail_no_variadic : Error<
2890 "%0 attribute may not be used with variadic functions">;
2891
2892def err_nsobject_attribute : Error<
2893 "'NSObject' attribute is for pointer types only">;
2894def err_attributes_are_not_compatible : Error<
2895 "%0 and %1 attributes are not compatible">;
2896def err_attribute_invalid_argument : Error<
2897 "%select{a reference type|an array type|a non-vector or "
2898 "non-vectorizable scalar type}0 is an invalid argument to attribute %1">;
2899def err_attribute_wrong_number_arguments : Error<
2900 "%0 attribute %plural{0:takes no arguments|1:takes one argument|"
2901 ":requires exactly %1 arguments}1">;
2902def err_attribute_too_many_arguments : Error<
2903 "%0 attribute takes no more than %1 argument%s1">;
2904def err_attribute_too_few_arguments : Error<
2905 "%0 attribute takes at least %1 argument%s1">;
2906def err_attribute_invalid_vector_type : Error<"invalid vector element type %0">;
2907def err_attribute_invalid_matrix_type : Error<"invalid matrix element type %0">;
2908def err_attribute_bad_neon_vector_size : Error<
2909 "Neon vector size must be 64 or 128 bits">;
2910def err_attribute_invalid_sve_type : Error<
2911 "%0 attribute applied to non-SVE type %1">;
2912def err_attribute_bad_sve_vector_size : Error<
2913 "invalid SVE vector size '%0', must match value set by "
2914 "'-msve-vector-bits' ('%1')">;
2915def err_attribute_arm_feature_sve_bits_unsupported : Error<
2916 "%0 is only supported when '-msve-vector-bits=<bits>' is specified with a "
2917 "value of 128, 256, 512, 1024 or 2048.">;
2918def err_attribute_requires_positive_integer : Error<
2919 "%0 attribute requires a %select{positive|non-negative}1 "
2920 "integral compile time constant expression">;
2921def err_attribute_requires_opencl_version : Error<
2922 "%0 attribute requires OpenCL version %1%select{| or above}2">;
2923def err_invalid_branch_protection_spec : Error<
2924 "invalid or misplaced branch protection specification '%0'">;
2925def warn_unsupported_target_attribute
2926 : Warning<"%select{unsupported|duplicate|unknown}0%select{| architecture|"
2927 " tune CPU}1 '%2' in the 'target' attribute string; 'target' "
2928 "attribute ignored">,
2929 InGroup<IgnoredAttributes>;
2930def err_attribute_unsupported
2931 : Error<"%0 attribute is not supported on targets missing %1;"
2932 " specify an appropriate -march= or -mcpu=">;
2933// The err_*_attribute_argument_not_int are separate because they're used by
2934// VerifyIntegerConstantExpression.
2935def err_aligned_attribute_argument_not_int : Error<
2936 "'aligned' attribute requires integer constant">;
2937def err_align_value_attribute_argument_not_int : Error<
2938 "'align_value' attribute requires integer constant">;
2939def err_alignas_attribute_wrong_decl_type : Error<
2940 "%0 attribute cannot be applied to a %select{function parameter|"
2941 "variable with 'register' storage class|'catch' variable|bit-field}1">;
2942def err_alignas_missing_on_definition : Error<
2943 "%0 must be specified on definition if it is specified on any declaration">;
2944def note_alignas_on_declaration : Note<"declared with %0 attribute here">;
2945def err_alignas_mismatch : Error<
2946 "redeclaration has different alignment requirement (%1 vs %0)">;
2947def err_alignas_underaligned : Error<
2948 "requested alignment is less than minimum alignment of %1 for type %0">;
2949def err_attribute_sizeless_type : Error<
2950 "%0 attribute cannot be applied to sizeless type %1">;
2951def err_attribute_argument_n_type : Error<
2952 "%0 attribute requires parameter %1 to be %select{int or bool|an integer "
2953 "constant|a string|an identifier|a constant expression}2">;
2954def err_attribute_argument_type : Error<
2955 "%0 attribute requires %select{int or bool|an integer "
2956 "constant|a string|an identifier}1">;
2957def err_attribute_argument_out_of_range : Error<
2958 "%0 attribute requires integer constant between %1 and %2 inclusive">;
2959def err_init_priority_object_attr : Error<
2960 "can only use 'init_priority' attribute on file-scope definitions "
2961 "of objects of class type">;
2962def err_attribute_argument_out_of_bounds : Error<
2963 "%0 attribute parameter %1 is out of bounds">;
2964def err_attribute_only_once_per_parameter : Error<
2965 "%0 attribute can only be applied once per parameter">;
2966def err_mismatched_uuid : Error<"uuid does not match previous declaration">;
2967def note_previous_uuid : Note<"previous uuid specified here">;
2968def warn_attribute_pointers_only : Warning<
2969 "%0 attribute only applies to%select{| constant}1 pointer arguments">,
2970 InGroup<IgnoredAttributes>;
2971def err_attribute_pointers_only : Error<warn_attribute_pointers_only.Text>;
2972def err_attribute_integers_only : Error<
2973 "%0 attribute argument may only refer to a function parameter of integer "
2974 "type">;
2975def warn_attribute_return_pointers_only : Warning<
2976 "%0 attribute only applies to return values that are pointers">,
2977 InGroup<IgnoredAttributes>;
2978def warn_attribute_return_pointers_refs_only : Warning<
2979 "%0 attribute only applies to return values that are pointers or references">,
2980 InGroup<IgnoredAttributes>;
2981def warn_attribute_pointer_or_reference_only : Warning<
2982 "%0 attribute only applies to a pointer or reference (%1 is invalid)">,
2983 InGroup<IgnoredAttributes>;
2984def err_attribute_no_member_pointers : Error<
2985 "%0 attribute cannot be used with pointers to members">;
2986def err_attribute_invalid_implicit_this_argument : Error<
2987 "%0 attribute is invalid for the implicit this argument">;
2988def err_ownership_type : Error<
2989 "%0 attribute only applies to %select{pointer|integer}1 arguments">;
2990def err_ownership_returns_index_mismatch : Error<
2991 "'ownership_returns' attribute index does not match; here it is %0">;
2992def note_ownership_returns_index_mismatch : Note<
2993 "declared with index %0 here">;
2994def err_format_strftime_third_parameter : Error<
2995 "strftime format attribute requires 3rd parameter to be 0">;
2996def err_format_attribute_requires_variadic : Error<
2997 "format attribute requires variadic function">;
2998def err_format_attribute_not : Error<"format argument not %0">;
2999def err_format_attribute_result_not : Error<"function does not return %0">;
3000def err_format_attribute_implicit_this_format_string : Error<
3001 "format attribute cannot specify the implicit this argument as the format "
3002 "string">;
3003def err_callback_attribute_no_callee : Error<
3004 "'callback' attribute specifies no callback callee">;
3005def err_callback_attribute_invalid_callee : Error<
3006 "'callback' attribute specifies invalid callback callee">;
3007def err_callback_attribute_multiple : Error<
3008 "multiple 'callback' attributes specified">;
3009def err_callback_attribute_argument_unknown : Error<
3010 "'callback' attribute argument %0 is not a known function parameter">;
3011def err_callback_callee_no_function_type : Error<
3012 "'callback' attribute callee does not have function type">;
3013def err_callback_callee_is_variadic : Error<
3014 "'callback' attribute callee may not be variadic">;
3015def err_callback_implicit_this_not_available : Error<
3016 "'callback' argument at position %0 references unavailable implicit 'this'">;
3017def err_init_method_bad_return_type : Error<
3018 "init methods must return an object pointer type, not %0">;
3019def err_attribute_invalid_size : Error<
3020 "vector size not an integral multiple of component size">;
3021def err_attribute_zero_size : Error<"zero %0 size">;
3022def err_attribute_size_too_large : Error<"%0 size too large">;
3023def err_typecheck_sve_ambiguous : Error<
3024 "cannot combine fixed-length and sizeless SVE vectors in expression, result is ambiguous (%0 and %1)">;
3025def err_typecheck_sve_gnu_ambiguous : Error<
3026 "cannot combine GNU and SVE vectors in expression, result is ambiguous (%0 and %1)">;
3027def err_typecheck_vector_not_convertable_implict_truncation : Error<
3028 "cannot convert between %select{scalar|vector}0 type %1 and vector type"
3029 " %2 as implicit conversion would cause truncation">;
3030def err_typecheck_vector_not_convertable : Error<
3031 "cannot convert between vector values of different size (%0 and %1)">;
3032def err_typecheck_vector_not_convertable_non_scalar : Error<
3033 "cannot convert between vector and non-scalar values (%0 and %1)">;
3034def err_typecheck_vector_lengths_not_equal : Error<
3035 "vector operands do not have the same number of elements (%0 and %1)">;
3036def warn_typecheck_vector_element_sizes_not_equal : Warning<
3037 "vector operands do not have the same elements sizes (%0 and %1)">,
3038 InGroup<DiagGroup<"vec-elem-size">>, DefaultError;
3039def err_ext_vector_component_exceeds_length : Error<
3040 "vector component access exceeds type %0">;
3041def err_ext_vector_component_name_illegal : Error<
3042 "illegal vector component name '%0'">;
3043def err_attribute_address_space_negative : Error<
3044 "address space is negative">;
3045def err_attribute_address_space_too_high : Error<
3046 "address space is larger than the maximum supported (%0)">;
3047def err_attribute_address_multiple_qualifiers : Error<
3048 "multiple address spaces specified for type">;
3049def warn_attribute_address_multiple_identical_qualifiers : Warning<
3050 "multiple identical address spaces specified for type">,
3051 InGroup<DuplicateDeclSpecifier>;
3052def err_attribute_not_clinkage : Error<
3053 "function type with %0 attribute must have C linkage">;
3054def err_function_decl_cmse_ns_call : Error<
3055 "functions may not be declared with 'cmse_nonsecure_call' attribute">;
3056def err_attribute_address_function_type : Error<
3057 "function type may not be qualified with an address space">;
3058def err_as_qualified_auto_decl : Error<
3059 "automatic variable qualified with an%select{| invalid}0 address space">;
3060def err_arg_with_address_space : Error<
3061 "parameter may not be qualified with an address space">;
3062def err_field_with_address_space : Error<
3063 "field may not be qualified with an address space">;
3064def err_compound_literal_with_address_space : Error<
3065 "compound literal in function scope may not be qualified with an address space">;
3066def err_address_space_mismatch_templ_inst : Error<
3067 "conflicting address space qualifiers are provided between types %0 and %1">;
3068def err_attr_objc_ownership_redundant : Error<
3069 "the type %0 is already explicitly ownership-qualified">;
3070def err_invalid_nsnumber_type : Error<
3071 "%0 is not a valid literal type for NSNumber">;
3072def err_objc_illegal_boxed_expression_type : Error<
3073 "illegal type %0 used in a boxed expression">;
3074def err_objc_non_trivially_copyable_boxed_expression_type : Error<
3075 "non-trivially copyable type %0 cannot be used in a boxed expression">;
3076def err_objc_incomplete_boxed_expression_type : Error<
3077 "incomplete type %0 used in a boxed expression">;
3078def err_undeclared_objc_literal_class : Error<
3079 "definition of class %0 must be available to use Objective-C "
3080 "%select{array literals|dictionary literals|numeric literals|boxed expressions|"
3081 "string literals}1">;
3082def err_undeclared_boxing_method : Error<
3083 "declaration of %0 is missing in %1 class">;
3084def err_objc_literal_method_sig : Error<
3085 "literal construction method %0 has incompatible signature">;
3086def note_objc_literal_method_param : Note<
3087 "%select{first|second|third}0 parameter has unexpected type %1 "
3088 "(should be %2)">;
3089def note_objc_literal_method_return : Note<
3090 "method returns unexpected type %0 (should be an object type)">;
3091def err_invalid_collection_element : Error<
3092 "collection element of type %0 is not an Objective-C object">;
3093def err_box_literal_collection : Error<
3094 "%select{string|character|boolean|numeric}0 literal must be prefixed by '@' "
3095 "in a collection">;
3096def warn_objc_literal_comparison : Warning<
3097 "direct comparison of %select{an array literal|a dictionary literal|"
3098 "a numeric literal|a boxed expression|}0 has undefined behavior">,
3099 InGroup<ObjCLiteralComparison>;
3100def err_missing_atsign_prefix : Error<
3101 "%select{string|numeric}0 literal must be prefixed by '@'">;
3102def warn_objc_string_literal_comparison : Warning<
3103 "direct comparison of a string literal has undefined behavior">,
3104 InGroup<ObjCStringComparison>;
3105def warn_concatenated_literal_array_init : Warning<
3106 "suspicious concatenation of string literals in an array initialization; "
3107 "did you mean to separate the elements with a comma?">,
3108 InGroup<StringConcatation>, DefaultIgnore;
3109def warn_concatenated_nsarray_literal : Warning<
3110 "concatenated NSString literal for an NSArray expression - "
3111 "possibly missing a comma">,
3112 InGroup<ObjCStringConcatenation>;
3113def note_objc_literal_comparison_isequal : Note<
3114 "use 'isEqual:' instead">;
3115def warn_objc_collection_literal_element : Warning<
3116 "object of type %0 is not compatible with "
3117 "%select{array element type|dictionary key type|dictionary value type}1 %2">,
3118 InGroup<ObjCLiteralConversion>;
3119def warn_nsdictionary_duplicate_key : Warning<
3120 "duplicate key in dictionary literal">,
3121 InGroup<DiagGroup<"objc-dictionary-duplicate-keys">>;
3122def note_nsdictionary_duplicate_key_here : Note<
3123 "previous equal key is here">;
3124def err_swift_param_attr_not_swiftcall : Error<
3125 "'%0' parameter can only be used with swiftcall calling convention">;
3126def err_swift_indirect_result_not_first : Error<
3127 "'swift_indirect_result' parameters must be first parameters of function">;
3128def err_swift_error_result_not_after_swift_context : Error<
3129 "'swift_error_result' parameter must follow 'swift_context' parameter">;
3130def err_swift_abi_parameter_wrong_type : Error<
3131 "'%0' parameter must have pointer%select{| to unqualified pointer}1 type; "
3132 "type here is %2">;
3133
3134def err_attribute_argument_invalid : Error<
3135 "%0 attribute argument is invalid: %select{max must be 0 since min is 0|"
3136 "min must not be greater than max}1">;
3137def err_attribute_argument_is_zero : Error<
3138 "%0 attribute must be greater than 0">;
3139def warn_attribute_argument_n_negative : Warning<
3140 "%0 attribute parameter %1 is negative and will be ignored">,
3141 InGroup<CudaCompat>;
3142def err_property_function_in_objc_container : Error<
3143 "use of Objective-C property in function nested in Objective-C "
3144 "container not supported, move function outside its container">;
3145
3146let CategoryName = "Cocoa API Issue" in {
3147def warn_objc_redundant_literal_use : Warning<
3148 "using %0 with a literal is redundant">, InGroup<ObjCRedundantLiteralUse>;
3149}
3150
3151def err_attr_tlsmodel_arg : Error<"tls_model must be \"global-dynamic\", "
3152 "\"local-dynamic\", \"initial-exec\" or \"local-exec\"">;
3153
3154def err_tls_var_aligned_over_maximum : Error<
3155 "alignment (%0) of thread-local variable %1 is greater than the maximum supported "
3156 "alignment (%2) for a thread-local variable on this target">;
3157
3158def err_only_annotate_after_access_spec : Error<
3159 "access specifier can only have annotation attributes">;
3160
3161def err_attribute_section_invalid_for_target : Error<
3162 "argument to %select{'code_seg'|'section'}1 attribute is not valid for this target: %0">;
3163def err_pragma_section_invalid_for_target : Error<
3164 "argument to #pragma section is not valid for this target: %0">;
3165def warn_attribute_section_drectve : Warning<
3166 "#pragma %0(\".drectve\") has undefined behavior, "
3167 "use #pragma comment(linker, ...) instead">, InGroup<MicrosoftDrectveSection>;
3168def warn_mismatched_section : Warning<
3169 "%select{codeseg|section}0 does not match previous declaration">, InGroup<Section>;
3170def warn_attribute_section_on_redeclaration : Warning<
3171 "section attribute is specified on redeclared variable">, InGroup<Section>;
3172def err_mismatched_code_seg_base : Error<
3173 "derived class must specify the same code segment as its base classes">;
3174def err_mismatched_code_seg_override : Error<
3175 "overriding virtual function must specify the same code segment as its overridden function">;
3176def err_conflicting_codeseg_attribute : Error<
3177 "conflicting code segment specifiers">;
3178def warn_duplicate_codeseg_attribute : Warning<
3179 "duplicate code segment specifiers">, InGroup<Section>;
3180
3181def err_anonymous_property: Error<
3182 "anonymous property is not supported">;
3183def err_property_is_variably_modified : Error<
3184 "property %0 has a variably modified type">;
3185def err_no_accessor_for_property : Error<
3186 "no %select{getter|setter}0 defined for property %1">;
3187def err_cannot_find_suitable_accessor : Error<
3188 "cannot find suitable %select{getter|setter}0 for property %1">;
3189
3190def warn_alloca : Warning<
3191 "use of function %0 is discouraged; there is no way to check for failure but "
3192 "failure may still occur, resulting in a possibly exploitable security vulnerability">,
3193 InGroup<DiagGroup<"alloca">>, DefaultIgnore;
3194
3195def warn_alloca_align_alignof : Warning<
3196 "second argument to __builtin_alloca_with_align is supposed to be in bits">,
3197 InGroup<DiagGroup<"alloca-with-align-alignof">>;
3198
3199def err_alignment_too_small : Error<
3200 "requested alignment must be %0 or greater">;
3201def err_alignment_too_big : Error<
3202 "requested alignment must be %0 or smaller">;
3203def err_alignment_not_power_of_two : Error<
3204 "requested alignment is not a power of 2">;
3205def warn_alignment_not_power_of_two : Warning<
3206 err_alignment_not_power_of_two.Text>,
3207 InGroup<DiagGroup<"non-power-of-two-alignment">>;
3208def err_alignment_dependent_typedef_name : Error<
3209 "requested alignment is dependent but declaration is not dependent">;
3210
3211def warn_alignment_builtin_useless : Warning<
3212 "%select{aligning a value|the result of checking whether a value is aligned}0"
3213 " to 1 byte is %select{a no-op|always true}0">, InGroup<TautologicalCompare>;
3214def err_attribute_aligned_too_great : Error<
3215 "requested alignment must be %0 bytes or smaller">;
3216def warn_assume_aligned_too_great
3217 : Warning<"requested alignment must be %0 bytes or smaller; maximum "
3218 "alignment assumed">,
3219 InGroup<DiagGroup<"builtin-assume-aligned-alignment">>;
3220def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning<
3221 "%q0 redeclared without %1 attribute: previous %1 ignored">,
3222 InGroup<MicrosoftInconsistentDllImport>;
3223def warn_redeclaration_without_import_attribute : Warning<
3224 "%q0 redeclared without 'dllimport' attribute: 'dllexport' attribute added">,
3225 InGroup<MicrosoftInconsistentDllImport>;
3226def warn_dllimport_dropped_from_inline_function : Warning<
3227 "%q0 redeclared inline; %1 attribute ignored">,
3228 InGroup<IgnoredAttributes>;
3229def warn_attribute_ignored : Warning<"%0 attribute ignored">,
3230 InGroup<IgnoredAttributes>;
3231def warn_nothrow_attribute_ignored : Warning<"'nothrow' attribute conflicts with"
3232 " exception specification; attribute ignored">,
3233 InGroup<IgnoredAttributes>;
3234def warn_attribute_ignored_on_non_definition :
3235 Warning<"%0 attribute ignored on a non-definition declaration">,
3236 InGroup<IgnoredAttributes>;
3237def warn_attribute_ignored_on_inline :
3238 Warning<"%0 attribute ignored on inline function">,
3239 InGroup<IgnoredAttributes>;
3240def warn_nocf_check_attribute_ignored :
3241 Warning<"'nocf_check' attribute ignored; use -fcf-protection to enable the attribute">,
3242 InGroup<IgnoredAttributes>;
3243def warn_attribute_after_definition_ignored : Warning<
3244 "attribute %0 after definition is ignored">,
3245 InGroup<IgnoredAttributes>;
3246def warn_attributes_likelihood_ifstmt_conflict
3247 : Warning<"conflicting attributes %0 are ignored">,
3248 InGroup<IgnoredAttributes>;
3249def warn_cxx11_gnu_attribute_on_type : Warning<
3250 "attribute %0 ignored, because it cannot be applied to a type">,
3251 InGroup<IgnoredAttributes>;
3252def warn_unhandled_ms_attribute_ignored : Warning<
3253 "__declspec attribute %0 is not supported">,
3254 InGroup<IgnoredAttributes>;
3255def warn_attribute_has_no_effect_on_infinite_loop : Warning<
3256 "attribute %0 has no effect when annotating an infinite loop">,
3257 InGroup<IgnoredAttributes>;
3258def note_attribute_has_no_effect_on_infinite_loop_here : Note<
3259 "annotating the infinite loop here">;
3260def warn_attribute_has_no_effect_on_if_constexpr : Warning<
3261 "attribute %0 has no effect when annotating an 'if constexpr' statement">,
3262 InGroup<IgnoredAttributes>;
3263def note_attribute_has_no_effect_on_if_constexpr_here : Note<
3264 "annotating the 'if constexpr' statement here">;
3265def err_decl_attribute_invalid_on_stmt : Error<
3266 "%0 attribute cannot be applied to a statement">;
3267def err_stmt_attribute_invalid_on_decl : Error<
3268 "%0 attribute cannot be applied to a declaration">;
3269def warn_declspec_attribute_ignored : Warning<
3270 "attribute %0 is ignored, place it after "
3271 "\"%select{class|struct|interface|union|enum}1\" to apply attribute to "
3272 "type declaration">, InGroup<IgnoredAttributes>;
3273def warn_attribute_precede_definition : Warning<
3274 "attribute declaration must precede definition">,
3275 InGroup<IgnoredAttributes>;
3276def warn_attribute_void_function_method : Warning<
3277 "attribute %0 cannot be applied to "
3278 "%select{functions|Objective-C method}1 without return value">,
3279 InGroup<IgnoredAttributes>;
3280def warn_attribute_weak_on_field : Warning<
3281 "__weak attribute cannot be specified on a field declaration">,
3282 InGroup<IgnoredAttributes>;
3283def warn_gc_attribute_weak_on_local : Warning<
3284 "Objective-C GC does not allow weak variables on the stack">,
3285 InGroup<IgnoredAttributes>;
3286def warn_nsobject_attribute : Warning<
3287 "'NSObject' attribute may be put on a typedef only; attribute is ignored">,
3288 InGroup<NSobjectAttribute>;
3289def warn_independentclass_attribute : Warning<
3290 "'objc_independent_class' attribute may be put on a typedef only; "
3291 "attribute is ignored">,
3292 InGroup<IndependentClassAttribute>;
3293def warn_ptr_independentclass_attribute : Warning<
3294 "'objc_independent_class' attribute may be put on Objective-C object "
3295 "pointer type only; attribute is ignored">,
3296 InGroup<IndependentClassAttribute>;
3297def warn_attribute_weak_on_local : Warning<
3298 "__weak attribute cannot be specified on an automatic variable when ARC "
3299 "is not enabled">,
3300 InGroup<IgnoredAttributes>;
3301def warn_weak_identifier_undeclared : Warning<
3302 "weak identifier %0 never declared">;
3303def warn_attribute_cmse_entry_static : Warning<
3304 "'cmse_nonsecure_entry' cannot be applied to functions with internal linkage">,
3305 InGroup<IgnoredAttributes>;
3306def warn_cmse_nonsecure_union : Warning<
3307 "passing union across security boundary via %select{parameter %1|return value}0 "
3308 "may leak information">,
3309 InGroup<DiagGroup<"cmse-union-leak">>;
3310def err_attribute_weak_static : Error<
3311 "weak declaration cannot have internal linkage">;
3312def err_attribute_selectany_non_extern_data : Error<
3313 "'selectany' can only be applied to data items with external linkage">;
3314def err_declspec_thread_on_thread_variable : Error<
3315 "'__declspec(thread)' applied to variable that already has a "
3316 "thread-local storage specifier">;
3317def err_attribute_dll_not_extern : Error<
3318 "%q0 must have external linkage when declared %q1">;
3319def err_attribute_dll_thread_local : Error<
3320 "%q0 cannot be thread local when declared %q1">;
3321def err_attribute_dll_lambda : Error<
3322 "lambda cannot be declared %0">;
3323def warn_attribute_invalid_on_definition : Warning<
3324 "'%0' attribute cannot be specified on a definition">,
3325 InGroup<IgnoredAttributes>;
3326def err_attribute_dll_redeclaration : Error<
3327 "redeclaration of %q0 cannot add %q1 attribute">;
3328def warn_attribute_dll_redeclaration : Warning<
3329 "redeclaration of %q0 should not add %q1 attribute">,
3330 InGroup<DiagGroup<"dll-attribute-on-redeclaration">>;
3331def err_attribute_dllimport_function_definition : Error<
3332 "dllimport cannot be applied to non-inline function definition">;
3333def err_attribute_dll_deleted : Error<
3334 "attribute %q0 cannot be applied to a deleted function">;
3335def err_attribute_dllimport_data_definition : Error<
3336 "definition of dllimport data">;
3337def err_attribute_dllimport_static_field_definition : Error<
3338 "definition of dllimport static field not allowed">;
3339def warn_attribute_dllimport_static_field_definition : Warning<
3340 "definition of dllimport static field">,
3341 InGroup<DiagGroup<"dllimport-static-field-def">>;
3342def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
3343 "explicit instantiation declaration should not be 'dllexport'">,
3344 InGroup<DiagGroup<"dllexport-explicit-instantiation-decl">>;
3345def warn_attribute_dllexport_explicit_instantiation_def : Warning<
3346 "'dllexport' attribute ignored on explicit instantiation definition">,
3347 InGroup<IgnoredAttributes>;
3348def warn_invalid_initializer_from_system_header : Warning<
3349 "invalid constructor from class in system header, should not be explicit">,
3350 InGroup<DiagGroup<"invalid-initializer-from-system-header">>;
3351def note_used_in_initialization_here : Note<"used in initialization here">;
3352def err_attribute_dll_member_of_dll_class : Error<
3353 "attribute %q0 cannot be applied to member of %q1 class">;
3354def warn_attribute_dll_instantiated_base_class : Warning<
3355 "propagating dll attribute to %select{already instantiated|explicitly specialized}0 "
3356 "base class template without dll attribute is not supported">,
3357 InGroup<DiagGroup<"unsupported-dll-base-class-template">>, DefaultIgnore;
3358def err_attribute_dll_ambiguous_default_ctor : Error<
3359 "'__declspec(dllexport)' cannot be applied to more than one default constructor in %0">;
3360def err_attribute_weakref_not_static : Error<
3361 "weakref declaration must have internal linkage">;
3362def err_attribute_weakref_not_global_context : Error<
3363 "weakref declaration of %0 must be in a global context">;
3364def err_attribute_weakref_without_alias : Error<
3365 "weakref declaration of %0 must also have an alias attribute">;
3366def err_alias_not_supported_on_darwin : Error <
3367 "aliases are not supported on darwin">;
3368def warn_attribute_wrong_decl_type_str : Warning<
3369 "%0 attribute only applies to %1">, InGroup<IgnoredAttributes>;
3370def err_attribute_wrong_decl_type_str : Error<
3371 warn_attribute_wrong_decl_type_str.Text>;
3372def warn_attribute_wrong_decl_type : Warning<
3373 "%0 attribute only applies to %select{"
3374 "functions"
3375 "|unions"
3376 "|variables and functions"
3377 "|functions and methods"
3378 "|functions, methods and blocks"
3379 "|functions, methods, and parameters"
3380 "|variables"
3381 "|variables and fields"
3382 "|variables, data members and tag types"
3383 "|types and namespaces"
3384 "|variables, functions and classes"
3385 "|kernel functions"
3386 "|non-K&R-style functions}1">,
3387 InGroup<IgnoredAttributes>;
3388def err_attribute_wrong_decl_type : Error<warn_attribute_wrong_decl_type.Text>;
3389def warn_type_attribute_wrong_type : Warning<
3390 "'%0' only applies to %select{function|pointer|"
3391 "Objective-C object or block pointer}1 types; type here is %2">,
3392 InGroup<IgnoredAttributes>;
3393def warn_incomplete_encoded_type : Warning<
3394 "encoding of %0 type is incomplete because %1 component has unknown encoding">,
3395 InGroup<DiagGroup<"encode-type">>;
3396def warn_gnu_inline_attribute_requires_inline : Warning<
3397 "'gnu_inline' attribute requires function to be marked 'inline',"
3398 " attribute ignored">,
3399 InGroup<IgnoredAttributes>;
3400def warn_gnu_inline_cplusplus_without_extern : Warning<
3401 "'gnu_inline' attribute without 'extern' in C++ treated as externally"
3402 " available, this changed in Clang 10">,
3403 InGroup<DiagGroup<"gnu-inline-cpp-without-extern">>;
3404def err_attribute_vecreturn_only_vector_member : Error<
3405 "the vecreturn attribute can only be used on a class or structure with one member, which must be a vector">;
3406def err_attribute_vecreturn_only_pod_record : Error<
3407 "the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)">;
3408def err_cconv_change : Error<
3409 "function declared '%0' here was previously declared "
3410 "%select{'%2'|without calling convention}1">;
3411def warn_cconv_unsupported : Warning<
3412 "%0 calling convention is not supported %select{"
3413 // Use CallingConventionIgnoredReason Enum to specify these.
3414 "for this target"
3415 "|on variadic function"
3416 "|on constructor/destructor"
3417 "|on builtin function"
3418 "}1">,
3419 InGroup<IgnoredAttributes>;
3420def error_cconv_unsupported : Error<warn_cconv_unsupported.Text>;
3421def err_cconv_knr : Error<
3422 "function with no prototype cannot use the %0 calling convention">;
3423def warn_cconv_knr : Warning<
3424 err_cconv_knr.Text>,
3425 InGroup<DiagGroup<"missing-prototype-for-cc">>;
3426def err_cconv_varargs : Error<
3427 "variadic function cannot use %0 calling convention">;
3428def err_regparm_mismatch : Error<"function declared with regparm(%0) "
3429 "attribute was previously declared "
3430 "%plural{0:without the regparm|:with the regparm(%1)}1 attribute">;
3431def err_function_attribute_mismatch : Error<
3432 "function declared with %0 attribute "
3433 "was previously declared without the %0 attribute">;
3434def err_objc_precise_lifetime_bad_type : Error<
3435 "objc_precise_lifetime only applies to retainable types; type here is %0">;
3436def warn_objc_precise_lifetime_meaningless : Error<
3437 "objc_precise_lifetime is not meaningful for "
3438 "%select{__unsafe_unretained|__autoreleasing}0 objects">;
3439def err_invalid_pcs : Error<"invalid PCS type">;
3440def warn_attribute_not_on_decl : Warning<
3441 "%0 attribute ignored when parsing type">, InGroup<IgnoredAttributes>;
3442def err_base_specifier_attribute : Error<
3443 "%0 attribute cannot be applied to a base specifier">;
3444def err_invalid_attribute_on_virtual_function : Error<
3445 "%0 attribute cannot be applied to virtual functions">;
3446def warn_declspec_allocator_nonpointer : Warning<
3447 "ignoring __declspec(allocator) because the function return type %0 is not "
3448 "a pointer or reference type">, InGroup<IgnoredAttributes>;
3449def err_cconv_incomplete_param_type : Error<
3450 "parameter %0 must have a complete type to use function %1 with the %2 "
3451 "calling convention">;
3452def err_attribute_output_parameter : Error<
3453 "attribute only applies to output parameters">;
3454
3455def ext_cannot_use_trivial_abi : ExtWarn<
3456 "'trivial_abi' cannot be applied to %0">, InGroup<IgnoredAttributes>;
3457def note_cannot_use_trivial_abi_reason : Note<
3458 "'trivial_abi' is disallowed on %0 because %select{"
3459 "its copy constructors and move constructors are all deleted|"
3460 "it is polymorphic|"
3461 "it has a base of a non-trivial class type|it has a virtual base|"
3462 "it has a __weak field|it has a field of a non-trivial class type}1">;
3463
3464// Availability attribute
3465def warn_availability_unknown_platform : Warning<
3466 "unknown platform %0 in availability macro">, InGroup<Availability>;
3467def warn_availability_version_ordering : Warning<
3468 "feature cannot be %select{introduced|deprecated|obsoleted}0 in %1 version "
3469 "%2 before it was %select{introduced|deprecated|obsoleted}3 in version %4; "
3470 "attribute ignored">, InGroup<Availability>;
3471def warn_mismatched_availability: Warning<
3472 "availability does not match previous declaration">, InGroup<Availability>;
3473def warn_mismatched_availability_override : Warning<
3474 "%select{|overriding }4method %select{introduced after|"
3475 "deprecated before|obsoleted before}0 "
3476 "%select{the protocol method it implements|overridden method}4 "
3477 "on %1 (%2 vs. %3)">, InGroup<Availability>;
3478def warn_mismatched_availability_override_unavail : Warning<
3479 "%select{|overriding }1method cannot be unavailable on %0 when "
3480 "%select{the protocol method it implements|its overridden method}1 is "
3481 "available">,
3482 InGroup<Availability>;
3483def warn_availability_on_static_initializer : Warning<
3484 "ignoring availability attribute %select{on '+load' method|"
3485 "with constructor attribute|with destructor attribute}0">,
3486 InGroup<Availability>;
3487def note_overridden_method : Note<
3488 "overridden method is here">;
3489def warn_availability_swift_unavailable_deprecated_only : Warning<
3490 "only 'unavailable' and 'deprecated' are supported for Swift availability">,
3491 InGroup<Availability>;
3492def note_protocol_method : Note<
3493 "protocol method is here">;
3494
3495def warn_unguarded_availability :
3496 Warning<"%0 is only available on %1 %2 or newer">,
3497 InGroup<UnguardedAvailability>, DefaultIgnore;
3498def warn_unguarded_availability_new :
3499 Warning<warn_unguarded_availability.Text>,
3500 InGroup<UnguardedAvailabilityNew>;
3501def note_decl_unguarded_availability_silence : Note<
3502 "annotate %select{%1|anonymous %1}0 with an availability attribute to silence this warning">;
3503def note_unguarded_available_silence : Note<
3504 "enclose %0 in %select{an @available|a __builtin_available}1 check to silence"
3505 " this warning">;
3506def warn_at_available_unchecked_use : Warning<
3507 "%select{@available|__builtin_available}0 does not guard availability here; "
3508 "use if (%select{@available|__builtin_available}0) instead">,
3509 InGroup<DiagGroup<"unsupported-availability-guard">>;
3510
3511// Thread Safety Attributes
3512def warn_thread_attribute_ignored : Warning<
3513 "ignoring %0 attribute because its argument is invalid">,
3514 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3515def warn_thread_attribute_not_on_non_static_member : Warning<
3516 "%0 attribute without capability arguments can only be applied to non-static "
3517 "methods of a class">,
3518 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3519def warn_thread_attribute_not_on_capability_member : Warning<
3520 "%0 attribute without capability arguments refers to 'this', but %1 isn't "
3521 "annotated with 'capability' or 'scoped_lockable' attribute">,
3522 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3523def warn_thread_attribute_argument_not_lockable : Warning<
3524 "%0 attribute requires arguments whose type is annotated "
3525 "with 'capability' attribute; type here is %1">,
3526 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3527def warn_thread_attribute_decl_not_lockable : Warning<
3528 "%0 attribute can only be applied in a context annotated "
3529 "with 'capability' attribute">,
3530 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3531def warn_thread_attribute_decl_not_pointer : Warning<
3532 "%0 only applies to pointer types; type here is %1">,
3533 InGroup<ThreadSafetyAttributes>, DefaultIgnore;
3534def err_attribute_argument_out_of_bounds_extra_info : Error<
3535 "%0 attribute parameter %1 is out of bounds: "
3536 "%plural{0:no parameters to index into|"
3537 "1:can only be 1, since there is one parameter|"
3538 ":must be between 1 and %2}2">;
3539
3540// Thread Safety Analysis
3541def warn_unlock_but_no_lock : Warning<"releasing %0 '%1' that was not held">,
3542 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3543def warn_unlock_kind_mismatch : Warning<
3544 "releasing %0 '%1' using %select{shared|exclusive}2 access, expected "
3545 "%select{shared|exclusive}3 access">,
3546 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3547def warn_double_lock : Warning<"acquiring %0 '%1' that is already held">,
3548 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3549def warn_no_unlock : Warning<
3550 "%0 '%1' is still held at the end of function">,
3551 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3552def warn_expecting_locked : Warning<
3553 "expecting %0 '%1' to be held at the end of function">,
3554 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3555// FIXME: improve the error message about locks not in scope
3556def warn_lock_some_predecessors : Warning<
3557 "%0 '%1' is not held on every path through here">,
3558 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3559def warn_expecting_lock_held_on_loop : Warning<
3560 "expecting %0 '%1' to be held at start of each loop">,
3561 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3562def note_locked_here : Note<"%0 acquired here">;
3563def note_unlocked_here : Note<"%0 released here">;
3564def warn_lock_exclusive_and_shared : Warning<
3565 "%0 '%1' is acquired exclusively and shared in the same scope">,
3566 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3567def note_lock_exclusive_and_shared : Note<
3568 "the other acquisition of %0 '%1' is here">;
3569def warn_variable_requires_any_lock : Warning<
3570 "%select{reading|writing}1 variable %0 requires holding "
3571 "%select{any mutex|any mutex exclusively}1">,
3572 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3573def warn_var_deref_requires_any_lock : Warning<
3574 "%select{reading|writing}1 the value pointed to by %0 requires holding "
3575 "%select{any mutex|any mutex exclusively}1">,
3576 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3577def warn_fun_excludes_mutex : Warning<
3578 "cannot call function '%1' while %0 '%2' is held">,
3579 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3580def warn_cannot_resolve_lock : Warning<
3581 "cannot resolve lock expression">,
3582 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3583def warn_acquired_before : Warning<
3584 "%0 '%1' must be acquired before '%2'">,
3585 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3586def warn_acquired_before_after_cycle : Warning<
3587 "Cycle in acquired_before/after dependencies, starting with '%0'">,
3588 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3589
3590
3591// Thread safety warnings negative capabilities
3592def warn_acquire_requires_negative_cap : Warning<
3593 "acquiring %0 '%1' requires negative capability '%2'">,
3594 InGroup<ThreadSafetyNegative>, DefaultIgnore;
3595def warn_fun_requires_negative_cap : Warning<
3596 "calling function %0 requires negative capability '%1'">,
3597 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3598
3599// Thread safety warnings on pass by reference
3600def warn_guarded_pass_by_reference : Warning<
3601 "passing variable %1 by reference requires holding %0 "
3602 "%select{'%2'|'%2' exclusively}3">,
3603 InGroup<ThreadSafetyReference>, DefaultIgnore;
3604def warn_pt_guarded_pass_by_reference : Warning<
3605 "passing the value that %1 points to by reference requires holding %0 "
3606 "%select{'%2'|'%2' exclusively}3">,
3607 InGroup<ThreadSafetyReference>, DefaultIgnore;
3608
3609// Imprecise thread safety warnings
3610def warn_variable_requires_lock : Warning<
3611 "%select{reading|writing}3 variable %1 requires holding %0 "
3612 "%select{'%2'|'%2' exclusively}3">,
3613 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3614def warn_var_deref_requires_lock : Warning<
3615 "%select{reading|writing}3 the value pointed to by %1 requires "
3616 "holding %0 %select{'%2'|'%2' exclusively}3">,
3617 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3618def warn_fun_requires_lock : Warning<
3619 "calling function %1 requires holding %0 %select{'%2'|'%2' exclusively}3">,
3620 InGroup<ThreadSafetyAnalysis>, DefaultIgnore;
3621
3622// Precise thread safety warnings
3623def warn_variable_requires_lock_precise :
3624 Warning<warn_variable_requires_lock.Text>,
3625 InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3626def warn_var_deref_requires_lock_precise :
3627 Warning<warn_var_deref_requires_lock.Text>,
3628 InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3629def warn_fun_requires_lock_precise :
3630 Warning<warn_fun_requires_lock.Text>,
3631 InGroup<ThreadSafetyPrecise>, DefaultIgnore;
3632def note_found_mutex_near_match : Note<"found near match '%0'">;
3633
3634// Verbose thread safety warnings
3635def warn_thread_safety_verbose : Warning<"Thread safety verbose warning.">,
3636 InGroup<ThreadSafetyVerbose>, DefaultIgnore;
3637def note_thread_warning_in_fun : Note<"Thread warning in function %0">;
3638def note_guarded_by_declared_here : Note<"Guarded_by declared here.">;
3639
3640// Dummy warning that will trigger "beta" warnings from the analysis if enabled.
3641def warn_thread_safety_beta : Warning<"Thread safety beta warning.">,
3642 InGroup<ThreadSafetyBeta>, DefaultIgnore;
3643
3644// Consumed warnings
3645def warn_use_in_invalid_state : Warning<
3646 "invalid invocation of method '%0' on object '%1' while it is in the '%2' "
3647 "state">, InGroup<Consumed>, DefaultIgnore;
3648def warn_use_of_temp_in_invalid_state : Warning<
3649 "invalid invocation of method '%0' on a temporary object while it is in the "
3650 "'%1' state">, InGroup<Consumed>, DefaultIgnore;
3651def warn_attr_on_unconsumable_class : Warning<
3652 "consumed analysis attribute is attached to member of class %0 which isn't "
3653 "marked as consumable">, InGroup<Consumed>, DefaultIgnore;
3654def warn_return_typestate_for_unconsumable_type : Warning<
3655 "return state set for an unconsumable type '%0'">, InGroup<Consumed>,
3656 DefaultIgnore;
3657def warn_return_typestate_mismatch : Warning<
3658 "return value not in expected state; expected '%0', observed '%1'">,
3659 InGroup<Consumed>, DefaultIgnore;
3660def warn_loop_state_mismatch : Warning<
3661 "state of variable '%0' must match at the entry and exit of loop">,
3662 InGroup<Consumed>, DefaultIgnore;
3663def warn_param_return_typestate_mismatch : Warning<
3664 "parameter '%0' not in expected state when the function returns: expected "
3665 "'%1', observed '%2'">, InGroup<Consumed>, DefaultIgnore;
3666def warn_param_typestate_mismatch : Warning<
3667 "argument not in expected state; expected '%0', observed '%1'">,
3668 InGroup<Consumed>, DefaultIgnore;
3669
3670// no_sanitize attribute
3671def warn_unknown_sanitizer_ignored : Warning<
3672 "unknown sanitizer '%0' ignored">, InGroup<UnknownSanitizers>;
3673
3674def warn_impcast_vector_scalar : Warning<
3675 "implicit conversion turns vector to scalar: %0 to %1">,
3676 InGroup<Conversion>, DefaultIgnore;
3677def warn_impcast_complex_scalar : Warning<
3678 "implicit conversion discards imaginary component: %0 to %1">,
3679 InGroup<Conversion>, DefaultIgnore;
3680def err_impcast_complex_scalar : Error<
3681 "implicit conversion from %0 to %1 is not permitted in C++">;
3682def warn_impcast_float_precision : Warning<
3683 "implicit conversion loses floating-point precision: %0 to %1">,
3684 InGroup<ImplicitFloatConversion>, DefaultIgnore;
3685def warn_impcast_float_result_precision : Warning<
3686 "implicit conversion when assigning computation result loses floating-point precision: %0 to %1">,
3687 InGroup<ImplicitFloatConversion>, DefaultIgnore;
3688def warn_impcast_double_promotion : Warning<
3689 "implicit conversion increases floating-point precision: %0 to %1">,
3690 InGroup<DoublePromotion>, DefaultIgnore;
3691def warn_impcast_integer_sign : Warning<
3692 "implicit conversion changes signedness: %0 to %1">,
3693 InGroup<SignConversion>, DefaultIgnore;
3694def warn_impcast_integer_sign_conditional : Warning<
3695 "operand of ? changes signedness: %0 to %1">,
3696 InGroup<SignConversion>, DefaultIgnore;
3697def warn_impcast_integer_precision : Warning<
3698 "implicit conversion loses integer precision: %0 to %1">,
3699 InGroup<ImplicitIntConversion>, DefaultIgnore;
3700def warn_impcast_high_order_zero_bits : Warning<
3701 "higher order bits are zeroes after implicit conversion">,
3702 InGroup<ImplicitIntConversion>, DefaultIgnore;
3703def warn_impcast_nonnegative_result : Warning<
3704 "the resulting value is always non-negative after implicit conversion">,
3705 InGroup<SignConversion>, DefaultIgnore;
3706def warn_impcast_integer_64_32 : Warning<
3707 "implicit conversion loses integer precision: %0 to %1">,
3708 InGroup<Shorten64To32>, DefaultIgnore;
3709def warn_impcast_integer_precision_constant : Warning<
3710 "implicit conversion from %2 to %3 changes value from %0 to %1">,
3711 InGroup<ConstantConversion>;
3712def warn_impcast_bitfield_precision_constant : Warning<
3713 "implicit truncation from %2 to bit-field changes value from %0 to %1">,
3714 InGroup<BitFieldConstantConversion>;
3715def warn_impcast_constant_value_to_objc_bool : Warning<
3716 "implicit conversion from constant value %0 to 'BOOL'; "
3717 "the only well defined values for 'BOOL' are YES and NO">,
3718 InGroup<ObjCBoolConstantConversion>;
3719
3720def warn_impcast_fixed_point_range : Warning<
3721 "implicit conversion from %0 cannot fit within the range of values for %1">,
3722 InGroup<ImplicitFixedPointConversion>;
3723
3724def warn_impcast_literal_float_to_integer : Warning<
3725 "implicit conversion from %0 to %1 changes value from %2 to %3">,
3726 InGroup<LiteralConversion>;
3727def warn_impcast_literal_float_to_integer_out_of_range : Warning<
3728 "implicit conversion of out of range value from %0 to %1 is undefined">,
3729 InGroup<LiteralConversion>;
3730def warn_impcast_float_integer : Warning<
3731 "implicit conversion turns floating-point number into integer: %0 to %1">,
3732 InGroup<FloatConversion>, DefaultIgnore;
3733def warn_impcast_float_to_objc_signed_char_bool : Warning<
3734 "implicit conversion from floating-point type %0 to 'BOOL'">,
3735 InGroup<ObjCSignedCharBoolImplicitFloatConversion>;
3736def warn_impcast_int_to_objc_signed_char_bool : Warning<
3737 "implicit conversion from integral type %0 to 'BOOL'">,
3738 InGroup<ObjCSignedCharBoolImplicitIntConversion>, DefaultIgnore;
3739
3740// Implicit int -> float conversion precision loss warnings.
3741def warn_impcast_integer_float_precision : Warning<
3742 "implicit conversion from %0 to %1 may lose precision">,
3743 InGroup<ImplicitIntFloatConversion>, DefaultIgnore;
3744def warn_impcast_integer_float_precision_constant : Warning<
3745 "implicit conversion from %2 to %3 changes value from %0 to %1">,
3746 InGroup<ImplicitConstIntFloatConversion>;
3747
3748def warn_impcast_float_to_integer : Warning<
3749 "implicit conversion from %0 to %1 changes value from %2 to %3">,
3750 InGroup<FloatOverflowConversion>, DefaultIgnore;
3751def warn_impcast_float_to_integer_out_of_range : Warning<
3752 "implicit conversion of out of range value from %0 to %1 is undefined">,
3753 InGroup<FloatOverflowConversion>, DefaultIgnore;
3754def warn_impcast_float_to_integer_zero : Warning<
3755 "implicit conversion from %0 to %1 changes non-zero value from %2 to %3">,
3756 InGroup<FloatZeroConversion>, DefaultIgnore;
3757
3758def warn_impcast_string_literal_to_bool : Warning<
3759 "implicit conversion turns string literal into bool: %0 to %1">,
3760 InGroup<StringConversion>, DefaultIgnore;
3761def warn_impcast_different_enum_types : Warning<
3762 "implicit conversion from enumeration type %0 to different enumeration type "
3763 "%1">, InGroup<EnumConversion>;
3764def warn_impcast_bool_to_null_pointer : Warning<
3765 "initialization of pointer of type %0 to null from a constant boolean "
3766 "expression">, InGroup<BoolConversion>;
3767def warn_non_literal_null_pointer : Warning<
3768 "expression which evaluates to zero treated as a null pointer constant of "
3769 "type %0">, InGroup<NonLiteralNullConversion>;
3770def warn_pointer_compare : Warning<
3771 "comparing a pointer to a null character constant; did you mean "
3772 "to compare to %select{NULL|(void *)0}0?">,
3773 InGroup<DiagGroup<"pointer-compare">>;
3774def warn_impcast_null_pointer_to_integer : Warning<
3775 "implicit conversion of %select{NULL|nullptr}0 constant to %1">,
3776 InGroup<NullConversion>;
3777def warn_impcast_floating_point_to_bool : Warning<
3778 "implicit conversion turns floating-point number into bool: %0 to %1">,
3779 InGroup<ImplicitConversionFloatingPointToBool>;
3780def ext_ms_impcast_fn_obj : ExtWarn<
3781 "implicit conversion between pointer-to-function and pointer-to-object is a "
3782 "Microsoft extension">, InGroup<MicrosoftCast>;
3783
3784def warn_impcast_pointer_to_bool : Warning<
3785 "address of%select{| function| array}0 '%1' will always evaluate to "
3786 "'true'">,
3787 InGroup<PointerBoolConversion>;
3788def warn_cast_nonnull_to_bool : Warning<
3789 "nonnull %select{function call|parameter}0 '%1' will evaluate to "
3790 "'true' on first encounter">,
3791 InGroup<PointerBoolConversion>;
3792def warn_this_bool_conversion : Warning<
3793 "'this' pointer cannot be null in well-defined C++ code; pointer may be "
3794 "assumed to always convert to true">, InGroup<UndefinedBoolConversion>;
3795def warn_address_of_reference_bool_conversion : Warning<
3796 "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3797 "code; pointer may be assumed to always convert to true">,
3798 InGroup<UndefinedBoolConversion>;
3799
3800def warn_xor_used_as_pow : Warning<
3801 "result of '%0' is %1; did you mean exponentiation?">,
3802 InGroup<XorUsedAsPow>;
3803def warn_xor_used_as_pow_base_extra : Warning<
3804 "result of '%0' is %1; did you mean '%2' (%3)?">,
3805 InGroup<XorUsedAsPow>;
3806def warn_xor_used_as_pow_base : Warning<
3807 "result of '%0' is %1; did you mean '%2'?">,
3808 InGroup<XorUsedAsPow>;
3809def note_xor_used_as_pow_silence : Note<
3810 "replace expression with '%0' %select{|or use 'xor' instead of '^' }1to silence this warning">;
3811
3812def warn_null_pointer_compare : Warning<
3813 "comparison of %select{address of|function|array}0 '%1' %select{not |}2"
3814 "equal to a null pointer is always %select{true|false}2">,
3815 InGroup<TautologicalPointerCompare>;
3816def warn_nonnull_expr_compare : Warning<
3817 "comparison of nonnull %select{function call|parameter}0 '%1' "
3818 "%select{not |}2equal to a null pointer is '%select{true|false}2' on first "
3819 "encounter">,
3820 InGroup<TautologicalPointerCompare>;
3821def warn_this_null_compare : Warning<
3822 "'this' pointer cannot be null in well-defined C++ code; comparison may be "
3823 "assumed to always evaluate to %select{true|false}0">,
3824 InGroup<TautologicalUndefinedCompare>;
3825def warn_address_of_reference_null_compare : Warning<
3826 "reference cannot be bound to dereferenced null pointer in well-defined C++ "
3827 "code; comparison may be assumed to always evaluate to "
3828 "%select{true|false}0">,
3829 InGroup<TautologicalUndefinedCompare>;
3830def note_reference_is_return_value : Note<"%0 returns a reference">;
3831
3832def note_pointer_declared_here : Note<
3833 "pointer %0 declared here">;
3834def warn_division_sizeof_ptr : Warning<
3835 "'%0' will return the size of the pointer, not the array itself">,
3836 InGroup<DiagGroup<"sizeof-pointer-div">>;
3837def warn_division_sizeof_array : Warning<
3838 "expression does not compute the number of elements in this array; element "
3839 "type is %0, not %1">,
3840 InGroup<DiagGroup<"sizeof-array-div">>;
3841
3842def note_function_warning_silence : Note<
3843 "prefix with the address-of operator to silence this warning">;
3844def note_function_to_function_call : Note<
3845 "suffix with parentheses to turn this into a function call">;
3846def warn_impcast_objective_c_literal_to_bool : Warning<
3847 "implicit boolean conversion of Objective-C object literal always "
3848 "evaluates to true">,
3849 InGroup<ObjCLiteralConversion>;
3850
3851def warn_cast_align : Warning<
3852 "cast from %0 to %1 increases required alignment from %2 to %3">,
3853 InGroup<CastAlign>, DefaultIgnore;
3854def warn_old_style_cast : Warning<
3855 "use of old-style cast">, InGroup<OldStyleCast>, DefaultIgnore;
3856
3857// Separate between casts to void* and non-void* pointers.
3858// Some APIs use (abuse) void* for something like a user context,
3859// and often that value is an integer even if it isn't a pointer itself.
3860// Having a separate warning flag allows users to control the warning
3861// for their workflow.
3862def warn_int_to_pointer_cast : Warning<
3863 "cast to %1 from smaller integer type %0">,
3864 InGroup<IntToPointerCast>;
3865def warn_int_to_void_pointer_cast : Warning<
3866 "cast to %1 from smaller integer type %0">,
3867 InGroup<IntToVoidPointerCast>;
3868def warn_pointer_to_int_cast : Warning<
3869 "cast to smaller integer type %1 from %0">,
3870 InGroup<PointerToIntCast>;
3871def warn_pointer_to_enum_cast : Warning<
3872 warn_pointer_to_int_cast.Text>,
3873 InGroup<PointerToEnumCast>;
3874def warn_void_pointer_to_int_cast : Warning<
3875 "cast to smaller integer type %1 from %0">,
3876 InGroup<VoidPointerToIntCast>;
3877def warn_void_pointer_to_enum_cast : Warning<
3878 warn_void_pointer_to_int_cast.Text>,
3879 InGroup<VoidPointerToEnumCast>;
3880
3881def warn_attribute_ignored_for_field_of_type : Warning<
3882 "%0 attribute ignored for field of type %1">,
3883 InGroup<IgnoredAttributes>;
3884def warn_no_underlying_type_specified_for_enum_bitfield : Warning<
3885 "enums in the Microsoft ABI are signed integers by default; consider giving "
3886 "the enum %0 an unsigned underlying type to make this code portable">,
3887 InGroup<SignedEnumBitfield>, DefaultIgnore;
3888def warn_attribute_packed_for_bitfield : Warning<
3889 "'packed' attribute was ignored on bit-fields with single-byte alignment "
3890 "in older versions of GCC and Clang">,
3891 InGroup<DiagGroup<"attribute-packed-for-bitfield">>;
3892def warn_transparent_union_attribute_field_size_align : Warning<
3893 "%select{alignment|size}0 of field %1 (%2 bits) does not match the "
3894 "%select{alignment|size}0 of the first field in transparent union; "
3895 "transparent_union attribute ignored">,
3896 InGroup<IgnoredAttributes>;
3897def note_transparent_union_first_field_size_align : Note<
3898 "%select{alignment|size}0 of first field is %1 bits">;
3899def warn_transparent_union_attribute_not_definition : Warning<
3900 "transparent_union attribute can only be applied to a union definition; "
3901 "attribute ignored">,
3902 InGroup<IgnoredAttributes>;
3903def warn_transparent_union_attribute_floating : Warning<
3904 "first field of a transparent union cannot have %select{floating point|"
3905 "vector}0 type %1; transparent_union attribute ignored">,
3906 InGroup<IgnoredAttributes>;
3907def warn_transparent_union_attribute_zero_fields : Warning<
3908 "transparent union definition must contain at least one field; "
3909 "transparent_union attribute ignored">,
3910 InGroup<IgnoredAttributes>;
3911def warn_attribute_type_not_supported : Warning<
3912 "%0 attribute argument not supported: %1">,
3913 InGroup<IgnoredAttributes>;
3914def warn_attribute_unknown_visibility : Warning<"unknown visibility %0">,
3915 InGroup<IgnoredAttributes>;
3916def warn_attribute_protected_visibility :
3917 Warning<"target does not support 'protected' visibility; using 'default'">,
3918 InGroup<DiagGroup<"unsupported-visibility">>;
3919def err_mismatched_visibility: Error<"visibility does not match previous declaration">;
3920def note_previous_attribute : Note<"previous attribute is here">;
3921def note_conflicting_attribute : Note<"conflicting attribute is here">;
3922def note_attribute : Note<"attribute is here">;
3923def err_mismatched_ms_inheritance : Error<
3924 "inheritance model does not match %select{definition|previous declaration}0">;
3925def warn_ignored_ms_inheritance : Warning<
3926 "inheritance model ignored on %select{primary template|partial specialization}0">,
3927 InGroup<IgnoredAttributes>;
3928def note_previous_ms_inheritance : Note<
3929 "previous inheritance model specified here">;
3930def err_machine_mode : Error<"%select{unknown|unsupported}0 machine mode %1">;
3931def err_mode_not_primitive : Error<
3932 "mode attribute only supported for integer and floating-point types">;
3933def err_mode_wrong_type : Error<
3934 "type of machine mode does not match type of base type">;
3935def warn_vector_mode_deprecated : Warning<
3936 "specifying vector types with the 'mode' attribute is deprecated; "
3937 "use the 'vector_size' attribute instead">,
3938 InGroup<DeprecatedAttributes>;
3939def err_complex_mode_vector_type : Error<
3940 "type of machine mode does not support base vector types">;
3941def err_enum_mode_vector_type : Error<
3942 "mode %0 is not supported for enumeration types">;
3943def warn_attribute_nonnull_no_pointers : Warning<
3944 "'nonnull' attribute applied to function with no pointer arguments">,
3945 InGroup<IgnoredAttributes>;
3946def warn_attribute_nonnull_parm_no_args : Warning<
3947 "'nonnull' attribute when used on parameters takes no arguments">,
3948 InGroup<IgnoredAttributes>;
3949def note_declared_nonnull : Note<
3950 "declared %select{'returns_nonnull'|'nonnull'}0 here">;
3951def warn_attribute_sentinel_named_arguments : Warning<
3952 "'sentinel' attribute requires named arguments">,
3953 InGroup<IgnoredAttributes>;
3954def warn_attribute_sentinel_not_variadic : Warning<
3955 "'sentinel' attribute only supported for variadic %select{functions|blocks}0">,
3956 InGroup<IgnoredAttributes>;
3957def err_attribute_sentinel_less_than_zero : Error<
3958 "'sentinel' parameter 1 less than zero">;
3959def err_attribute_sentinel_not_zero_or_one : Error<
3960 "'sentinel' parameter 2 not 0 or 1">;
3961def warn_cleanup_ext : Warning<
3962 "GCC does not allow the 'cleanup' attribute argument to be anything other "
3963 "than a simple identifier">,
3964 InGroup<GccCompat>;
3965def err_attribute_cleanup_arg_not_function : Error<
3966 "'cleanup' argument %select{|%1 |%1 }0is not a %select{||single }0function">;
3967def err_attribute_cleanup_func_must_take_one_arg : Error<
3968 "'cleanup' function %0 must take 1 parameter">;
3969def err_attribute_cleanup_func_arg_incompatible_type : Error<
3970 "'cleanup' function %0 parameter has "
3971 "%diff{type $ which is incompatible with type $|incompatible type}1,2">;
3972def err_attribute_regparm_wrong_platform : Error<
3973 "'regparm' is not valid on this platform">;
3974def err_attribute_regparm_invalid_number : Error<
3975 "'regparm' parameter must be between 0 and %0 inclusive">;
3976def err_attribute_not_supported_in_lang : Error<
3977 "%0 attribute is not supported in %select{C|C++|Objective-C}1">;
3978def err_attribute_not_supported_on_arch
3979 : Error<"%0 attribute is not supported on '%1'">;
3980def warn_gcc_ignores_type_attr : Warning<
3981 "GCC does not allow the %0 attribute to be written on a type">,
3982 InGroup<GccCompat>;
3983
3984// Clang-Specific Attributes
3985def warn_attribute_iboutlet : Warning<
3986 "%0 attribute can only be applied to instance variables or properties">,
3987 InGroup<IgnoredAttributes>;
3988def err_iboutletcollection_type : Error<
3989 "invalid type %0 as argument of iboutletcollection attribute">;
3990def err_iboutletcollection_builtintype : Error<
3991 "type argument of iboutletcollection attribute cannot be a builtin type">;
3992def warn_iboutlet_object_type : Warning<
3993 "%select{instance variable|property}2 with %0 attribute must "
3994 "be an object type (invalid %1)">, InGroup<ObjCInvalidIBOutletProperty>;
3995def warn_iboutletcollection_property_assign : Warning<
3996 "IBOutletCollection properties should be copy/strong and not assign">,
3997 InGroup<ObjCInvalidIBOutletProperty>;
3998
3999def err_attribute_overloadable_mismatch : Error<
4000 "redeclaration of %0 must %select{not |}1have the 'overloadable' attribute">;
4001def note_attribute_overloadable_prev_overload : Note<
4002 "previous %select{unmarked |}0overload of function is here">;
4003def err_attribute_overloadable_no_prototype : Error<
4004 "'overloadable' function %0 must have a prototype">;
4005def err_attribute_overloadable_multiple_unmarked_overloads : Error<
4006 "at most one overload for a given name may lack the 'overloadable' "
4007 "attribute">;
4008def warn_attribute_no_builtin_invalid_builtin_name : Warning<
4009 "'%0' is not a valid builtin name for %1">,
4010 InGroup<DiagGroup<"invalid-no-builtin-names">>;
4011def err_attribute_no_builtin_wildcard_or_builtin_name : Error<
4012 "empty %0 cannot be composed with named ones">;
4013def err_attribute_no_builtin_on_non_definition : Error<
4014 "%0 attribute is permitted on definitions only">;
4015def err_attribute_no_builtin_on_defaulted_deleted_function : Error<
4016 "%0 attribute has no effect on defaulted or deleted functions">;
4017def warn_ns_attribute_wrong_return_type : Warning<
4018 "%0 attribute only applies to %select{functions|methods|properties}1 that "
4019 "return %select{an Objective-C object|a pointer|a non-retainable pointer}2">,
4020 InGroup<IgnoredAttributes>;
4021def err_ns_attribute_wrong_parameter_type : Error<
4022 "%0 attribute only applies to "
4023 "%select{Objective-C object|pointer|pointer-to-CF-pointer}1 parameters">;
4024def warn_ns_attribute_wrong_parameter_type : Warning<
4025 "%0 attribute only applies to "
4026 "%select{Objective-C object|pointer|pointer-to-CF-pointer|pointer/reference-to-OSObject-pointer}1 parameters">,
4027 InGroup<IgnoredAttributes>;
4028def warn_objc_requires_super_protocol : Warning<
4029 "%0 attribute cannot be applied to %select{methods in protocols|dealloc}1">,
4030 InGroup<DiagGroup<"requires-super-attribute">>;
4031def note_protocol_decl : Note<
4032 "protocol is declared here">;
4033def note_protocol_decl_undefined : Note<
4034 "protocol %0 has no definition">;
4035def err_attribute_preferred_name_arg_invalid : Error<
4036 "argument %0 to 'preferred_name' attribute is not a typedef for "
4037 "a specialization of %1">;
4038def err_attribute_builtin_alias : Error<
4039 "%0 attribute can only be applied to a ARM or RISC-V builtin">;
4040
4041// called-once attribute diagnostics.
4042def err_called_once_attribute_wrong_type : Error<
4043 "'called_once' attribute only applies to function-like parameters">;
4044
4045def warn_completion_handler_never_called : Warning<
4046 "%select{|captured }1completion handler is never called">,
4047 InGroup<CompletionHandler>, DefaultIgnore;
4048def warn_called_once_never_called : Warning<
4049 "%select{|captured }1%0 parameter marked 'called_once' is never called">,
4050 InGroup<CalledOnceParameter>;
4051
4052def warn_completion_handler_never_called_when : Warning<
4053 "completion handler is never %select{used|called}1 when "
4054 "%select{taking true branch|taking false branch|"
4055 "handling this case|none of the cases applies|"
4056 "entering the loop|skipping the loop|taking one of the branches}2">,
4057 InGroup<CompletionHandler>, DefaultIgnore;
4058def warn_called_once_never_called_when : Warning<
4059 "%0 parameter marked 'called_once' is never %select{used|called}1 when "
4060 "%select{taking true branch|taking false branch|"
4061 "handling this case|none of the cases applies|"
4062 "entering the loop|skipping the loop|taking one of the branches}2">,
4063 InGroup<CalledOnceParameter>;
4064
4065def warn_completion_handler_called_twice : Warning<
4066 "completion handler is called twice">,
4067 InGroup<CompletionHandler>, DefaultIgnore;
4068def warn_called_once_gets_called_twice : Warning<
4069 "%0 parameter marked 'called_once' is called twice">,
4070 InGroup<CalledOnceParameter>;
4071def note_called_once_gets_called_twice : Note<
4072 "previous call is here%select{; set to nil to indicate "
4073 "it cannot be called afterwards|}0">;
4074
4075// objc_designated_initializer attribute diagnostics.
4076def warn_objc_designated_init_missing_super_call : Warning<
4077 "designated initializer missing a 'super' call to a designated initializer of the super class">,
4078 InGroup<ObjCDesignatedInit>;
4079def note_objc_designated_init_marked_here : Note<
4080 "method marked as designated initializer of the class here">;
4081def warn_objc_designated_init_non_super_designated_init_call : Warning<
4082 "designated initializer should only invoke a designated initializer on 'super'">,
4083 InGroup<ObjCDesignatedInit>;
4084def warn_objc_designated_init_non_designated_init_call : Warning<
4085 "designated initializer invoked a non-designated initializer">,
4086 InGroup<ObjCDesignatedInit>;
4087def warn_objc_secondary_init_super_init_call : Warning<
4088 "convenience initializer should not invoke an initializer on 'super'">,
4089 InGroup<ObjCDesignatedInit>;
4090def warn_objc_secondary_init_missing_init_call : Warning<
4091 "convenience initializer missing a 'self' call to another initializer">,
4092 InGroup<ObjCDesignatedInit>;
4093def warn_objc_implementation_missing_designated_init_override : Warning<
4094 "method override for the designated initializer of the superclass %objcinstance0 not found">,
4095 InGroup<ObjCDesignatedInit>;
4096def err_designated_init_attr_non_init : Error<
4097 "'objc_designated_initializer' attribute only applies to init methods "
4098 "of interface or class extension declarations">;
4099
4100// objc_bridge attribute diagnostics.
4101def err_objc_attr_not_id : Error<
4102 "parameter of %0 attribute must be a single name of an Objective-C %select{class|protocol}1">;
4103def err_objc_attr_typedef_not_id : Error<
4104 "parameter of %0 attribute must be 'id' when used on a typedef">;
4105def err_objc_attr_typedef_not_void_pointer : Error<
4106 "'objc_bridge(id)' is only allowed on structs and typedefs of void pointers">;
4107def err_objc_cf_bridged_not_interface : Error<
4108 "CF object of type %0 is bridged to %1, which is not an Objective-C class">;
4109def err_objc_ns_bridged_invalid_cfobject : Error<
4110 "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">;
4111def warn_objc_invalid_bridge : Warning<
4112 "%0 bridges to %1, not %2">, InGroup<ObjCBridge>;
4113def warn_objc_invalid_bridge_to_cf : Warning<
4114 "%0 cannot bridge to %1">, InGroup<ObjCBridge>;
4115
4116// objc_bridge_related attribute diagnostics.
4117def err_objc_bridged_related_invalid_class : Error<
4118 "could not find Objective-C class %0 to convert %1 to %2">;
4119def err_objc_bridged_related_invalid_class_name : Error<
4120 "%0 must be name of an Objective-C class to be able to convert %1 to %2">;
4121def err_objc_bridged_related_known_method : Error<
4122 "%0 must be explicitly converted to %1; use %select{%objcclass2|%objcinstance2}3 "
4123 "method for this conversion">;
4124
4125def err_objc_attr_protocol_requires_definition : Error<
4126 "attribute %0 can only be applied to @protocol definitions, not forward declarations">;
4127
4128// Swift attributes.
4129def warn_attr_swift_name_function
4130 : Warning<"%0 attribute argument must be a string literal specifying a Swift function name">,
4131 InGroup<SwiftNameAttribute>;
4132def warn_attr_swift_name_invalid_identifier
4133 : Warning<"%0 attribute has invalid identifier for the %select{base|context|parameter}1 name">,
4134 InGroup<SwiftNameAttribute>;
4135def warn_attr_swift_name_decl_kind
4136 : Warning<"%0 attribute cannot be applied to this declaration">,
4137 InGroup<SwiftNameAttribute>;
4138def warn_attr_swift_name_subscript_invalid_parameter
4139 : Warning<"%0 attribute for 'subscript' must %select{be a getter or setter|"
4140 "have at least one parameter|"
4141 "have a 'self:' parameter}1">,
4142 InGroup<SwiftNameAttribute>;
4143def warn_attr_swift_name_missing_parameters
4144 : Warning<"%0 attribute is missing parameter label clause">,
4145 InGroup<SwiftNameAttribute>;
4146def warn_attr_swift_name_setter_parameters
4147 : Warning<"%0 attribute for setter must have one parameter for new value">,
4148 InGroup<SwiftNameAttribute>;
4149def warn_attr_swift_name_multiple_selfs
4150 : Warning<"%0 attribute cannot specify more than one 'self:' parameter">,
4151 InGroup<SwiftNameAttribute>;
4152def warn_attr_swift_name_getter_parameters
4153 : Warning<"%0 attribute for getter must not have any parameters besides 'self:'">,
4154 InGroup<SwiftNameAttribute>;
4155def warn_attr_swift_name_subscript_setter_no_newValue
4156 : Warning<"%0 attribute for 'subscript' setter must have a 'newValue:' parameter">,
4157 InGroup<SwiftNameAttribute>;
4158def warn_attr_swift_name_subscript_setter_multiple_newValues
4159 : Warning<"%0 attribute for 'subscript' setter cannot have multiple 'newValue:' parameters">,
4160 InGroup<SwiftNameAttribute>;
4161def warn_attr_swift_name_subscript_getter_newValue
4162 : Warning<"%0 attribute for 'subscript' getter cannot have a 'newValue:' parameter">,
4163 InGroup<SwiftNameAttribute>;
4164def warn_attr_swift_name_num_params
4165 : Warning<"too %select{few|many}0 parameters in the signature specified by "
4166 "the %1 attribute (expected %2; got %3)">,
4167 InGroup<SwiftNameAttribute>;
4168def warn_attr_swift_name_decl_missing_params
4169 : Warning<"%0 attribute cannot be applied to a %select{function|method}1 "
4170 "with no parameters">,
4171 InGroup<SwiftNameAttribute>;
4172
4173def err_attr_swift_error_no_error_parameter : Error<
4174 "%0 attribute can only be applied to a %select{function|method}1 with an "
4175 "error parameter">;
4176def err_attr_swift_error_return_type : Error<
4177 "%0 attribute with '%1' convention can only be applied to a "
4178 "%select{function|method}2 returning %select{an integral type|a pointer}3">;
4179
4180def err_swift_async_no_access : Error<
4181 "first argument to 'swift_async' must be either 'none', 'swift_private', or "
4182 "'not_swift_private'">;
4183def err_swift_async_bad_block_type : Error<
4184 "'swift_async' completion handler parameter must have block type returning"
4185 " 'void', type here is %0">;
4186
4187def err_swift_async_error_without_swift_async : Error<
4188 "%0 attribute must be applied to a %select{function|method}1 annotated "
4189 "with non-'none' attribute 'swift_async'">;
4190def err_swift_async_error_no_error_parameter : Error<
4191 "%0 attribute with 'nonnull_error' convention can only be applied to a "
4192 "%select{function|method}1 with a completion handler with an error "
4193 "parameter">;
4194def err_swift_async_error_non_integral : Error<
4195 "%0 attribute with '%1' convention must have an integral-typed parameter "
4196 "in completion handler at index %2, type here is %3">;
4197
4198def warn_ignored_objc_externally_retained : Warning<
4199 "'objc_externally_retained' can only be applied to local variables "
4200 "%select{of retainable type|with strong ownership}0">,
4201 InGroup<IgnoredAttributes>;
4202
4203// Function Parameter Semantic Analysis.
4204def err_param_with_void_type : Error<"argument may not have 'void' type">;
4205def err_void_only_param : Error<
4206 "'void' must be the first and only parameter if specified">;
4207def err_void_param_qualified : Error<
4208 "'void' as parameter must not have type qualifiers">;
4209def err_ident_list_in_fn_declaration : Error<
4210 "a parameter list without types is only allowed in a function definition">;
4211def ext_param_not_declared : Extension<
4212 "parameter %0 was not declared, defaulting to type 'int'">;
4213def err_param_default_argument : Error<
4214 "C does not support default arguments">;
4215def err_param_default_argument_redefinition : Error<
4216 "redefinition of default argument">;
4217def ext_param_default_argument_redefinition : ExtWarn<
4218 err_param_default_argument_redefinition.Text>,
4219 InGroup<MicrosoftDefaultArgRedefinition>;
4220def err_param_default_argument_missing : Error<
4221 "missing default argument on parameter">;
4222def err_param_default_argument_missing_name : Error<
4223 "missing default argument on parameter %0">;
4224def err_param_default_argument_references_param : Error<
4225 "default argument references parameter %0">;
4226def err_param_default_argument_references_local : Error<
4227 "default argument references local variable %0 of enclosing function">;
4228def err_param_default_argument_references_this : Error<
4229 "default argument references 'this'">;
4230def err_param_default_argument_nonfunc : Error<
4231 "default arguments can only be specified for parameters in a function "
4232 "declaration">;
4233def err_param_default_argument_template_redecl : Error<
4234 "default arguments cannot be added to a function template that has already "
4235 "been declared">;
4236def err_param_default_argument_member_template_redecl : Error<
4237 "default arguments cannot be added to an out-of-line definition of a member "
4238 "of a %select{class template|class template partial specialization|nested "
4239 "class in a template}0">;
4240def err_param_default_argument_on_parameter_pack : Error<
4241 "parameter pack cannot have a default argument">;
4242def err_uninitialized_member_for_assign : Error<
4243 "cannot define the implicit copy assignment operator for %0, because "
4244 "non-static %select{reference|const}1 member %2 cannot use copy "
4245 "assignment operator">;
4246def err_uninitialized_member_in_ctor : Error<
4247 "%select{constructor for %1|"
4248 "implicit default constructor for %1|"
4249 "cannot use constructor inherited from %1:}0 must explicitly "
4250 "initialize the %select{reference|const}2 member %3">;
4251def err_default_arg_makes_ctor_special : Error<
4252 "addition of default argument on redeclaration makes this constructor a "
4253 "%select{default|copy|move}0 constructor">;
4254
4255def err_use_of_default_argument_to_function_declared_later : Error<
4256 "use of default argument to function %0 that is declared later in class %1">;
4257def note_default_argument_declared_here : Note<
4258 "default argument declared here">;
4259def err_recursive_default_argument : Error<"recursive evaluation of default argument">;
4260def note_recursive_default_argument_used_here : Note<
4261 "default argument used here">;
4262
4263def ext_param_promoted_not_compatible_with_prototype : ExtWarn<
4264 "%diff{promoted type $ of K&R function parameter is not compatible with the "
4265 "parameter type $|promoted type of K&R function parameter is not compatible "
4266 "with parameter type}0,1 declared in a previous prototype">,
4267 InGroup<KNRPromotedParameter>;
4268
4269
4270// C++ Overloading Semantic Analysis.
4271def err_ovl_diff_return_type : Error<
4272 "functions that differ only in their return type cannot be overloaded">;
4273def err_ovl_static_nonstatic_member : Error<
4274 "static and non-static member functions with the same parameter types "
4275 "cannot be overloaded">;
4276
4277let Deferrable = 1 in {
4278
4279def err_ovl_no_viable_function_in_call : Error<
4280 "no matching function for call to %0">;
4281def err_ovl_no_viable_member_function_in_call : Error<
4282 "no matching member function for call to %0">;
4283def err_ovl_ambiguous_call : Error<
4284 "call to %0 is ambiguous">;
4285def err_ovl_deleted_call : Error<"call to deleted function %0">;
4286def err_ovl_ambiguous_member_call : Error<
4287 "call to member function %0 is ambiguous">;
4288def err_ovl_deleted_member_call : Error<
4289 "call to deleted member function %0">;
4290def note_ovl_too_many_candidates : Note<
4291 "remaining %0 candidate%s0 omitted; "
4292 "pass -fshow-overloads=all to show them">;
4293
4294def select_ovl_candidate_kind : TextSubstitution<
4295 "%select{function|function|function (with reversed parameter order)|"
4296 "constructor|"
4297 "constructor (the implicit default constructor)|"
4298 "constructor (the implicit copy constructor)|"
4299 "constructor (the implicit move constructor)|"
4300 "function (the implicit copy assignment operator)|"
4301 "function (the implicit move assignment operator)|"
4302 "function (the implicit 'operator==' for this 'operator<=>)'|"
4303 "inherited constructor}0%select{| template| %2}1">;
4304
4305def note_ovl_candidate : Note<
4306 "candidate %sub{select_ovl_candidate_kind}0,1,3"
4307 "%select{| has different class%diff{ (expected $ but has $)|}5,6"
4308 "| has different number of parameters (expected %5 but has %6)"
4309 "| has type mismatch at %ordinal5 parameter"
4310 "%diff{ (expected $ but has $)|}6,7"
4311 "| has different return type%diff{ ($ expected but has $)|}5,6"
4312 "| has different qualifiers (expected %5 but found %6)"
4313 "| has different exception specification}4">;
4314
4315def note_ovl_candidate_explicit : Note<
4316 "explicit %select{constructor|conversion function|deduction guide}0 "
4317 "is not a candidate%select{| (explicit specifier evaluates to true)}1">;
4318def note_ovl_candidate_inherited_constructor : Note<
4319 "constructor from base class %0 inherited here">;
4320def note_ovl_candidate_inherited_constructor_slice : Note<
4321 "candidate %select{constructor|template}0 ignored: "
4322 "inherited constructor cannot be used to %select{copy|move}1 object">;
4323def note_ovl_candidate_illegal_constructor : Note<
4324 "candidate %select{constructor|template}0 ignored: "
4325 "instantiation %select{takes|would take}0 its own class type by value">;
4326def note_ovl_candidate_illegal_constructor_adrspace_mismatch : Note<
4327 "candidate constructor ignored: cannot be used to construct an object "
4328 "in address space %0">;
4329def note_ovl_candidate_bad_deduction : Note<
4330 "candidate template ignored: failed template argument deduction">;
4331def note_ovl_candidate_incomplete_deduction : Note<"candidate template ignored: "
4332 "couldn't infer template argument %0">;
4333def note_ovl_candidate_incomplete_deduction_pack : Note<
4334 "candidate template ignored: "
4335 "deduced too few arguments for expanded pack %0; no argument for %ordinal1 "
4336 "expanded parameter in deduced argument pack %2">;
4337def note_ovl_candidate_inconsistent_deduction : Note<
4338 "candidate template ignored: deduced %select{conflicting types|"
4339 "conflicting values|conflicting templates|packs of different lengths}0 "
4340 "for parameter %1%diff{ ($ vs. $)|}2,3">;
4341def note_ovl_candidate_inconsistent_deduction_types : Note<
4342 "candidate template ignored: deduced values %diff{"
4343 "of conflicting types for parameter %0 (%1 of type $ vs. %3 of type $)|"
4344 "%1 and %3 of conflicting types for parameter %0}2,4">;
4345def note_ovl_candidate_explicit_arg_mismatch_named : Note<
4346 "candidate template ignored: invalid explicitly-specified argument "
4347 "for template parameter %0">;
4348def note_ovl_candidate_unsatisfied_constraints : Note<
4349 "candidate template ignored: constraints not satisfied%0">;
4350def note_ovl_candidate_explicit_arg_mismatch_unnamed : Note<
4351 "candidate template ignored: invalid explicitly-specified argument "
4352 "for %ordinal0 template parameter">;
4353def note_ovl_candidate_instantiation_depth : Note<
4354 "candidate template ignored: substitution exceeded maximum template "
4355 "instantiation depth">;
4356def note_ovl_candidate_underqualified : Note<
4357 "candidate template ignored: cannot deduce a type for %0 that would "
4358 "make %2 equal %1">;
4359def note_ovl_candidate_substitution_failure : Note<
4360 "candidate template ignored: substitution failure%0%1">;
4361def note_ovl_candidate_disabled_by_enable_if : Note<
4362 "candidate template ignored: disabled by %0%1">;
4363def note_ovl_candidate_disabled_by_requirement : Note<
4364 "candidate template ignored: requirement '%0' was not satisfied%1">;
4365def note_ovl_candidate_has_pass_object_size_params: Note<
4366 "candidate address cannot be taken because parameter %0 has "
4367 "pass_object_size attribute">;
4368def err_diagnose_if_succeeded : Error<"%0">;
4369def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
4370 ShowInSystemHeader;
4371def note_ovl_candidate_disabled_by_function_cond_attr : Note<
4372 "candidate disabled: %0">;
4373def note_ovl_candidate_disabled_by_extension : Note<
4374 "candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
4375def err_addrof_function_disabled_by_enable_if_attr : Error<
4376 "cannot take address of function %0 because it has one or more "
4377 "non-tautological enable_if conditions">;
4378def err_addrof_function_constraints_not_satisfied : Error<
4379 "cannot take address of function %0 because its constraints are not "
4380 "satisfied">;
4381def note_addrof_ovl_candidate_disabled_by_enable_if_attr : Note<
4382 "candidate function made ineligible by enable_if">;
4383def note_ovl_candidate_deduced_mismatch : Note<
4384 "candidate template ignored: deduced type "
4385 "%diff{$ of %select{|element of }4%ordinal0 parameter does not match "
4386 "adjusted type $ of %select{|element of }4argument"
4387 "|of %select{|element of }4%ordinal0 parameter does not match "
4388 "adjusted type of %select{|element of }4argument}1,2%3">;
4389def note_ovl_candidate_non_deduced_mismatch : Note<
4390 "candidate template ignored: could not match %diff{$ against $|types}0,1">;
4391// This note is needed because the above note would sometimes print two
4392// different types with the same name. Remove this note when the above note
4393// can handle that case properly.
4394def note_ovl_candidate_non_deduced_mismatch_qualified : Note<
4395 "candidate template ignored: could not match %q0 against %q1">;
4396
4397// Note that we don't treat templates differently for this diagnostic.
4398def note_ovl_candidate_arity : Note<"candidate "
4399 "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4400 "requires%select{ at least| at most|}3 %4 argument%s4, but %5 "
4401 "%plural{1:was|:were}5 provided">;
4402
4403def note_ovl_candidate_arity_one : Note<"candidate "
4404 "%sub{select_ovl_candidate_kind}0,1,2 not viable: "
4405 "%select{requires at least|allows at most single|requires single}3 "
4406 "argument %4, but %plural{0:no|:%5}5 arguments were provided">;
4407
4408def note_ovl_candidate_deleted : Note<
4409 "candidate %sub{select_ovl_candidate_kind}0,1,2 has been "
4410 "%select{explicitly made unavailable|explicitly deleted|"
4411 "implicitly deleted}3">;
4412
4413// Giving the index of the bad argument really clutters this message, and
4414// it's relatively unimportant because 1) it's generally obvious which
4415// argument(s) are of the given object type and 2) the fix is usually
4416// to complete the type, which doesn't involve changes to the call line
4417// anyway. If people complain, we can change it.
4418def note_ovl_candidate_bad_conv_incomplete : Note<
4419 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4420 "cannot convert argument of incomplete type "
4421 "%diff{$ to $|to parameter type}3,4 for "
4422 "%select{%ordinal6 argument|object argument}5"
4423 "%select{|; dereference the argument with *|"
4424 "; take the address of the argument with &|"
4425 "; remove *|"
4426 "; remove &}7">;
4427def note_ovl_candidate_bad_list_argument : Note<
4428 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4429 "cannot convert initializer list argument to %4">;
4430def note_ovl_candidate_bad_overload : Note<
4431 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4432 "no overload of %4 matching %3 for %ordinal5 argument">;
4433def note_ovl_candidate_bad_conv : Note<
4434 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4435 "no known conversion "
4436 "%diff{from $ to $|from argument type to parameter type}3,4 for "
4437 "%select{%ordinal6 argument|object argument}5"
4438 "%select{|; dereference the argument with *|"
4439 "; take the address of the argument with &|"
4440 "; remove *|"
4441 "; remove &}7">;
4442def note_ovl_candidate_bad_arc_conv : Note<
4443 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4444 "cannot implicitly convert argument "
4445 "%diff{of type $ to $|type to parameter type}3,4 for "
4446 "%select{%ordinal6 argument|object argument}5 under ARC">;
4447def note_ovl_candidate_bad_value_category : Note<
4448 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4449 "expects an %select{lvalue|rvalue}5 for "
4450 "%select{%ordinal4 argument|object argument}3">;
4451def note_ovl_candidate_bad_addrspace : Note<
4452 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4453 "cannot %select{pass pointer to|bind reference in}5 %3 "
4454 "%select{as a pointer to|to object in}5 %4 in %ordinal6 "
4455 "argument">;
4456def note_ovl_candidate_bad_addrspace_this : Note<
4457 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4458 "'this' object is in %3, but method expects object in %4">;
4459def note_ovl_candidate_bad_gc : Note<
4460 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4461 "%select{%ordinal7|'this'}6 argument (%3) has %select{no|__weak|__strong}4 "
4462 "ownership, but parameter has %select{no|__weak|__strong}5 ownership">;
4463def note_ovl_candidate_bad_ownership : Note<
4464 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4465 "%select{%ordinal7|'this'}6 argument (%3) has "
4466 "%select{no|__unsafe_unretained|__strong|__weak|__autoreleasing}4 ownership,"
4467 " but parameter has %select{no|__unsafe_unretained|__strong|__weak|"
4468 "__autoreleasing}5 ownership">;
4469def note_ovl_candidate_bad_cvr_this : Note<
4470 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4471 "'this' argument has type %3, but method is not marked "
4472 "%select{const|restrict|const or restrict|volatile|const or volatile|"
4473 "volatile or restrict|const, volatile, or restrict}4">;
4474def note_ovl_candidate_bad_cvr : Note<
4475 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4476 "%ordinal5 argument (%3) would lose "
4477 "%select{const|restrict|const and restrict|volatile|const and volatile|"
4478 "volatile and restrict|const, volatile, and restrict}4 qualifier"
4479 "%select{||s||s|s|s}4">;
4480def note_ovl_candidate_bad_unaligned : Note<
4481 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4482 "%ordinal5 argument (%3) would lose __unaligned qualifier">;
4483def note_ovl_candidate_bad_base_to_derived_conv : Note<
4484 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4485 "cannot %select{convert from|convert from|bind}3 "
4486 "%select{base class pointer|superclass|base class object of type}3 %4 to "
4487 "%select{derived class pointer|subclass|derived class reference}3 %5 for "
4488 "%ordinal6 argument">;
4489def note_ovl_candidate_bad_target : Note<
4490 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: "
4491 "call to "
4492 "%select{__device__|__global__|__host__|__host__ __device__|invalid}3 function from"
4493 " %select{__device__|__global__|__host__|__host__ __device__|invalid}4 function">;
4494def note_ovl_candidate_constraints_not_satisfied : Note<
4495 "candidate %sub{select_ovl_candidate_kind}0,1,2 not viable: constraints "
4496 "not satisfied">;
4497def note_implicit_member_target_infer_collision : Note<
4498 "implicit %sub{select_special_member_kind}0 inferred target collision: call to both "
4499 "%select{__device__|__global__|__host__|__host__ __device__}1 and "
4500 "%select{__device__|__global__|__host__|__host__ __device__}2 members">;
4501
4502def note_ambiguous_type_conversion: Note<
4503 "because of ambiguity in conversion %diff{of $ to $|between types}0,1">;
4504def note_ovl_builtin_candidate : Note<"built-in candidate %0">;
4505def err_ovl_no_viable_function_in_init : Error<
4506 "no matching constructor for initialization of %0">;
4507def err_ovl_no_conversion_in_cast : Error<
4508 "cannot convert %1 to %2 without a conversion operator">;
4509def err_ovl_no_viable_conversion_in_cast : Error<
4510 "no matching conversion for %select{|static_cast|reinterpret_cast|"
4511 "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4512def err_ovl_ambiguous_conversion_in_cast : Error<
4513 "ambiguous conversion for %select{|static_cast|reinterpret_cast|"
4514 "dynamic_cast|C-style cast|functional-style cast|}0 from %1 to %2">;
4515def err_ovl_deleted_conversion_in_cast : Error<
4516 "%select{|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
4517 "functional-style cast|}0 from %1 to %2 uses deleted function">;
4518def err_ovl_ambiguous_init : Error<"call to constructor of %0 is ambiguous">;
4519def err_ref_init_ambiguous : Error<
4520 "reference initialization of type %0 with initializer of type %1 is ambiguous">;
4521def err_ovl_deleted_init : Error<
4522 "call to deleted constructor of %0">;
4523def err_ovl_deleted_special_init : Error<
4524 "call to implicitly-deleted %select{default constructor|copy constructor|"
4525 "move constructor|copy assignment operator|move assignment operator|"
4526 "destructor|function}0 of %1">;
4527def err_ovl_ambiguous_oper_unary : Error<
4528 "use of overloaded operator '%0' is ambiguous (operand type %1)">;
4529def err_ovl_ambiguous_oper_binary : Error<
4530 "use of overloaded operator '%0' is ambiguous (with operand types %1 and %2)">;
4531def ext_ovl_ambiguous_oper_binary_reversed : ExtWarn<
4532 "ISO C++20 considers use of overloaded operator '%0' (with operand types %1 "
4533 "and %2) to be ambiguous despite there being a unique best viable function"
4534 "%select{ with non-reversed arguments|}3">,
4535 InGroup<DiagGroup<"ambiguous-reversed-operator">>, SFINAEFailure;
4536def note_ovl_ambiguous_oper_binary_reversed_self : Note<
4537 "ambiguity is between a regular call to this operator and a call with the "
4538 "argument order reversed">;
4539def note_ovl_ambiguous_oper_binary_selected_candidate : Note<
4540 "candidate function with non-reversed arguments">;
4541def note_ovl_ambiguous_oper_binary_reversed_candidate : Note<
4542 "ambiguous candidate function with reversed arguments">;
4543def err_ovl_no_viable_oper : Error<"no viable overloaded '%0'">;
4544def note_assign_lhs_incomplete : Note<"type %0 is incomplete">;
4545def err_ovl_deleted_oper : Error<
4546 "overload resolution selected deleted operator '%0'">;
4547def err_ovl_deleted_special_oper : Error<
4548 "object of type %0 cannot be %select{constructed|copied|moved|assigned|"
4549 "assigned|destroyed}1 because its %sub{select_special_member_kind}1 is "
4550 "implicitly deleted">;
4551def err_ovl_deleted_comparison : Error<
4552 "object of type %0 cannot be compared because its %1 is implicitly deleted">;
4553def err_ovl_rewrite_equalequal_not_bool : Error<
4554 "return type %0 of selected 'operator==' function for rewritten "
4555 "'%1' comparison is not 'bool'">;
4556def ext_ovl_rewrite_equalequal_not_bool : ExtWarn<
4557 "ISO C++20 requires return type of selected 'operator==' function for "
4558 "rewritten '%1' comparison to be 'bool', not %0">,
4559 InGroup<DiagGroup<"rewrite-not-bool">>, SFINAEFailure;
4560def err_ovl_no_viable_subscript :
4561 Error<"no viable overloaded operator[] for type %0">;
4562def err_ovl_no_oper :
4563 Error<"type %0 does not provide a %select{subscript|call}1 operator">;
4564def err_ovl_unresolvable : Error<
4565 "reference to %select{overloaded|multiversioned}1 function could not be "
4566 "resolved; did you mean to call it%select{| with no arguments}0?">;
4567def err_bound_member_function : Error<
4568 "reference to non-static member function must be called"
4569 "%select{|; did you mean to call it with no arguments?}0">;
4570def note_possible_target_of_call : Note<"possible target for call">;
4571
4572def err_ovl_no_viable_object_call : Error<
4573 "no matching function for call to object of type %0">;
4574def err_ovl_ambiguous_object_call : Error<
4575 "call to object of type %0 is ambiguous">;
4576def err_ovl_deleted_object_call : Error<
4577 "call to deleted function call operator in type %0">;
4578def note_ovl_surrogate_cand : Note<"conversion candidate of type %0">;
4579def err_member_call_without_object : Error<
4580 "call to non-static member function without an object argument">;
4581
4582// C++ Address of Overloaded Function
4583def err_addr_ovl_no_viable : Error<
4584 "address of overloaded function %0 does not match required type %1">;
4585def err_addr_ovl_ambiguous : Error<
4586 "address of overloaded function %0 is ambiguous">;
4587def err_addr_ovl_not_func_ptrref : Error<
4588 "address of overloaded function %0 cannot be converted to type %1">;
4589def err_addr_ovl_no_qualifier : Error<
4590 "cannot form member pointer of type %0 without '&' and class name">;
4591
4592} // let Deferrable
4593
4594// C++11 Literal Operators
4595def err_ovl_no_viable_literal_operator : Error<
4596 "no matching literal operator for call to %0"
4597 "%select{| with argument of type %2| with arguments of types %2 and %3}1"
4598 "%select{| or 'const char *'}4"
4599 "%select{|, and no matching literal operator template}5">;
4600
4601// C++ Template Declarations
4602def err_template_param_shadow : Error<
4603 "declaration of %0 shadows template parameter">;
4604def ext_template_param_shadow : ExtWarn<
4605 err_template_param_shadow.Text>, InGroup<MicrosoftTemplateShadow>;
4606def note_template_param_here : Note<"template parameter is declared here">;
4607def warn_template_export_unsupported : Warning<
4608 "exported templates are unsupported">;
4609def err_template_outside_namespace_or_class_scope : Error<
4610 "templates can only be declared in namespace or class scope">;
4611def err_template_inside_local_class : Error<
4612 "templates cannot be declared inside of a local class">;
4613def err_template_linkage : Error<"templates must have C++ linkage">;
4614def err_template_typedef : Error<"a typedef cannot be a template">;
4615def err_template_unnamed_class : Error<
4616 "cannot declare a class template with no name">;
4617def err_template_param_list_different_arity : Error<
4618 "%select{too few|too many}0 template parameters in template "
4619 "%select{|template parameter }1redeclaration">;
4620def note_template_param_list_different_arity : Note<
4621 "%select{too few|too many}0 template parameters in template template "
4622 "argument">;
4623def note_template_prev_declaration : Note<
4624 "previous template %select{declaration|template parameter}0 is here">;
4625def err_template_param_different_kind : Error<
4626 "template parameter has a different kind in template "
4627 "%select{|template parameter }0redeclaration">;
4628def note_template_param_different_kind : Note<
4629 "template parameter has a different kind in template argument">;
4630
4631def err_invalid_decl_specifier_in_nontype_parm : Error<
4632 "invalid declaration specifier in template non-type parameter">;
4633
4634def err_template_nontype_parm_different_type : Error<
4635 "template non-type parameter has a different type %0 in template "
4636 "%select{|template parameter }1redeclaration">;
4637
4638def note_template_nontype_parm_different_type : Note<
4639 "template non-type parameter has a different type %0 in template argument">;
4640def note_template_nontype_parm_prev_declaration : Note<
4641 "previous non-type template parameter with type %0 is here">;
4642def err_template_nontype_parm_bad_type : Error<
4643 "a non-type template parameter cannot have type %0">;
4644def err_template_nontype_parm_bad_structural_type : Error<
4645 "a non-type template parameter cannot have type %0 before C++20">;
4646def err_template_nontype_parm_incomplete : Error<
4647 "non-type template parameter has incomplete type %0">;
4648def err_template_nontype_parm_not_literal : Error<
4649 "non-type template parameter has non-literal type %0">;
4650def err_template_nontype_parm_rvalue_ref : Error<
4651 "non-type template parameter has rvalue reference type %0">;
4652def err_template_nontype_parm_not_structural : Error<
4653 "type %0 of non-type template parameter is not a structural type">;
4654def note_not_structural_non_public : Note<
4655 "%0 is not a structural type because it has a "
4656 "%select{non-static data member|base class}1 that is not public">;
4657def note_not_structural_mutable_field : Note<
4658 "%0 is not a structural type because it has a mutable "
4659 "non-static data member">;
4660def note_not_structural_rvalue_ref_field : Note<
4661 "%0 is not a structural type because it has a non-static data member "
4662 "of rvalue reference type">;
4663def note_not_structural_subobject : Note<
4664 "%0 is not a structural type because it has a "
4665 "%select{non-static data member|base class}1 of non-structural type %2">;
4666def warn_cxx17_compat_template_nontype_parm_type : Warning<
4667 "non-type template parameter of type %0 is incompatible with "
4668 "C++ standards before C++20">,
4669 DefaultIgnore, InGroup<CXXPre20Compat>;
4670def warn_cxx14_compat_template_nontype_parm_auto_type : Warning<
4671 "non-type template parameters declared with %0 are incompatible with C++ "
4672 "standards before C++17">,
4673 DefaultIgnore, InGroup<CXXPre17Compat>;
4674def err_template_param_default_arg_redefinition : Error<
4675 "template parameter redefines default argument">;
4676def note_template_param_prev_default_arg : Note<
4677 "previous default template argument defined here">;
4678def err_template_param_default_arg_missing : Error<
4679 "template parameter missing a default argument">;
4680def ext_template_parameter_default_in_function_template : ExtWarn<
4681 "default template arguments for a function template are a C++11 extension">,
4682 InGroup<CXX11>;
4683def warn_cxx98_compat_template_parameter_default_in_function_template : Warning<
4684 "default template arguments for a function template are incompatible with C++98">,
4685 InGroup<CXX98Compat>, DefaultIgnore;
4686def err_template_parameter_default_template_member : Error<
4687 "cannot add a default template argument to the definition of a member of a "
4688 "class template">;
4689def err_template_parameter_default_friend_template : Error<
4690 "default template argument not permitted on a friend template">;
4691def err_template_template_parm_no_parms : Error<
4692 "template template parameter must have its own template parameters">;
4693
4694def ext_variable_template : ExtWarn<"variable templates are a C++14 extension">,
4695 InGroup<CXX14>;
4696def warn_cxx11_compat_variable_template : Warning<
4697 "variable templates are incompatible with C++ standards before C++14">,
4698 InGroup<CXXPre14Compat>, DefaultIgnore;
4699def err_template_variable_noparams : Error<
4700 "extraneous 'template<>' in declaration of variable %0">;
4701def err_template_member : Error<"member %0 declared as a template">;
4702def err_template_member_noparams : Error<
4703 "extraneous 'template<>' in declaration of member %0">;
4704def err_template_tag_noparams : Error<
4705 "extraneous 'template<>' in declaration of %0 %1">;
4706
4707def warn_cxx17_compat_adl_only_template_id : Warning<
4708 "use of function template name with no prior function template "
4709 "declaration in function call with explicit template arguments "
4710 "is incompatible with C++ standards before C++20">,
4711 InGroup<CXXPre20Compat>, DefaultIgnore;
4712def ext_adl_only_template_id : ExtWarn<
4713 "use of function template name with no prior declaration in function call "
4714 "with explicit template arguments is a C++20 extension">, InGroup<CXX20>;
4715
4716// C++ Template Argument Lists
4717def err_template_missing_args : Error<
4718 "use of "
4719 "%select{class template|function template|variable template|alias template|"
4720 "template template parameter|concept|template}0 %1 requires template "
4721 "arguments">;
4722def err_template_arg_list_different_arity : Error<
4723 "%select{too few|too many}0 template arguments for "
4724 "%select{class template|function template|variable template|alias template|"
4725 "template template parameter|concept|template}1 %2">;
4726def note_template_decl_here : Note<"template is declared here">;
4727def err_template_arg_must_be_type : Error<
4728 "template argument for template type parameter must be a type">;
4729def err_template_arg_must_be_type_suggest : Error<
4730 "template argument for template type parameter must be a type; "
4731 "did you forget 'typename'?">;
4732def ext_ms_template_type_arg_missing_typename : ExtWarn<
4733 "template argument for template type parameter must be a type; "
4734 "omitted 'typename' is a Microsoft extension">,
4735 InGroup<MicrosoftTemplate>;
4736def err_template_arg_must_be_expr : Error<
4737 "template argument for non-type template parameter must be an expression">;
4738def err_template_arg_nontype_ambig : Error<
4739 "template argument for non-type template parameter is treated as function type %0">;
4740def err_template_arg_must_be_template : Error<
4741 "template argument for template template parameter must be a class template%select{| or type alias template}0">;
4742def ext_template_arg_local_type : ExtWarn<
4743 "template argument uses local type %0">, InGroup<LocalTypeTemplateArgs>;
4744def ext_template_arg_unnamed_type : ExtWarn<
4745 "template argument uses unnamed type">, InGroup<UnnamedTypeTemplateArgs>;
4746def warn_cxx98_compat_template_arg_local_type : Warning<
4747 "local type %0 as template argument is incompatible with C++98">,
4748 InGroup<CXX98CompatLocalTypeTemplateArgs>, DefaultIgnore;
4749def warn_cxx98_compat_template_arg_unnamed_type : Warning<
4750 "unnamed type as template argument is incompatible with C++98">,
4751 InGroup<CXX98CompatUnnamedTypeTemplateArgs>, DefaultIgnore;
4752def note_template_unnamed_type_here : Note<
4753 "unnamed type used in template argument was declared here">;
4754def err_template_arg_overload_type : Error<
4755 "template argument is the type of an unresolved overloaded function">;
4756def err_template_arg_not_valid_template : Error<
4757 "template argument does not refer to a class or alias template, or template "
4758 "template parameter">;
4759def note_template_arg_refers_here_func : Note<
4760 "template argument refers to function template %0, here">;
4761def err_template_arg_template_params_mismatch : Error<
4762 "template template argument has different template parameters than its "
4763 "corresponding template template parameter">;
4764def err_template_arg_not_integral_or_enumeral : Error<
4765 "non-type template argument of type %0 must have an integral or enumeration"
4766 " type">;
4767def err_template_arg_not_ice : Error<
4768 "non-type template argument of type %0 is not an integral constant "
4769 "expression">;
4770def err_template_arg_not_address_constant : Error<
4771 "non-type template argument of type %0 is not a constant expression">;
4772def warn_cxx98_compat_template_arg_null : Warning<
4773 "use of null pointer as non-type template argument is incompatible with "
4774 "C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4775def err_template_arg_untyped_null_constant : Error<
4776 "null non-type template argument must be cast to template parameter type %0">;
4777def err_template_arg_wrongtype_null_constant : Error<
4778 "null non-type template argument of type %0 does not match template parameter "
4779 "of type %1">;
4780def err_non_type_template_parm_type_deduction_failure : Error<
4781 "non-type template parameter %0 with type %1 has incompatible initializer of type %2">;
4782def err_deduced_non_type_template_arg_type_mismatch : Error<
4783 "deduced non-type template argument does not have the same type as the "
4784 "corresponding template parameter%diff{ ($ vs $)|}0,1">;
4785def err_non_type_template_arg_subobject : Error<
4786 "non-type template argument refers to subobject '%0'">;
4787def err_non_type_template_arg_addr_label_diff : Error<
4788 "template argument / label address difference / what did you expect?">;
4789def err_non_type_template_arg_unsupported : Error<
4790 "sorry, non-type template argument of type %0 is not yet supported">;
4791def err_template_arg_not_convertible : Error<
4792 "non-type template argument of type %0 cannot be converted to a value "
4793 "of type %1">;
4794def warn_template_arg_negative : Warning<
4795 "non-type template argument with value '%0' converted to '%1' for unsigned "
4796 "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4797def warn_template_arg_too_large : Warning<
4798 "non-type template argument value '%0' truncated to '%1' for "
4799 "template parameter of type %2">, InGroup<Conversion>, DefaultIgnore;
4800def err_template_arg_no_ref_bind : Error<
4801 "non-type template parameter of reference type "
4802 "%diff{$ cannot bind to template argument of type $"
4803 "|cannot bind to template of incompatible argument type}0,1">;
4804def err_template_arg_ref_bind_ignores_quals : Error<
4805 "reference binding of non-type template parameter "
4806 "%diff{of type $ to template argument of type $|to template argument}0,1 "
4807 "ignores qualifiers">;
4808def err_template_arg_not_decl_ref : Error<
4809 "non-type template argument does not refer to any declaration">;
4810def err_template_arg_not_address_of : Error<
4811 "non-type template argument for template parameter of pointer type %0 must "
4812 "have its address taken">;
4813def err_template_arg_address_of_non_pointer : Error<
4814 "address taken in non-type template argument for template parameter of "
4815 "reference type %0">;
4816def err_template_arg_reference_var : Error<
4817 "non-type template argument of reference type %0 is not an object">;
4818def err_template_arg_field : Error<
4819 "non-type template argument refers to non-static data member %0">;
4820def err_template_arg_method : Error<
4821 "non-type template argument refers to non-static member function %0">;
4822def err_template_arg_object_no_linkage : Error<
4823 "non-type template argument refers to %select{function|object}0 %1 that "
4824 "does not have linkage">;
4825def warn_cxx98_compat_template_arg_object_internal : Warning<
4826 "non-type template argument referring to %select{function|object}0 %1 with "
4827 "internal linkage is incompatible with C++98">,
4828 InGroup<CXX98Compat>, DefaultIgnore;
4829def ext_template_arg_object_internal : ExtWarn<
4830 "non-type template argument referring to %select{function|object}0 %1 with "
4831 "internal linkage is a C++11 extension">, InGroup<CXX11>;
4832def err_template_arg_thread_local : Error<
4833 "non-type template argument refers to thread-local object">;
4834def note_template_arg_internal_object : Note<
4835 "non-type template argument refers to %select{function|object}0 here">;
4836def note_template_arg_refers_here : Note<
4837 "non-type template argument refers here">;
4838def err_template_arg_not_object_or_func : Error<
4839 "non-type template argument does not refer to an object or function">;
4840def err_template_arg_not_pointer_to_member_form : Error<
4841 "non-type template argument is not a pointer to member constant">;
4842def err_template_arg_member_ptr_base_derived_not_supported : Error<
4843 "sorry, non-type template argument of pointer-to-member type %1 that refers "
4844 "to member %q0 of a different class is not supported yet">;
4845def ext_template_arg_extra_parens : ExtWarn<
4846 "address non-type template argument cannot be surrounded by parentheses">;
4847def warn_cxx98_compat_template_arg_extra_parens : Warning<
4848 "redundant parentheses surrounding address non-type template argument are "
4849 "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
4850def err_pointer_to_member_type : Error<
4851 "invalid use of pointer to member type after %select{.*|->*}0">;
4852def err_pointer_to_member_call_drops_quals : Error<
4853 "call to pointer to member function of type %0 drops '%1' qualifier%s2">;
4854def err_pointer_to_member_oper_value_classify: Error<
4855 "pointer-to-member function type %0 can only be called on an "
4856 "%select{rvalue|lvalue}1">;
4857def ext_pointer_to_const_ref_member_on_rvalue : Extension<
4858 "invoking a pointer to a 'const &' member function on an rvalue is a C++20 extension">,
4859 InGroup<CXX20>, SFINAEFailure;
4860def warn_cxx17_compat_pointer_to_const_ref_member_on_rvalue : Warning<
4861 "invoking a pointer to a 'const &' member function on an rvalue is "
4862 "incompatible with C++ standards before C++20">,
4863 InGroup<CXXPre20CompatPedantic>, DefaultIgnore;
4864def ext_ms_deref_template_argument: ExtWarn<
4865 "non-type template argument containing a dereference operation is a "
4866 "Microsoft extension">, InGroup<MicrosoftTemplate>;
4867def ext_ms_delayed_template_argument: ExtWarn<
4868 "using the undeclared type %0 as a default template argument is a "
4869 "Microsoft extension">, InGroup<MicrosoftTemplate>;
4870def err_template_arg_deduced_incomplete_pack : Error<
4871 "deduced incomplete pack %0 for template parameter %1">;
4872
4873// C++ template specialization
4874def err_template_spec_unknown_kind : Error<
4875 "can only provide an explicit specialization for a class template, function "
4876 "template, variable template, or a member function, static data member, "
4877 "%select{or member class|member class, or member enumeration}0 of a "
4878 "class template">;
4879def note_specialized_entity : Note<
4880 "explicitly specialized declaration is here">;
4881def note_explicit_specialization_declared_here : Note<
4882 "explicit specialization declared here">;
4883def err_template_spec_decl_function_scope : Error<
4884 "explicit specialization of %0 in function scope">;
4885def err_template_spec_decl_friend : Error<
4886 "cannot declare an explicit specialization in a friend">;
4887def err_template_spec_redecl_out_of_scope : Error<
4888 "%select{class template|class template partial|variable template|"
4889 "variable template partial|function template|member "
4890 "function|static data member|member class|member enumeration}0 "
4891 "specialization of %1 not in %select{a namespace enclosing %2|"
4892 "class %2 or an enclosing namespace}3">;
4893def ext_ms_template_spec_redecl_out_of_scope: ExtWarn<
4894 "%select{class template|class template partial|variable template|"
4895 "variable template partial|function template|member "
4896 "function|static data member|member class|member enumeration}0 "
4897 "specialization of %1 not in %select{a namespace enclosing %2|"
4898 "class %2 or an enclosing namespace}3 "
4899 "is a Microsoft extension">, InGroup<MicrosoftTemplate>;
4900def err_template_spec_redecl_global_scope : Error<
4901 "%select{class template|class template partial|variable template|"
4902 "variable template partial|function template|member "
4903 "function|static data member|member class|member enumeration}0 "
4904 "specialization of %1 must occur at global scope">;
4905def err_spec_member_not_instantiated : Error<
4906 "specialization of member %q0 does not specialize an instantiated member">;
4907def note_specialized_decl : Note<"attempt to specialize declaration here">;
4908def err_specialization_after_instantiation : Error<
4909 "explicit specialization of %0 after instantiation">;
4910def note_instantiation_required_here : Note<
4911 "%select{implicit|explicit}0 instantiation first required here">;
4912def err_template_spec_friend : Error<
4913 "template specialization declaration cannot be a friend">;
4914def err_template_spec_default_arg : Error<
4915 "default argument not permitted on an explicit "
4916 "%select{instantiation|specialization}0 of function %1">;
4917def err_not_class_template_specialization : Error<
4918 "cannot specialize a %select{dependent template|template template "
4919 "parameter}0">;
4920def ext_explicit_specialization_storage_class : ExtWarn<
4921 "explicit specialization cannot have a storage class">;
4922def err_explicit_specialization_inconsistent_storage_class : Error<
4923 "explicit specialization has extraneous, inconsistent storage class "
4924 "'%select{none|extern|static|__private_extern__|auto|register}0'">;
4925def err_dependent_function_template_spec_no_match : Error<
4926 "no candidate function template was found for dependent"
4927 " friend function template specialization">;
4928def note_dependent_function_template_spec_discard_reason : Note<
4929 "candidate ignored: %select{not a function template"
4930 "|not a member of the enclosing namespace;"
4931 " did you mean to explicitly qualify the specialization?}0">;
4932
4933// C++ class template specializations and out-of-line definitions
4934def err_template_spec_needs_header : Error<
4935 "template specialization requires 'template<>'">;
4936def err_template_spec_needs_template_parameters : Error<
4937 "template specialization or definition requires a template parameter list "
4938 "corresponding to the nested type %0">;
4939def err_template_param_list_matches_nontemplate : Error<
4940 "template parameter list matching the non-templated nested type %0 should "
4941 "be empty ('template<>')">;
4942def err_alias_template_extra_headers : Error<
4943 "extraneous template parameter list in alias template declaration">;
4944def err_template_spec_extra_headers : Error<
4945 "extraneous template parameter list in template specialization or "
4946 "out-of-line template definition">;
4947def warn_template_spec_extra_headers : Warning<
4948 "extraneous template parameter list in template specialization">;
4949def note_explicit_template_spec_does_not_need_header : Note<
4950 "'template<>' header not required for explicitly-specialized class %0 "
4951 "declared here">;
4952def err_template_qualified_declarator_no_match : Error<
4953 "nested name specifier '%0' for declaration does not refer into a class, "
4954 "class template or class template partial specialization">;
4955def err_specialize_member_of_template : Error<
4956 "cannot specialize %select{|(with 'template<>') }0a member of an "
4957 "unspecialized template">;
4958
4959// C++ Class Template Partial Specialization
4960def err_default_arg_in_partial_spec : Error<
4961 "default template argument in a class template partial specialization">;
4962def err_dependent_non_type_arg_in_partial_spec : Error<
4963 "type of specialized non-type template argument depends on a template "
4964 "parameter of the partial specialization">;
4965def note_dependent_non_type_default_arg_in_partial_spec : Note<
4966 "template parameter is used in default argument declared here">;
4967def err_dependent_typed_non_type_arg_in_partial_spec : Error<
4968 "non-type template argument specializes a template parameter with "
4969 "dependent type %0">;
4970def err_partial_spec_args_match_primary_template : Error<
4971 "%select{class|variable}0 template partial specialization does not "
4972 "specialize any template argument; to %select{declare|define}1 the "
4973 "primary template, remove the template argument list">;
4974def ext_partial_spec_not_more_specialized_than_primary : ExtWarn<
4975 "%select{class|variable}0 template partial specialization is not "
4976 "more specialized than the primary template">, DefaultError,
4977 InGroup<DiagGroup<"invalid-partial-specialization">>;
4978def note_partial_spec_not_more_specialized_than_primary : Note<"%0">;
4979def ext_partial_specs_not_deducible : ExtWarn<
4980 "%select{class|variable}0 template partial specialization contains "
4981 "%select{a template parameter|template parameters}1 that cannot be "
4982 "deduced; this partial specialization will never be used">,
4983 DefaultError, InGroup<DiagGroup<"unusable-partial-specialization">>;
4984def note_non_deducible_parameter : Note<
4985 "non-deducible template parameter %0">;
4986def err_partial_spec_ordering_ambiguous : Error<
4987 "ambiguous partial specializations of %0">;
4988def note_partial_spec_match : Note<"partial specialization matches %0">;
4989def err_partial_spec_redeclared : Error<
4990 "class template partial specialization %0 cannot be redeclared">;
4991def note_partial_specialization_declared_here : Note<
4992 "explicit specialization declared here">;
4993def note_prev_partial_spec_here : Note<
4994 "previous declaration of class template partial specialization %0 is here">;
4995def err_partial_spec_fully_specialized : Error<
4996 "partial specialization of %0 does not use any of its template parameters">;
4997
4998// C++ Variable Template Partial Specialization
4999def err_var_partial_spec_redeclared : Error<
5000 "variable template partial specialization %0 cannot be redefined">;
5001def note_var_prev_partial_spec_here : Note<
5002 "previous declaration of variable template partial specialization is here">;
5003def err_var_spec_no_template : Error<
5004 "no variable template matches%select{| partial}0 specialization">;
5005def err_var_spec_no_template_but_method : Error<
5006 "no variable template matches specialization; "
5007 "did you mean to use %0 as function template instead?">;
5008
5009// C++ Function template specializations
5010def err_function_template_spec_no_match : Error<
5011 "no function template matches function template specialization %0">;
5012def err_function_template_spec_ambiguous : Error<
5013 "function template specialization %0 ambiguously refers to more than one "
5014 "function template; explicitly specify%select{| additional}1 template "
5015 "arguments to identify a particular function template">;
5016def note_function_template_spec_matched : Note<
5017 "function template %q0 matches specialization %1">;
5018def err_function_template_partial_spec : Error<
5019 "function template partial specialization is not allowed">;
5020
5021// C++ Template Instantiation
5022def err_template_recursion_depth_exceeded : Error<
5023 "recursive template instantiation exceeded maximum depth of %0">,
5024 DefaultFatal, NoSFINAE;
5025def note_template_recursion_depth : Note<
5026 "use -ftemplate-depth=N to increase recursive template instantiation depth">;
5027
5028def err_template_instantiate_within_definition : Error<
5029 "%select{implicit|explicit}0 instantiation of template %1 within its"
5030 " own definition">;
5031def err_template_instantiate_undefined : Error<
5032 "%select{implicit|explicit}0 instantiation of undefined template %1">;
5033def err_implicit_instantiate_member_undefined : Error<
5034 "implicit instantiation of undefined member %0">;
5035def note_template_class_instantiation_was_here : Note<
5036 "class template %0 was instantiated here">;
5037def note_template_class_explicit_specialization_was_here : Note<
5038 "class template %0 was explicitly specialized here">;
5039def note_template_class_instantiation_here : Note<
5040 "in instantiation of template class %q0 requested here">;
5041def note_template_member_class_here : Note<
5042 "in instantiation of member class %q0 requested here">;
5043def note_template_member_function_here : Note<
5044 "in instantiation of member function %q0 requested here">;
5045def note_function_template_spec_here : Note<
5046 "in instantiation of function template specialization %q0 requested here">;
5047def note_template_static_data_member_def_here : Note<
5048 "in instantiation of static data member %q0 requested here">;
5049def note_template_variable_def_here : Note<
5050 "in instantiation of variable template specialization %q0 requested here">;
5051def note_template_enum_def_here : Note<
5052 "in instantiation of enumeration %q0 requested here">;
5053def note_template_nsdmi_here : Note<
5054 "in instantiation of default member initializer %q0 requested here">;
5055def note_template_type_alias_instantiation_here : Note<
5056 "in instantiation of template type alias %0 requested here">;
5057def note_template_exception_spec_instantiation_here : Note<
5058 "in instantiation of exception specification for %0 requested here">;
5059def note_template_requirement_instantiation_here : Note<
5060 "in instantiation of requirement here">;
5061def warn_var_template_missing : Warning<"instantiation of variable %q0 "
5062 "required here, but no definition is available">,
5063 InGroup<UndefinedVarTemplate>;
5064def warn_func_template_missing : Warning<"instantiation of function %q0 "
5065 "required here, but no definition is available">,
5066 InGroup<UndefinedFuncTemplate>, DefaultIgnore;
5067def note_forward_template_decl : Note<
5068 "forward declaration of template entity is here">;
5069def note_inst_declaration_hint : Note<"add an explicit instantiation "
5070 "declaration to suppress this warning if %q0 is explicitly instantiated in "
5071 "another translation unit">;
5072def note_evaluating_exception_spec_here : Note<
5073 "in evaluation of exception specification for %q0 needed here">;
5074
5075def note_default_arg_instantiation_here : Note<
5076 "in instantiation of default argument for '%0' required here">;
5077def note_default_function_arg_instantiation_here : Note<
5078 "in instantiation of default function argument expression "
5079 "for '%0' required here">;
5080def note_explicit_template_arg_substitution_here : Note<
5081 "while substituting explicitly-specified template arguments into function "
5082 "template %0 %1">;
5083def note_function_template_deduction_instantiation_here : Note<
5084 "while substituting deduced template arguments into function template %0 "
5085 "%1">;
5086def note_deduced_template_arg_substitution_here : Note<
5087 "during template argument deduction for %select{class|variable}0 template "
5088 "%select{partial specialization |}1%2 %3">;
5089def note_prior_template_arg_substitution : Note<
5090 "while substituting prior template arguments into %select{non-type|template}0"
5091 " template parameter%1 %2">;
5092def note_template_default_arg_checking : Note<
5093 "while checking a default template argument used here">;
5094def note_concept_specialization_here : Note<
5095 "while checking the satisfaction of concept '%0' requested here">;
5096def note_nested_requirement_here : Note<
5097 "while checking the satisfaction of nested requirement requested here">;
5098def note_checking_constraints_for_template_id_here : Note<
5099 "while checking constraint satisfaction for template '%0' required here">;
5100def note_checking_constraints_for_var_spec_id_here : Note<
5101 "while checking constraint satisfaction for variable template "
5102 "partial specialization '%0' required here">;
5103def note_checking_constraints_for_class_spec_id_here : Note<
5104 "while checking constraint satisfaction for class template partial "
5105 "specialization '%0' required here">;
5106def note_checking_constraints_for_function_here : Note<
5107 "while checking constraint satisfaction for function '%0' required here">;
5108def note_constraint_substitution_here : Note<
5109 "while substituting template arguments into constraint expression here">;
5110def note_constraint_normalization_here : Note<
5111 "while calculating associated constraint of template '%0' here">;
5112def note_parameter_mapping_substitution_here : Note<
5113 "while substituting into concept arguments here; substitution failures not "
5114 "allowed in concept arguments">;
5115def note_instantiation_contexts_suppressed : Note<
5116 "(skipping %0 context%s0 in backtrace; use -ftemplate-backtrace-limit=0 to "
5117 "see all)">;
5118
5119def err_field_instantiates_to_function : Error<
5120 "data member instantiated with function type %0">;
5121def err_variable_instantiates_to_function : Error<
5122 "%select{variable|static data member}0 instantiated with function type %1">;
5123def err_nested_name_spec_non_tag : Error<
5124 "type %0 cannot be used prior to '::' because it has no members">;
5125
5126def err_using_pack_expansion_empty : Error<
5127 "%select{|member}0 using declaration %1 instantiates to an empty pack">;
5128
5129// C++ Explicit Instantiation
5130def err_explicit_instantiation_duplicate : Error<
5131 "duplicate explicit instantiation of %0">;
5132def ext_explicit_instantiation_duplicate : ExtWarn<
5133 "duplicate explicit instantiation of %0 ignored as a Microsoft extension">,
5134 InGroup<MicrosoftTemplate>;
5135def note_previous_explicit_instantiation : Note<
5136 "previous explicit instantiation is here">;
5137def warn_explicit_instantiation_after_specialization : Warning<
5138 "explicit instantiation of %0 that occurs after an explicit "
5139 "specialization has no effect">,
5140 InGroup<DiagGroup<"instantiation-after-specialization">>;
5141def note_previous_template_specialization : Note<
5142 "previous template specialization is here">;
5143def err_explicit_instantiation_nontemplate_type : Error<
5144 "explicit instantiation of non-templated type %0">;
5145def note_nontemplate_decl_here : Note<
5146 "non-templated declaration is here">;
5147def err_explicit_instantiation_in_class : Error<
5148 "explicit instantiation of %0 in class scope">;
5149def err_explicit_instantiation_out_of_scope : Error<
5150 "explicit instantiation of %0 not in a namespace enclosing %1">;
5151def err_explicit_instantiation_must_be_global : Error<
5152 "explicit instantiation of %0 must occur at global scope">;
5153def warn_explicit_instantiation_out_of_scope_0x : Warning<
5154 "explicit instantiation of %0 not in a namespace enclosing %1">,
5155 InGroup<CXX11Compat>, DefaultIgnore;
5156def warn_explicit_instantiation_must_be_global_0x : Warning<
5157 "explicit instantiation of %0 must occur at global scope">,
5158 InGroup<CXX11Compat>, DefaultIgnore;
5159
5160def err_explicit_instantiation_requires_name : Error<
5161 "explicit instantiation declaration requires a name">;
5162def err_explicit_instantiation_of_typedef : Error<
5163 "explicit instantiation of typedef %0">;
5164def err_explicit_instantiation_storage_class : Error<
5165 "explicit instantiation cannot have a storage class">;
5166def err_explicit_instantiation_internal_linkage : Error<
5167 "explicit instantiation declaration of %0 with internal linkage">;
5168def err_explicit_instantiation_not_known : Error<
5169 "explicit instantiation of %0 does not refer to a function template, "
5170 "variable template, member function, member class, or static data member">;
5171def note_explicit_instantiation_here : Note<
5172 "explicit instantiation refers here">;
5173def err_explicit_instantiation_data_member_not_instantiated : Error<
5174 "explicit instantiation refers to static data member %q0 that is not an "
5175 "instantiation">;
5176def err_explicit_instantiation_member_function_not_instantiated : Error<
5177 "explicit instantiation refers to member function %q0 that is not an "
5178 "instantiation">;
5179def err_explicit_instantiation_ambiguous : Error<
5180 "partial ordering for explicit instantiation of %0 is ambiguous">;
5181def note_explicit_instantiation_candidate : Note<
5182 "explicit instantiation candidate function %q0 template here %1">;
5183def err_explicit_instantiation_inline : Error<
5184 "explicit instantiation cannot be 'inline'">;
5185def warn_explicit_instantiation_inline_0x : Warning<
5186 "explicit instantiation cannot be 'inline'">, InGroup<CXX11Compat>,
5187 DefaultIgnore;
5188def err_explicit_instantiation_constexpr : Error<
5189 "explicit instantiation cannot be 'constexpr'">;
5190def ext_explicit_instantiation_without_qualified_id : Extension<
5191 "qualifier in explicit instantiation of %q0 requires a template-id "
5192 "(a typedef is not permitted)">;
5193def err_explicit_instantiation_without_template_id : Error<
5194 "explicit instantiation of %q0 must specify a template argument list">;
5195def err_explicit_instantiation_unqualified_wrong_namespace : Error<
5196 "explicit instantiation of %q0 must occur in namespace %1">;
5197def warn_explicit_instantiation_unqualified_wrong_namespace_0x : Warning<
5198 "explicit instantiation of %q0 must occur in namespace %1">,
5199 InGroup<CXX11Compat>, DefaultIgnore;
5200def err_explicit_instantiation_undefined_member : Error<
5201 "explicit instantiation of undefined %select{member class|member function|"
5202 "static data member}0 %1 of class template %2">;
5203def err_explicit_instantiation_undefined_func_template : Error<
5204 "explicit instantiation of undefined function template %0">;
5205def err_explicit_instantiation_undefined_var_template : Error<
5206 "explicit instantiation of undefined variable template %q0">;
5207def err_explicit_instantiation_declaration_after_definition : Error<
5208 "explicit instantiation declaration (with 'extern') follows explicit "
5209 "instantiation definition (without 'extern')">;
5210def note_explicit_instantiation_definition_here : Note<
5211 "explicit instantiation definition is here">;
5212def err_invalid_var_template_spec_type : Error<"type %2 "
5213 "of %select{explicit instantiation|explicit specialization|"
5214 "partial specialization|redeclaration}0 of %1 does not match"
5215 " expected type %3">;
5216def err_mismatched_exception_spec_explicit_instantiation : Error<
5217 "exception specification in explicit instantiation does not match "
5218 "instantiated one">;
5219def ext_mismatched_exception_spec_explicit_instantiation : ExtWarn<
5220 err_mismatched_exception_spec_explicit_instantiation.Text>,
5221 InGroup<MicrosoftExceptionSpec>;
5222def err_explicit_instantiation_dependent : Error<
5223 "explicit instantiation has dependent template arguments">;
5224
5225// C++ typename-specifiers
5226def err_typename_nested_not_found : Error<"no type named %0 in %1">;
5227def err_typename_nested_not_found_enable_if : Error<
5228 "no type named 'type' in %0; 'enable_if' cannot be used to disable "
5229 "this declaration">;
5230def err_typename_nested_not_found_requirement : Error<
5231 "failed requirement '%0'; 'enable_if' cannot be used to disable this "
5232 "declaration">;
5233def err_typename_nested_not_type : Error<
5234 "typename specifier refers to non-type member %0 in %1">;
5235def err_typename_not_type : Error<
5236 "typename specifier refers to non-type %0">;
5237def note_typename_member_refers_here : Note<
5238 "referenced member %0 is declared here">;
5239def note_typename_refers_here : Note<
5240 "referenced %0 is declared here">;
5241def err_typename_missing : Error<
5242 "missing 'typename' prior to dependent type name '%0%1'">;
5243def err_typename_missing_template : Error<
5244 "missing 'typename' prior to dependent type template name '%0%1'">;
5245def ext_typename_missing : ExtWarn<
5246 "missing 'typename' prior to dependent type name '%0%1'">,
5247 InGroup<DiagGroup<"typename-missing">>;
5248def ext_typename_outside_of_template : ExtWarn<
5249 "'typename' occurs outside of a template">, InGroup<CXX11>;
5250def warn_cxx98_compat_typename_outside_of_template : Warning<
5251 "use of 'typename' outside of a template is incompatible with C++98">,
5252 InGroup<CXX98Compat>, DefaultIgnore;
5253def err_typename_refers_to_using_value_decl : Error<
5254 "typename specifier refers to a dependent using declaration for a value "
5255 "%0 in %1">;
5256def note_using_value_decl_missing_typename : Note<
5257 "add 'typename' to treat this using declaration as a type">;
5258
5259def err_template_kw_refers_to_non_template : Error<
5260 "%0%select{| following the 'template' keyword}1 "
5261 "does not refer to a template">;
5262def note_template_kw_refers_to_non_template : Note<
5263 "declared as a non-template here">;
5264def err_template_kw_refers_to_dependent_non_template : Error<
5265 "%0%select{| following the 'template' keyword}1 "
5266 "cannot refer to a dependent template">;
5267def err_template_kw_refers_to_class_template : Error<
5268 "'%0%1' instantiated to a class template, not a function template">;
5269def note_referenced_class_template : Note<
5270 "class template declared here">;
5271def err_template_kw_missing : Error<
5272 "missing 'template' keyword prior to dependent template name '%0%1'">;
5273def ext_template_outside_of_template : ExtWarn<
5274 "'template' keyword outside of a template">, InGroup<CXX11>;
5275def warn_cxx98_compat_template_outside_of_template : Warning<
5276 "use of 'template' keyword outside of a template is incompatible with C++98">,
5277 InGroup<CXX98Compat>, DefaultIgnore;
5278
5279def err_non_type_template_in_nested_name_specifier : Error<
5280 "qualified name refers into a specialization of %select{function|variable}0 "
5281 "template %1">;
5282def err_template_id_not_a_type : Error<
5283 "template name refers to non-type template %0">;
5284def note_template_declared_here : Note<
5285 "%select{function template|class template|variable template"
5286 "|type alias template|template template parameter}0 "
5287 "%1 declared here">;
5288def err_template_expansion_into_fixed_list : Error<
5289 "pack expansion used as argument for non-pack parameter of %select{alias "
5290 "template|concept}0">;
5291def note_parameter_type : Note<
5292 "parameter of type %0 is declared here">;
5293
5294// C++11 Variadic Templates
5295def err_template_param_pack_default_arg : Error<
5296 "template parameter pack cannot have a default argument">;
5297def err_template_param_pack_must_be_last_template_parameter : Error<
5298 "template parameter pack must be the last template parameter">;
5299
5300def err_template_parameter_pack_non_pack : Error<
5301 "%select{template type|non-type template|template template}0 parameter"
5302 "%select{| pack}1 conflicts with previous %select{template type|"
5303 "non-type template|template template}0 parameter%select{ pack|}1">;
5304def note_template_parameter_pack_non_pack : Note<
5305 "%select{template type|non-type template|template template}0 parameter"
5306 "%select{| pack}1 does not match %select{template type|non-type template"
5307 "|template template}0 parameter%select{ pack|}1 in template argument">;
5308def note_template_parameter_pack_here : Note<
5309 "previous %select{template type|non-type template|template template}0 "
5310 "parameter%select{| pack}1 declared here">;
5311
5312def err_unexpanded_parameter_pack : Error<
5313 "%select{expression|base type|declaration type|data member type|bit-field "
5314 "size|static assertion|fixed underlying type|enumerator value|"
5315 "using declaration|friend declaration|qualifier|initializer|default argument|"
5316 "non-type template parameter type|exception type|partial specialization|"
5317 "__if_exists name|__if_not_exists name|lambda|block|type constraint|"
5318 "requirement|requires clause}0 "
5319 "contains%plural{0: an|:}1 unexpanded parameter pack"
5320 "%plural{0:|1: %2|2:s %2 and %3|:s %2, %3, ...}1">;
5321
5322def err_pack_expansion_without_parameter_packs : Error<
5323 "pack expansion does not contain any unexpanded parameter packs">;
5324def err_pack_expansion_length_conflict : Error<
5325 "pack expansion contains parameter packs %0 and %1 that have different "
5326 "lengths (%2 vs. %3)">;
5327def err_pack_expansion_length_conflict_multilevel : Error<
5328 "pack expansion contains parameter pack %0 that has a different "
5329 "length (%1 vs. %2) from outer parameter packs">;
5330def err_pack_expansion_length_conflict_partial : Error<
5331 "pack expansion contains parameter pack %0 that has a different "
5332 "length (at least %1 vs. %2) from outer parameter packs">;
5333def err_pack_expansion_member_init : Error<
5334 "pack expansion for initialization of member %0">;
5335
5336def err_function_parameter_pack_without_parameter_packs : Error<
5337 "type %0 of function parameter pack does not contain any unexpanded "
5338 "parameter packs">;
5339def err_ellipsis_in_declarator_not_parameter : Error<
5340 "only function and template parameters can be parameter packs">;
5341
5342def err_sizeof_pack_no_pack_name : Error<
5343 "%0 does not refer to the name of a parameter pack">;
5344
5345def err_fold_expression_packs_both_sides : Error<
5346 "binary fold expression has unexpanded parameter packs in both operands">;
5347def err_fold_expression_empty : Error<
5348 "unary fold expression has empty expansion for operator '%0' "
5349 "with no fallback value">;
5350def err_fold_expression_bad_operand : Error<
5351 "expression not permitted as operand of fold expression">;
5352def err_fold_expression_limit_exceeded: Error<
5353 "instantiating fold expression with %0 arguments exceeded expression nesting "
5354 "limit of %1">, DefaultFatal, NoSFINAE;
5355
5356def err_unexpected_typedef : Error<
5357 "unexpected type name %0: expected expression">;
5358def err_unexpected_namespace : Error<
5359 "unexpected namespace name %0: expected expression">;
5360def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
5361def ext_undeclared_unqual_id_with_dependent_base : ExtWarn<
5362 "use of undeclared identifier %0; "
5363 "unqualified lookup into dependent bases of class template %1 is a Microsoft extension">,
5364 InGroup<MicrosoftTemplate>;
5365def err_found_in_dependent_base : Error<
5366 "explicit qualification required to use member %0 from dependent base class">;
5367def ext_found_in_dependent_base : ExtWarn<"use of member %0 "
5368 "found via unqualified lookup into dependent bases of class templates is a "
5369 "Microsoft extension">, InGroup<MicrosoftTemplate>;
5370def err_found_later_in_class : Error<"member %0 used before its declaration">;
5371def ext_found_later_in_class : ExtWarn<
5372 "use of member %0 before its declaration is a Microsoft extension">,
5373 InGroup<MicrosoftTemplate>;
5374def note_dependent_member_use : Note<
5375 "must qualify identifier to find this declaration in dependent base class">;
5376def err_not_found_by_two_phase_lookup : Error<"call to function %0 that is neither "
5377 "visible in the template definition nor found by argument-dependent lookup">;
5378def note_not_found_by_two_phase_lookup : Note<"%0 should be declared prior to the "
5379 "call site%select{| or in %2| or in an associated namespace of one of its arguments}1">;
5380def err_undeclared_use : Error<"use of undeclared %0">;
5381def warn_deprecated : Warning<"%0 is deprecated">,
5382 InGroup<DeprecatedDeclarations>;
5383def note_from_diagnose_if : Note<"from 'diagnose_if' attribute on %0:">;
5384def warn_property_method_deprecated :
5385 Warning<"property access is using %0 method which is deprecated">,
5386 InGroup<DeprecatedDeclarations>;
5387def warn_deprecated_message : Warning<"%0 is deprecated: %1">,
5388 InGroup<DeprecatedDeclarations>;
5389def warn_deprecated_anonymous_namespace : Warning<
5390 "'deprecated' attribute on anonymous namespace ignored">,
5391 InGroup<IgnoredAttributes>;
5392def warn_deprecated_fwdclass_message : Warning<
5393 "%0 may be deprecated because the receiver type is unknown">,
5394 InGroup<DeprecatedDeclarations>;
5395def warn_deprecated_def : Warning<
5396 "implementing deprecated %select{method|class|category}0">,
5397 InGroup<DeprecatedImplementations>, DefaultIgnore;
5398def warn_unavailable_def : Warning<
5399 "implementing unavailable method">,
5400 InGroup<DeprecatedImplementations>, DefaultIgnore;
5401def err_unavailable : Error<"%0 is unavailable">;
5402def err_property_method_unavailable :
5403 Error<"property access is using %0 method which is unavailable">;
5404def err_unavailable_message : Error<"%0 is unavailable: %1">;
5405def warn_unavailable_fwdclass_message : Warning<
5406 "%0 may be unavailable because the receiver type is unknown">,
5407 InGroup<UnavailableDeclarations>;
5408def note_availability_specified_here : Note<
5409 "%0 has been explicitly marked "
5410 "%select{unavailable|deleted|deprecated}1 here">;
5411def note_partial_availability_specified_here : Note<
5412 "%0 has been marked as being introduced in %1 %2 here, "
5413 "but the deployment target is %1 %3">;
5414def note_implicitly_deleted : Note<
5415 "explicitly defaulted function was implicitly deleted here">;
5416def warn_not_enough_argument : Warning<
5417 "not enough variable arguments in %0 declaration to fit a sentinel">,
5418 InGroup<Sentinel>;
5419def warn_missing_sentinel : Warning <
5420 "missing sentinel in %select{function call|method dispatch|block call}0">,
5421 InGroup<Sentinel>;
5422def note_sentinel_here : Note<
5423 "%select{function|method|block}0 has been explicitly marked sentinel here">;
5424def warn_missing_prototype : Warning<
5425 "no previous prototype for function %0">,
5426 InGroup<DiagGroup<"missing-prototypes">>, DefaultIgnore;
5427def note_declaration_not_a_prototype : Note<
5428 "this declaration is not a prototype; add %select{'void'|parameter declarations}0 "
5429 "to make it %select{a prototype for a zero-parameter function|one}0">;
5430def warn_strict_prototypes : Warning<
5431 "this %select{function declaration is not|block declaration is not|"
5432 "old-style function definition is not preceded by}0 a prototype">,
5433 InGroup<DiagGroup<"strict-prototypes">>, DefaultIgnore;
5434def warn_missing_variable_declarations : Warning<
5435 "no previous extern declaration for non-static variable %0">,
5436 InGroup<DiagGroup<"missing-variable-declarations">>, DefaultIgnore;
5437def note_static_for_internal_linkage : Note<
5438 "declare 'static' if the %select{variable|function}0 is not intended to be "
5439 "used outside of this translation unit">;
5440def err_static_data_member_reinitialization :
5441 Error<"static data member %0 already has an initializer">;
5442def err_redefinition : Error<"redefinition of %0">;
5443def err_alias_after_tentative :
5444 Error<"alias definition of %0 after tentative definition">;
5445def err_alias_is_definition :
5446 Error<"definition %0 cannot also be an %select{alias|ifunc}1">;
5447def err_definition_of_implicitly_declared_member : Error<
5448 "definition of implicitly declared %select{default constructor|copy "
5449 "constructor|move constructor|copy assignment operator|move assignment "
5450 "operator|destructor|function}1">;
5451def err_definition_of_explicitly_defaulted_member : Error<
5452 "definition of explicitly defaulted %select{default constructor|copy "
5453 "constructor|move constructor|copy assignment operator|move assignment "
5454 "operator|destructor|function}0">;
5455def err_redefinition_extern_inline : Error<
5456 "redefinition of a 'extern inline' function %0 is not supported in "
5457 "%select{C99 mode|C++}1">;
5458def warn_attr_abi_tag_namespace : Warning<
5459 "'abi_tag' attribute on %select{non-inline|anonymous}0 namespace ignored">,
5460 InGroup<IgnoredAttributes>;
5461def err_abi_tag_on_redeclaration : Error<
5462 "cannot add 'abi_tag' attribute in a redeclaration">;
5463def err_new_abi_tag_on_redeclaration : Error<
5464 "'abi_tag' %0 missing in original declaration">;
5465def note_use_ifdef_guards : Note<
5466 "unguarded header; consider using #ifdef guards or #pragma once">;
5467
5468def note_deleted_dtor_no_operator_delete : Note<
5469 "virtual destructor requires an unambiguous, accessible 'operator delete'">;
5470def note_deleted_special_member_class_subobject : Note<
5471 "%select{default constructor of|copy constructor of|move constructor of|"
5472 "copy assignment operator of|move assignment operator of|destructor of|"
5473 "constructor inherited by}0 "
5474 "%1 is implicitly deleted because "
5475 "%select{base class %3|%select{||||variant }4field %3}2 "
5476 "%select{has "
5477 "%select{no|a deleted|multiple|an inaccessible|a non-trivial}4 "
5478 "%select{%select{default constructor|copy constructor|move constructor|copy "
5479 "assignment operator|move assignment operator|destructor|"
5480 "%select{default|corresponding|default|default|default}4 constructor}0|"
5481 "destructor}5"
5482 "%select{||s||}4"
5483 "|is an ObjC pointer}6">;
5484def note_deleted_default_ctor_uninit_field : Note<
5485 "%select{default constructor of|constructor inherited by}0 "
5486 "%1 is implicitly deleted because field %2 of "
5487 "%select{reference|const-qualified}4 type %3 would not be initialized">;
5488def note_deleted_default_ctor_all_const : Note<
5489 "%select{default constructor of|constructor inherited by}0 "
5490 "%1 is implicitly deleted because all "
5491 "%select{data members|data members of an anonymous union member}2"
5492 " are const-qualified">;
5493def note_deleted_copy_ctor_rvalue_reference : Note<
5494 "copy constructor of %0 is implicitly deleted because field %1 is of "
5495 "rvalue reference type %2">;
5496def note_deleted_copy_user_declared_move : Note<
5497 "copy %select{constructor|assignment operator}0 is implicitly deleted because"
5498 " %1 has a user-declared move %select{constructor|assignment operator}2">;
5499def note_deleted_assign_field : Note<
5500 "%select{copy|move}0 assignment operator of %1 is implicitly deleted "
5501 "because field %2 is of %select{reference|const-qualified}4 type %3">;
5502
5503// These should be errors.
5504def warn_undefined_internal : Warning<
5505 "%select{function|variable}0 %q1 has internal linkage but is not defined">,
5506 InGroup<DiagGroup<"undefined-internal">>;
5507def err_undefined_internal_type : Error<
5508 "%select{function|variable}0 %q1 is used but not defined in this "
5509 "translation unit, and cannot be defined in any other translation unit "
5510 "because its type does not have linkage">;
5511def ext_undefined_internal_type : Extension<
5512 "ISO C++ requires a definition in this translation unit for "
5513 "%select{function|variable}0 %q1 because its type does not have linkage">,
5514 InGroup<DiagGroup<"undefined-internal-type">>;
5515def warn_undefined_inline : Warning<"inline function %q0 is not defined">,
5516 InGroup<DiagGroup<"undefined-inline">>;
5517def err_undefined_inline_var : Error<"inline variable %q0 is not defined">;
5518def note_used_here : Note<"used here">;
5519
5520def err_internal_linkage_redeclaration : Error<
5521 "'internal_linkage' attribute does not appear on the first declaration of %0">;
5522def warn_internal_linkage_local_storage : Warning<
5523 "'internal_linkage' attribute on a non-static local variable is ignored">,
5524 InGroup<IgnoredAttributes>;
5525
5526def ext_internal_in_extern_inline : ExtWarn<
5527 "static %select{function|variable}0 %1 is used in an inline function with "
5528 "external linkage">, InGroup<StaticInInline>;
5529def ext_internal_in_extern_inline_quiet : Extension<
5530 "static %select{function|variable}0 %1 is used in an inline function with "
5531 "external linkage">, InGroup<StaticInInline>;
5532def warn_static_local_in_extern_inline : Warning<
5533 "non-constant static local variable in inline function may be different "
5534 "in different files">, InGroup<StaticLocalInInline>;
5535def note_convert_inline_to_static : Note<
5536 "use 'static' to give inline function %0 internal linkage">;
5537
5538def ext_redefinition_of_typedef : ExtWarn<
5539 "redefinition of typedef %0 is a C11 feature">,
5540 InGroup<DiagGroup<"typedef-redefinition"> >;
5541def err_redefinition_variably_modified_typedef : Error<
5542 "redefinition of %select{typedef|type alias}0 for variably-modified type %1">;
5543
5544def err_inline_decl_follows_def : Error<
5545 "inline declaration of %0 follows non-inline definition">;
5546def err_inline_declaration_block_scope : Error<
5547 "inline declaration of %0 not allowed in block scope">;
5548def err_static_non_static : Error<
5549 "static declaration of %0 follows non-static declaration">;
5550def err_different_language_linkage : Error<
5551 "declaration of %0 has a different language linkage">;
5552def ext_retained_language_linkage : Extension<
5553 "friend function %0 retaining previous language linkage is an extension">,
5554 InGroup<DiagGroup<"retained-language-linkage">>;
5555def err_extern_c_global_conflict : Error<
5556 "declaration of %1 %select{with C language linkage|in global scope}0 "
5557 "conflicts with declaration %select{in global scope|with C language linkage}0">;
5558def note_extern_c_global_conflict : Note<
5559 "declared %select{in global scope|with C language linkage}0 here">;
5560def note_extern_c_begins_here : Note<
5561 "extern \"C\" language linkage specification begins here">;
5562def warn_weak_import : Warning <
5563 "an already-declared variable is made a weak_import declaration %0">;
5564def ext_static_non_static : Extension<
5565 "redeclaring non-static %0 as static is a Microsoft extension">,
5566 InGroup<MicrosoftRedeclareStatic>;
5567def err_non_static_static : Error<
5568 "non-static declaration of %0 follows static declaration">;
5569def err_extern_non_extern : Error<
5570 "extern declaration of %0 follows non-extern declaration">;
5571def err_non_extern_extern : Error<
5572 "non-extern declaration of %0 follows extern declaration">;
5573def err_non_thread_thread : Error<
5574 "non-thread-local declaration of %0 follows thread-local declaration">;
5575def err_thread_non_thread : Error<
5576 "thread-local declaration of %0 follows non-thread-local declaration">;
5577def err_thread_thread_different_kind : Error<
5578 "thread-local declaration of %0 with %select{static|dynamic}1 initialization "
5579 "follows declaration with %select{dynamic|static}1 initialization">;
5580def err_mismatched_owning_module : Error<
5581 "declaration of %0 in %select{the global module|module %2}1 follows "
5582 "declaration in %select{the global module|module %4}3">;
5583def err_redefinition_different_type : Error<
5584 "redefinition of %0 with a different type%diff{: $ vs $|}1,2">;
5585def err_redefinition_different_kind : Error<
5586 "redefinition of %0 as different kind of symbol">;
5587def err_redefinition_different_namespace_alias : Error<
5588 "redefinition of %0 as an alias for a different namespace">;
5589def note_previous_namespace_alias : Note<
5590 "previously defined as an alias for %0">;
5591def warn_forward_class_redefinition : Warning<
5592 "redefinition of forward class %0 of a typedef name of an object type is ignored">,
5593 InGroup<DiagGroup<"objc-forward-class-redefinition">>;
5594def err_redefinition_different_typedef : Error<
5595 "%select{typedef|type alias|type alias template}0 "
5596 "redefinition with different types%diff{ ($ vs $)|}1,2">;
5597def err_tag_reference_non_tag : Error<
5598 "%select{non-struct type|non-class type|non-union type|non-enum "
5599 "type|typedef|type alias|template|type alias template|template "
5600 "template argument}1 %0 cannot be referenced with a "
5601 "%select{struct|interface|union|class|enum}2 specifier">;
5602def err_tag_reference_conflict : Error<
5603 "implicit declaration introduced by elaborated type conflicts with a "
5604 "%select{non-struct type|non-class type|non-union type|non-enum "
5605 "type|typedef|type alias|template|type alias template|template "
5606 "template argument}0 of the same name">;
5607def err_dependent_tag_decl : Error<
5608 "%select{declaration|definition}0 of "
5609 "%select{struct|interface|union|class|enum}1 in a dependent scope">;
5610def err_tag_definition_of_typedef : Error<
5611 "definition of type %0 conflicts with %select{typedef|type alias}1 of the same name">;
5612def err_conflicting_types : Error<"conflicting types for %0">;
5613def err_different_pass_object_size_params : Error<
5614 "conflicting pass_object_size attributes on parameters">;
5615def err_late_asm_label_name : Error<
5616 "cannot apply asm label to %select{variable|function}0 after its first use">;
5617def err_different_asm_label : Error<"conflicting asm label">;
5618def err_nested_redefinition : Error<"nested redefinition of %0">;
5619def err_use_with_wrong_tag : Error<
5620 "use of %0 with tag type that does not match previous declaration">;
5621def warn_struct_class_tag_mismatch : Warning<
5622 "%select{struct|interface|class}0%select{| template}1 %2 was previously "
5623 "declared as a %select{struct|interface|class}3%select{| template}1; "
5624 "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5625 InGroup<MismatchedTags>, DefaultIgnore;
5626def warn_struct_class_previous_tag_mismatch : Warning<
5627 "%2 defined as %select{a struct|an interface|a class}0%select{| template}1 "
5628 "here but previously declared as "
5629 "%select{a struct|an interface|a class}3%select{| template}1; "
5630 "this is valid, but may result in linker errors under the Microsoft C++ ABI">,
5631 InGroup<MismatchedTags>, DefaultIgnore;
5632def note_struct_class_suggestion : Note<
5633 "did you mean %select{struct|interface|class}0 here?">;
5634def ext_forward_ref_enum : Extension<
5635 "ISO C forbids forward references to 'enum' types">;
5636def err_forward_ref_enum : Error<
5637 "ISO C++ forbids forward references to 'enum' types">;
5638def ext_ms_forward_ref_enum : ExtWarn<
5639 "forward references to 'enum' types are a Microsoft extension">,
5640 InGroup<MicrosoftEnumForwardReference>;
5641def ext_forward_ref_enum_def : Extension<
5642 "redeclaration of already-defined enum %0 is a GNU extension">,
5643 InGroup<GNURedeclaredEnum>;
5644
5645def err_redefinition_of_enumerator : Error<"redefinition of enumerator %0">;
5646def err_duplicate_member : Error<"duplicate member %0">;
5647def err_misplaced_ivar : Error<
5648 "instance variables may not be placed in %select{categories|class extension}0">;
5649def warn_ivars_in_interface : Warning<
5650 "declaration of instance variables in the interface is deprecated">,
5651 InGroup<DiagGroup<"objc-interface-ivars">>, DefaultIgnore;
5652def ext_enum_value_not_int : Extension<
5653 "ISO C restricts enumerator values to range of 'int' (%0 is too "
5654 "%select{small|large}1)">;
5655def ext_enum_too_large : ExtWarn<
5656 "enumeration values exceed range of largest integer">, InGroup<EnumTooLarge>;
5657def ext_enumerator_increment_too_large : ExtWarn<
5658 "incremented enumerator value %0 is not representable in the "
5659 "largest integer type">, InGroup<EnumTooLarge>;
5660def warn_flag_enum_constant_out_of_range : Warning<
5661 "enumeration value %0 is out of range of flags in enumeration type %1">,
5662 InGroup<FlagEnum>;
5663
5664def err_vm_decl_in_file_scope : Error<
5665 "variably modified type declaration not allowed at file scope">;
5666def err_vm_decl_has_extern_linkage : Error<
5667 "variably modified type declaration cannot have 'extern' linkage">;
5668def err_typecheck_field_variable_size : Error<
5669 "fields must have a constant size: 'variable length array in structure' "
5670 "extension will never be supported">;
5671def err_vm_func_decl : Error<
5672 "function declaration cannot have variably modified type">;
5673def err_array_too_large : Error<
5674 "array is too large (%0 elements)">;
5675
5676def err_typecheck_negative_array_size : Error<"array size is negative">;
5677def warn_typecheck_function_qualifiers_ignored : Warning<
5678 "'%0' qualifier on function type %1 has no effect">,
5679 InGroup<IgnoredQualifiers>;
5680def warn_typecheck_function_qualifiers_unspecified : Warning<
5681 "'%0' qualifier on function type %1 has unspecified behavior">;
5682def warn_typecheck_reference_qualifiers : Warning<
5683 "'%0' qualifier on reference type %1 has no effect">,
5684 InGroup<IgnoredQualifiers>;
5685def err_typecheck_invalid_restrict_not_pointer : Error<
5686 "restrict requires a pointer or reference (%0 is invalid)">;
5687def err_typecheck_invalid_restrict_not_pointer_noarg : Error<
5688 "restrict requires a pointer or reference">;
5689def err_typecheck_invalid_restrict_invalid_pointee : Error<
5690 "pointer to function type %0 may not be 'restrict' qualified">;
5691def ext_typecheck_zero_array_size : Extension<
5692 "zero size arrays are an extension">, InGroup<ZeroLengthArray>;
5693def err_typecheck_zero_array_size : Error<
5694 "zero-length arrays are not permitted in C++">;
5695def err_array_size_non_int : Error<"size of array has non-integer type %0">;
5696def err_init_element_not_constant : Error<
5697 "initializer element is not a compile-time constant">;
5698def ext_aggregate_init_not_constant : Extension<
5699 "initializer for aggregate is not a compile-time constant">, InGroup<C99>;
5700def err_local_cant_init : Error<
5701 "'__local' variable cannot have an initializer">;
5702def err_loader_uninitialized_cant_init
5703 : Error<"variable with 'loader_uninitialized' attribute cannot have an "
5704 "initializer">;
5705def err_loader_uninitialized_trivial_ctor
5706 : Error<"variable with 'loader_uninitialized' attribute must have a "
5707 "trivial default constructor">;
5708def err_loader_uninitialized_redeclaration
5709 : Error<"redeclaration cannot add 'loader_uninitialized' attribute">;
5710def err_loader_uninitialized_extern_decl
5711 : Error<"variable %0 cannot be declared both 'extern' and with the "
5712 "'loader_uninitialized' attribute">;
5713def err_block_extern_cant_init : Error<
5714 "'extern' variable cannot have an initializer">;
5715def warn_extern_init : Warning<"'extern' variable has an initializer">,
5716 InGroup<DiagGroup<"extern-initializer">>;
5717def err_variable_object_no_init : Error<
5718 "variable-sized object may not be initialized">;
5719def err_excess_initializers : Error<
5720 "excess elements in %select{array|vector|scalar|union|struct}0 initializer">;
5721def ext_excess_initializers : ExtWarn<
5722 "excess elements in %select{array|vector|scalar|union|struct}0 initializer">,
5723 InGroup<ExcessInitializers>;
5724def err_excess_initializers_for_sizeless_type : Error<
5725 "excess elements in initializer for indivisible sizeless type %0">;
5726def ext_excess_initializers_for_sizeless_type : ExtWarn<
5727 "excess elements in initializer for indivisible sizeless type %0">,
5728 InGroup<ExcessInitializers>;
5729def err_excess_initializers_in_char_array_initializer : Error<
5730 "excess elements in char array initializer">;
5731def ext_excess_initializers_in_char_array_initializer : ExtWarn<
5732 "excess elements in char array initializer">,
5733 InGroup<ExcessInitializers>;
5734def err_initializer_string_for_char_array_too_long : Error<
5735 "initializer-string for char array is too long">;
5736def ext_initializer_string_for_char_array_too_long : ExtWarn<
5737 "initializer-string for char array is too long">,
5738 InGroup<ExcessInitializers>;
5739def warn_missing_field_initializers : Warning<
5740 "missing field %0 initializer">,
5741 InGroup<MissingFieldInitializers>, DefaultIgnore;
5742def warn_braces_around_init : Warning<
5743 "braces around %select{scalar |}0initializer">,
5744 InGroup<DiagGroup<"braced-scalar-init">>;
5745def ext_many_braces_around_init : ExtWarn<
5746 "too many braces around %select{scalar |}0initializer">,
5747 InGroup<DiagGroup<"many-braces-around-scalar-init">>, SFINAEFailure;
5748def ext_complex_component_init : Extension<
5749 "complex initialization specifying real and imaginary components "
5750 "is an extension">, InGroup<DiagGroup<"complex-component-init">>;
5751def err_empty_scalar_initializer : Error<"scalar initializer cannot be empty">;
5752def err_empty_sizeless_initializer : Error<
5753 "initializer for sizeless type %0 cannot be empty">;
5754def warn_cxx98_compat_empty_scalar_initializer : Warning<
5755 "scalar initialized from empty initializer list is incompatible with C++98">,
5756 InGroup<CXX98Compat>, DefaultIgnore;
5757def warn_cxx98_compat_empty_sizeless_initializer : Warning<
5758 "initializing %0 from an empty initializer list is incompatible with C++98">,
5759 InGroup<CXX98Compat>, DefaultIgnore;
5760def warn_cxx98_compat_reference_list_init : Warning<
5761 "reference initialized from initializer list is incompatible with C++98">,
5762 InGroup<CXX98Compat>, DefaultIgnore;
5763def warn_cxx98_compat_initializer_list_init : Warning<
5764 "initialization of initializer_list object is incompatible with C++98">,
5765 InGroup<CXX98Compat>, DefaultIgnore;
5766def warn_cxx98_compat_ctor_list_init : Warning<
5767 "constructor call from initializer list is incompatible with C++98">,
5768 InGroup<CXX98Compat>, DefaultIgnore;
5769def err_illegal_initializer : Error<
5770 "illegal initializer (only variables can be initialized)">;
5771def err_illegal_initializer_type : Error<"illegal initializer type %0">;
5772def ext_init_list_type_narrowing : ExtWarn<
5773 "type %0 cannot be narrowed to %1 in initializer list">,
5774 InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5775def ext_init_list_variable_narrowing : ExtWarn<
5776 "non-constant-expression cannot be narrowed from type %0 to %1 in "
5777 "initializer list">, InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5778def ext_init_list_constant_narrowing : ExtWarn<
5779 "constant expression evaluates to %0 which cannot be narrowed to type %1">,
5780 InGroup<CXX11Narrowing>, DefaultError, SFINAEFailure;
5781def warn_init_list_type_narrowing : Warning<
5782 "type %0 cannot be narrowed to %1 in initializer list in C++11">,
5783 InGroup<CXX11Narrowing>, DefaultIgnore;
5784def warn_init_list_variable_narrowing : Warning<
5785 "non-constant-expression cannot be narrowed from type %0 to %1 in "
5786 "initializer list in C++11">,
5787 InGroup<CXX11Narrowing>, DefaultIgnore;
5788def warn_init_list_constant_narrowing : Warning<
5789 "constant expression evaluates to %0 which cannot be narrowed to type %1 in "
5790 "C++11">,
5791 InGroup<CXX11Narrowing>, DefaultIgnore;
5792def note_init_list_narrowing_silence : Note<
5793 "insert an explicit cast to silence this issue">;
5794def err_init_objc_class : Error<
5795 "cannot initialize Objective-C class type %0">;
5796def err_implicit_empty_initializer : Error<
5797 "initializer for aggregate with no elements requires explicit braces">;
5798def err_bitfield_has_negative_width : Error<
5799 "bit-field %0 has negative width (%1)">;
5800def err_anon_bitfield_has_negative_width : Error<
5801 "anonymous bit-field has negative width (%0)">;
5802def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
5803def err_bitfield_width_exceeds_type_width : Error<
5804 "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
5805 "of its type (%3 bit%s3)">;
5806def err_anon_bitfield_width_exceeds_type_width : Error<
5807 "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
5808 "of its type (%2 bit%s2)">;
5809def err_incorrect_number_of_vector_initializers : Error<
5810 "number of elements must be either one or match the size of the vector">;
5811
5812// Used by C++ which allows bit-fields that are wider than the type.
5813def warn_bitfield_width_exceeds_type_width: Warning<
5814 "width of bit-field %0 (%1 bits) exceeds the width of its type; value will "
5815 "be truncated to %2 bit%s2">, InGroup<BitFieldWidth>;
5816def err_bitfield_too_wide : Error<
5817 "%select{bit-field %1|anonymous bit-field}0 is too wide (%2 bits)">;
5818def warn_bitfield_too_small_for_enum : Warning<
5819 "bit-field %0 is not wide enough to store all enumerators of %1">,
5820 InGroup<BitFieldEnumConversion>, DefaultIgnore;
5821def note_widen_bitfield : Note<
5822 "widen this field to %0 bits to store all values of %1">;
5823def warn_unsigned_bitfield_assigned_signed_enum : Warning<
5824 "assigning value of signed enum type %1 to unsigned bit-field %0; "
5825 "negative enumerators of enum %1 will be converted to positive values">,
5826 InGroup<BitFieldEnumConversion>, DefaultIgnore;
5827def warn_signed_bitfield_enum_conversion : Warning<
5828 "signed bit-field %0 needs an extra bit to represent the largest positive "
5829 "enumerators of %1">,
5830 InGroup<BitFieldEnumConversion>, DefaultIgnore;
5831def note_change_bitfield_sign : Note<
5832 "consider making the bitfield type %select{unsigned|signed}0">;
5833
5834def warn_missing_braces : Warning<
5835 "suggest braces around initialization of subobject">,
5836 InGroup<MissingBraces>, DefaultIgnore;
5837
5838def err_redefinition_of_label : Error<"redefinition of label %0">;
5839def err_undeclared_label_use : Error<"use of undeclared label %0">;
5840def err_goto_ms_asm_label : Error<
5841 "cannot jump from this goto statement to label %0 inside an inline assembly block">;
5842def note_goto_ms_asm_label : Note<
5843 "inline assembly label %0 declared here">;
5844def warn_unused_label : Warning<"unused label %0">,
5845 InGroup<UnusedLabel>, DefaultIgnore;
5846
5847def err_continue_from_cond_var_init : Error<
5848 "cannot jump from this continue statement to the loop increment; "
5849 "jump bypasses initialization of loop condition variable">;
5850def err_goto_into_protected_scope : Error<
5851 "cannot jump from this goto statement to its label">;
5852def ext_goto_into_protected_scope : ExtWarn<
5853 "jump from this goto statement to its label is a Microsoft extension">,
5854 InGroup<MicrosoftGoto>;
5855def warn_cxx98_compat_goto_into_protected_scope : Warning<
5856 "jump from this goto statement to its label is incompatible with C++98">,
5857 InGroup<CXX98Compat>, DefaultIgnore;
5858def err_switch_into_protected_scope : Error<
5859 "cannot jump from switch statement to this case label">;
5860def warn_cxx98_compat_switch_into_protected_scope : Warning<
5861 "jump from switch statement to this case label is incompatible with C++98">,
5862 InGroup<CXX98Compat>, DefaultIgnore;
5863def err_indirect_goto_without_addrlabel : Error<
5864 "indirect goto in function with no address-of-label expressions">;
5865def err_indirect_goto_in_protected_scope : Error<
5866 "cannot jump from this %select{indirect|asm}0 goto statement to one of its possible targets">;
5867def warn_cxx98_compat_indirect_goto_in_protected_scope : Warning<
5868 "jump from this %select{indirect|asm}0 goto statement to one of its possible targets "
5869 "is incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
5870def note_indirect_goto_target : Note<
5871 "possible target of %select{indirect|asm}0 goto statement">;
5872def note_protected_by_variable_init : Note<
5873 "jump bypasses variable initialization">;
5874def note_protected_by_variable_nontriv_destructor : Note<
5875 "jump bypasses variable with a non-trivial destructor">;
5876def note_protected_by_variable_non_pod : Note<
5877 "jump bypasses initialization of non-POD variable">;
5878def note_protected_by_cleanup : Note<
5879 "jump bypasses initialization of variable with __attribute__((cleanup))">;
5880def note_protected_by_vla_typedef : Note<
5881 "jump bypasses initialization of VLA typedef">;
5882def note_protected_by_vla_type_alias : Note<
5883 "jump bypasses initialization of VLA type alias">;
5884def note_protected_by_constexpr_if : Note<
5885 "jump enters controlled statement of constexpr if">;
5886def note_protected_by_if_available : Note<
5887 "jump enters controlled statement of if available">;
5888def note_protected_by_vla : Note<
5889 "jump bypasses initialization of variable length array">;
5890def note_protected_by_objc_fast_enumeration : Note<
5891 "jump enters Objective-C fast enumeration loop">;
5892def note_protected_by_objc_try : Note<
5893 "jump bypasses initialization of @try block">;
5894def note_protected_by_objc_catch : Note<
5895 "jump bypasses initialization of @catch block">;
5896def note_protected_by_objc_finally : Note<
5897 "jump bypasses initialization of @finally block">;
5898def note_protected_by_objc_synchronized : Note<
5899 "jump bypasses initialization of @synchronized block">;
5900def note_protected_by_objc_autoreleasepool : Note<
5901 "jump bypasses auto release push of @autoreleasepool block">;
5902def note_protected_by_cxx_try : Note<
5903 "jump bypasses initialization of try block">;
5904def note_protected_by_cxx_catch : Note<
5905 "jump bypasses initialization of catch block">;
5906def note_protected_by_seh_try : Note<
5907 "jump bypasses initialization of __try block">;
5908def note_protected_by_seh_except : Note<
5909 "jump bypasses initialization of __except block">;
5910def note_protected_by_seh_finally : Note<
5911 "jump bypasses initialization of __finally block">;
5912def note_protected_by___block : Note<
5913 "jump bypasses setup of __block variable">;
5914def note_protected_by_objc_strong_init : Note<
5915 "jump bypasses initialization of __strong variable">;
5916def note_protected_by_objc_weak_init : Note<
5917 "jump bypasses initialization of __weak variable">;
5918def note_protected_by_non_trivial_c_struct_init : Note<
5919 "jump bypasses initialization of variable of non-trivial C struct type">;
5920def note_enters_block_captures_cxx_obj : Note<
5921 "jump enters lifetime of block which captures a destructible C++ object">;
5922def note_enters_block_captures_strong : Note<
5923 "jump enters lifetime of block which strongly captures a variable">;
5924def note_enters_block_captures_weak : Note<
5925 "jump enters lifetime of block which weakly captures a variable">;
5926def note_enters_block_captures_non_trivial_c_struct : Note<
5927 "jump enters lifetime of block which captures a C struct that is non-trivial "
5928 "to destroy">;
5929def note_enters_compound_literal_scope : Note<
5930 "jump enters lifetime of a compound literal that is non-trivial to destruct">;
5931
5932def note_exits_cleanup : Note<
5933 "jump exits scope of variable with __attribute__((cleanup))">;
5934def note_exits_dtor : Note<
5935 "jump exits scope of variable with non-trivial destructor">;
5936def note_exits_temporary_dtor : Note<
5937 "jump exits scope of lifetime-extended temporary with non-trivial "
5938 "destructor">;
5939def note_exits___block : Note<
5940 "jump exits scope of __block variable">;
5941def note_exits_objc_try : Note<
5942 "jump exits @try block">;
5943def note_exits_objc_catch : Note<
5944 "jump exits @catch block">;
5945def note_exits_objc_finally : Note<
5946 "jump exits @finally block">;
5947def note_exits_objc_synchronized : Note<
5948 "jump exits @synchronized block">;
5949def note_exits_cxx_try : Note<
5950 "jump exits try block">;
5951def note_exits_cxx_catch : Note<
5952 "jump exits catch block">;
5953def note_exits_seh_try : Note<
5954 "jump exits __try block">;
5955def note_exits_seh_except : Note<
5956 "jump exits __except block">;
5957def note_exits_seh_finally : Note<
5958 "jump exits __finally block">;
5959def note_exits_objc_autoreleasepool : Note<
5960 "jump exits autoreleasepool block">;
5961def note_exits_objc_strong : Note<
5962 "jump exits scope of __strong variable">;
5963def note_exits_objc_weak : Note<
5964 "jump exits scope of __weak variable">;
5965def note_exits_block_captures_cxx_obj : Note<
5966 "jump exits lifetime of block which captures a destructible C++ object">;
5967def note_exits_block_captures_strong : Note<
5968 "jump exits lifetime of block which strongly captures a variable">;
5969def note_exits_block_captures_weak : Note<
5970 "jump exits lifetime of block which weakly captures a variable">;
5971def note_exits_block_captures_non_trivial_c_struct : Note<
5972 "jump exits lifetime of block which captures a C struct that is non-trivial "
5973 "to destroy">;
5974def note_exits_compound_literal_scope : Note<
5975 "jump exits lifetime of a compound literal that is non-trivial to destruct">;
5976
5977def err_func_returning_qualified_void : ExtWarn<
5978 "function cannot return qualified void type %0">,
5979 InGroup<DiagGroup<"qualified-void-return-type">>;
5980def err_func_returning_array_function : Error<
5981 "function cannot return %select{array|function}0 type %1">;
5982def err_field_declared_as_function : Error<"field %0 declared as a function">;
5983def err_field_incomplete_or_sizeless : Error<
5984 "field has %select{incomplete|sizeless}0 type %1">;
5985def ext_variable_sized_type_in_struct : ExtWarn<
5986 "field %0 with variable sized type %1 not at the end of a struct or class is"
5987 " a GNU extension">, InGroup<GNUVariableSizedTypeNotAtEnd>;
5988
5989def ext_c99_flexible_array_member : Extension<
5990 "flexible array members are a C99 feature">, InGroup<C99>;
5991def err_flexible_array_virtual_base : Error<
5992 "flexible array member %0 not allowed in "
5993 "%select{struct|interface|union|class|enum}1 which has a virtual base class">;
5994def err_flexible_array_empty_aggregate : Error<
5995 "flexible array member %0 not allowed in otherwise empty "
5996 "%select{struct|interface|union|class|enum}1">;
5997def err_flexible_array_has_nontrivial_dtor : Error<
5998 "flexible array member %0 of type %1 with non-trivial destruction">;
5999def ext_flexible_array_in_struct : Extension<
6000 "%0 may not be nested in a struct due to flexible array member">,
6001 InGroup<FlexibleArrayExtensions>;
6002def ext_flexible_array_in_array : Extension<
6003 "%0 may not be used as an array element due to flexible array member">,
6004 InGroup<FlexibleArrayExtensions>;
6005def err_flexible_array_init : Error<
6006 "initialization of flexible array member is not allowed">;
6007def ext_flexible_array_empty_aggregate_ms : Extension<
6008 "flexible array member %0 in otherwise empty "
6009 "%select{struct|interface|union|class|enum}1 is a Microsoft extension">,
6010 InGroup<MicrosoftFlexibleArray>;
6011def err_flexible_array_union : Error<
6012 "flexible array member %0 in a union is not allowed">;
6013def ext_flexible_array_union_ms : Extension<
6014 "flexible array member %0 in a union is a Microsoft extension">,
6015 InGroup<MicrosoftFlexibleArray>;
6016def ext_flexible_array_empty_aggregate_gnu : Extension<
6017 "flexible array member %0 in otherwise empty "
6018 "%select{struct|interface|union|class|enum}1 is a GNU extension">,
6019 InGroup<GNUEmptyStruct>;
6020def ext_flexible_array_union_gnu : Extension<
6021 "flexible array member %0 in a union is a GNU extension">, InGroup<GNUFlexibleArrayUnionMember>;
6022
6023def err_flexible_array_not_at_end : Error<
6024 "flexible array member %0 with type %1 is not at the end of"
6025 " %select{struct|interface|union|class|enum}2">;
6026def err_objc_variable_sized_type_not_at_end : Error<
6027 "field %0 with variable sized type %1 is not at the end of class">;
6028def note_next_field_declaration : Note<
6029 "next field declaration is here">;
6030def note_next_ivar_declaration : Note<
6031 "next %select{instance variable declaration|synthesized instance variable}0"
6032 " is here">;
6033def err_synthesize_variable_sized_ivar : Error<
6034 "synthesized property with variable size type %0"
6035 " requires an existing instance variable">;
6036def err_flexible_array_arc_retainable : Error<
6037 "ARC forbids flexible array members with retainable object type">;
6038def warn_variable_sized_ivar_visibility : Warning<
6039 "field %0 with variable sized type %1 is not visible to subclasses and"
6040 " can conflict with their instance variables">, InGroup<ObjCFlexibleArray>;
6041def warn_superclass_variable_sized_type_not_at_end : Warning<
6042 "field %0 can overwrite instance variable %1 with variable sized type %2"
6043 " in superclass %3">, InGroup<ObjCFlexibleArray>;
6044
6045let CategoryName = "ARC Semantic Issue" in {
6046
6047// ARC-mode diagnostics.
6048
6049let CategoryName = "ARC Weak References" in {
6050
6051def err_arc_weak_no_runtime : Error<
6052 "cannot create __weak reference because the current deployment target "
6053 "does not support weak references">;
6054def err_arc_weak_disabled : Error<
6055 "cannot create __weak reference in file using manual reference counting">;
6056def err_synthesizing_arc_weak_property_disabled : Error<
6057 "cannot synthesize weak property in file using manual reference counting">;
6058def err_synthesizing_arc_weak_property_no_runtime : Error<
6059 "cannot synthesize weak property because the current deployment target "
6060 "does not support weak references">;
6061def err_arc_unsupported_weak_class : Error<
6062 "class is incompatible with __weak references">;
6063def err_arc_weak_unavailable_assign : Error<
6064 "assignment of a weak-unavailable object to a __weak object">;
6065def err_arc_weak_unavailable_property : Error<
6066 "synthesizing __weak instance variable of type %0, which does not "
6067 "support weak references">;
6068def note_implemented_by_class : Note<
6069 "when implemented by class %0">;
6070def err_arc_convesion_of_weak_unavailable : Error<
6071 "%select{implicit conversion|cast}0 of weak-unavailable object of type %1 to"
6072 " a __weak object of type %2">;
6073
6074} // end "ARC Weak References" category
6075
6076let CategoryName = "ARC Restrictions" in {
6077
6078def err_unavailable_in_arc : Error<
6079 "%0 is unavailable in ARC">;
6080def note_arc_forbidden_type : Note<
6081 "declaration uses type that is ill-formed in ARC">;
6082def note_performs_forbidden_arc_conversion : Note<
6083 "inline function performs a conversion which is forbidden in ARC">;
6084def note_arc_init_returns_unrelated : Note<
6085 "init method must return a type related to its receiver type">;
6086def note_arc_weak_disabled : Note<
6087 "declaration uses __weak, but ARC is disabled">;
6088def note_arc_weak_no_runtime : Note<"declaration uses __weak, which "
6089 "the current deployment target does not support">;
6090def note_arc_field_with_ownership : Note<
6091 "field has non-trivial ownership qualification">;
6092
6093def err_arc_illegal_explicit_message : Error<
6094 "ARC forbids explicit message send of %0">;
6095def err_arc_unused_init_message : Error<
6096 "the result of a delegate init call must be immediately returned "
6097 "or assigned to 'self'">;
6098def err_arc_mismatched_cast : Error<
6099 "%select{implicit conversion|cast}0 of "
6100 "%select{%2|a non-Objective-C pointer type %2|a block pointer|"
6101 "an Objective-C pointer|an indirect pointer to an Objective-C pointer}1"
6102 " to %3 is disallowed with ARC">;
6103def err_arc_nolifetime_behavior : Error<
6104 "explicit ownership qualifier on cast result has no effect">;
6105def err_arc_objc_property_default_assign_on_object : Error<
6106 "ARC forbids synthesizing a property of an Objective-C object "
6107 "with unspecified ownership or storage attribute">;
6108def err_arc_illegal_selector : Error<
6109 "ARC forbids use of %0 in a @selector">;
6110def err_arc_illegal_method_def : Error<
6111 "ARC forbids %select{implementation|synthesis}0 of %1">;
6112def warn_arc_strong_pointer_objc_pointer : Warning<
6113 "method parameter of type %0 with no explicit ownership">,
6114 InGroup<DiagGroup<"explicit-ownership-type">>, DefaultIgnore;
6115
6116} // end "ARC Restrictions" category
6117
6118def err_arc_lost_method_convention : Error<
6119 "method was declared as %select{an 'alloc'|a 'copy'|an 'init'|a 'new'}0 "
6120 "method, but its implementation doesn't match because %select{"
6121 "its result type is not an object pointer|"
6122 "its result type is unrelated to its receiver type}1">;
6123def note_arc_lost_method_convention : Note<"declaration in interface">;
6124def err_arc_gained_method_convention : Error<
6125 "method implementation does not match its declaration">;
6126def note_arc_gained_method_convention : Note<
6127 "declaration in interface is not in the '%select{alloc|copy|init|new}0' "
6128 "family because %select{its result type is not an object pointer|"
6129 "its result type is unrelated to its receiver type}1">;
6130def err_typecheck_arc_assign_self : Error<
6131 "cannot assign to 'self' outside of a method in the init family">;
6132def err_typecheck_arc_assign_self_class_method : Error<
6133 "cannot assign to 'self' in a class method">;
6134def err_typecheck_arr_assign_enumeration : Error<
6135 "fast enumeration variables cannot be modified in ARC by default; "
6136 "declare the variable __strong to allow this">;
6137def err_typecheck_arc_assign_externally_retained : Error<
6138 "variable declared with 'objc_externally_retained' "
6139 "cannot be modified in ARC">;
6140def warn_arc_retained_assign : Warning<
6141 "assigning retained object to %select{weak|unsafe_unretained}0 "
6142 "%select{property|variable}1"
6143 "; object will be released after assignment">,
6144 InGroup<ARCUnsafeRetainedAssign>;
6145def warn_arc_retained_property_assign : Warning<
6146 "assigning retained object to unsafe property"
6147 "; object will be released after assignment">,
6148 InGroup<ARCUnsafeRetainedAssign>;
6149def warn_arc_literal_assign : Warning<
6150 "assigning %select{array literal|dictionary literal|numeric literal|boxed expression|<should not happen>|block literal}0"
6151 " to a weak %select{property|variable}1"
6152 "; object will be released after assignment">,
6153 InGroup<ARCUnsafeRetainedAssign>;
6154def err_arc_new_array_without_ownership : Error<
6155 "'new' cannot allocate an array of %0 with no explicit ownership">;
6156def err_arc_autoreleasing_var : Error<
6157 "%select{__block variables|global variables|fields|instance variables}0 cannot have "
6158 "__autoreleasing ownership">;
6159def err_arc_autoreleasing_capture : Error<
6160 "cannot capture __autoreleasing variable in a "
6161 "%select{block|lambda by copy}0">;
6162def err_arc_thread_ownership : Error<
6163 "thread-local variable has non-trivial ownership: type is %0">;
6164def err_arc_indirect_no_ownership : Error<
6165 "%select{pointer|reference}1 to non-const type %0 with no explicit ownership">;
6166def err_arc_array_param_no_ownership : Error<
6167 "must explicitly describe intended ownership of an object array parameter">;
6168def err_arc_pseudo_dtor_inconstant_quals : Error<
6169 "pseudo-destructor destroys object of type %0 with inconsistently-qualified "
6170 "type %1">;
6171def err_arc_init_method_unrelated_result_type : Error<
6172 "init methods must return a type related to the receiver type">;
6173def err_arc_nonlocal_writeback : Error<
6174 "passing address of %select{non-local|non-scalar}0 object to "
6175 "__autoreleasing parameter for write-back">;
6176def err_arc_method_not_found : Error<
6177 "no known %select{instance|class}1 method for selector %0">;
6178def err_arc_receiver_forward_class : Error<
6179 "receiver %0 for class message is a forward declaration">;
6180def err_arc_may_not_respond : Error<
6181 "no visible @interface for %0 declares the selector %1">;
6182def err_arc_receiver_forward_instance : Error<
6183 "receiver type %0 for instance message is a forward declaration">;
6184def warn_receiver_forward_instance : Warning<
6185 "receiver type %0 for instance message is a forward declaration">,
6186 InGroup<ForwardClassReceiver>, DefaultIgnore;
6187def err_arc_collection_forward : Error<
6188 "collection expression type %0 is a forward declaration">;
6189def err_arc_multiple_method_decl : Error<
6190 "multiple methods named %0 found with mismatched result, "
6191 "parameter type or attributes">;
6192def warn_arc_lifetime_result_type : Warning<
6193 "ARC %select{unused|__unsafe_unretained|__strong|__weak|__autoreleasing}0 "
6194 "lifetime qualifier on return type is ignored">,
6195 InGroup<IgnoredQualifiers>;
6196
6197let CategoryName = "ARC Retain Cycle" in {
6198
6199def warn_arc_retain_cycle : Warning<
6200 "capturing %0 strongly in this block is likely to lead to a retain cycle">,
6201 InGroup<ARCRetainCycles>;
6202def note_arc_retain_cycle_owner : Note<
6203 "block will be retained by %select{the captured object|an object strongly "
6204 "retained by the captured object}0">;
6205
6206} // end "ARC Retain Cycle" category
6207
6208def warn_arc_object_memaccess : Warning<
6209 "%select{destination for|source of}0 this %1 call is a pointer to "
6210 "ownership-qualified type %2">, InGroup<ARCNonPodMemAccess>;
6211
6212let CategoryName = "ARC and @properties" in {
6213
6214def err_arc_strong_property_ownership : Error<
6215 "existing instance variable %1 for strong property %0 may not be "
6216 "%select{|__unsafe_unretained||__weak}2">;
6217def err_arc_assign_property_ownership : Error<
6218 "existing instance variable %1 for property %0 with %select{unsafe_unretained|assign}2 "
6219 "attribute must be __unsafe_unretained">;
6220def err_arc_inconsistent_property_ownership : Error<
6221 "%select{|unsafe_unretained|strong|weak}1 property %0 may not also be "
6222 "declared %select{|__unsafe_unretained|__strong|__weak|__autoreleasing}2">;
6223
6224} // end "ARC and @properties" category
6225
6226def warn_block_capture_autoreleasing : Warning<
6227 "block captures an autoreleasing out-parameter, which may result in "
6228 "use-after-free bugs">,
6229 InGroup<BlockCaptureAutoReleasing>;
6230def note_declare_parameter_strong : Note<
6231 "declare the parameter __strong or capture a __block __strong variable to "
6232 "keep values alive across autorelease pools">;
6233
6234def err_arc_atomic_ownership : Error<
6235 "cannot perform atomic operation on a pointer to type %0: type has "
6236 "non-trivial ownership">;
6237
6238let CategoryName = "ARC Casting Rules" in {
6239
6240def err_arc_bridge_cast_incompatible : Error<
6241 "incompatible types casting %0 to %1 with a %select{__bridge|"
6242 "__bridge_transfer|__bridge_retained}2 cast">;
6243def err_arc_bridge_cast_wrong_kind : Error<
6244 "cast of %select{Objective-C|block|C}0 pointer type %1 to "
6245 "%select{Objective-C|block|C}2 pointer type %3 cannot use %select{__bridge|"
6246 "__bridge_transfer|__bridge_retained}4">;
6247def err_arc_cast_requires_bridge : Error<
6248 "%select{cast|implicit conversion}0 of %select{Objective-C|block|C}1 "
6249 "pointer type %2 to %select{Objective-C|block|C}3 pointer type %4 "
6250 "requires a bridged cast">;
6251def note_arc_bridge : Note<
6252 "use __bridge to convert directly (no change in ownership)">;
6253def note_arc_cstyle_bridge : Note<
6254 "use __bridge with C-style cast to convert directly (no change in ownership)">;
6255def note_arc_bridge_transfer : Note<
6256 "use %select{__bridge_transfer|CFBridgingRelease call}1 to transfer "
6257 "ownership of a +1 %0 into ARC">;
6258def note_arc_cstyle_bridge_transfer : Note<
6259 "use __bridge_transfer with C-style cast to transfer "
6260 "ownership of a +1 %0 into ARC">;
6261def note_arc_bridge_retained : Note<
6262 "use %select{__bridge_retained|CFBridgingRetain call}1 to make an "
6263 "ARC object available as a +1 %0">;
6264def note_arc_cstyle_bridge_retained : Note<
6265 "use __bridge_retained with C-style cast to make an "
6266 "ARC object available as a +1 %0">;
6267
6268} // ARC Casting category
6269
6270} // ARC category name
6271
6272def err_flexible_array_init_needs_braces : Error<
6273 "flexible array requires brace-enclosed initializer">;
6274def err_illegal_decl_array_of_functions : Error<
6275 "'%0' declared as array of functions of type %1">;
6276def err_array_incomplete_or_sizeless_type : Error<
6277 "array has %select{incomplete|sizeless}0 element type %1">;
6278def err_illegal_message_expr_incomplete_type : Error<
6279 "Objective-C message has incomplete result type %0">;
6280def err_illegal_decl_array_of_references : Error<
6281 "'%0' declared as array of references of type %1">;
6282def err_decl_negative_array_size : Error<
6283 "'%0' declared as an array with a negative size">;
6284def err_array_static_outside_prototype : Error<
6285 "%0 used in array declarator outside of function prototype">;
6286def err_array_static_not_outermost : Error<
6287 "%0 used in non-outermost array type derivation">;
6288def err_array_star_outside_prototype : Error<
6289 "star modifier used outside of function prototype">;
6290def err_illegal_decl_pointer_to_reference : Error<
6291 "'%0' declared as a pointer to a reference of type %1">;
6292def err_illegal_decl_mempointer_to_reference : Error<
6293 "'%0' declared as a member pointer to a reference of type %1">;
6294def err_illegal_decl_mempointer_to_void : Error<
6295 "'%0' declared as a member pointer to void">;
6296def err_illegal_decl_mempointer_in_nonclass : Error<
6297 "'%0' does not point into a class">;
6298def err_mempointer_in_nonclass_type : Error<
6299 "member pointer refers into non-class type %0">;
6300def err_reference_to_void : Error<"cannot form a reference to 'void'">;
6301def err_nonfunction_block_type : Error<
6302 "block pointer to non-function type is invalid">;
6303def err_return_block_has_expr : Error<"void block should not return a value">;
6304def err_block_return_missing_expr : Error<
6305 "non-void block should return a value">;
6306def err_func_def_incomplete_result : Error<
6307 "incomplete result type %0 in function definition">;
6308def err_atomic_specifier_bad_type
6309 : Error<"_Atomic cannot be applied to "
6310 "%select{incomplete |array |function |reference |atomic |qualified "
6311 "|sizeless ||integer }0type "
6312 "%1 %select{|||||||which is not trivially copyable|}0">;
6313
6314// Expressions.
6315def ext_sizeof_alignof_function_type : Extension<
6316 "invalid application of '%0' to a function type">, InGroup<PointerArith>;
6317def ext_sizeof_alignof_void_type : Extension<
6318 "invalid application of '%0' to a void type">, InGroup<PointerArith>;
6319def err_opencl_sizeof_alignof_type : Error<
6320 "invalid application of '%0' to a void type">;
6321def err_sizeof_alignof_incomplete_or_sizeless_type : Error<
6322 "invalid application of '%0' to %select{an incomplete|sizeless}1 type %2">;
6323def err_sizeof_alignof_function_type : Error<
6324 "invalid application of '%0' to a function type">;
6325def err_openmp_default_simd_align_expr : Error<
6326 "invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed">;
6327def err_sizeof_alignof_typeof_bitfield : Error<
6328 "invalid application of '%select{sizeof|alignof|typeof}0' to bit-field">;
6329def err_alignof_member_of_incomplete_type : Error<
6330 "invalid application of 'alignof' to a field of a class still being defined">;
6331def err_vecstep_non_scalar_vector_type : Error<
6332 "'vec_step' requires built-in scalar or vector type, %0 invalid">;
6333def err_offsetof_incomplete_type : Error<
6334 "offsetof of incomplete type %0">;
6335def err_offsetof_record_type : Error<
6336 "offsetof requires struct, union, or class type, %0 invalid">;
6337def err_offsetof_array_type : Error<"offsetof requires array type, %0 invalid">;
6338def ext_offsetof_non_pod_type : ExtWarn<"offset of on non-POD type %0">,
6339 InGroup<InvalidOffsetof>;
6340def ext_offsetof_non_standardlayout_type : ExtWarn<
6341 "offset of on non-standard-layout type %0">, InGroup<InvalidOffsetof>;
6342def err_offsetof_bitfield : Error<"cannot compute offset of bit-field %0">;
6343def err_offsetof_field_of_virtual_base : Error<
6344 "invalid application of 'offsetof' to a field of a virtual base">;
6345def warn_sub_ptr_zero_size_types : Warning<
6346 "subtraction of pointers to type %0 of zero size has undefined behavior">,
6347 InGroup<PointerArith>;
6348def warn_pointer_arith_null_ptr : Warning<
6349 "performing pointer arithmetic on a null pointer has undefined behavior%select{| if the offset is nonzero}0">,
6350 InGroup<NullPointerArithmetic>, DefaultIgnore;
6351def warn_gnu_null_ptr_arith : Warning<
6352 "arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension">,
6353 InGroup<NullPointerArithmetic>, DefaultIgnore;
6354
6355def warn_floatingpoint_eq : Warning<
6356 "comparing floating point with == or != is unsafe">,
6357 InGroup<DiagGroup<"float-equal">>, DefaultIgnore;
6358
6359def warn_remainder_division_by_zero : Warning<
6360 "%select{remainder|division}0 by zero is undefined">,
6361 InGroup<DivZero>;
6362def warn_shift_lhs_negative : Warning<"shifting a negative signed value is undefined">,
6363 InGroup<DiagGroup<"shift-negative-value">>;
6364def warn_shift_negative : Warning<"shift count is negative">,
6365 InGroup<DiagGroup<"shift-count-negative">>;
6366def warn_shift_gt_typewidth : Warning<"shift count >= width of type">,
6367 InGroup<DiagGroup<"shift-count-overflow">>;
6368def warn_shift_result_gt_typewidth : Warning<
6369 "signed shift result (%0) requires %1 bits to represent, but %2 only has "
6370 "%3 bits">, InGroup<DiagGroup<"shift-overflow">>;
6371def warn_shift_result_sets_sign_bit : Warning<
6372 "signed shift result (%0) sets the sign bit of the shift expression's "
6373 "type (%1) and becomes negative">,
6374 InGroup<DiagGroup<"shift-sign-overflow">>, DefaultIgnore;
6375
6376def warn_precedence_bitwise_rel : Warning<
6377 "%0 has lower precedence than %1; %1 will be evaluated first">,
6378 InGroup<Parentheses>;
6379def note_precedence_bitwise_first : Note<
6380 "place parentheses around the %0 expression to evaluate it first">;
6381def note_precedence_silence : Note<
6382 "place parentheses around the '%0' expression to silence this warning">;
6383
6384def warn_precedence_conditional : Warning<
6385 "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6386 InGroup<Parentheses>;
6387def warn_precedence_bitwise_conditional : Warning<
6388 "operator '?:' has lower precedence than '%0'; '%0' will be evaluated first">,
6389 InGroup<BitwiseConditionalParentheses>;
6390def note_precedence_conditional_first : Note<
6391 "place parentheses around the '?:' expression to evaluate it first">;
6392
6393def warn_enum_constant_in_bool_context : Warning<
6394 "converting the enum constant to a boolean">,
6395 InGroup<IntInBoolContext>, DefaultIgnore;
6396def warn_left_shift_in_bool_context : Warning<
6397 "converting the result of '<<' to a boolean; did you mean '(%0) != 0'?">,
6398 InGroup<IntInBoolContext>, DefaultIgnore;
6399def warn_logical_instead_of_bitwise : Warning<
6400 "use of logical '%0' with constant operand">,
6401 InGroup<DiagGroup<"constant-logical-operand">>;
6402def note_logical_instead_of_bitwise_change_operator : Note<
6403 "use '%0' for a bitwise operation">;
6404def note_logical_instead_of_bitwise_remove_constant : Note<
6405 "remove constant to silence this warning">;
6406
6407def warn_bitwise_op_in_bitwise_op : Warning<
6408 "'%0' within '%1'">, InGroup<BitwiseOpParentheses>, DefaultIgnore;
6409
6410def warn_logical_and_in_logical_or : Warning<
6411 "'&&' within '||'">, InGroup<LogicalOpParentheses>, DefaultIgnore;
6412
6413def warn_overloaded_shift_in_comparison :Warning<
6414 "overloaded operator %select{>>|<<}0 has higher precedence than "
6415 "comparison operator">,
6416 InGroup<OverloadedShiftOpParentheses>;
6417def note_evaluate_comparison_first :Note<
6418 "place parentheses around comparison expression to evaluate it first">;
6419
6420def note_concatenated_string_literal_silence :Note<
6421 "place parentheses around the string literal to silence warning">;
6422
6423def warn_addition_in_bitshift : Warning<
6424 "operator '%0' has lower precedence than '%1'; "
6425 "'%1' will be evaluated first">, InGroup<ShiftOpParentheses>;
6426
6427def warn_self_assignment_builtin : Warning<
6428 "explicitly assigning value of variable of type %0 to itself">,
6429 InGroup<SelfAssignment>, DefaultIgnore;
6430def warn_self_assignment_overloaded : Warning<
6431 "explicitly assigning value of variable of type %0 to itself">,
6432 InGroup<SelfAssignmentOverloaded>, DefaultIgnore;
6433def warn_self_move : Warning<
6434 "explicitly moving variable of type %0 to itself">,
6435 InGroup<SelfMove>, DefaultIgnore;
6436
6437def warn_redundant_move_on_return : Warning<
6438 "redundant move in return statement">,
6439 InGroup<RedundantMove>, DefaultIgnore;
6440def warn_pessimizing_move_on_return : Warning<
6441 "moving a local object in a return statement prevents copy elision">,
6442 InGroup<PessimizingMove>, DefaultIgnore;
6443def warn_pessimizing_move_on_initialization : Warning<
6444 "moving a temporary object prevents copy elision">,
6445 InGroup<PessimizingMove>, DefaultIgnore;
6446def note_remove_move : Note<"remove std::move call here">;
6447
6448def warn_return_std_move : Warning<
6449 "local variable %0 will be copied despite being %select{returned|thrown}1 by name">,
6450 InGroup<ReturnStdMove>, DefaultIgnore;
6451def note_add_std_move : Note<
6452 "call 'std::move' explicitly to avoid copying">;
6453
6454def warn_string_plus_int : Warning<
6455 "adding %0 to a string does not append to the string">,
6456 InGroup<StringPlusInt>;
6457def warn_string_plus_char : Warning<
6458 "adding %0 to a string pointer does not append to the string">,
6459 InGroup<StringPlusChar>;
6460def note_string_plus_scalar_silence : Note<
6461 "use array indexing to silence this warning">;
6462
6463def warn_sizeof_array_param : Warning<
6464 "sizeof on array function parameter will return size of %0 instead of %1">,
6465 InGroup<SizeofArrayArgument>;
6466
6467def warn_sizeof_array_decay : Warning<
6468 "sizeof on pointer operation will return size of %0 instead of %1">,
6469 InGroup<SizeofArrayDecay>;
6470
6471def err_sizeof_nonfragile_interface : Error<
6472 "application of '%select{alignof|sizeof}1' to interface %0 is "
6473 "not supported on this architecture and platform">;
6474def err_atdef_nonfragile_interface : Error<
6475 "use of @defs is not supported on this architecture and platform">;
6476def err_subscript_nonfragile_interface : Error<
6477 "subscript requires size of interface %0, which is not constant for "
6478 "this architecture and platform">;
6479
6480def err_arithmetic_nonfragile_interface : Error<
6481 "arithmetic on pointer to interface %0, which is not a constant size for "
6482 "this architecture and platform">;
6483
6484def warn_deprecated_comma_subscript : Warning<
6485 "top-level comma expression in array subscript is deprecated">,
6486 InGroup<DeprecatedCommaSubscript>;
6487
6488def ext_subscript_non_lvalue : Extension<
6489 "ISO C90 does not allow subscripting non-lvalue array">;
6490def err_typecheck_subscript_value : Error<
6491 "subscripted value is not an array, pointer, or vector">;
6492def err_typecheck_subscript_not_integer : Error<
6493 "array subscript is not an integer">;
6494def err_subscript_function_type : Error<
6495 "subscript of pointer to function type %0">;
6496def err_subscript_incomplete_or_sizeless_type : Error<
6497 "subscript of pointer to %select{incomplete|sizeless}0 type %1">;
6498def err_dereference_incomplete_type : Error<
6499 "dereference of pointer to incomplete type %0">;
6500def ext_gnu_subscript_void_type : Extension<
6501 "subscript of a pointer to void is a GNU extension">, InGroup<PointerArith>;
6502def err_typecheck_member_reference_struct_union : Error<
6503 "member reference base type %0 is not a structure or union">;
6504def err_typecheck_member_reference_ivar : Error<
6505 "%0 does not have a member named %1">;
6506def err_arc_weak_ivar_access : Error<
6507 "dereferencing a __weak pointer is not allowed due to possible "
6508 "null value caused by race condition, assign it to strong variable first">;
6509def err_typecheck_member_reference_arrow : Error<
6510 "member reference type %0 is not a pointer">;
6511def err_typecheck_member_reference_suggestion : Error<
6512 "member reference type %0 is %select{a|not a}1 pointer; did you mean to use '%select{->|.}1'?">;
6513def note_typecheck_member_reference_suggestion : Note<
6514 "did you mean to use '.' instead?">;
6515def note_member_reference_arrow_from_operator_arrow : Note<
6516 "'->' applied to return value of the operator->() declared here">;
6517def err_typecheck_member_reference_type : Error<
6518 "cannot refer to type member %0 in %1 with '%select{.|->}2'">;
6519def err_typecheck_member_reference_unknown : Error<
6520 "cannot refer to member %0 in %1 with '%select{.|->}2'">;
6521def err_member_reference_needs_call : Error<
6522 "base of member reference is a function; perhaps you meant to call "
6523 "it%select{| with no arguments}0?">;
6524def warn_subscript_is_char : Warning<"array subscript is of type 'char'">,
6525 InGroup<CharSubscript>, DefaultIgnore;
6526
6527def err_typecheck_incomplete_tag : Error<"incomplete definition of type %0">;
6528def err_no_member : Error<"no member named %0 in %1">;
6529def err_no_member_overloaded_arrow : Error<
6530 "no member named %0 in %1; did you mean to use '->' instead of '.'?">;
6531
6532def err_member_not_yet_instantiated : Error<
6533 "no member %0 in %1; it has not yet been instantiated">;
6534def note_non_instantiated_member_here : Note<
6535 "not-yet-instantiated member is declared here">;
6536
6537def err_enumerator_does_not_exist : Error<
6538 "enumerator %0 does not exist in instantiation of %1">;
6539def note_enum_specialized_here : Note<
6540 "enum %0 was explicitly specialized here">;
6541
6542def err_specialization_not_primary_template : Error<
6543 "cannot reference member of primary template because deduced class "
6544 "template specialization %0 is %select{instantiated from a partial|"
6545 "an explicit}1 specialization">;
6546
6547def err_member_redeclared : Error<"class member cannot be redeclared">;
6548def ext_member_redeclared : ExtWarn<"class member cannot be redeclared">,
6549 InGroup<RedeclaredClassMember>;
6550def err_member_redeclared_in_instantiation : Error<
6551 "multiple overloads of %0 instantiate to the same signature %1">;
6552def err_member_name_of_class : Error<"member %0 has the same name as its class">;
6553def err_member_def_undefined_record : Error<
6554 "out-of-line definition of %0 from class %1 without definition">;
6555def err_member_decl_does_not_match : Error<
6556 "out-of-line %select{declaration|definition}2 of %0 "
6557 "does not match any declaration in %1">;
6558def err_friend_decl_with_def_arg_must_be_def : Error<
6559 "friend declaration specifying a default argument must be a definition">;
6560def err_friend_decl_with_def_arg_redeclared : Error<
6561 "friend declaration specifying a default argument must be the only declaration">;
6562def err_friend_decl_does_not_match : Error<
6563 "friend declaration of %0 does not match any declaration in %1">;
6564def err_member_decl_does_not_match_suggest : Error<
6565 "out-of-line %select{declaration|definition}2 of %0 "
6566 "does not match any declaration in %1; did you mean %3?">;
6567def err_member_def_does_not_match_ret_type : Error<
6568 "return type of out-of-line definition of %q0 differs from "
6569 "that in the declaration">;
6570def err_nonstatic_member_out_of_line : Error<
6571 "non-static data member defined out-of-line">;
6572def err_qualified_typedef_declarator : Error<
6573 "typedef declarator cannot be qualified">;
6574def err_qualified_param_declarator : Error<
6575 "parameter declarator cannot be qualified">;
6576def ext_out_of_line_declaration : ExtWarn<
6577 "out-of-line declaration of a member must be a definition">,
6578 InGroup<OutOfLineDeclaration>, DefaultError;
6579def err_member_extra_qualification : Error<
6580 "extra qualification on member %0">;
6581def warn_member_extra_qualification : Warning<
6582 err_member_extra_qualification.Text>, InGroup<MicrosoftExtraQualification>;
6583def warn_namespace_member_extra_qualification : Warning<
6584 "extra qualification on member %0">,
6585 InGroup<DiagGroup<"extra-qualification">>;
6586def err_member_qualification : Error<
6587 "non-friend class member %0 cannot have a qualified name">;
6588def note_member_def_close_match : Note<"member declaration nearly matches">;
6589def note_member_def_close_const_match : Note<
6590 "member declaration does not match because "
6591 "it %select{is|is not}0 const qualified">;
6592def note_member_def_close_param_match : Note<
6593 "type of %ordinal0 parameter of member declaration does not match definition"
6594 "%diff{ ($ vs $)|}1,2">;
6595def note_local_decl_close_match : Note<"local declaration nearly matches">;
6596def note_local_decl_close_param_match : Note<
6597 "type of %ordinal0 parameter of local declaration does not match definition"
6598 "%diff{ ($ vs $)|}1,2">;
6599def err_typecheck_ivar_variable_size : Error<
6600 "instance variables must have a constant size">;
6601def err_ivar_reference_type : Error<
6602 "instance variables cannot be of reference type">;
6603def err_typecheck_illegal_increment_decrement : Error<
6604 "cannot %select{decrement|increment}1 value of type %0">;
6605def err_typecheck_expect_int : Error<
6606 "used type %0 where integer is required">;
6607def err_typecheck_arithmetic_incomplete_or_sizeless_type : Error<
6608 "arithmetic on a pointer to %select{an incomplete|sizeless}0 type %1">;
6609def err_typecheck_pointer_arith_function_type : Error<
6610 "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 "
6611 "function type%select{|s}2 %1%select{| and %3}2">;
6612def err_typecheck_pointer_arith_void_type : Error<
6613 "arithmetic on%select{ a|}0 pointer%select{|s}0 to void">;
6614def err_typecheck_decl_incomplete_type : Error<
6615 "variable has incomplete type %0">;
6616def ext_typecheck_decl_incomplete_type : ExtWarn<
6617 "tentative definition of variable with internal linkage has incomplete non-array type %0">,
6618 InGroup<DiagGroup<"tentative-definition-incomplete-type">>;
6619def err_tentative_def_incomplete_type : Error<
6620 "tentative definition has type %0 that is never completed">;
6621def warn_tentative_incomplete_array : Warning<
6622 "tentative array definition assumed to have one element">;
6623def err_typecheck_incomplete_array_needs_initializer : Error<
6624 "definition of variable with array type needs an explicit size "
6625 "or an initializer">;
6626def err_array_init_not_init_list : Error<
6627 "array initializer must be an initializer "
6628 "list%select{| or string literal| or wide string literal}0">;
6629def err_array_init_narrow_string_into_wchar : Error<
6630 "initializing wide char array with non-wide string literal">;
6631def err_array_init_wide_string_into_char : Error<
6632 "initializing char array with wide string literal">;
6633def err_array_init_incompat_wide_string_into_wchar : Error<
6634 "initializing wide char array with incompatible wide string literal">;
6635def err_array_init_plain_string_into_char8_t : Error<
6636 "initializing 'char8_t' array with plain string literal">;
6637def note_array_init_plain_string_into_char8_t : Note<
6638 "add 'u8' prefix to form a 'char8_t' string literal">;
6639def err_array_init_utf8_string_into_char : Error<
6640 "%select{|ISO C++20 does not permit }0initialization of char array with "
6641 "UTF-8 string literal%select{ is not permitted by '-fchar8_t'|}0">;
6642def warn_cxx20_compat_utf8_string : Warning<
6643 "type of UTF-8 string literal will change from array of const char to "
6644 "array of const char8_t in C++20">, InGroup<CXX20Compat>, DefaultIgnore;
6645def note_cxx20_compat_utf8_string_remove_u8 : Note<
6646 "remove 'u8' prefix to avoid a change of behavior; "
6647 "Clang encodes unprefixed narrow string literals as UTF-8">;
6648def err_array_init_different_type : Error<
6649 "cannot initialize array %diff{of type $ with array of type $|"
6650 "with different type of array}0,1">;
6651def err_array_init_non_constant_array : Error<
6652 "cannot initialize array %diff{of type $ with non-constant array of type $|"
6653 "with different type of array}0,1">;
6654def ext_array_init_copy : Extension<
6655 "initialization of an array "
6656 "%diff{of type $ from a compound literal of type $|"
6657 "from a compound literal}0,1 is a GNU extension">, InGroup<GNUCompoundLiteralInitializer>;
6658// This is intentionally not disabled by -Wno-gnu.
6659def ext_array_init_parens : ExtWarn<
6660 "parenthesized initialization of a member array is a GNU extension">,
6661 InGroup<DiagGroup<"gnu-array-member-paren-init">>, DefaultError;
6662def warn_deprecated_string_literal_conversion : Warning<
6663 "conversion from string literal to %0 is deprecated">,
6664 InGroup<CXX11CompatDeprecatedWritableStr>;
6665def ext_deprecated_string_literal_conversion : ExtWarn<
6666 "ISO C++11 does not allow conversion from string literal to %0">,
6667 InGroup<WritableStrings>, SFINAEFailure;
6668def err_realimag_invalid_type : Error<"invalid type %0 to %1 operator">;
6669def err_typecheck_sclass_fscope : Error<
6670 "illegal storage class on file-scoped variable">;
6671def warn_standalone_specifier : Warning<"'%0' ignored on this declaration">,
6672 InGroup<MissingDeclarations>;
6673def ext_standalone_specifier : ExtWarn<"'%0' is not permitted on a declaration "
6674 "of a type">, InGroup<MissingDeclarations>;
6675def err_standalone_class_nested_name_specifier : Error<
6676 "forward declaration of %select{class|struct|interface|union|enum}0 cannot "
6677 "have a nested name specifier">;
6678def err_typecheck_sclass_func : Error<"illegal storage class on function">;
6679def err_static_block_func : Error<
6680 "function declared in block scope cannot have 'static' storage class">;
6681def err_typecheck_address_of : Error<"address of %select{bit-field"
6682 "|vector element|property expression|register variable|matrix element}0 requested">;
6683def ext_typecheck_addrof_void : Extension<
6684 "ISO C forbids taking the address of an expression of type 'void'">;
6685def err_unqualified_pointer_member_function : Error<
6686 "must explicitly qualify name of member function when taking its address">;
6687def err_invalid_form_pointer_member_function : Error<
6688 "cannot create a non-constant pointer to member function">;
6689def err_address_of_function_with_pass_object_size_params: Error<
6690 "cannot take address of function %0 because parameter %1 has "
6691 "pass_object_size attribute">;
6692def err_parens_pointer_member_function : Error<
6693 "cannot parenthesize the name of a method when forming a member pointer">;
6694def err_typecheck_invalid_lvalue_addrof_addrof_function : Error<
6695 "extra '&' taking address of overloaded function">;
6696def err_typecheck_invalid_lvalue_addrof : Error<
6697 "cannot take the address of an rvalue of type %0">;
6698def ext_typecheck_addrof_temporary : ExtWarn<
6699 "taking the address of a temporary object of type %0">,
6700 InGroup<AddressOfTemporary>, DefaultError;
6701def err_typecheck_addrof_temporary : Error<
6702 "taking the address of a temporary object of type %0">;
6703def err_typecheck_addrof_dtor : Error<
6704 "taking the address of a destructor">;
6705def err_typecheck_unary_expr : Error<
6706 "invalid argument type %0 to unary expression">;
6707def err_typecheck_indirection_requires_pointer : Error<
6708 "indirection requires pointer operand (%0 invalid)">;
6709def ext_typecheck_indirection_through_void_pointer : ExtWarn<
6710 "ISO C++ does not allow indirection on operand of type %0">,
6711 InGroup<DiagGroup<"void-ptr-dereference">>;
6712def warn_indirection_through_null : Warning<
6713 "indirection of non-volatile null pointer will be deleted, not trap">,
6714 InGroup<NullDereference>;
6715def warn_binding_null_to_reference : Warning<
6716 "binding dereferenced null pointer to reference has undefined behavior">,
6717 InGroup<NullDereference>;
6718def note_indirection_through_null : Note<
6719 "consider using __builtin_trap() or qualifying pointer with 'volatile'">;
6720def warn_pointer_indirection_from_incompatible_type : Warning<
6721 "dereference of type %1 that was reinterpret_cast from type %0 has undefined "
6722 "behavior">,
6723 InGroup<UndefinedReinterpretCast>, DefaultIgnore;
6724def warn_taking_address_of_packed_member : Warning<
6725 "taking address of packed member %0 of class or structure %q1 may result in an unaligned pointer value">,
6726 InGroup<DiagGroup<"address-of-packed-member">>;
6727def warn_param_mismatched_alignment : Warning<
6728 "passing %0-byte aligned argument to %1-byte aligned parameter %2 of %3 may result in an unaligned pointer access">,
6729 InGroup<DiagGroup<"align-mismatch">>;
6730
6731def err_objc_object_assignment : Error<
6732 "cannot assign to class object (%0 invalid)">;
6733def err_typecheck_invalid_operands : Error<
6734 "invalid operands to binary expression (%0 and %1)">;
6735def note_typecheck_invalid_operands_converted : Note<
6736 "%select{first|second}0 operand was implicitly converted to type %1">;
6737def err_typecheck_logical_vector_expr_gnu_cpp_restrict : Error<
6738 "logical expression with vector %select{type %1 and non-vector type %2|types"
6739 " %1 and %2}0 is only supported in C++">;
6740def err_typecheck_sub_ptr_compatible : Error<
6741 "%diff{$ and $ are not pointers to compatible types|"
6742 "pointers to incompatible types}0,1">;
6743def ext_typecheck_ordered_comparison_of_pointer_integer : ExtWarn<
6744 "ordered comparison between pointer and integer (%0 and %1)">;
6745def ext_typecheck_ordered_comparison_of_pointer_and_zero : Extension<
6746 "ordered comparison between pointer and zero (%0 and %1) is an extension">;
6747def err_typecheck_ordered_comparison_of_pointer_and_zero : Error<
6748 "ordered comparison between pointer and zero (%0 and %1)">;
6749def err_typecheck_three_way_comparison_of_pointer_and_zero : Error<
6750 "three-way comparison between pointer and zero">;
6751def ext_typecheck_compare_complete_incomplete_pointers : Extension<
6752 "pointer comparisons before C11 "
6753 "need to be between two complete or two incomplete types; "
6754 "%0 is %select{|in}2complete and "
6755 "%1 is %select{|in}3complete">,
6756 InGroup<C11>;
6757def ext_typecheck_ordered_comparison_of_function_pointers : ExtWarn<
6758 "ordered comparison of function pointers (%0 and %1)">,
6759 InGroup<DiagGroup<"ordered-compare-function-pointers">>;
6760def ext_typecheck_comparison_of_fptr_to_void : Extension<
6761 "equality comparison between function pointer and void pointer (%0 and %1)">;
6762def err_typecheck_comparison_of_fptr_to_void : Error<
6763 "equality comparison between function pointer and void pointer (%0 and %1)">;
6764def ext_typecheck_comparison_of_pointer_integer : ExtWarn<
6765 "comparison between pointer and integer (%0 and %1)">,
6766 InGroup<DiagGroup<"pointer-integer-compare">>;
6767def err_typecheck_comparison_of_pointer_integer : Error<
6768 "comparison between pointer and integer (%0 and %1)">;
6769def ext_typecheck_comparison_of_distinct_pointers : ExtWarn<
6770 "comparison of distinct pointer types%diff{ ($ and $)|}0,1">,
6771 InGroup<CompareDistinctPointerType>;
6772def ext_typecheck_cond_incompatible_operands : ExtWarn<
6773 "incompatible operand types (%0 and %1)">;
6774def err_cond_voidptr_arc : Error <
6775 "operands to conditional of types%diff{ $ and $|}0,1 are incompatible "
6776 "in ARC mode">;
6777def err_typecheck_comparison_of_distinct_pointers : Error<
6778 "comparison of distinct pointer types%diff{ ($ and $)|}0,1">;
6779def err_typecheck_op_on_nonoverlapping_address_space_pointers : Error<
6780 "%select{comparison between %diff{ ($ and $)|}0,1"
6781 "|arithmetic operation with operands of type %diff{ ($ and $)|}0,1"
6782 "|conditional operator with the second and third operands of type "
6783 "%diff{ ($ and $)|}0,1}2"
6784 " which are pointers to non-overlapping address spaces">;
6785
6786def select_arith_conv_kind : TextSubstitution<
6787 "%select{arithmetic between|bitwise operation between|comparison of|"
6788 "conditional expression between|compound assignment of}0">;
6789def warn_arith_conv_enum_float : Warning<
6790 "%sub{select_arith_conv_kind}0 "
6791 "%select{floating-point|enumeration}1 type %2 "
6792 "%plural{2:with|4:from|:and}0 "
6793 "%select{enumeration|floating-point}1 type %3">,
6794 InGroup<EnumFloatConversion>, DefaultIgnore;
6795def warn_arith_conv_enum_float_cxx20 : Warning<
6796 "%sub{select_arith_conv_kind}0 "
6797 "%select{floating-point|enumeration}1 type %2 "
6798 "%plural{2:with|4:from|:and}0 "
6799 "%select{enumeration|floating-point}1 type %3 is deprecated">,
6800 InGroup<DeprecatedEnumFloatConversion>;
6801def warn_arith_conv_mixed_enum_types : Warning<
6802 "%sub{select_arith_conv_kind}0 "
6803 "different enumeration types%diff{ ($ and $)|}1,2">,
6804 InGroup<EnumEnumConversion>, DefaultIgnore;
6805def warn_arith_conv_mixed_enum_types_cxx20 : Warning<
6806 "%sub{select_arith_conv_kind}0 "
6807 "different enumeration types%diff{ ($ and $)|}1,2 is deprecated">,
6808 InGroup<DeprecatedEnumEnumConversion>;
6809def warn_arith_conv_mixed_anon_enum_types : Warning<
6810 warn_arith_conv_mixed_enum_types.Text>,
6811 InGroup<AnonEnumEnumConversion>, DefaultIgnore;
6812def warn_arith_conv_mixed_anon_enum_types_cxx20 : Warning<
6813 warn_arith_conv_mixed_enum_types_cxx20.Text>,
6814 InGroup<DeprecatedAnonEnumEnumConversion>;
6815def warn_conditional_mixed_enum_types : Warning<
6816 warn_arith_conv_mixed_enum_types.Text>,
6817 InGroup<EnumCompareConditional>, DefaultIgnore;
6818def warn_conditional_mixed_enum_types_cxx20 : Warning<
6819 warn_arith_conv_mixed_enum_types_cxx20.Text>,
6820 InGroup<DeprecatedEnumCompareConditional>;
6821def warn_comparison_mixed_enum_types : Warning<
6822 warn_arith_conv_mixed_enum_types.Text>,
6823 InGroup<EnumCompare>;
6824def warn_comparison_mixed_enum_types_cxx20 : Warning<
6825 warn_arith_conv_mixed_enum_types_cxx20.Text>,
6826 InGroup<DeprecatedEnumCompare>;
6827def warn_comparison_of_mixed_enum_types_switch : Warning<
6828 "comparison of different enumeration types in switch statement"
6829 "%diff{ ($ and $)|}0,1">,
6830 InGroup<EnumCompareSwitch>;
6831
6832def err_typecheck_assign_const : Error<
6833 "%select{"
6834 "cannot assign to return value because function %1 returns a const value|"
6835 "cannot assign to variable %1 with const-qualified type %2|"
6836 "cannot assign to %select{non-|}1static data member %2 "
6837 "with const-qualified type %3|"
6838 "cannot assign to non-static data member within const member function %1|"
6839 "cannot assign to %select{variable %2|non-static data member %2|lvalue}1 "
6840 "with %select{|nested }3const-qualified data member %4|"
6841 "read-only variable is not assignable}0">;
6842
6843def note_typecheck_assign_const : Note<
6844 "%select{"
6845 "function %1 which returns const-qualified type %2 declared here|"
6846 "variable %1 declared const here|"
6847 "%select{non-|}1static data member %2 declared const here|"
6848 "member function %q1 is declared const here|"
6849 "%select{|nested }1data member %2 declared const here}0">;
6850
6851def warn_unsigned_always_true_comparison : Warning<
6852 "result of comparison of %select{%3|unsigned expression}0 %2 "
6853 "%select{unsigned expression|%3}0 is always %4">,
6854 InGroup<TautologicalUnsignedZeroCompare>, DefaultIgnore;
6855def warn_unsigned_char_always_true_comparison : Warning<
6856 "result of comparison of %select{%3|char expression}0 %2 "
6857 "%select{char expression|%3}0 is always %4, since char is interpreted as "
6858 "unsigned">, InGroup<TautologicalUnsignedCharZeroCompare>, DefaultIgnore;
6859def warn_unsigned_enum_always_true_comparison : Warning<
6860 "result of comparison of %select{%3|unsigned enum expression}0 %2 "
6861 "%select{unsigned enum expression|%3}0 is always %4">,
6862 InGroup<TautologicalUnsignedEnumZeroCompare>, DefaultIgnore;
6863def warn_tautological_constant_compare : Warning<
6864 "result of comparison %select{%3|%1}0 %2 "
6865 "%select{%1|%3}0 is always %4">,
6866 InGroup<TautologicalTypeLimitCompare>, DefaultIgnore;
6867def warn_tautological_compare_objc_bool : Warning<
6868 "result of comparison of constant %0 with expression of type 'BOOL'"
6869 " is always %1, as the only well defined values for 'BOOL' are YES and NO">,
6870 InGroup<TautologicalObjCBoolCompare>;
6871def subst_int_range : TextSubstitution<"%0-bit %select{signed|unsigned}1 value">;
6872def warn_tautological_compare_value_range : Warning<
6873 "result of comparison of "
6874 "%select{%4|%sub{subst_int_range}1,2}0 %3 "
6875 "%select{%sub{subst_int_range}1,2|%4}0 is always %5">,
6876 InGroup<TautologicalValueRangeCompare>, DefaultIgnore;
6877
6878def warn_mixed_sign_comparison : Warning<
6879 "comparison of integers of different signs: %0 and %1">,
6880 InGroup<SignCompare>, DefaultIgnore;
6881def warn_out_of_range_compare : Warning<
6882 "result of comparison of %select{constant %0|true|false}1 with "
6883 "%select{expression of type %2|boolean expression}3 is always %4">,
6884 InGroup<TautologicalOutOfRangeCompare>;
6885def warn_tautological_bool_compare : Warning<warn_out_of_range_compare.Text>,
6886 InGroup<TautologicalConstantCompare>;
6887def warn_integer_constants_in_conditional_always_true : Warning<
6888 "converting the result of '?:' with integer constants to a boolean always "
6889 "evaluates to 'true'">,
6890 InGroup<TautologicalConstantCompare>;
6891def warn_left_shift_always : Warning<
6892 "converting the result of '<<' to a boolean always evaluates "
6893 "to %select{false|true}0">,
6894 InGroup<TautologicalConstantCompare>;
6895def warn_null_in_arithmetic_operation : Warning<
6896 "use of NULL in arithmetic operation">,
6897 InGroup<NullArithmetic>;
6898def warn_null_in_comparison_operation : Warning<
6899 "comparison between NULL and non-pointer "
6900 "%select{(%1 and NULL)|(NULL and %1)}0">,
6901 InGroup<NullArithmetic>;
6902def err_shift_rhs_only_vector : Error<
6903 "requested shift is a vector of type %0 but the first operand is not a "
6904 "vector (%1)">;
6905
6906def warn_logical_not_on_lhs_of_check : Warning<
6907 "logical not is only applied to the left hand side of this "
6908 "%select{comparison|bitwise operator}0">,
6909 InGroup<LogicalNotParentheses>;
6910def note_logical_not_fix : Note<
6911 "add parentheses after the '!' to evaluate the "
6912 "%select{comparison|bitwise operator}0 first">;
6913def note_logical_not_silence_with_parens : Note<
6914 "add parentheses around left hand side expression to silence this warning">;
6915
6916def err_invalid_this_use : Error<
6917 "invalid use of 'this' outside of a non-static member function">;
6918def err_this_static_member_func : Error<
6919 "'this' cannot be%select{| implicitly}0 used in a static member function "
6920 "declaration">;
6921def err_invalid_member_use_in_static_method : Error<
6922 "invalid use of member %0 in static member function">;
6923def err_invalid_qualified_function_type : Error<
6924 "%select{non-member function|static member function|deduction guide}0 "
6925 "%select{of type %2 |}1cannot have '%3' qualifier">;
6926def err_compound_qualified_function_type : Error<
6927 "%select{block pointer|pointer|reference}0 to function type %select{%2 |}1"
6928 "cannot have '%3' qualifier">;
6929def err_qualified_function_typeid : Error<
6930 "type operand %0 of 'typeid' cannot have '%1' qualifier">;
6931
6932def err_ref_qualifier_overload : Error<
6933 "cannot overload a member function %select{without a ref-qualifier|with "
6934 "ref-qualifier '&'|with ref-qualifier '&&'}0 with a member function %select{"
6935 "without a ref-qualifier|with ref-qualifier '&'|with ref-qualifier '&&'}1">;
6936
6937def err_invalid_non_static_member_use : Error<
6938 "invalid use of non-static data member %0">;
6939def err_nested_non_static_member_use : Error<
6940 "%select{call to non-static member function|use of non-static data member}0 "
6941 "%2 of %1 from nested type %3">;
6942def warn_cxx98_compat_non_static_member_use : Warning<
6943 "use of non-static data member %0 in an unevaluated context is "
6944 "incompatible with C++98">, InGroup<CXX98Compat>, DefaultIgnore;
6945def err_invalid_incomplete_type_use : Error<
6946 "invalid use of incomplete type %0">;
6947def err_builtin_func_cast_more_than_one_arg : Error<
6948 "function-style cast to a builtin type can only take one argument">;
6949def err_value_init_for_array_type : Error<
6950 "array types cannot be value-initialized">;
6951def err_init_for_function_type : Error<
6952 "cannot create object of function type %0">;
6953def warn_format_nonliteral_noargs : Warning<
6954 "format string is not a string literal (potentially insecure)">,
6955 InGroup<FormatSecurity>;
6956def warn_format_nonliteral : Warning<
6957 "format string is not a string literal">,
6958 InGroup<FormatNonLiteral>, DefaultIgnore;
6959
6960def err_unexpected_interface : Error<
6961 "unexpected interface name %0: expected expression">;
6962def err_ref_non_value : Error<"%0 does not refer to a value">;
6963def err_ref_vm_type : Error<
6964 "cannot refer to declaration with a variably modified type inside block">;
6965def err_ref_flexarray_type : Error<
6966 "cannot refer to declaration of structure variable with flexible array member "
6967 "inside block">;
6968def err_ref_array_type : Error<
6969 "cannot refer to declaration with an array type inside block">;
6970def err_property_not_found : Error<
6971 "property %0 not found on object of type %1">;
6972def err_invalid_property_name : Error<
6973 "%0 is not a valid property name (accessing an object of type %1)">;
6974def err_getter_not_found : Error<
6975 "no getter method for read from property">;
6976def err_objc_subscript_method_not_found : Error<
6977 "expected method to %select{read|write}1 %select{dictionary|array}2 element not "
6978 "found on object of type %0">;
6979def err_objc_subscript_index_type : Error<
6980 "method index parameter type %0 is not integral type">;
6981def err_objc_subscript_key_type : Error<
6982 "method key parameter type %0 is not object type">;
6983def err_objc_subscript_dic_object_type : Error<
6984 "method object parameter type %0 is not object type">;
6985def err_objc_subscript_object_type : Error<
6986 "cannot assign to this %select{dictionary|array}1 because assigning method's "
6987 "2nd parameter of type %0 is not an Objective-C pointer type">;
6988def err_objc_subscript_base_type : Error<
6989 "%select{dictionary|array}1 subscript base type %0 is not an Objective-C object">;
6990def err_objc_multiple_subscript_type_conversion : Error<
6991 "indexing expression is invalid because subscript type %0 has "
6992 "multiple type conversion functions">;
6993def err_objc_subscript_type_conversion : Error<
6994 "indexing expression is invalid because subscript type %0 is not an integral"
6995 " or Objective-C pointer type">;
6996def err_objc_subscript_pointer : Error<
6997 "indexing expression is invalid because subscript type %0 is not an"
6998 " Objective-C pointer">;
6999def err_objc_indexing_method_result_type : Error<
7000 "method for accessing %select{dictionary|array}1 element must have Objective-C"
7001 " object return type instead of %0">;
7002def err_objc_index_incomplete_class_type : Error<
7003 "Objective-C index expression has incomplete class type %0">;
7004def err_illegal_container_subscripting_op : Error<
7005 "illegal operation on Objective-C container subscripting">;
7006def err_property_not_found_forward_class : Error<
7007 "property %0 cannot be found in forward class object %1">;
7008def err_property_not_as_forward_class : Error<
7009 "property %0 refers to an incomplete Objective-C class %1 "
7010 "(with no @interface available)">;
7011def note_forward_class : Note<
7012 "forward declaration of class here">;
7013def err_duplicate_property : Error<
7014 "property has a previous declaration">;
7015def ext_gnu_void_ptr : Extension<
7016 "arithmetic on%select{ a|}0 pointer%select{|s}0 to void is a GNU extension">,
7017 InGroup<PointerArith>;
7018def ext_gnu_ptr_func_arith : Extension<
7019 "arithmetic on%select{ a|}0 pointer%select{|s}0 to%select{ the|}2 function "
7020 "type%select{|s}2 %1%select{| and %3}2 is a GNU extension">,
7021 InGroup<PointerArith>;
7022def err_readonly_message_assignment : Error<
7023 "assigning to 'readonly' return result of an Objective-C message not allowed">;
7024def ext_integer_increment_complex : Extension<
7025 "ISO C does not support '++'/'--' on complex integer type %0">;
7026def ext_integer_complement_complex : Extension<
7027 "ISO C does not support '~' for complex conjugation of %0">;
7028def err_nosetter_property_assignment : Error<
7029 "%select{assignment to readonly property|"
7030 "no setter method %1 for assignment to property}0">;
7031def err_nosetter_property_incdec : Error<
7032 "%select{%select{increment|decrement}1 of readonly property|"
7033 "no setter method %2 for %select{increment|decrement}1 of property}0">;
7034def err_nogetter_property_compound_assignment : Error<
7035 "a getter method is needed to perform a compound assignment on a property">;
7036def err_nogetter_property_incdec : Error<
7037 "no getter method %1 for %select{increment|decrement}0 of property">;
7038def err_no_subobject_property_setting : Error<
7039 "expression is not assignable">;
7040def err_qualified_objc_access : Error<
7041 "%select{property|instance variable}0 access cannot be qualified with '%1'">;
7042
7043def ext_freestanding_complex : Extension<
7044 "complex numbers are an extension in a freestanding C99 implementation">;
7045
7046// FIXME: Remove when we support imaginary.
7047def err_imaginary_not_supported : Error<"imaginary types are not supported">;
7048
7049// Obj-c expressions
7050def warn_root_inst_method_not_found : Warning<
7051 "instance method %0 is being used on 'Class' which is not in the root class">,
7052 InGroup<MethodAccess>;
7053def warn_class_method_not_found : Warning<
7054 "class method %objcclass0 not found (return type defaults to 'id')">,
7055 InGroup<MethodAccess>;
7056def warn_instance_method_on_class_found : Warning<
7057 "instance method %0 found instead of class method %1">,
7058 InGroup<MethodAccess>;
7059def warn_inst_method_not_found : Warning<
7060 "instance method %objcinstance0 not found (return type defaults to 'id')">,
7061 InGroup<MethodAccess>;
7062def warn_instance_method_not_found_with_typo : Warning<
7063 "instance method %objcinstance0 not found (return type defaults to 'id')"
7064 "; did you mean %objcinstance2?">, InGroup<MethodAccess>;
7065def warn_class_method_not_found_with_typo : Warning<
7066 "class method %objcclass0 not found (return type defaults to 'id')"
7067 "; did you mean %objcclass2?">, InGroup<MethodAccess>;
7068def err_method_not_found_with_typo : Error<
7069 "%select{instance|class}1 method %0 not found "
7070 "; did you mean %2?">;
7071def err_no_super_class_message : Error<
7072 "no @interface declaration found in class messaging of %0">;
7073def err_root_class_cannot_use_super : Error<
7074 "%0 cannot use 'super' because it is a root class">;
7075def err_invalid_receiver_to_message_super : Error<
7076 "'super' is only valid in a method body">;
7077def err_invalid_receiver_class_message : Error<
7078 "receiver type %0 is not an Objective-C class">;
7079def err_missing_open_square_message_send : Error<
7080 "missing '[' at start of message send expression">;
7081def warn_bad_receiver_type : Warning<
7082 "receiver type %0 is not 'id' or interface pointer, consider "
7083 "casting it to 'id'">,InGroup<ObjCReceiver>;
7084def err_bad_receiver_type : Error<"bad receiver type %0">;
7085def err_incomplete_receiver_type : Error<"incomplete receiver type %0">;
7086def err_unknown_receiver_suggest : Error<
7087 "unknown receiver %0; did you mean %1?">;
7088def err_objc_throw_expects_object : Error<
7089 "@throw requires an Objective-C object type (%0 invalid)">;
7090def err_objc_synchronized_expects_object : Error<
7091 "@synchronized requires an Objective-C object type (%0 invalid)">;
7092def err_rethrow_used_outside_catch : Error<
7093 "@throw (rethrow) used outside of a @catch block">;
7094def err_attribute_multiple_objc_gc : Error<
7095 "multiple garbage collection attributes specified for type">;
7096def err_catch_param_not_objc_type : Error<
7097 "@catch parameter is not a pointer to an interface type">;
7098def err_illegal_qualifiers_on_catch_parm : Error<
7099 "illegal qualifiers on @catch parameter">;
7100def err_storage_spec_on_catch_parm : Error<
7101 "@catch parameter cannot have storage specifier '%0'">;
7102def warn_register_objc_catch_parm : Warning<
7103 "'register' storage specifier on @catch parameter will be ignored">;
7104def err_qualified_objc_catch_parm : Error<
7105 "@catch parameter declarator cannot be qualified">;
7106def warn_objc_pointer_cxx_catch_fragile : Warning<
7107 "cannot catch an exception thrown with @throw in C++ in the non-unified "
7108 "exception model">, InGroup<ObjCNonUnifiedException>;
7109def err_objc_object_catch : Error<
7110 "cannot catch an Objective-C object by value">;
7111def err_incomplete_type_objc_at_encode : Error<
7112 "'@encode' of incomplete type %0">;
7113def warn_objc_circular_container : Warning<
7114 "adding %0 to %1 might cause circular dependency in container">,
7115 InGroup<DiagGroup<"objc-circular-container">>;
7116def note_objc_circular_container_declared_here : Note<"%0 declared here">;
7117def warn_objc_unsafe_perform_selector : Warning<
7118 "%0 is incompatible with selectors that return a "
7119 "%select{struct|union|vector}1 type">,
7120 InGroup<DiagGroup<"objc-unsafe-perform-selector">>;
7121def note_objc_unsafe_perform_selector_method_declared_here : Note<
7122 "method %0 that returns %1 declared here">;
7123def err_attribute_arm_builtin_alias : Error<
7124 "'__clang_arm_builtin_alias' attribute can only be applied to an ARM builtin">;
7125def err_attribute_arm_mve_polymorphism : Error<
7126 "'__clang_arm_mve_strict_polymorphism' attribute can only be applied to an MVE/NEON vector type">;
7127
7128def warn_setter_getter_impl_required : Warning<
7129 "property %0 requires method %1 to be defined - "
7130 "use @synthesize, @dynamic or provide a method implementation "
7131 "in this class implementation">,
7132 InGroup<ObjCPropertyImpl>;
7133def warn_setter_getter_impl_required_in_category : Warning<
7134 "property %0 requires method %1 to be defined - "
7135 "use @dynamic or provide a method implementation in this category">,
7136 InGroup<ObjCPropertyImpl>;
7137def note_parameter_named_here : Note<
7138 "passing argument to parameter %0 here">;
7139def note_parameter_here : Note<
7140 "passing argument to parameter here">;
7141def note_method_return_type_change : Note<
7142 "compiler has implicitly changed method %0 return type">;
7143
7144def warn_impl_required_for_class_property : Warning<
7145 "class property %0 requires method %1 to be defined - "
7146 "use @dynamic or provide a method implementation "
7147 "in this class implementation">,
7148 InGroup<ObjCPropertyImpl>;
7149def warn_impl_required_in_category_for_class_property : Warning<
7150 "class property %0 requires method %1 to be defined - "
7151 "use @dynamic or provide a method implementation in this category">,
7152 InGroup<ObjCPropertyImpl>;
7153
7154// C++ casts
7155// These messages adhere to the TryCast pattern: %0 is an int specifying the
7156// cast type, %1 is the source type, %2 is the destination type.
7157def err_bad_reinterpret_cast_overload : Error<
7158 "reinterpret_cast cannot resolve overloaded function %0 to type %1">;
7159
7160def warn_reinterpret_different_from_static : Warning<
7161 "'reinterpret_cast' %select{from|to}3 class %0 %select{to|from}3 its "
7162 "%select{virtual base|base at non-zero offset}2 %1 behaves differently from "
7163 "'static_cast'">, InGroup<ReinterpretBaseClass>;
7164def note_reinterpret_updowncast_use_static: Note<
7165 "use 'static_cast' to adjust the pointer correctly while "
7166 "%select{upcasting|downcasting}0">;
7167
7168def err_bad_static_cast_overload : Error<
7169 "address of overloaded function %0 cannot be static_cast to type %1">;
7170
7171def err_bad_cstyle_cast_overload : Error<
7172 "address of overloaded function %0 cannot be cast to type %1">;
7173
7174
7175def err_bad_cxx_cast_generic : Error<
7176 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7177 "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 is not allowed">;
7178def err_bad_cxx_cast_unrelated_class : Error<
7179 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7180 "functional-style cast|}0 from %1 to %2, which are not related by "
7181 "inheritance, is not allowed">;
7182def note_type_incomplete : Note<"%0 is incomplete">;
7183def err_bad_cxx_cast_rvalue : Error<
7184 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7185 "functional-style cast|addrspace_cast}0 from rvalue to reference type %2">;
7186def err_bad_cxx_cast_bitfield : Error<
7187 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7188 "functional-style cast|}0 from bit-field lvalue to reference type %2">;
7189def err_bad_cxx_cast_qualifiers_away : Error<
7190 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7191 "functional-style cast|}0 from %1 to %2 casts away qualifiers">;
7192def err_bad_cxx_cast_addr_space_mismatch : Error<
7193 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|"
7194 "C-style cast|functional-style cast|addrspace_cast}0 from %1 to %2 converts between mismatching address"
7195 " spaces">;
7196def ext_bad_cxx_cast_qualifiers_away_incoherent : ExtWarn<
7197 "ISO C++ does not allow "
7198 "%select{const_cast|static_cast|reinterpret_cast|dynamic_cast|C-style cast|"
7199 "functional-style cast|}0 from %1 to %2 because it casts away qualifiers, "
7200 "even though the source and destination types are unrelated">,
7201 SFINAEFailure, InGroup<DiagGroup<"cast-qual-unrelated">>;
7202def err_bad_const_cast_dest : Error<
7203 "%select{const_cast||||C-style cast|functional-style cast|}0 to %2, "
7204 "which is not a reference, pointer-to-object, or pointer-to-data-member">;
7205def ext_cast_fn_obj : Extension<
7206 "cast between pointer-to-function and pointer-to-object is an extension">;
7207def ext_ms_cast_fn_obj : ExtWarn<
7208 "static_cast between pointer-to-function and pointer-to-object is a "
7209 "Microsoft extension">, InGroup<MicrosoftCast>;
7210def warn_cxx98_compat_cast_fn_obj : Warning<
7211 "cast between pointer-to-function and pointer-to-object is incompatible with C++98">,
7212 InGroup<CXX98CompatPedantic>, DefaultIgnore;
7213def err_bad_reinterpret_cast_small_int : Error<
7214 "cast from pointer to smaller type %2 loses information">;
7215def err_bad_cxx_cast_vector_to_scalar_different_size : Error<
7216 "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7217 "to scalar %2 of different size">;
7218def err_bad_cxx_cast_scalar_to_vector_different_size : Error<
7219 "%select{||reinterpret_cast||C-style cast||}0 from scalar %1 "
7220 "to vector %2 of different size">;
7221def err_bad_cxx_cast_vector_to_vector_different_size : Error<
7222 "%select{||reinterpret_cast||C-style cast||}0 from vector %1 "
7223 "to vector %2 of different size">;
7224def warn_bad_cxx_cast_nested_pointer_addr_space : Warning<
7225 "%select{reinterpret_cast|C-style cast}0 from %1 to %2 "
7226 "changes address space of nested pointers">,
7227 InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
7228def err_bad_lvalue_to_rvalue_cast : Error<
7229 "cannot cast from lvalue of type %1 to rvalue reference type %2; types are "
7230 "not compatible">;
7231def err_bad_rvalue_to_rvalue_cast : Error<
7232 "cannot cast from rvalue of type %1 to rvalue reference type %2; types are "
7233 "not compatible">;
7234def err_bad_static_cast_pointer_nonpointer : Error<
7235 "cannot cast from type %1 to pointer type %2">;
7236def err_bad_static_cast_member_pointer_nonmp : Error<
7237 "cannot cast from type %1 to member pointer type %2">;
7238def err_bad_cxx_cast_member_pointer_size : Error<
7239 "cannot %select{||reinterpret_cast||C-style cast||}0 from member pointer "
7240 "type %1 to member pointer type %2 of different size">;
7241def err_bad_reinterpret_cast_reference : Error<
7242 "reinterpret_cast of a %0 to %1 needs its address, which is not allowed">;
7243def warn_undefined_reinterpret_cast : Warning<
7244 "reinterpret_cast from %0 to %1 has undefined behavior">,
7245 InGroup<UndefinedReinterpretCast>, DefaultIgnore;
7246
7247// These messages don't adhere to the pattern.
7248// FIXME: Display the path somehow better.
7249def err_ambiguous_base_to_derived_cast : Error<
7250 "ambiguous cast from base %0 to derived %1:%2">;
7251def err_static_downcast_via_virtual : Error<
7252 "cannot cast %0 to %1 via virtual base %2">;
7253def err_downcast_from_inaccessible_base : Error<
7254 "cannot cast %select{private|protected}2 base class %1 to %0">;
7255def err_upcast_to_inaccessible_base : Error<
7256 "cannot cast %0 to its %select{private|protected}2 base class %1">;
7257def err_bad_dynamic_cast_not_ref_or_ptr : Error<
7258 "invalid target type %0 for dynamic_cast; target type must be a reference or pointer type to a defined class">;
7259def err_bad_dynamic_cast_not_class : Error<"%0 is not a class type">;
7260def err_bad_cast_incomplete : Error<"%0 is an incomplete type">;
7261def err_bad_dynamic_cast_not_ptr : Error<"cannot use dynamic_cast to convert from %0 to %1">;
7262def err_bad_dynamic_cast_not_polymorphic : Error<"%0 is not polymorphic">;
7263
7264// Other C++ expressions
7265def err_need_header_before_typeid : Error<
7266 "you need to include <typeinfo> before using the 'typeid' operator">;
7267def err_need_header_before_ms_uuidof : Error<
7268 "you need to include <guiddef.h> before using the '__uuidof' operator">;
7269def err_need_header_before_placement_new : Error<
7270 "no matching %0 function for non-allocating placement new expression; "
7271 "include <new>">;
7272def err_ms___leave_not_in___try : Error<
7273 "'__leave' statement not in __try block">;
7274def err_uuidof_without_guid : Error<
7275 "cannot call operator __uuidof on a type with no GUID">;
7276def err_uuidof_with_multiple_guids : Error<
7277 "cannot call operator __uuidof on a type with multiple GUIDs">;
7278def err_incomplete_typeid : Error<"'typeid' of incomplete type %0">;
7279def err_variably_modified_typeid : Error<"'typeid' of variably modified type %0">;
7280def err_static_illegal_in_new : Error<
7281 "the 'static' modifier for the array size is not legal in new expressions">;
7282def err_array_new_needs_size : Error<
7283 "array size must be specified in new expression with no initializer">;
7284def err_bad_new_type : Error<
7285 "cannot allocate %select{function|reference}1 type %0 with new">;
7286def err_new_incomplete_or_sizeless_type : Error<
7287 "allocation of %select{incomplete|sizeless}0 type %1">;
7288def err_new_array_nonconst : Error<
7289 "only the first dimension of an allocated array may have dynamic size">;
7290def err_new_array_size_unknown_from_init : Error<
7291 "cannot determine allocated array size from initializer">;
7292def err_new_array_init_args : Error<
7293 "array 'new' cannot have initialization arguments">;
7294def ext_new_paren_array_nonconst : ExtWarn<
7295 "when type is in parentheses, array cannot have dynamic size">;
7296def err_placement_new_non_placement_delete : Error<
7297 "'new' expression with placement arguments refers to non-placement "
7298 "'operator delete'">;
7299def err_array_size_not_integral : Error<
7300 "array size expression must have integral or %select{|unscoped }0"
7301 "enumeration type, not %1">;
7302def err_array_size_incomplete_type : Error<
7303 "array size expression has incomplete class type %0">;
7304def err_array_size_explicit_conversion : Error<
7305 "array size expression of type %0 requires explicit conversion to type %1">;
7306def note_array_size_conversion : Note<
7307 "conversion to %select{integral|enumeration}0 type %1 declared here">;
7308def err_array_size_ambiguous_conversion : Error<
7309 "ambiguous conversion of array size expression of type %0 to an integral or "
7310 "enumeration type">;
7311def ext_array_size_conversion : Extension<
7312 "implicit conversion from array size expression of type %0 to "
7313 "%select{integral|enumeration}1 type %2 is a C++11 extension">,
7314 InGroup<CXX11>;
7315def warn_cxx98_compat_array_size_conversion : Warning<
7316 "implicit conversion from array size expression of type %0 to "
7317 "%select{integral|enumeration}1 type %2 is incompatible with C++98">,
7318 InGroup<CXX98CompatPedantic>, DefaultIgnore;
7319def err_address_space_qualified_new : Error<
7320 "'new' cannot allocate objects of type %0 in address space '%1'">;
7321def err_address_space_qualified_delete : Error<
7322 "'delete' cannot delete objects of type %0 in address space '%1'">;
7323
7324def err_default_init_const : Error<
7325 "default initialization of an object of const type %0"
7326 "%select{| without a user-provided default constructor}1">;
7327def ext_default_init_const : ExtWarn<
7328 "default initialization of an object of const type %0"
7329 "%select{| without a user-provided default constructor}1 "
7330 "is a Microsoft extension">,
7331 InGroup<MicrosoftConstInit>;
7332def err_delete_operand : Error<"cannot delete expression of type %0">;
7333def ext_delete_void_ptr_operand : ExtWarn<
7334 "cannot delete expression with pointer-to-'void' type %0">,
7335 InGroup<DeleteIncomplete>;
7336def err_ambiguous_delete_operand : Error<
7337 "ambiguous conversion of delete expression of type %0 to a pointer">;
7338def warn_delete_incomplete : Warning<
7339 "deleting pointer to incomplete type %0 may cause undefined behavior">,
7340 InGroup<DeleteIncomplete>;
7341def err_delete_incomplete_class_type : Error<
7342 "deleting incomplete class type %0; no conversions to pointer type">;
7343def err_delete_explicit_conversion : Error<
7344 "converting delete expression from type %0 to type %1 invokes an explicit "
7345 "conversion function">;
7346def note_delete_conversion : Note<"conversion to pointer type %0">;
7347def warn_delete_array_type : Warning<
7348 "'delete' applied to a pointer-to-array type %0 treated as 'delete[]'">;
7349def warn_mismatched_delete_new : Warning<
7350 "'delete%select{|[]}0' applied to a pointer that was allocated with "
7351 "'new%select{[]|}0'; did you mean 'delete%select{[]|}0'?">,
7352 InGroup<DiagGroup<"mismatched-new-delete">>;
7353def note_allocated_here : Note<"allocated with 'new%select{[]|}0' here">;
7354def err_no_suitable_delete_member_function_found : Error<
7355 "no suitable member %0 in %1">;
7356def err_ambiguous_suitable_delete_member_function_found : Error<
7357 "multiple suitable %0 functions in %1">;
7358def warn_ambiguous_suitable_delete_function_found : Warning<
7359 "multiple suitable %0 functions for %1; no 'operator delete' function "
7360 "will be invoked if initialization throws an exception">,
7361 InGroup<DiagGroup<"ambiguous-delete">>;
7362def note_member_declared_here : Note<
7363 "member %0 declared here">;
7364def note_member_first_declared_here : Note<
7365 "member %0 first declared here">;
7366def warn_bitwise_negation_bool : Warning<
7367 "bitwise negation of a boolean expression%select{;| always evaluates to 'true';}0 "
7368 "did you mean logical negation?">,
7369 InGroup<DiagGroup<"bool-operation">>;
7370def err_decrement_bool : Error<"cannot decrement expression of type bool">;
7371def warn_increment_bool : Warning<
7372 "incrementing expression of type bool is deprecated and "
7373 "incompatible with C++17">, InGroup<DeprecatedIncrementBool>;
7374def ext_increment_bool : ExtWarn<
7375 "ISO C++17 does not allow incrementing expression of type bool">,
7376 DefaultError, InGroup<IncrementBool>;
7377def err_increment_decrement_enum : Error<
7378 "cannot %select{decrement|increment}0 expression of enum type %1">;
7379
7380def warn_deprecated_increment_decrement_volatile : Warning<
7381 "%select{decrement|increment}0 of object of volatile-qualified type %1 "
7382 "is deprecated">, InGroup<DeprecatedVolatile>;
7383def warn_deprecated_simple_assign_volatile : Warning<
7384 "use of result of assignment to object of volatile-qualified type %0 "
7385 "is deprecated">, InGroup<DeprecatedVolatile>;
7386def warn_deprecated_compound_assign_volatile : Warning<
7387 "compound assignment to object of volatile-qualified type %0 is deprecated">,
7388 InGroup<DeprecatedVolatile>;
7389def warn_deprecated_volatile_return : Warning<
7390 "volatile-qualified return type %0 is deprecated">,
7391 InGroup<DeprecatedVolatile>;
7392def warn_deprecated_volatile_param : Warning<
7393 "volatile-qualified parameter type %0 is deprecated">,
7394 InGroup<DeprecatedVolatile>;
7395def warn_deprecated_volatile_structured_binding : Warning<
7396 "volatile qualifier in structured binding declaration is deprecated">,
7397 InGroup<DeprecatedVolatile>;
7398
7399def err_catch_incomplete_ptr : Error<
7400 "cannot catch pointer to incomplete type %0">;
7401def err_catch_incomplete_ref : Error<
7402 "cannot catch reference to incomplete type %0">;
7403def err_catch_incomplete : Error<"cannot catch incomplete type %0">;
7404def err_catch_sizeless : Error<
7405 "cannot catch %select{|reference to }0sizeless type %1">;
7406def err_catch_rvalue_ref : Error<"cannot catch exceptions by rvalue reference">;
7407def err_catch_variably_modified : Error<
7408 "cannot catch variably modified type %0">;
7409def err_qualified_catch_declarator : Error<
7410 "exception declarator cannot be qualified">;
7411def err_early_catch_all : Error<"catch-all handler must come last">;
7412def err_bad_memptr_rhs : Error<
7413 "right hand operand to %0 has non-pointer-to-member type %1">;
7414def err_bad_memptr_lhs : Error<
7415 "left hand operand to %0 must be a %select{|pointer to }1class "
7416 "compatible with the right hand operand, but is %2">;
7417def err_memptr_incomplete : Error<
7418 "member pointer has incomplete base type %0">;
7419def warn_exception_caught_by_earlier_handler : Warning<
7420 "exception of type %0 will be caught by earlier handler">,
7421 InGroup<Exceptions>;
7422def note_previous_exception_handler : Note<"for type %0">;
7423def err_exceptions_disabled : Error<
7424 "cannot use '%0' with exceptions disabled">;
7425def err_objc_exceptions_disabled : Error<
7426 "cannot use '%0' with Objective-C exceptions disabled">;
7427def warn_throw_in_noexcept_func : Warning<
7428 "%0 has a non-throwing exception specification but can still throw">,
7429 InGroup<Exceptions>;
7430def note_throw_in_dtor : Note<
7431 "%select{destructor|deallocator}0 has a %select{non-throwing|implicit "
7432 "non-throwing}1 exception specification">;
7433def note_throw_in_function : Note<"function declared non-throwing here">;
7434def err_seh_try_outside_functions : Error<
7435 "cannot use SEH '__try' in blocks, captured regions, or Obj-C method decls">;
7436def err_mixing_cxx_try_seh_try : Error<
7437 "cannot use C++ 'try' in the same function as SEH '__try'">;
7438def err_seh_try_unsupported : Error<
7439 "SEH '__try' is not supported on this target">;
7440def note_conflicting_try_here : Note<
7441 "conflicting %0 here">;
7442def warn_jump_out_of_seh_finally : Warning<
7443 "jump out of __finally block has undefined behavior">,
7444 InGroup<DiagGroup<"jump-seh-finally">>;
7445def warn_non_virtual_dtor : Warning<
7446 "%0 has virtual functions but non-virtual destructor">,
7447 InGroup<NonVirtualDtor>, DefaultIgnore;
7448def warn_delete_non_virtual_dtor : Warning<
7449 "%select{delete|destructor}0 called on non-final %1 that has "
7450 "virtual functions but non-virtual destructor">,
7451 InGroup<DeleteNonAbstractNonVirtualDtor>, DefaultIgnore, ShowInSystemHeader;
7452def note_delete_non_virtual : Note<
7453 "qualify call to silence this warning">;
7454def warn_delete_abstract_non_virtual_dtor : Warning<
7455 "%select{delete|destructor}0 called on %1 that is abstract but has "
7456 "non-virtual destructor">, InGroup<DeleteAbstractNonVirtualDtor>, ShowInSystemHeader;
7457def warn_overloaded_virtual : Warning<
7458 "%q0 hides overloaded virtual %select{function|functions}1">,
7459 InGroup<OverloadedVirtual>, DefaultIgnore;
7460def note_hidden_overloaded_virtual_declared_here : Note<
7461 "hidden overloaded virtual function %q0 declared here"
7462 "%select{|: different classes%diff{ ($ vs $)|}2,3"
7463 "|: different number of parameters (%2 vs %3)"
7464 "|: type mismatch at %ordinal2 parameter%diff{ ($ vs $)|}3,4"
7465 "|: different return type%diff{ ($ vs $)|}2,3"
7466 "|: different qualifiers (%2 vs %3)"
7467 "|: different exception specifications}1">;
7468def warn_using_directive_in_header : Warning<
7469 "using namespace directive in global context in header">,
7470 InGroup<HeaderHygiene>, DefaultIgnore;
7471def warn_overaligned_type : Warning<
7472 "type %0 requires %1 bytes of alignment and the default allocator only "
7473 "guarantees %2 bytes">,
7474 InGroup<OveralignedType>, DefaultIgnore;
7475def err_aligned_allocation_unavailable : Error<
7476 "aligned %select{allocation|deallocation}0 function of type '%1' is "
7477 "%select{only|not}4 available on %2%select{ %3 or newer|}4">;
7478def note_silence_aligned_allocation_unavailable : Note<
7479 "if you supply your own aligned allocation functions, use "
7480 "-faligned-allocation to silence this diagnostic">;
7481
7482def err_conditional_void_nonvoid : Error<
7483 "%select{left|right}1 operand to ? is void, but %select{right|left}1 operand "
7484 "is of type %0">;
7485def err_conditional_ambiguous : Error<
7486 "conditional expression is ambiguous; "
7487 "%diff{$ can be converted to $ and vice versa|"
7488 "types can be convert to each other}0,1">;
7489def err_conditional_ambiguous_ovl : Error<
7490 "conditional expression is ambiguous; %diff{$ and $|types}0,1 "
7491 "can be converted to several common types">;
7492def err_conditional_vector_size : Error<
7493 "vector condition type %0 and result type %1 do not have the same number "
7494 "of elements">;
7495def err_conditional_vector_element_size : Error<
7496 "vector condition type %0 and result type %1 do not have elements of the "
7497 "same size">;
7498def err_conditional_vector_has_void : Error<
7499 "GNU vector conditional operand cannot be %select{void|a throw expression}0">;
7500def err_conditional_vector_operand_type
7501 : Error<"enumeration type %0 is not allowed in a vector conditional">;
7502def err_conditional_vector_cond_result_mismatch
7503 : Error<"cannot mix vectors and extended vectors in a vector conditional">;
7504def err_conditional_vector_mismatched
7505 : Error<"vector operands to the vector conditional must be the same type "
7506 "%diff{($ and $)|}0,1}">;
7507
7508def err_throw_incomplete : Error<
7509 "cannot throw object of incomplete type %0">;
7510def err_throw_incomplete_ptr : Error<
7511 "cannot throw pointer to object of incomplete type %0">;
7512def err_throw_sizeless : Error<
7513 "cannot throw object of sizeless type %0">;
7514def warn_throw_underaligned_obj : Warning<
7515 "underaligned exception object thrown">,
7516 InGroup<UnderalignedExceptionObject>;
7517def note_throw_underaligned_obj : Note<
7518 "required alignment of type %0 (%1 bytes) is larger than the supported "
7519 "alignment of C++ exception objects on this target (%2 bytes)">;
7520def err_return_in_constructor_handler : Error<
7521 "return in the catch of a function try block of a constructor is illegal">;
7522def warn_cdtor_function_try_handler_mem_expr : Warning<
7523 "cannot refer to a non-static member from the handler of a "
7524 "%select{constructor|destructor}0 function try block">, InGroup<Exceptions>;
7525
7526let CategoryName = "Lambda Issue" in {
7527 def err_capture_more_than_once : Error<
7528 "%0 can appear only once in a capture list">;
7529 def err_reference_capture_with_reference_default : Error<
7530 "'&' cannot precede a capture when the capture default is '&'">;
7531 def err_copy_capture_with_copy_default : Error<
7532 "'&' must precede a capture when the capture default is '='">;
7533 def err_capture_does_not_name_variable : Error<
7534 "%0 in capture list does not name a variable">;
7535 def err_capture_non_automatic_variable : Error<
7536 "%0 cannot be captured because it does not have automatic storage "
7537 "duration">;
7538 def err_this_capture : Error<
7539 "'this' cannot be %select{implicitly |}0captured in this context">;
7540 def note_lambda_this_capture_fixit : Note<
7541 "explicitly capture 'this'">;
7542 def err_lambda_capture_anonymous_var : Error<
7543 "unnamed variable cannot be implicitly captured in a lambda expression">;
7544 def err_lambda_capture_flexarray_type : Error<
7545 "variable %0 with flexible array member cannot be captured in "
7546 "a lambda expression">;
7547 def err_lambda_impcap : Error<
7548 "variable %0 cannot be implicitly captured in a lambda with no "
7549 "capture-default specified">;
7550 def note_lambda_variable_capture_fixit : Note<
7551 "capture %0 by %select{value|reference}1">;
7552 def note_lambda_default_capture_fixit : Note<
7553 "default capture by %select{value|reference}0">;
7554 def note_lambda_decl : Note<"lambda expression begins here">;
7555 def err_lambda_unevaluated_operand : Error<
7556 "lambda expression in an unevaluated operand">;
7557 def err_lambda_in_constant_expression : Error<
7558 "a lambda expression may not appear inside of a constant expression">;
7559 def err_lambda_in_invalid_context : Error<
7560 "a lambda expression cannot appear in this context">;
7561 def err_lambda_return_init_list : Error<
7562 "cannot deduce lambda return type from initializer list">;
7563 def err_lambda_capture_default_arg : Error<
7564 "lambda expression in default argument cannot capture any entity">;
7565 def err_lambda_incomplete_result : Error<
7566 "incomplete result type %0 in lambda expression">;
7567 def err_noreturn_lambda_has_return_expr : Error<
7568 "lambda declared 'noreturn' should not return">;
7569 def warn_maybe_falloff_nonvoid_lambda : Warning<
7570 "non-void lambda does not return a value in all control paths">,
7571 InGroup<ReturnType>;
7572 def warn_falloff_nonvoid_lambda : Warning<
7573 "non-void lambda does not return a value">,
7574 InGroup<ReturnType>;
7575 def err_access_lambda_capture : Error<
7576 // The ERRORs represent other special members that aren't constructors, in
7577 // hopes that someone will bother noticing and reporting if they appear
7578 "capture of variable '%0' as type %1 calls %select{private|protected}3 "
7579 "%select{default |copy |move |*ERROR* |*ERROR* |*ERROR* |}2constructor">,
7580 AccessControl;
7581 def note_lambda_to_block_conv : Note<
7582 "implicit capture of lambda object due to conversion to block pointer "
7583 "here">;
7584 def note_var_explicitly_captured_here : Note<"variable %0 is"
7585 "%select{| explicitly}1 captured here">;
7586
7587 // C++14 lambda init-captures.
7588 def warn_cxx11_compat_init_capture : Warning<
7589 "initialized lambda captures are incompatible with C++ standards "
7590 "before C++14">, InGroup<CXXPre14Compat>, DefaultIgnore;
7591 def ext_init_capture : ExtWarn<
7592 "initialized lambda captures are a C++14 extension">, InGroup<CXX14>;
7593 def err_init_capture_no_expression : Error<
7594 "initializer missing for lambda capture %0">;
7595 def err_init_capture_multiple_expressions : Error<
7596 "initializer for lambda capture %0 contains multiple expressions">;
7597 def err_init_capture_paren_braces : Error<
7598 "cannot deduce type for lambda capture %1 from "
7599 "%select{parenthesized|nested}0 initializer list">;
7600 def err_init_capture_deduction_failure : Error<
7601 "cannot deduce type for lambda capture %0 from initializer of type %2">;
7602 def err_init_capture_deduction_failure_from_init_list : Error<
7603 "cannot deduce type for lambda capture %0 from initializer list">;
7604 def warn_cxx17_compat_init_capture_pack : Warning<
7605 "initialized lambda capture packs are incompatible with C++ standards "
7606 "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7607 def ext_init_capture_pack : ExtWarn<
7608 "initialized lambda pack captures are a C++20 extension">, InGroup<CXX20>;
7609
7610 // C++14 generic lambdas.
7611 def warn_cxx11_compat_generic_lambda : Warning<
7612 "generic lambdas are incompatible with C++11">,
7613 InGroup<CXXPre14Compat>, DefaultIgnore;
7614
7615 // C++17 '*this' captures.
7616 def warn_cxx14_compat_star_this_lambda_capture : Warning<
7617 "by value capture of '*this' is incompatible with C++ standards before C++17">,
7618 InGroup<CXXPre17Compat>, DefaultIgnore;
7619 def ext_star_this_lambda_capture_cxx17 : ExtWarn<
7620 "capture of '*this' by copy is a C++17 extension">, InGroup<CXX17>;
7621
7622 // C++17 parameter shadows capture
7623 def err_parameter_shadow_capture : Error<
7624 "a lambda parameter cannot shadow an explicitly captured entity">;
7625
7626 // C++20 [=, this] captures.
7627 def warn_cxx17_compat_equals_this_lambda_capture : Warning<
7628 "explicit capture of 'this' with a capture default of '=' is incompatible "
7629 "with C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7630 def ext_equals_this_lambda_capture_cxx20 : ExtWarn<
7631 "explicit capture of 'this' with a capture default of '=' "
7632 "is a C++20 extension">, InGroup<CXX20>;
7633 def warn_deprecated_this_capture : Warning<
7634 "implicit capture of 'this' with a capture default of '=' is deprecated">,
7635 InGroup<DeprecatedThisCapture>, DefaultIgnore;
7636 def note_deprecated_this_capture : Note<
7637 "add an explicit capture of 'this' to capture '*this' by reference">;
7638
7639 // C++20 default constructible / assignable lambdas.
7640 def warn_cxx17_compat_lambda_def_ctor_assign : Warning<
7641 "%select{default construction|assignment}0 of lambda is incompatible with "
7642 "C++ standards before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
7643}
7644
7645def err_return_in_captured_stmt : Error<
7646 "cannot return from %0">;
7647def err_capture_block_variable : Error<
7648 "__block variable %0 cannot be captured in a "
7649 "%select{lambda expression|captured statement}1">;
7650
7651def err_operator_arrow_circular : Error<
7652 "circular pointer delegation detected">;
7653def err_operator_arrow_depth_exceeded : Error<
7654 "use of 'operator->' on type %0 would invoke a sequence of more than %1 "
7655 "'operator->' calls">;
7656def note_operator_arrow_here : Note<
7657 "'operator->' declared here produces an object of type %0">;
7658def note_operator_arrows_suppressed : Note<
7659 "(skipping %0 'operator->'%s0 in backtrace)">;
7660def note_operator_arrow_depth : Note<
7661 "use -foperator-arrow-depth=N to increase 'operator->' limit">;
7662
7663def err_pseudo_dtor_base_not_scalar : Error<
7664 "object expression of non-scalar type %0 cannot be used in a "
7665 "pseudo-destructor expression">;
7666def ext_pseudo_dtor_on_void : ExtWarn<
7667 "pseudo-destructors on type void are a Microsoft extension">,
7668 InGroup<MicrosoftVoidPseudoDtor>;
7669def err_pseudo_dtor_type_mismatch : Error<
7670 "the type of object expression "
7671 "%diff{($) does not match the type being destroyed ($)|"
7672 "does not match the type being destroyed}0,1 "
7673 "in pseudo-destructor expression">;
7674def err_pseudo_dtor_call_with_args : Error<
7675 "call to pseudo-destructor cannot have any arguments">;
7676def err_dtor_expr_without_call : Error<
7677 "reference to %select{destructor|pseudo-destructor}0 must be called"
7678 "%select{|; did you mean to call it with no arguments?}1">;
7679def err_pseudo_dtor_destructor_non_type : Error<
7680 "%0 does not refer to a type name in pseudo-destructor expression; expected "
7681 "the name of type %1">;
7682def err_invalid_use_of_function_type : Error<
7683 "a function type is not allowed here">;
7684def err_invalid_use_of_array_type : Error<"an array type is not allowed here">;
7685def err_typecheck_bool_condition : Error<
7686 "value of type %0 is not contextually convertible to 'bool'">;
7687def err_typecheck_ambiguous_condition : Error<
7688 "conversion %diff{from $ to $|between types}0,1 is ambiguous">;
7689def err_typecheck_nonviable_condition : Error<
7690 "no viable conversion%select{%diff{ from $ to $|}1,2|"
7691 "%diff{ from returned value of type $ to function return type $|}1,2}0">;
7692def err_typecheck_nonviable_condition_incomplete : Error<
7693 "no viable conversion%diff{ from $ to incomplete type $|}0,1">;
7694def err_typecheck_deleted_function : Error<
7695 "conversion function %diff{from $ to $|between types}0,1 "
7696 "invokes a deleted function">;
7697
7698def err_expected_class_or_namespace : Error<"%0 is not a class"
7699 "%select{ or namespace|, namespace, or enumeration}1">;
7700def err_invalid_declarator_scope : Error<"cannot define or redeclare %0 here "
7701 "because namespace %1 does not enclose namespace %2">;
7702def err_invalid_declarator_global_scope : Error<
7703 "definition or redeclaration of %0 cannot name the global scope">;
7704def err_invalid_declarator_in_function : Error<
7705 "definition or redeclaration of %0 not allowed inside a function">;
7706def err_invalid_declarator_in_block : Error<
7707 "definition or redeclaration of %0 not allowed inside a block">;
7708def err_not_tag_in_scope : Error<
7709 "no %select{struct|interface|union|class|enum}0 named %1 in %2">;
7710
7711def err_no_typeid_with_fno_rtti : Error<
7712 "use of typeid requires -frtti">;
7713def err_no_dynamic_cast_with_fno_rtti : Error<
7714 "use of dynamic_cast requires -frtti">;
7715def warn_no_dynamic_cast_with_rtti_disabled: Warning<
7716 "dynamic_cast will not work since RTTI data is disabled by "
7717 "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7718def warn_no_typeid_with_rtti_disabled: Warning<
7719 "typeid will not work since RTTI data is disabled by "
7720 "%select{-fno-rtti-data|/GR-}0">, InGroup<RTTI>;
7721
7722def err_cannot_form_pointer_to_member_of_reference_type : Error<
7723 "cannot form a pointer-to-member to member %0 of reference type %1">;
7724def err_incomplete_object_call : Error<
7725 "incomplete type in call to object of type %0">;
7726
7727def warn_condition_is_assignment : Warning<"using the result of an "
7728 "assignment as a condition without parentheses">,
7729 InGroup<Parentheses>;
7730def warn_free_nonheap_object
7731 : Warning<"attempt to call %0 on non-heap %select{object %2|object: block expression|object: lambda-to-function-pointer conversion}1">,
7732 InGroup<FreeNonHeapObject>;
7733
7734// Completely identical except off by default.
7735def warn_condition_is_idiomatic_assignment : Warning<"using the result "
7736 "of an assignment as a condition without parentheses">,
7737 InGroup<DiagGroup<"idiomatic-parentheses">>, DefaultIgnore;
7738def note_condition_assign_to_comparison : Note<
7739 "use '==' to turn this assignment into an equality comparison">;
7740def note_condition_or_assign_to_comparison : Note<
7741 "use '!=' to turn this compound assignment into an inequality comparison">;
7742def note_condition_assign_silence : Note<
7743 "place parentheses around the assignment to silence this warning">;
7744
7745def warn_equality_with_extra_parens : Warning<"equality comparison with "
7746 "extraneous parentheses">, InGroup<ParenthesesOnEquality>;
7747def note_equality_comparison_to_assign : Note<
7748 "use '=' to turn this equality comparison into an assignment">;
7749def note_equality_comparison_silence : Note<
7750 "remove extraneous parentheses around the comparison to silence this warning">;
7751
7752// assignment related diagnostics (also for argument passing, returning, etc).
7753// In most of these diagnostics the %2 is a value from the
7754// Sema::AssignmentAction enumeration
7755def err_typecheck_convert_incompatible : Error<
7756 "%select{%diff{assigning to $ from incompatible type $|"
7757 "assigning to type from incompatible type}0,1"
7758 "|%diff{passing $ to parameter of incompatible type $|"
7759 "passing type to parameter of incompatible type}0,1"
7760 "|%diff{returning $ from a function with incompatible result type $|"
7761 "returning type from a function with incompatible result type}0,1"
7762 "|%diff{converting $ to incompatible type $|"
7763 "converting type to incompatible type}0,1"
7764 "|%diff{initializing $ with an expression of incompatible type $|"
7765 "initializing type with an expression of incompatible type}0,1"
7766 "|%diff{sending $ to parameter of incompatible type $|"
7767 "sending type to parameter of incompatible type}0,1"
7768 "|%diff{casting $ to incompatible type $|"
7769 "casting type to incompatible type}0,1}2"
7770 "%select{|; dereference with *|"
7771 "; take the address with &|"
7772 "; remove *|"
7773 "; remove &}3"
7774 "%select{|: different classes%diff{ ($ vs $)|}5,6"
7775 "|: different number of parameters (%5 vs %6)"
7776 "|: type mismatch at %ordinal5 parameter%diff{ ($ vs $)|}6,7"
7777 "|: different return type%diff{ ($ vs $)|}5,6"
7778 "|: different qualifiers (%5 vs %6)"
7779 "|: different exception specifications}4">;
7780def err_typecheck_missing_return_type_incompatible : Error<
7781 "%diff{return type $ must match previous return type $|"
7782 "return type must match previous return type}0,1 when %select{block "
7783 "literal|lambda expression}2 has unspecified explicit return type">;
7784
7785def note_incomplete_class_and_qualified_id : Note<
7786 "conformance of forward class %0 to protocol %1 can not be confirmed">;
7787def warn_incompatible_qualified_id : Warning<
7788 "%select{%diff{assigning to $ from incompatible type $|"
7789 "assigning to type from incompatible type}0,1"
7790 "|%diff{passing $ to parameter of incompatible type $|"
7791 "passing type to parameter of incompatible type}0,1"
7792 "|%diff{returning $ from a function with incompatible result type $|"
7793 "returning type from a function with incompatible result type}0,1"
7794 "|%diff{converting $ to incompatible type $|"
7795 "converting type to incompatible type}0,1"
7796 "|%diff{initializing $ with an expression of incompatible type $|"
7797 "initializing type with an expression of incompatible type}0,1"
7798 "|%diff{sending $ to parameter of incompatible type $|"
7799 "sending type to parameter of incompatible type}0,1"
7800 "|%diff{casting $ to incompatible type $|"
7801 "casting type to incompatible type}0,1}2">;
7802def err_incompatible_qualified_id : Error<
7803 "%select{%diff{assigning to $ from incompatible type $|"
7804 "assigning to type from incompatible type}0,1"
7805 "|%diff{passing $ to parameter of incompatible type $|"
7806 "passing type to parameter of incompatible type}0,1"
7807 "|%diff{returning $ from a function with incompatible result type $|"
7808 "returning type from a function with incompatible result type}0,1"
7809 "|%diff{converting $ to incompatible type $|"
7810 "converting type to incompatible type}0,1"
7811 "|%diff{initializing $ with an expression of incompatible type $|"
7812 "initializing type with an expression of incompatible type}0,1"
7813 "|%diff{sending $ to parameter of incompatible type $|"
7814 "sending type to parameter of incompatible type}0,1"
7815 "|%diff{casting $ to incompatible type $|"
7816 "casting type to incompatible type}0,1}2">;
7817def ext_typecheck_convert_pointer_int : ExtWarn<
7818 "incompatible pointer to integer conversion "
7819 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7820 "|%diff{passing $ to parameter of type $|"
7821 "passing to parameter of different type}0,1"
7822 "|%diff{returning $ from a function with result type $|"
7823 "returning from function with different return type}0,1"
7824 "|%diff{converting $ to type $|converting between types}0,1"
7825 "|%diff{initializing $ with an expression of type $|"
7826 "initializing with expression of different type}0,1"
7827 "|%diff{sending $ to parameter of type $|"
7828 "sending to parameter of different type}0,1"
7829 "|%diff{casting $ to type $|casting between types}0,1}2"
7830 "%select{|; dereference with *|"
7831 "; take the address with &|"
7832 "; remove *|"
7833 "; remove &}3">,
7834 InGroup<IntConversion>;
7835def err_typecheck_convert_pointer_int : Error<
7836 "incompatible pointer to integer conversion "
7837 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7838 "|%diff{passing $ to parameter of type $|"
7839 "passing to parameter of different type}0,1"
7840 "|%diff{returning $ from a function with result type $|"
7841 "returning from function with different return type}0,1"
7842 "|%diff{converting $ to type $|converting between types}0,1"
7843 "|%diff{initializing $ with an expression of type $|"
7844 "initializing with expression of different type}0,1"
7845 "|%diff{sending $ to parameter of type $|"
7846 "sending to parameter of different type}0,1"
7847 "|%diff{casting $ to type $|casting between types}0,1}2"
7848 "%select{|; dereference with *|"
7849 "; take the address with &|"
7850 "; remove *|"
7851 "; remove &}3">;
7852def ext_typecheck_convert_int_pointer : ExtWarn<
7853 "incompatible integer to pointer conversion "
7854 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7855 "|%diff{passing $ to parameter of type $|"
7856 "passing to parameter of different type}0,1"
7857 "|%diff{returning $ from a function with result type $|"
7858 "returning from function with different return type}0,1"
7859 "|%diff{converting $ to type $|converting between types}0,1"
7860 "|%diff{initializing $ with an expression of type $|"
7861 "initializing with expression of different type}0,1"
7862 "|%diff{sending $ to parameter of type $|"
7863 "sending to parameter of different type}0,1"
7864 "|%diff{casting $ to type $|casting between types}0,1}2"
7865 "%select{|; dereference with *|"
7866 "; take the address with &|"
7867 "; remove *|"
7868 "; remove &}3">,
7869 InGroup<IntConversion>, SFINAEFailure;
7870def err_typecheck_convert_int_pointer : Error<
7871 "incompatible integer to pointer conversion "
7872 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7873 "|%diff{passing $ to parameter of type $|"
7874 "passing to parameter of different type}0,1"
7875 "|%diff{returning $ from a function with result type $|"
7876 "returning from function with different return type}0,1"
7877 "|%diff{converting $ to type $|converting between types}0,1"
7878 "|%diff{initializing $ with an expression of type $|"
7879 "initializing with expression of different type}0,1"
7880 "|%diff{sending $ to parameter of type $|"
7881 "sending to parameter of different type}0,1"
7882 "|%diff{casting $ to type $|casting between types}0,1}2"
7883 "%select{|; dereference with *|"
7884 "; take the address with &|"
7885 "; remove *|"
7886 "; remove &}3">;
7887def ext_typecheck_convert_pointer_void_func : Extension<
7888 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7889 "|%diff{passing $ to parameter of type $|"
7890 "passing to parameter of different type}0,1"
7891 "|%diff{returning $ from a function with result type $|"
7892 "returning from function with different return type}0,1"
7893 "|%diff{converting $ to type $|converting between types}0,1"
7894 "|%diff{initializing $ with an expression of type $|"
7895 "initializing with expression of different type}0,1"
7896 "|%diff{sending $ to parameter of type $|"
7897 "sending to parameter of different type}0,1"
7898 "|%diff{casting $ to type $|casting between types}0,1}2"
7899 " converts between void pointer and function pointer">;
7900def err_typecheck_convert_pointer_void_func : Error<
7901 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7902 "|%diff{passing $ to parameter of type $|"
7903 "passing to parameter of different type}0,1"
7904 "|%diff{returning $ from a function with result type $|"
7905 "returning from function with different return type}0,1"
7906 "|%diff{converting $ to type $|converting between types}0,1"
7907 "|%diff{initializing $ with an expression of type $|"
7908 "initializing with expression of different type}0,1"
7909 "|%diff{sending $ to parameter of type $|"
7910 "sending to parameter of different type}0,1"
7911 "|%diff{casting $ to type $|casting between types}0,1}2"
7912 " converts between void pointer and function pointer">;
7913def ext_typecheck_convert_incompatible_pointer_sign : ExtWarn<
7914 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7915 "|%diff{passing $ to parameter of type $|"
7916 "passing to parameter of different type}0,1"
7917 "|%diff{returning $ from a function with result type $|"
7918 "returning from function with different return type}0,1"
7919 "|%diff{converting $ to type $|converting between types}0,1"
7920 "|%diff{initializing $ with an expression of type $|"
7921 "initializing with expression of different type}0,1"
7922 "|%diff{sending $ to parameter of type $|"
7923 "sending to parameter of different type}0,1"
7924 "|%diff{casting $ to type $|casting between types}0,1}2"
7925 " converts between pointers to integer types %select{with different sign|"
7926 "where one is of the unique plain 'char' type and the other is not}3">,
7927 InGroup<DiagGroup<"pointer-sign">>;
7928def err_typecheck_convert_incompatible_pointer_sign :
7929 Error<ext_typecheck_convert_incompatible_pointer_sign.Text>;
7930def ext_typecheck_convert_incompatible_pointer : ExtWarn<
7931 "incompatible pointer types "
7932 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7933 "|%diff{passing $ to parameter of type $|"
7934 "passing to parameter of different type}0,1"
7935 "|%diff{returning $ from a function with result type $|"
7936 "returning from function with different return type}0,1"
7937 "|%diff{converting $ to type $|converting between types}0,1"
7938 "|%diff{initializing $ with an expression of type $|"
7939 "initializing with expression of different type}0,1"
7940 "|%diff{sending $ to parameter of type $|"
7941 "sending to parameter of different type}0,1"
7942 "|%diff{casting $ to type $|casting between types}0,1}2"
7943 "%select{|; dereference with *|"
7944 "; take the address with &|"
7945 "; remove *|"
7946 "; remove &}3">,
7947 InGroup<IncompatiblePointerTypes>;
7948def err_typecheck_convert_incompatible_pointer : Error<
7949 "incompatible pointer types "
7950 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7951 "|%diff{passing $ to parameter of type $|"
7952 "passing to parameter of different type}0,1"
7953 "|%diff{returning $ from a function with result type $|"
7954 "returning from function with different return type}0,1"
7955 "|%diff{converting $ to type $|converting between types}0,1"
7956 "|%diff{initializing $ with an expression of type $|"
7957 "initializing with expression of different type}0,1"
7958 "|%diff{sending $ to parameter of type $|"
7959 "sending to parameter of different type}0,1"
7960 "|%diff{casting $ to type $|casting between types}0,1}2"
7961 "%select{|; dereference with *|"
7962 "; take the address with &|"
7963 "; remove *|"
7964 "; remove &}3">;
7965def ext_typecheck_convert_incompatible_function_pointer : ExtWarn<
7966 "incompatible function pointer types "
7967 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7968 "|%diff{passing $ to parameter of type $|"
7969 "passing to parameter of different type}0,1"
7970 "|%diff{returning $ from a function with result type $|"
7971 "returning from function with different return type}0,1"
7972 "|%diff{converting $ to type $|converting between types}0,1"
7973 "|%diff{initializing $ with an expression of type $|"
7974 "initializing with expression of different type}0,1"
7975 "|%diff{sending $ to parameter of type $|"
7976 "sending to parameter of different type}0,1"
7977 "|%diff{casting $ to type $|casting between types}0,1}2"
7978 "%select{|; dereference with *|"
7979 "; take the address with &|"
7980 "; remove *|"
7981 "; remove &}3">,
7982 InGroup<IncompatibleFunctionPointerTypes>;
7983def err_typecheck_convert_incompatible_function_pointer : Error<
7984 "incompatible function pointer types "
7985 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
7986 "|%diff{passing $ to parameter of type $|"
7987 "passing to parameter of different type}0,1"
7988 "|%diff{returning $ from a function with result type $|"
7989 "returning from function with different return type}0,1"
7990 "|%diff{converting $ to type $|converting between types}0,1"
7991 "|%diff{initializing $ with an expression of type $|"
7992 "initializing with expression of different type}0,1"
7993 "|%diff{sending $ to parameter of type $|"
7994 "sending to parameter of different type}0,1"
7995 "|%diff{casting $ to type $|casting between types}0,1}2"
7996 "%select{|; dereference with *|"
7997 "; take the address with &|"
7998 "; remove *|"
7999 "; remove &}3">;
8000def ext_typecheck_convert_discards_qualifiers : ExtWarn<
8001 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8002 "|%diff{passing $ to parameter of type $|"
8003 "passing to parameter of different type}0,1"
8004 "|%diff{returning $ from a function with result type $|"
8005 "returning from function with different return type}0,1"
8006 "|%diff{converting $ to type $|converting between types}0,1"
8007 "|%diff{initializing $ with an expression of type $|"
8008 "initializing with expression of different type}0,1"
8009 "|%diff{sending $ to parameter of type $|"
8010 "sending to parameter of different type}0,1"
8011 "|%diff{casting $ to type $|casting between types}0,1}2"
8012 " discards qualifiers">,
8013 InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8014def err_typecheck_convert_discards_qualifiers : Error<
8015 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8016 "|%diff{passing $ to parameter of type $|"
8017 "passing to parameter of different type}0,1"
8018 "|%diff{returning $ from a function with result type $|"
8019 "returning from function with different return type}0,1"
8020 "|%diff{converting $ to type $|converting between types}0,1"
8021 "|%diff{initializing $ with an expression of type $|"
8022 "initializing with expression of different type}0,1"
8023 "|%diff{sending $ to parameter of type $|"
8024 "sending to parameter of different type}0,1"
8025 "|%diff{casting $ to type $|casting between types}0,1}2"
8026 " discards qualifiers">;
8027def ext_nested_pointer_qualifier_mismatch : ExtWarn<
8028 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8029 "|%diff{passing $ to parameter of type $|"
8030 "passing to parameter of different type}0,1"
8031 "|%diff{returning $ from a function with result type $|"
8032 "returning from function with different return type}0,1"
8033 "|%diff{converting $ to type $|converting between types}0,1"
8034 "|%diff{initializing $ with an expression of type $|"
8035 "initializing with expression of different type}0,1"
8036 "|%diff{sending $ to parameter of type $|"
8037 "sending to parameter of different type}0,1"
8038 "|%diff{casting $ to type $|casting between types}0,1}2"
8039 " discards qualifiers in nested pointer types">,
8040 InGroup<IncompatiblePointerTypesDiscardsQualifiers>;
8041def err_nested_pointer_qualifier_mismatch : Error<
8042 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8043 "|%diff{passing $ to parameter of type $|"
8044 "passing to parameter of different type}0,1"
8045 "|%diff{returning $ from a function with result type $|"
8046 "returning from function with different return type}0,1"
8047 "|%diff{converting $ to type $|converting between types}0,1"
8048 "|%diff{initializing $ with an expression of type $|"
8049 "initializing with expression of different type}0,1"
8050 "|%diff{sending $ to parameter of type $|"
8051 "sending to parameter of different type}0,1"
8052 "|%diff{casting $ to type $|casting between types}0,1}2"
8053 " discards qualifiers in nested pointer types">;
8054def warn_incompatible_vectors : Warning<
8055 "incompatible vector types "
8056 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8057 "|%diff{passing $ to parameter of type $|"
8058 "passing to parameter of different type}0,1"
8059 "|%diff{returning $ from a function with result type $|"
8060 "returning from function with different return type}0,1"
8061 "|%diff{converting $ to type $|converting between types}0,1"
8062 "|%diff{initializing $ with an expression of type $|"
8063 "initializing with expression of different type}0,1"
8064 "|%diff{sending $ to parameter of type $|"
8065 "sending to parameter of different type}0,1"
8066 "|%diff{casting $ to type $|casting between types}0,1}2">,
8067 InGroup<VectorConversion>, DefaultIgnore;
8068def err_incompatible_vectors : Error<
8069 "incompatible vector types "
8070 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8071 "|%diff{passing $ to parameter of type $|"
8072 "passing to parameter of different type}0,1"
8073 "|%diff{returning $ from a function with result type $|"
8074 "returning from function with different return type}0,1"
8075 "|%diff{converting $ to type $|converting between types}0,1"
8076 "|%diff{initializing $ with an expression of type $|"
8077 "initializing with expression of different type}0,1"
8078 "|%diff{sending $ to parameter of type $|"
8079 "sending to parameter of different type}0,1"
8080 "|%diff{casting $ to type $|casting between types}0,1}2">;
8081def err_int_to_block_pointer : Error<
8082 "invalid block pointer conversion "
8083 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8084 "|%diff{passing $ to parameter of type $|"
8085 "passing to parameter of different type}0,1"
8086 "|%diff{returning $ from a function with result type $|"
8087 "returning from function with different return type}0,1"
8088 "|%diff{converting $ to type $|converting between types}0,1"
8089 "|%diff{initializing $ with an expression of type $|"
8090 "initializing with expression of different type}0,1"
8091 "|%diff{sending $ to parameter of type $|"
8092 "sending to parameter of different type}0,1"
8093 "|%diff{casting $ to type $|casting between types}0,1}2">;
8094def err_typecheck_convert_incompatible_block_pointer : Error<
8095 "incompatible block pointer types "
8096 "%select{%diff{assigning to $ from $|assigning to different types}0,1"
8097 "|%diff{passing $ to parameter of type $|"
8098 "passing to parameter of different type}0,1"
8099 "|%diff{returning $ from a function with result type $|"
8100 "returning from function with different return type}0,1"
8101 "|%diff{converting $ to type $|converting between types}0,1"
8102 "|%diff{initializing $ with an expression of type $|"
8103 "initializing with expression of different type}0,1"
8104 "|%diff{sending $ to parameter of type $|"
8105 "sending to parameter of different type}0,1"
8106 "|%diff{casting $ to type $|casting between types}0,1}2">;
8107def err_typecheck_incompatible_address_space : Error<
8108 "%select{%diff{assigning $ to $|assigning to different types}1,0"
8109 "|%diff{passing $ to parameter of type $|"
8110 "passing to parameter of different type}0,1"
8111 "|%diff{returning $ from a function with result type $|"
8112 "returning from function with different return type}0,1"
8113 "|%diff{converting $ to type $|converting between types}0,1"
8114 "|%diff{initializing $ with an expression of type $|"
8115 "initializing with expression of different type}0,1"
8116 "|%diff{sending $ to parameter of type $|"
8117 "sending to parameter of different type}0,1"
8118 "|%diff{casting $ to type $|casting between types}0,1}2"
8119 " changes address space of pointer">;
8120def err_typecheck_incompatible_nested_address_space : Error<
8121 "%select{%diff{assigning $ to $|assigning to different types}1,0"
8122 "|%diff{passing $ to parameter of type $|"
8123 "passing to parameter of different type}0,1"
8124 "|%diff{returning $ from a function with result type $|"
8125 "returning from function with different return type}0,1"
8126 "|%diff{converting $ to type $|converting between types}0,1"
8127 "|%diff{initializing $ with an expression of type $|"
8128 "initializing with expression of different type}0,1"
8129 "|%diff{sending $ to parameter of type $|"
8130 "sending to parameter of different type}0,1"
8131 "|%diff{casting $ to type $|casting between types}0,1}2"
8132 " changes address space of nested pointer">;
8133def err_typecheck_incompatible_ownership : Error<
8134 "%select{%diff{assigning $ to $|assigning to different types}1,0"
8135 "|%diff{passing $ to parameter of type $|"
8136 "passing to parameter of different type}0,1"
8137 "|%diff{returning $ from a function with result type $|"
8138 "returning from function with different return type}0,1"
8139 "|%diff{converting $ to type $|converting between types}0,1"
8140 "|%diff{initializing $ with an expression of type $|"
8141 "initializing with expression of different type}0,1"
8142 "|%diff{sending $ to parameter of type $|"
8143 "sending to parameter of different type}0,1"
8144 "|%diff{casting $ to type $|casting between types}0,1}2"
8145 " changes retain/release properties of pointer">;
8146def err_typecheck_comparison_of_distinct_blocks : Error<
8147 "comparison of distinct block types%diff{ ($ and $)|}0,1">;
8148
8149def err_typecheck_array_not_modifiable_lvalue : Error<
8150 "array type %0 is not assignable">;
8151def err_typecheck_non_object_not_modifiable_lvalue : Error<
8152 "non-object type %0 is not assignable">;
8153def err_typecheck_expression_not_modifiable_lvalue : Error<
8154 "expression is not assignable">;
8155def err_typecheck_incomplete_type_not_modifiable_lvalue : Error<
8156 "incomplete type %0 is not assignable">;
8157def err_typecheck_lvalue_casts_not_supported : Error<
8158 "assignment to cast is illegal, lvalue casts are not supported">;
8159
8160def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
8161 "vector is not assignable (contains duplicate components)">;
8162def err_block_decl_ref_not_modifiable_lvalue : Error<
8163 "variable is not assignable (missing __block type specifier)">;
8164def err_lambda_decl_ref_not_modifiable_lvalue : Error<
8165 "cannot assign to a variable captured by copy in a non-mutable lambda">;
8166def err_typecheck_call_not_function : Error<
8167 "called object type %0 is not a function or function pointer">;
8168def err_call_incomplete_return : Error<
8169 "calling function with incomplete return type %0">;
8170def err_call_function_incomplete_return : Error<
8171 "calling %0 with incomplete return type %1">;
8172def err_call_incomplete_argument : Error<
8173 "argument type %0 is incomplete">;
8174def err_typecheck_call_too_few_args : Error<
8175 "too few %select{|||execution configuration }0arguments to "
8176 "%select{function|block|method|kernel function}0 call, "
8177 "expected %1, have %2">;
8178def err_typecheck_call_too_few_args_one : Error<
8179 "too few %select{|||execution configuration }0arguments to "
8180 "%select{function|block|method|kernel function}0 call, "
8181 "single argument %1 was not specified">;
8182def err_typecheck_call_too_few_args_at_least : Error<
8183 "too few %select{|||execution configuration }0arguments to "
8184 "%select{function|block|method|kernel function}0 call, "
8185 "expected at least %1, have %2">;
8186def err_typecheck_call_too_few_args_at_least_one : Error<
8187 "too few %select{|||execution configuration }0arguments to "
8188 "%select{function|block|method|kernel function}0 call, "
8189 "at least argument %1 must be specified">;
8190def err_typecheck_call_too_few_args_suggest : Error<
8191 "too few %select{|||execution configuration }0arguments to "
8192 "%select{function|block|method|kernel function}0 call, "
8193 "expected %1, have %2; did you mean %3?">;
8194def err_typecheck_call_too_few_args_at_least_suggest : Error<
8195 "too few %select{|||execution configuration }0arguments to "
8196 "%select{function|block|method|kernel function}0 call, "
8197 "expected at least %1, have %2; did you mean %3?">;
8198def err_typecheck_call_too_many_args : Error<
8199 "too many %select{|||execution configuration }0arguments to "
8200 "%select{function|block|method|kernel function}0 call, "
8201 "expected %1, have %2">;
8202def err_typecheck_call_too_many_args_one : Error<
8203 "too many %select{|||execution configuration }0arguments to "
8204 "%select{function|block|method|kernel function}0 call, "
8205 "expected single argument %1, have %2 arguments">;
8206def err_typecheck_call_too_many_args_at_most : Error<
8207 "too many %select{|||execution configuration }0arguments to "
8208 "%select{function|block|method|kernel function}0 call, "
8209 "expected at most %1, have %2">;
8210def err_typecheck_call_too_many_args_at_most_one : Error<
8211 "too many %select{|||execution configuration }0arguments to "
8212 "%select{function|block|method|kernel function}0 call, "
8213 "expected at most single argument %1, have %2 arguments">;
8214def err_typecheck_call_too_many_args_suggest : Error<
8215 "too many %select{|||execution configuration }0arguments to "
8216 "%select{function|block|method|kernel function}0 call, "
8217 "expected %1, have %2; did you mean %3?">;
8218def err_typecheck_call_too_many_args_at_most_suggest : Error<
8219 "too many %select{|||execution configuration }0arguments to "
8220 "%select{function|block|method|kernel function}0 call, "
8221 "expected at most %1, have %2; did you mean %3?">;
8222
8223def err_arc_typecheck_convert_incompatible_pointer : Error<
8224 "incompatible pointer types passing retainable parameter of type %0"
8225 "to a CF function expecting %1 type">;
8226
8227def err_builtin_fn_use : Error<"builtin functions must be directly called">;
8228
8229def warn_call_wrong_number_of_arguments : Warning<
8230 "too %select{few|many}0 arguments in call to %1">;
8231def err_atomic_builtin_must_be_pointer : Error<
8232 "address argument to atomic builtin must be a pointer (%0 invalid)">;
8233def err_atomic_builtin_must_be_pointer_intptr : Error<
8234 "address argument to atomic builtin must be a pointer to integer or pointer"
8235 " (%0 invalid)">;
8236def err_atomic_builtin_cannot_be_const : Error<
8237 "address argument to atomic builtin cannot be const-qualified (%0 invalid)">;
8238def err_atomic_builtin_must_be_pointer_intfltptr : Error<
8239 "address argument to atomic builtin must be a pointer to integer,"
8240 " floating-point or pointer (%0 invalid)">;
8241def err_atomic_builtin_pointer_size : Error<
8242 "address argument to atomic builtin must be a pointer to 1,2,4,8 or 16 byte "
8243 "type (%0 invalid)">;
8244def err_atomic_exclusive_builtin_pointer_size : Error<
8245 "address argument to load or store exclusive builtin must be a pointer to"
8246 " 1,2,4 or 8 byte type (%0 invalid)">;
8247def err_atomic_builtin_ext_int_size : Error<
8248 "Atomic memory operand must have a power-of-two size">;
8249def err_atomic_builtin_ext_int_prohibit : Error<
8250 "argument to atomic builtin of type '_ExtInt' is not supported">;
8251def err_atomic_op_needs_atomic : Error<
8252 "address argument to atomic operation must be a pointer to _Atomic "
8253 "type (%0 invalid)">;
8254def err_atomic_op_needs_non_const_atomic : Error<
8255 "address argument to atomic operation must be a pointer to non-%select{const|constant}0 _Atomic "
8256 "type (%1 invalid)">;
8257def err_atomic_op_needs_non_const_pointer : Error<
8258 "address argument to atomic operation must be a pointer to non-const "
8259 "type (%0 invalid)">;
8260def err_atomic_op_needs_trivial_copy : Error<
8261 "address argument to atomic operation must be a pointer to a "
8262 "trivially-copyable type (%0 invalid)">;
8263def err_atomic_op_needs_atomic_int_ptr_or_fp : Error<
8264 "address argument to atomic operation must be a pointer to %select{|atomic }0"
8265 "integer, pointer or supported floating point type (%1 invalid)">;
8266def err_atomic_op_needs_atomic_int_or_ptr : Error<
8267 "address argument to atomic operation must be a pointer to %select{|atomic }0"
8268 "integer or pointer (%1 invalid)">;
8269def err_atomic_op_needs_atomic_int : Error<
8270 "address argument to atomic operation must be a pointer to "
8271 "%select{|atomic }0integer (%1 invalid)">;
8272def warn_atomic_op_has_invalid_memory_order : Warning<
8273 "memory order argument to atomic operation is invalid">,
8274 InGroup<DiagGroup<"atomic-memory-ordering">>;
8275def err_atomic_op_has_invalid_synch_scope : Error<
8276 "synchronization scope argument to atomic operation is invalid">;
8277def warn_atomic_implicit_seq_cst : Warning<
8278 "implicit use of sequentially-consistent atomic may incur stronger memory barriers than necessary">,
8279 InGroup<DiagGroup<"atomic-implicit-seq-cst">>, DefaultIgnore;
8280
8281def err_overflow_builtin_must_be_int : Error<
8282 "operand argument to overflow builtin must be an integer (%0 invalid)">;
8283def err_overflow_builtin_must_be_ptr_int : Error<
8284 "result argument to overflow builtin must be a pointer "
8285 "to a non-const integer (%0 invalid)">;
8286def err_overflow_builtin_ext_int_max_size : Error<
8287 "__builtin_mul_overflow does not support signed _ExtInt operands of more "
8288 "than %0 bits">;
8289
8290def err_atomic_load_store_uses_lib : Error<
8291 "atomic %select{load|store}0 requires runtime support that is not "
8292 "available for this target">;
8293
8294def err_nontemporal_builtin_must_be_pointer : Error<
8295 "address argument to nontemporal builtin must be a pointer (%0 invalid)">;
8296def err_nontemporal_builtin_must_be_pointer_intfltptr_or_vector : Error<
8297 "address argument to nontemporal builtin must be a pointer to integer, float, "
8298 "pointer, or a vector of such types (%0 invalid)">;
8299
8300def err_deleted_function_use : Error<"attempt to use a deleted function">;
8301def err_deleted_inherited_ctor_use : Error<
8302 "constructor inherited by %0 from base class %1 is implicitly deleted">;
8303
8304def note_called_by : Note<"called by %0">;
8305def err_kern_type_not_void_return : Error<
8306 "kernel function type %0 must have void return type">;
8307def err_kern_is_nonstatic_method : Error<
8308 "kernel function %0 must be a free function or static member function">;
8309def err_config_scalar_return : Error<
8310 "CUDA special function '%0' must have scalar return type">;
8311def err_kern_call_not_global_function : Error<
8312 "kernel call to non-global function %0">;
8313def err_global_call_not_config : Error<
8314 "call to global function %0 not configured">;
8315def err_ref_bad_target : Error<
8316 "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8317 "%select{function|variable}1 %2 in %select{__device__|__global__|__host__|__host__ __device__}3 function">;
8318def err_ref_bad_target_global_initializer : Error<
8319 "reference to %select{__device__|__global__|__host__|__host__ __device__}0 "
8320 "function %1 in global initializer">;
8321def err_capture_bad_target : Error<
8322 "capture host variable %0 by reference in device or host device lambda function">;
8323def err_capture_bad_target_this_ptr : Error<
8324 "capture host side class data member by this pointer in device or host device lambda function">;
8325def warn_kern_is_method : Extension<
8326 "kernel function %0 is a member function; this may not be accepted by nvcc">,
8327 InGroup<CudaCompat>;
8328def warn_kern_is_inline : Warning<
8329 "ignored 'inline' attribute on kernel function %0">,
8330 InGroup<CudaCompat>;
8331def err_variadic_device_fn : Error<
8332 "CUDA device code does not support variadic functions">;
8333def err_va_arg_in_device : Error<
8334 "CUDA device code does not support va_arg">;
8335def err_alias_not_supported_on_nvptx : Error<"CUDA does not support aliases">;
8336def err_cuda_unattributed_constexpr_cannot_overload_device : Error<
8337 "constexpr function %0 without __host__ or __device__ attributes cannot "
8338 "overload __device__ function with same signature. Add a __host__ "
8339 "attribute, or build with -fno-cuda-host-device-constexpr.">;
8340def note_cuda_conflicting_device_function_declared_here : Note<
8341 "conflicting __device__ function declared here">;
8342def err_cuda_device_exceptions : Error<
8343 "cannot use '%0' in "
8344 "%select{__device__|__global__|__host__|__host__ __device__}1 function">;
8345def err_dynamic_var_init : Error<
8346 "dynamic initialization is not supported for "
8347 "__device__, __constant__, __shared__, and __managed__ variables.">;
8348def err_shared_var_init : Error<
8349 "initialization is not supported for __shared__ variables.">;
8350def err_cuda_vla : Error<
8351 "cannot use variable-length arrays in "
8352 "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8353def err_cuda_extern_shared : Error<"__shared__ variable %0 cannot be 'extern'">;
8354def err_cuda_host_shared : Error<
8355 "__shared__ local variables not allowed in "
8356 "%select{__device__|__global__|__host__|__host__ __device__}0 functions">;
8357def err_cuda_nonstatic_constdev: Error<"__constant__, __device__, and "
8358 "__managed__ are not allowed on non-static local variables">;
8359def err_cuda_ovl_target : Error<
8360 "%select{__device__|__global__|__host__|__host__ __device__}0 function %1 "
8361 "cannot overload %select{__device__|__global__|__host__|__host__ __device__}2 function %3">;
8362def note_cuda_ovl_candidate_target_mismatch : Note<
8363 "candidate template ignored: target attributes do not match">;
8364
8365def err_cuda_device_builtin_surftex_cls_template : Error<
8366 "illegal device builtin %select{surface|texture}0 reference "
8367 "class template %1 declared here">;
8368def note_cuda_device_builtin_surftex_cls_should_have_n_args : Note<
8369 "%0 needs to have exactly %1 template parameters">;
8370def note_cuda_device_builtin_surftex_cls_should_have_match_arg : Note<
8371 "the %select{1st|2nd|3rd}1 template parameter of %0 needs to be "
8372 "%select{a type|an integer or enum value}2">;
8373
8374def err_cuda_device_builtin_surftex_ref_decl : Error<
8375 "illegal device builtin %select{surface|texture}0 reference "
8376 "type %1 declared here">;
8377def note_cuda_device_builtin_surftex_should_be_template_class : Note<
8378 "%0 needs to be instantiated from a class template with proper "
8379 "template arguments">;
8380
8381def err_hip_invalid_args_builtin_mangled_name : Error<
8382 "invalid argument: symbol must be a device-side function or global variable">;
8383
8384def warn_non_pod_vararg_with_format_string : Warning<
8385 "cannot pass %select{non-POD|non-trivial}0 object of type %1 to variadic "
8386 "%select{function|block|method|constructor}2; expected type from format "
8387 "string was %3">, InGroup<NonPODVarargs>, DefaultError;
8388// The arguments to this diagnostic should match the warning above.
8389def err_cannot_pass_objc_interface_to_vararg_format : Error<
8390 "cannot pass object with interface type %1 by value to variadic "
8391 "%select{function|block|method|constructor}2; expected type from format "
8392 "string was %3">;
8393def err_cannot_pass_non_trivial_c_struct_to_vararg : Error<
8394 "cannot pass non-trivial C object of type %0 by value to variadic "
8395 "%select{function|block|method|constructor}1">;
8396
8397
8398def err_cannot_pass_objc_interface_to_vararg : Error<
8399 "cannot pass object with interface type %0 by value through variadic "
8400 "%select{function|block|method|constructor}1">;
8401def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
8402 "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
8403 " %select{function|block|method|constructor}2; call will abort at runtime">,
8404 InGroup<NonPODVarargs>, DefaultError;
8405def warn_cxx98_compat_pass_non_pod_arg_to_vararg : Warning<
8406 "passing object of trivial but non-POD type %0 through variadic"
8407 " %select{function|block|method|constructor}1 is incompatible with C++98">,
8408 InGroup<CXX98Compat>, DefaultIgnore;
8409def warn_pass_class_arg_to_vararg : Warning<
8410 "passing object of class type %0 through variadic "
8411 "%select{function|block|method|constructor}1"
8412 "%select{|; did you mean to call '%3'?}2">,
8413 InGroup<ClassVarargs>, DefaultIgnore;
8414def err_cannot_pass_to_vararg : Error<
8415 "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8416 "%select{function|block|method|constructor}2">;
8417def err_cannot_pass_to_vararg_format : Error<
8418 "cannot pass %select{expression of type %1|initializer list}0 to variadic "
8419 "%select{function|block|method|constructor}2; expected type from format "
8420 "string was %3">;
8421
8422def err_typecheck_call_invalid_ordered_compare : Error<
8423 "ordered compare requires two args of floating point type"
8424 "%diff{ ($ and $)|}0,1">;
8425def err_typecheck_call_invalid_unary_fp : Error<
8426 "floating point classification requires argument of floating point type "
8427 "(passed in %0)">;
8428def err_typecheck_cond_expect_int_float : Error<
8429 "used type %0 where integer or floating point type is required">;
8430def err_typecheck_cond_expect_scalar : Error<
8431 "used type %0 where arithmetic or pointer type is required">;
8432def err_typecheck_cond_expect_nonfloat : Error<
8433 "used type %0 where floating point type is not allowed">;
8434def ext_typecheck_cond_one_void : Extension<
8435 "C99 forbids conditional expressions with only one void side">;
8436def err_typecheck_cast_to_incomplete : Error<
8437 "cast to incomplete type %0">;
8438def ext_typecheck_cast_nonscalar : Extension<
8439 "C99 forbids casting nonscalar type %0 to the same type">;
8440def ext_typecheck_cast_to_union : Extension<
8441 "cast to union type is a GNU extension">,
8442 InGroup<GNUUnionCast>;
8443def err_typecheck_cast_to_union_no_type : Error<
8444 "cast to union type from type %0 not present in union">;
8445def err_cast_pointer_from_non_pointer_int : Error<
8446 "operand of type %0 cannot be cast to a pointer type">;
8447def warn_cast_pointer_from_sel : Warning<
8448 "cast of type %0 to %1 is deprecated; use sel_getName instead">,
8449 InGroup<SelTypeCast>;
8450def warn_function_def_in_objc_container : Warning<
8451 "function definition inside an Objective-C container is deprecated">,
8452 InGroup<FunctionDefInObjCContainer>;
8453def err_typecheck_call_requires_real_fp : Error<
8454 "argument type %0 is not a real floating point type">;
8455def err_typecheck_call_different_arg_types : Error<
8456 "arguments are of different types%diff{ ($ vs $)|}0,1">;
8457
8458def warn_cast_calling_conv : Warning<
8459 "cast between incompatible calling conventions '%0' and '%1'; "
8460 "calls through this pointer may abort at runtime">,
8461 InGroup<DiagGroup<"cast-calling-convention">>;
8462def note_change_calling_conv_fixit : Note<
8463 "consider defining %0 with the '%1' calling convention">;
8464def warn_bad_function_cast : Warning<
8465 "cast from function call of type %0 to non-matching type %1">,
8466 InGroup<BadFunctionCast>, DefaultIgnore;
8467def warn_cast_function_type : Warning<
8468 "cast %diff{from $ to $ |}0,1converts to incompatible function type">,
8469 InGroup<CastFunctionType>, DefaultIgnore;
8470def err_cast_pointer_to_non_pointer_int : Error<
8471 "pointer cannot be cast to type %0">;
8472def err_cast_to_bfloat16 : Error<"cannot type-cast to __bf16">;
8473def err_cast_from_bfloat16 : Error<"cannot type-cast from __bf16">;
8474def err_typecheck_expect_scalar_operand : Error<
8475 "operand of type %0 where arithmetic or pointer type is required">;
8476def err_typecheck_cond_incompatible_operands : Error<
8477 "incompatible operand types%diff{ ($ and $)|}0,1">;
8478def err_cast_selector_expr : Error<
8479 "cannot type cast @selector expression">;
8480def ext_typecheck_cond_incompatible_pointers : ExtWarn<
8481 "pointer type mismatch%diff{ ($ and $)|}0,1">,
8482 InGroup<DiagGroup<"pointer-type-mismatch">>;
8483def ext_typecheck_cond_pointer_integer_mismatch : ExtWarn<
8484 "pointer/integer type mismatch in conditional expression"
8485 "%diff{ ($ and $)|}0,1">,
8486 InGroup<DiagGroup<"conditional-type-mismatch">>;
8487def err_typecheck_choose_expr_requires_constant : Error<
8488 "'__builtin_choose_expr' requires a constant expression">;
8489def warn_unused_expr : Warning<"expression result unused">,
8490 InGroup<UnusedValue>;
8491def warn_unused_voidptr : Warning<
8492 "expression result unused; should this cast be to 'void'?">,
8493 InGroup<UnusedValue>;
8494def warn_unused_property_expr : Warning<
8495 "property access result unused - getters should not be used for side effects">,
8496 InGroup<UnusedGetterReturnValue>;
8497def warn_unused_container_subscript_expr : Warning<
8498 "container access result unused - container access should not be used for side effects">,
8499 InGroup<UnusedValue>;
8500def warn_unused_call : Warning<
8501 "ignoring return value of function declared with %0 attribute">,
8502 InGroup<UnusedValue>;
8503def warn_unused_constructor : Warning<
8504 "ignoring temporary created by a constructor declared with %0 attribute">,
8505 InGroup<UnusedValue>;
8506def warn_unused_constructor_msg : Warning<
8507 "ignoring temporary created by a constructor declared with %0 attribute: %1">,
8508 InGroup<UnusedValue>;
8509def warn_side_effects_unevaluated_context : Warning<
8510 "expression with side effects has no effect in an unevaluated context">,
8511 InGroup<UnevaluatedExpression>;
8512def warn_side_effects_typeid : Warning<
8513 "expression with side effects will be evaluated despite being used as an "
8514 "operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
8515def warn_unused_result : Warning<
8516 "ignoring return value of function declared with %0 attribute">,
8517 InGroup<UnusedResult>;
8518def warn_unused_result_msg : Warning<
8519 "ignoring return value of function declared with %0 attribute: %1">,
8520 InGroup<UnusedResult>;
8521def warn_unused_volatile : Warning<
8522 "expression result unused; assign into a variable to force a volatile load">,
8523 InGroup<DiagGroup<"unused-volatile-lvalue">>;
8524
8525def ext_cxx14_attr : Extension<
8526 "use of the %0 attribute is a C++14 extension">, InGroup<CXX14>;
8527def ext_cxx17_attr : Extension<
8528 "use of the %0 attribute is a C++17 extension">, InGroup<CXX17>;
8529def ext_cxx20_attr : Extension<
8530 "use of the %0 attribute is a C++20 extension">, InGroup<CXX20>;
8531
8532def warn_unused_comparison : Warning<
8533 "%select{equality|inequality|relational|three-way}0 comparison result unused">,
8534 InGroup<UnusedComparison>;
8535def note_inequality_comparison_to_or_assign : Note<
8536 "use '|=' to turn this inequality comparison into an or-assignment">;
8537
8538def err_incomplete_type_used_in_type_trait_expr : Error<
8539 "incomplete type %0 used in type trait expression">;
8540
8541// C++20 constinit and require_constant_initialization attribute
8542def warn_cxx20_compat_constinit : Warning<
8543 "'constinit' specifier is incompatible with C++ standards before C++20">,
8544 InGroup<CXX20Compat>, DefaultIgnore;
8545def err_constinit_local_variable : Error<
8546 "local variable cannot be declared 'constinit'">;
8547def err_require_constant_init_failed : Error<
8548 "variable does not have a constant initializer">;
8549def note_declared_required_constant_init_here : Note<
8550 "required by %select{'require_constant_initialization' attribute|"
8551 "'constinit' specifier}0 here">;
8552def ext_constinit_missing : ExtWarn<
8553 "'constinit' specifier missing on initializing declaration of %0">,
8554 InGroup<DiagGroup<"missing-constinit">>;
8555def note_constinit_specified_here : Note<"variable declared constinit here">;
8556def err_constinit_added_too_late : Error<
8557 "'constinit' specifier added after initialization of variable">;
8558def warn_require_const_init_added_too_late : Warning<
8559 "'require_constant_initialization' attribute added after initialization "
8560 "of variable">, InGroup<IgnoredAttributes>;
8561def note_constinit_missing_here : Note<
8562 "add the "
8563 "%select{'require_constant_initialization' attribute|'constinit' specifier}0 "
8564 "to the initializing declaration here">;
8565
8566def err_dimension_expr_not_constant_integer : Error<
8567 "dimension expression does not evaluate to a constant unsigned int">;
8568
8569def err_typecheck_cond_incompatible_operands_null : Error<
8570 "non-pointer operand type %0 incompatible with %select{NULL|nullptr}1">;
8571def ext_empty_struct_union : Extension<
8572 "empty %select{struct|union}0 is a GNU extension">, InGroup<GNUEmptyStruct>;
8573def ext_no_named_members_in_struct_union : Extension<
8574 "%select{struct|union}0 without named members is a GNU extension">, InGroup<GNUEmptyStruct>;
8575def warn_zero_size_struct_union_compat : Warning<"%select{|empty }0"
8576 "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8577 InGroup<CXXCompat>, DefaultIgnore;
8578def warn_zero_size_struct_union_in_extern_c : Warning<"%select{|empty }0"
8579 "%select{struct|union}1 has size 0 in C, %select{size 1|non-zero size}2 in C++">,
8580 InGroup<ExternCCompat>;
8581def warn_cast_qual : Warning<"cast from %0 to %1 drops %select{const and "
8582 "volatile qualifiers|const qualifier|volatile qualifier}2">,
8583 InGroup<CastQual>, DefaultIgnore;
8584def warn_cast_qual2 : Warning<"cast from %0 to %1 must have all intermediate "
8585 "pointers const qualified to be safe">, InGroup<CastQual>, DefaultIgnore;
8586def warn_redefine_extname_not_applied : Warning<
8587 "#pragma redefine_extname is applicable to external C declarations only; "
8588 "not applied to %select{function|variable}0 %1">,
8589 InGroup<Pragmas>;
8590} // End of general sema category.
8591
8592// inline asm.
8593let CategoryName = "Inline Assembly Issue" in {
8594 def err_asm_invalid_lvalue_in_output : Error<"invalid lvalue in asm output">;
8595 def err_asm_invalid_output_constraint : Error<
8596 "invalid output constraint '%0' in asm">;
8597 def err_asm_invalid_lvalue_in_input : Error<
8598 "invalid lvalue in asm input for constraint '%0'">;
8599 def err_asm_invalid_input_constraint : Error<
8600 "invalid input constraint '%0' in asm">;
8601 def err_asm_tying_incompatible_types : Error<
8602 "unsupported inline asm: input with type "
8603 "%diff{$ matching output with type $|}0,1">;
8604 def err_asm_unexpected_constraint_alternatives : Error<
8605 "asm constraint has an unexpected number of alternatives: %0 vs %1">;
8606 def err_asm_incomplete_type : Error<"asm operand has incomplete type %0">;
8607 def err_asm_unknown_register_name : Error<"unknown register name '%0' in asm">;
8608 def err_asm_invalid_global_var_reg : Error<"register '%0' unsuitable for "
8609 "global register variables on this target">;
8610 def err_asm_register_size_mismatch : Error<"size of register '%0' does not "
8611 "match variable size">;
8612 def err_asm_bad_register_type : Error<"bad type for named register variable">;
8613 def err_asm_invalid_input_size : Error<
8614 "invalid input size for constraint '%0'">;
8615 def err_asm_invalid_output_size : Error<
8616 "invalid output size for constraint '%0'">;
8617 def err_invalid_asm_cast_lvalue : Error<
8618 "invalid use of a cast in a inline asm context requiring an lvalue: "
8619 "remove the cast or build with -fheinous-gnu-extensions">;
8620 def err_invalid_asm_value_for_constraint
8621 : Error <"value '%0' out of range for constraint '%1'">;
8622 def err_asm_non_addr_value_in_memory_constraint : Error <
8623 "reference to a %select{bit-field|vector element|global register variable}0"
8624 " in asm %select{input|output}1 with a memory constraint '%2'">;
8625 def err_asm_input_duplicate_match : Error<
8626 "more than one input constraint matches the same output '%0'">;
8627
8628 def warn_asm_label_on_auto_decl : Warning<
8629 "ignored asm label '%0' on automatic variable">;
8630 def warn_invalid_asm_cast_lvalue : Warning<
8631 "invalid use of a cast in an inline asm context requiring an lvalue: "
8632 "accepted due to -fheinous-gnu-extensions, but clang may remove support "
8633 "for this in the future">;
8634 def warn_asm_mismatched_size_modifier : Warning<
8635 "value size does not match register size specified by the constraint "
8636 "and modifier">,
8637 InGroup<ASMOperandWidths>;
8638
8639 def note_asm_missing_constraint_modifier : Note<
8640 "use constraint modifier \"%0\"">;
8641 def note_asm_input_duplicate_first : Note<
8642 "constraint '%0' is already present here">;
8643 def error_duplicate_asm_operand_name : Error<
8644 "duplicate use of asm operand name \"%0\"">;
8645 def note_duplicate_asm_operand_name : Note<
8646 "asm operand name \"%0\" first referenced here">;
8647}
8648
8649 def error_inoutput_conflict_with_clobber : Error<
8650 "asm-specifier for input or output variable conflicts with asm"
8651 " clobber list">;
8652
8653let CategoryName = "Semantic Issue" in {
8654
8655def err_invalid_conversion_between_matrixes : Error<
8656 "conversion between matrix types%diff{ $ and $|}0,1 of different size is not allowed">;
8657
8658def err_invalid_conversion_between_matrix_and_type : Error<
8659 "conversion between matrix type %0 and incompatible type %1 is not allowed">;
8660
8661def err_invalid_conversion_between_vectors : Error<
8662 "invalid conversion between vector type%diff{ $ and $|}0,1 of different "
8663 "size">;
8664def err_invalid_conversion_between_vector_and_integer : Error<
8665 "invalid conversion between vector type %0 and integer type %1 "
8666 "of different size">;
8667
8668def err_opencl_function_pointer : Error<
8669 "%select{pointers|references}0 to functions are not allowed">;
8670
8671def err_opencl_taking_address_capture : Error<
8672 "taking address of a capture is not allowed">;
8673
8674def err_invalid_conversion_between_vector_and_scalar : Error<
8675 "invalid conversion between vector type %0 and scalar type %1">;
8676
8677// C++ member initializers.
8678def err_only_constructors_take_base_inits : Error<
8679 "only constructors take base initializers">;
8680
8681def err_multiple_mem_initialization : Error <
8682 "multiple initializations given for non-static member %0">;
8683def err_multiple_mem_union_initialization : Error <
8684 "initializing multiple members of union">;
8685def err_multiple_base_initialization : Error <
8686 "multiple initializations given for base %0">;
8687
8688def err_mem_init_not_member_or_class : Error<
8689 "member initializer %0 does not name a non-static data member or base "
8690 "class">;
8691
8692def warn_initializer_out_of_order : Warning<
8693 "%select{field|base class}0 %1 will be initialized after "
8694 "%select{field|base}2 %3">,
8695 InGroup<ReorderCtor>, DefaultIgnore;
8696
8697def warn_some_initializers_out_of_order : Warning<
8698 "initializer order does not match the declaration order">,
8699 InGroup<ReorderCtor>, DefaultIgnore;
8700
8701def note_initializer_out_of_order : Note<
8702 "%select{field|base class}0 %1 will be initialized after "
8703 "%select{field|base}2 %3">;
8704
8705def warn_abstract_vbase_init_ignored : Warning<
8706 "initializer for virtual base class %0 of abstract class %1 "
8707 "will never be used">,
8708 InGroup<DiagGroup<"abstract-vbase-init">>, DefaultIgnore;
8709
8710def err_base_init_does_not_name_class : Error<
8711 "constructor initializer %0 does not name a class">;
8712def err_base_init_direct_and_virtual : Error<
8713 "base class initializer %0 names both a direct base class and an "
8714 "inherited virtual base class">;
8715def err_not_direct_base_or_virtual : Error<
8716 "type %0 is not a direct or virtual base of %1">;
8717
8718def err_in_class_initializer_non_const : Error<
8719 "non-const static data member must be initialized out of line">;
8720def err_in_class_initializer_volatile : Error<
8721 "static const volatile data member must be initialized out of line">;
8722def err_in_class_initializer_bad_type : Error<
8723 "static data member of type %0 must be initialized out of line">;
8724def ext_in_class_initializer_float_type : ExtWarn<
8725 "in-class initializer for static data member of type %0 is a GNU extension">,
8726 InGroup<GNUStaticFloatInit>;
8727def ext_in_class_initializer_float_type_cxx11 : ExtWarn<
8728 "in-class initializer for static data member of type %0 requires "
8729 "'constexpr' specifier">, InGroup<StaticFloatInit>, DefaultError;
8730def note_in_class_initializer_float_type_cxx11 : Note<"add 'constexpr'">;
8731def err_in_class_initializer_literal_type : Error<
8732 "in-class initializer for static data member of type %0 requires "
8733 "'constexpr' specifier">;
8734def err_in_class_initializer_non_constant : Error<
8735 "in-class initializer for static data member is not a constant expression">;
8736def err_default_member_initializer_not_yet_parsed : Error<
8737 "default member initializer for %1 needed within definition of enclosing "
8738 "class %0 outside of member functions">;
8739def note_default_member_initializer_not_yet_parsed : Note<
8740 "default member initializer declared here">;
8741def err_default_member_initializer_cycle
8742 : Error<"default member initializer for %0 uses itself">;
8743
8744def ext_in_class_initializer_non_constant : Extension<
8745 "in-class initializer for static data member is not a constant expression; "
8746 "folding it to a constant is a GNU extension">, InGroup<GNUFoldingConstant>;
8747
8748def err_thread_dynamic_init : Error<
8749 "initializer for thread-local variable must be a constant expression">;
8750def err_thread_nontrivial_dtor : Error<
8751 "type of thread-local variable has non-trivial destruction">;
8752def note_use_thread_local : Note<
8753 "use 'thread_local' to allow this">;
8754
8755// C++ anonymous unions and GNU anonymous structs/unions
8756def ext_anonymous_union : Extension<
8757 "anonymous unions are a C11 extension">, InGroup<C11>;
8758def ext_gnu_anonymous_struct : Extension<
8759 "anonymous structs are a GNU extension">, InGroup<GNUAnonymousStruct>;
8760def ext_c11_anonymous_struct : Extension<
8761 "anonymous structs are a C11 extension">, InGroup<C11>;
8762def err_anonymous_union_not_static : Error<
8763 "anonymous unions at namespace or global scope must be declared 'static'">;
8764def err_anonymous_union_with_storage_spec : Error<
8765 "anonymous union at class scope must not have a storage specifier">;
8766def err_anonymous_struct_not_member : Error<
8767 "anonymous %select{structs|structs and classes}0 must be "
8768 "%select{struct or union|class}0 members">;
8769def err_anonymous_record_member_redecl : Error<
8770 "member of anonymous %select{struct|union}0 redeclares %1">;
8771def err_anonymous_record_with_type : Error<
8772 "types cannot be declared in an anonymous %select{struct|union}0">;
8773def ext_anonymous_record_with_type : Extension<
8774 "types declared in an anonymous %select{struct|union}0 are a Microsoft "
8775 "extension">, InGroup<MicrosoftAnonTag>;
8776def ext_anonymous_record_with_anonymous_type : Extension<
8777 "anonymous types declared in an anonymous %select{struct|union}0 "
8778 "are an extension">, InGroup<DiagGroup<"nested-anon-types">>;
8779def err_anonymous_record_with_function : Error<
8780 "functions cannot be declared in an anonymous %select{struct|union}0">;
8781def err_anonymous_record_with_static : Error<
8782 "static members cannot be declared in an anonymous %select{struct|union}0">;
8783def err_anonymous_record_bad_member : Error<
8784 "anonymous %select{struct|union}0 can only contain non-static data members">;
8785def err_anonymous_record_nonpublic_member : Error<
8786 "anonymous %select{struct|union}0 cannot contain a "
8787 "%select{private|protected}1 data member">;
8788def ext_ms_anonymous_record : ExtWarn<
8789 "anonymous %select{structs|unions}0 are a Microsoft extension">,
8790 InGroup<MicrosoftAnonTag>;
8791
8792// C++ local classes
8793def err_reference_to_local_in_enclosing_context : Error<
8794 "reference to local %select{variable|binding}1 %0 declared in enclosing "
8795 "%select{%3|block literal|lambda expression|context}2">;
8796
8797def err_static_data_member_not_allowed_in_local_class : Error<
8798 "static data member %0 not allowed in local %sub{select_tag_type_kind}2 %1">;
8799
8800// C++ derived classes
8801def err_base_clause_on_union : Error<"unions cannot have base classes">;
8802def err_base_must_be_class : Error<"base specifier must name a class">;
8803def err_union_as_base_class : Error<"unions cannot be base classes">;
8804def err_circular_inheritance : Error<
8805 "circular inheritance between %0 and %1">;
8806def err_base_class_has_flexible_array_member : Error<
8807 "base class %0 has a flexible array member">;
8808def err_incomplete_base_class : Error<"base class has incomplete type">;
8809def err_duplicate_base_class : Error<
8810 "base class %0 specified more than once as a direct base class">;
8811def warn_inaccessible_base_class : Warning<
8812 "direct base %0 is inaccessible due to ambiguity:%1">,
8813 InGroup<DiagGroup<"inaccessible-base">>;
8814// FIXME: better way to display derivation? Pass entire thing into diagclient?
8815def err_ambiguous_derived_to_base_conv : Error<
8816 "ambiguous conversion from derived class %0 to base class %1:%2">;
8817def err_ambiguous_memptr_conv : Error<
8818 "ambiguous conversion from pointer to member of %select{base|derived}0 "
8819 "class %1 to pointer to member of %select{derived|base}0 class %2:%3">;
8820def ext_ms_ambiguous_direct_base : ExtWarn<
8821 "accessing inaccessible direct base %0 of %1 is a Microsoft extension">,
8822 InGroup<MicrosoftInaccessibleBase>;
8823
8824def err_memptr_conv_via_virtual : Error<
8825 "conversion from pointer to member of class %0 to pointer to member "
8826 "of class %1 via virtual base %2 is not allowed">;
8827
8828// C++ member name lookup
8829def err_ambiguous_member_multiple_subobjects : Error<
8830 "non-static member %0 found in multiple base-class subobjects of type %1:%2">;
8831def err_ambiguous_member_multiple_subobject_types : Error<
8832 "member %0 found in multiple base classes of different types">;
8833def note_ambiguous_member_found : Note<"member found by ambiguous name lookup">;
8834def note_ambiguous_member_type_found : Note<
8835 "member type %0 found by ambiguous name lookup">;
8836def err_ambiguous_reference : Error<"reference to %0 is ambiguous">;
8837def note_ambiguous_candidate : Note<"candidate found by name lookup is %q0">;
8838def err_ambiguous_tag_hiding : Error<"a type named %0 is hidden by a "
8839 "declaration in a different namespace">;
8840def note_hidden_tag : Note<"type declaration hidden">;
8841def note_hiding_object : Note<"declaration hides type">;
8842
8843// C++ operator overloading
8844def err_operator_overload_needs_class_or_enum : Error<
8845 "overloaded %0 must have at least one parameter of class "
8846 "or enumeration type">;
8847
8848def err_operator_overload_variadic : Error<"overloaded %0 cannot be variadic">;
8849def err_operator_overload_static : Error<
8850 "overloaded %0 cannot be a static member function">;
8851def err_operator_overload_default_arg : Error<
8852 "parameter of overloaded %0 cannot have a default argument">;
8853def err_operator_overload_must_be : Error<
8854 "overloaded %0 must be a %select{unary|binary|unary or binary}2 operator "
8855 "(has %1 parameter%s1)">;
8856
8857def err_operator_overload_must_be_member : Error<
8858 "overloaded %0 must be a non-static member function">;
8859def err_operator_overload_post_incdec_must_be_int : Error<
8860 "parameter of overloaded post-%select{increment|decrement}1 operator must "
8861 "have type 'int' (not %0)">;
8862
8863// C++ allocation and deallocation functions.
8864def err_operator_new_delete_declared_in_namespace : Error<
8865 "%0 cannot be declared inside a namespace">;
8866def err_operator_new_delete_declared_static : Error<
8867 "%0 cannot be declared static in global scope">;
8868def ext_operator_new_delete_declared_inline : ExtWarn<
8869 "replacement function %0 cannot be declared 'inline'">,
8870 InGroup<DiagGroup<"inline-new-delete">>;
8871def err_operator_new_delete_invalid_result_type : Error<
8872 "%0 must return type %1">;
8873def err_operator_new_delete_dependent_result_type : Error<
8874 "%0 cannot have a dependent return type; use %1 instead">;
8875def err_operator_new_delete_too_few_parameters : Error<
8876 "%0 must have at least one parameter">;
8877def err_operator_new_delete_template_too_few_parameters : Error<
8878 "%0 template must have at least two parameters">;
8879def warn_operator_new_returns_null : Warning<
8880 "%0 should not return a null pointer unless it is declared 'throw()'"
8881 "%select{| or 'noexcept'}1">, InGroup<OperatorNewReturnsNull>;
8882
8883def err_operator_new_dependent_param_type : Error<
8884 "%0 cannot take a dependent type as first parameter; "
8885 "use size_t (%1) instead">;
8886def err_operator_new_param_type : Error<
8887 "%0 takes type size_t (%1) as first parameter">;
8888def err_operator_new_default_arg: Error<
8889 "parameter of %0 cannot have a default argument">;
8890def err_operator_delete_dependent_param_type : Error<
8891 "%0 cannot take a dependent type as first parameter; use %1 instead">;
8892def err_operator_delete_param_type : Error<
8893 "first parameter of %0 must have type %1">;
8894def err_destroying_operator_delete_not_usual : Error<
8895 "destroying operator delete can have only an optional size and optional "
8896 "alignment parameter">;
8897def note_implicit_delete_this_in_destructor_here : Note<
8898 "while checking implicit 'delete this' for virtual destructor">;
8899def err_builtin_operator_new_delete_not_usual : Error<
8900 "call to '%select{__builtin_operator_new|__builtin_operator_delete}0' "
8901 "selects non-usual %select{allocation|deallocation}0 function">;
8902def note_non_usual_function_declared_here : Note<
8903 "non-usual %0 declared here">;
8904
8905// C++ literal operators
8906def err_literal_operator_outside_namespace : Error<
8907 "literal operator %0 must be in a namespace or global scope">;
8908def err_literal_operator_id_outside_namespace : Error<
8909 "non-namespace scope '%0' cannot have a literal operator member">;
8910def err_literal_operator_default_argument : Error<
8911 "literal operator cannot have a default argument">;
8912def err_literal_operator_bad_param_count : Error<
8913 "non-template literal operator must have one or two parameters">;
8914def err_literal_operator_invalid_param : Error<
8915 "parameter of literal operator must have type 'unsigned long long', 'long double', 'char', 'wchar_t', 'char16_t', 'char32_t', or 'const char *'">;
8916def err_literal_operator_param : Error<
8917 "invalid literal operator parameter type %0, did you mean %1?">;
8918def err_literal_operator_template_with_params : Error<
8919 "literal operator template cannot have any parameters">;
8920def err_literal_operator_template : Error<
8921 "template parameter list for literal operator must be either 'char...' or 'typename T, T...'">;
8922def err_literal_operator_extern_c : Error<
8923 "literal operator must have C++ linkage">;
8924def ext_string_literal_operator_template : ExtWarn<
8925 "string literal operator templates are a GNU extension">,
8926 InGroup<GNUStringLiteralOperatorTemplate>;
8927def warn_user_literal_reserved : Warning<
8928 "user-defined literal suffixes not starting with '_' are reserved"
8929 "%select{; no literal will invoke this operator|}0">,
8930 InGroup<UserDefinedLiterals>;
8931
8932// C++ conversion functions
8933def err_conv_function_not_member : Error<
8934 "conversion function must be a non-static member function">;
8935def err_conv_function_return_type : Error<
8936 "conversion function cannot have a return type">;
8937def err_conv_function_with_params : Error<
8938 "conversion function cannot have any parameters">;
8939def err_conv_function_variadic : Error<
8940 "conversion function cannot be variadic">;
8941def err_conv_function_to_array : Error<
8942 "conversion function cannot convert to an array type">;
8943def err_conv_function_to_function : Error<
8944 "conversion function cannot convert to a function type">;
8945def err_conv_function_with_complex_decl : Error<
8946 "cannot specify any part of a return type in the "
8947 "declaration of a conversion function"
8948 "%select{"
8949 "; put the complete type after 'operator'|"
8950 "; use a typedef to declare a conversion to %1|"
8951 "; use an alias template to declare a conversion to %1|"
8952 "}0">;
8953def err_conv_function_redeclared : Error<
8954 "conversion function cannot be redeclared">;
8955def warn_conv_to_self_not_used : Warning<
8956 "conversion function converting %0 to itself will never be used">,
8957 InGroup<ClassConversion>;
8958def warn_conv_to_base_not_used : Warning<
8959 "conversion function converting %0 to its base class %1 will never be used">,
8960 InGroup<ClassConversion>;
8961def warn_conv_to_void_not_used : Warning<
8962 "conversion function converting %0 to %1 will never be used">,
8963 InGroup<ClassConversion>;
8964
8965def warn_not_compound_assign : Warning<
8966 "use of unary operator that may be intended as compound assignment (%0=)">;
8967
8968// C++11 explicit conversion operators
8969def ext_explicit_conversion_functions : ExtWarn<
8970 "explicit conversion functions are a C++11 extension">, InGroup<CXX11>;
8971def warn_cxx98_compat_explicit_conversion_functions : Warning<
8972 "explicit conversion functions are incompatible with C++98">,
8973 InGroup<CXX98Compat>, DefaultIgnore;
8974
8975// C++11 defaulted functions
8976def err_defaulted_special_member_params : Error<
8977 "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8978 "have default arguments">;
8979def err_defaulted_special_member_variadic : Error<
8980 "an explicitly-defaulted %select{|copy |move }0constructor cannot "
8981 "be variadic">;
8982def err_defaulted_special_member_return_type : Error<
8983 "explicitly-defaulted %select{copy|move}0 assignment operator must "
8984 "return %1">;
8985def err_defaulted_special_member_quals : Error<
8986 "an explicitly-defaulted %select{copy|move}0 assignment operator may not "
8987 "have 'const'%select{, 'constexpr'|}1 or 'volatile' qualifiers">;
8988def err_defaulted_special_member_volatile_param : Error<
8989 "the parameter for an explicitly-defaulted %sub{select_special_member_kind}0 "
8990 "may not be volatile">;
8991def err_defaulted_special_member_move_const_param : Error<
8992 "the parameter for an explicitly-defaulted move "
8993 "%select{constructor|assignment operator}0 may not be const">;
8994def err_defaulted_special_member_copy_const_param : Error<
8995 "the parameter for this explicitly-defaulted copy "
8996 "%select{constructor|assignment operator}0 is const, but a member or base "
8997 "requires it to be non-const">;
8998def err_defaulted_copy_assign_not_ref : Error<
8999 "the parameter for an explicitly-defaulted copy assignment operator must be an "
9000 "lvalue reference type">;
9001def err_incorrect_defaulted_constexpr : Error<
9002 "defaulted definition of %sub{select_special_member_kind}0 "
9003 "is not constexpr">;
9004def err_incorrect_defaulted_consteval : Error<
9005 "defaulted declaration of %sub{select_special_member_kind}0 "
9006 "cannot be consteval because implicit definition is not constexpr">;
9007def warn_defaulted_method_deleted : Warning<
9008 "explicitly defaulted %sub{select_special_member_kind}0 is implicitly "
9009 "deleted">, InGroup<DefaultedFunctionDeleted>;
9010def err_out_of_line_default_deletes : Error<
9011 "defaulting this %sub{select_special_member_kind}0 "
9012 "would delete it after its first declaration">;
9013def note_deleted_type_mismatch : Note<
9014 "function is implicitly deleted because its declared type does not match "
9015 "the type of an implicit %sub{select_special_member_kind}0">;
9016def warn_cxx17_compat_defaulted_method_type_mismatch : Warning<
9017 "explicitly defaulting this %sub{select_special_member_kind}0 with a type "
9018 "different from the implicit type is incompatible with C++ standards before "
9019 "C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9020def warn_vbase_moved_multiple_times : Warning<
9021 "defaulted move assignment operator of %0 will move assign virtual base "
9022 "class %1 multiple times">, InGroup<DiagGroup<"multiple-move-vbase">>;
9023def note_vbase_moved_here : Note<
9024 "%select{%1 is a virtual base class of base class %2 declared here|"
9025 "virtual base class %1 declared here}0">;
9026
9027// C++20 defaulted comparisons
9028// This corresponds to values of Sema::DefaultedComparisonKind.
9029def select_defaulted_comparison_kind : TextSubstitution<
9030 "%select{<ERROR>|equality|three-way|equality|relational}0 comparison "
9031 "operator">;
9032def ext_defaulted_comparison : ExtWarn<
9033 "defaulted comparison operators are a C++20 extension">, InGroup<CXX20>;
9034def warn_cxx17_compat_defaulted_comparison : Warning<
9035 "defaulted comparison operators are incompatible with C++ standards "
9036 "before C++20">, InGroup<CXXPre20Compat>, DefaultIgnore;
9037def err_defaulted_comparison_template : Error<
9038 "comparison operator template cannot be defaulted">;
9039def err_defaulted_comparison_out_of_class : Error<
9040 "%sub{select_defaulted_comparison_kind}0 can only be defaulted in a class "
9041 "definition">;
9042def err_defaulted_comparison_param : Error<
9043 "invalid parameter type for defaulted %sub{select_defaulted_comparison_kind}0"
9044 "; found %1, expected %2%select{| or %4}3">;
9045def err_defaulted_comparison_param_mismatch : Error<
9046 "parameters for defaulted %sub{select_defaulted_comparison_kind}0 "
9047 "must have the same type%diff{ (found $ vs $)|}1,2">;
9048def err_defaulted_comparison_non_const : Error<
9049 "defaulted member %sub{select_defaulted_comparison_kind}0 must be "
9050 "const-qualified">;
9051def err_defaulted_comparison_return_type_not_bool : Error<
9052 "return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9053 "must be 'bool', not %1">;
9054def err_defaulted_comparison_deduced_return_type_not_auto : Error<
9055 "deduced return type for defaulted %sub{select_defaulted_comparison_kind}0 "
9056 "must be 'auto', not %1">;
9057def warn_defaulted_comparison_deleted : Warning<
9058 "explicitly defaulted %sub{select_defaulted_comparison_kind}0 is implicitly "
9059 "deleted">, InGroup<DefaultedFunctionDeleted>;
9060def err_non_first_default_compare_deletes : Error<
9061 "defaulting %select{this %sub{select_defaulted_comparison_kind}1|"
9062 "the corresponding implicit 'operator==' for this defaulted 'operator<=>'}0 "
9063 "would delete it after its first declaration">;
9064def note_defaulted_comparison_union : Note<
9065 "defaulted %0 is implicitly deleted because "
9066 "%2 is a %select{union-like class|union}1 with variant members">;
9067def note_defaulted_comparison_reference_member : Note<
9068 "defaulted %0 is implicitly deleted because "
9069 "class %1 has a reference member">;
9070def note_defaulted_comparison_ambiguous : Note<
9071 "defaulted %0 is implicitly deleted because implied %select{|'==' |'<' }1"
9072 "comparison %select{|for member %3 |for base class %3 }2is ambiguous">;
9073def note_defaulted_comparison_inaccessible : Note<
9074 "defaulted %0 is implicitly deleted because it would invoke a "
9075 "%select{private|protected}3 %4%select{ member of %6|"
9076 " member of %6 to compare member %2| to compare base class %2}1">;
9077def note_defaulted_comparison_calls_deleted : Note<
9078 "defaulted %0 is implicitly deleted because it would invoke a deleted "
9079 "comparison function%select{| for member %2| for base class %2}1">;
9080def note_defaulted_comparison_no_viable_function : Note<
9081 "defaulted %0 is implicitly deleted because there is no viable three-way "
9082 "comparison function for%select{| member| base class}1 %2">;
9083def note_defaulted_comparison_no_viable_function_synthesized : Note<
9084 "three-way comparison cannot be synthesized because there is no viable "
9085 "function for %select{'=='|'<'}0 comparison">;
9086def note_defaulted_comparison_not_rewritten_callee : Note<
9087 "defaulted %0 is implicitly deleted because this non-rewritten comparison "
9088 "function would be the best match for the comparison">;
9089def note_defaulted_comparison_cannot_deduce : Note<
9090 "return type of defaulted 'operator<=>' cannot be deduced because "
9091 "return type %2 of three-way comparison for %select{|member|base class}0 %1 "
9092 "is not a standard comparison category type">;
9093def err_defaulted_comparison_cannot_deduce_undeduced_auto : Error<
9094 "return type of defaulted 'operator<=>' cannot be deduced because "
9095 "three-way comparison for %select{|member|base class}0 %1 "
9096 "has a deduced return type and is not yet defined">;
9097def note_defaulted_comparison_cannot_deduce_undeduced_auto : Note<
9098 "%select{|member|base class}0 %1 declared here">;
9099def note_defaulted_comparison_cannot_deduce_callee : Note<
9100 "selected 'operator<=>' for %select{|member|base class}0 %1 declared here">;
9101def err_incorrect_defaulted_comparison_constexpr : Error<
9102 "defaulted definition of %select{%sub{select_defaulted_comparison_kind}1|"
9103 "three-way comparison operator}0 "
9104 "cannot be declared %select{constexpr|consteval}2 because "
9105 "%select{it|the corresponding implicit 'operator=='}0 "
9106 "invokes a non-constexpr comparison function">;
9107def note_defaulted_comparison_not_constexpr : Note<
9108 "non-constexpr comparison function would be used to compare "
9109 "%select{|member %1|base class %1}0">;
9110def note_defaulted_comparison_not_constexpr_here : Note<
9111 "non-constexpr comparison function declared here">;
9112def note_in_declaration_of_implicit_equality_comparison : Note<
9113 "while declaring the corresponding implicit 'operator==' "
9114 "for this defaulted 'operator<=>'">;
9115
9116def ext_implicit_exception_spec_mismatch : ExtWarn<
9117 "function previously declared with an %select{explicit|implicit}0 exception "
9118 "specification redeclared with an %select{implicit|explicit}0 exception "
9119 "specification">, InGroup<DiagGroup<"implicit-exception-spec-mismatch">>;
9120
9121def warn_ptr_arith_precedes_bounds : Warning<
9122 "the pointer decremented by %0 refers before the beginning of the array">,
9123 InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9124def warn_ptr_arith_exceeds_bounds : Warning<
9125 "the pointer incremented by %0 refers past the end of the array (that "
9126 "contains %1 element%s2)">,
9127 InGroup<ArrayBoundsPointerArithmetic>, DefaultIgnore;
9128def warn_array_index_precedes_bounds : Warning<
9129 "array index %0 is before the beginning of the array">,
9130 InGroup<ArrayBounds>;
9131def warn_array_index_exceeds_bounds : Warning<
9132 "array index %0 is past the end of the array (which contains %1 "
9133 "element%s2)">, InGroup<ArrayBounds>;
9134def note_array_declared_here : Note<
9135 "array %0 declared here">;
9136
9137def warn_printf_insufficient_data_args : Warning<
9138 "more '%%' conversions than data arguments">, InGroup<FormatInsufficientArgs>;
9139def warn_printf_data_arg_not_used : Warning<
9140 "data argument not used by format string">, InGroup<FormatExtraArgs>;
9141def warn_format_invalid_conversion : Warning<
9142 "invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
9143def warn_printf_incomplete_specifier : Warning<
9144 "incomplete format specifier">, InGroup<Format>;
9145def warn_missing_format_string : Warning<
9146 "format string missing">, InGroup<Format>;
9147def warn_scanf_nonzero_width : Warning<
9148 "zero field width in scanf format string is unused">,
9149 InGroup<Format>;
9150def warn_format_conversion_argument_type_mismatch : Warning<
9151 "format specifies type %0 but the argument has "
9152 "%select{type|underlying type}2 %1">,
9153 InGroup<Format>;
9154def warn_format_conversion_argument_type_mismatch_pedantic : Extension<
9155 warn_format_conversion_argument_type_mismatch.Text>,
9156 InGroup<FormatPedantic>;
9157def warn_format_conversion_argument_type_mismatch_confusion : Warning<
9158 warn_format_conversion_argument_type_mismatch.Text>,
9159 InGroup<FormatTypeConfusion>, DefaultIgnore;
9160def warn_format_argument_needs_cast : Warning<
9161 "%select{values of type|enum values with underlying type}2 '%0' should not "
9162 "be used as format arguments; add an explicit cast to %1 instead">,
9163 InGroup<Format>;
9164def warn_format_argument_needs_cast_pedantic : Warning<
9165 warn_format_argument_needs_cast.Text>,
9166 InGroup<FormatPedantic>, DefaultIgnore;
9167def warn_printf_positional_arg_exceeds_data_args : Warning <
9168 "data argument position '%0' exceeds the number of data arguments (%1)">,
9169 InGroup<Format>;
9170def warn_format_zero_positional_specifier : Warning<
9171 "position arguments in format strings start counting at 1 (not 0)">,
9172 InGroup<Format>;
9173def warn_format_invalid_positional_specifier : Warning<
9174 "invalid position specified for %select{field width|field precision}0">,
9175 InGroup<Format>;
9176def warn_format_mix_positional_nonpositional_args : Warning<
9177 "cannot mix positional and non-positional arguments in format string">,
9178 InGroup<Format>;
9179def warn_static_array_too_small : Warning<
9180 "array argument is too small; %select{contains %0 elements|is of size %0}2,"
9181 " callee requires at least %1">,
9182 InGroup<ArrayBounds>;
9183def note_callee_static_array : Note<
9184 "callee declares array parameter as static here">;
9185def warn_empty_format_string : Warning<
9186 "format string is empty">, InGroup<FormatZeroLength>;
9187def warn_format_string_is_wide_literal : Warning<
9188 "format string should not be a wide string">, InGroup<Format>;
9189def warn_printf_format_string_contains_null_char : Warning<
9190 "format string contains '\\0' within the string body">, InGroup<Format>;
9191def warn_printf_format_string_not_null_terminated : Warning<
9192 "format string is not null-terminated">, InGroup<Format>;
9193def warn_printf_asterisk_missing_arg : Warning<
9194 "'%select{*|.*}0' specified field %select{width|precision}0 is missing a matching 'int' argument">,
9195 InGroup<Format>;
9196def warn_printf_asterisk_wrong_type : Warning<
9197 "field %select{width|precision}0 should have type %1, but argument has type %2">,
9198 InGroup<Format>;
9199def warn_printf_nonsensical_optional_amount: Warning<
9200 "%select{field width|precision}0 used with '%1' conversion specifier, resulting in undefined behavior">,
9201 InGroup<Format>;
9202def warn_printf_nonsensical_flag: Warning<
9203 "flag '%0' results in undefined behavior with '%1' conversion specifier">,
9204 InGroup<Format>;
9205def warn_format_nonsensical_length: Warning<
9206 "length modifier '%0' results in undefined behavior or no effect with '%1' conversion specifier">,
9207 InGroup<Format>;
9208def warn_format_non_standard_positional_arg: Warning<
9209 "positional arguments are not supported by ISO C">, InGroup<FormatNonStandard>, DefaultIgnore;
9210def warn_format_non_standard: Warning<
9211 "'%0' %select{length modifier|conversion specifier}1 is not supported by ISO C">,
9212 InGroup<FormatNonStandard>, DefaultIgnore;
9213def warn_format_non_standard_conversion_spec: Warning<
9214 "using length modifier '%0' with conversion specifier '%1' is not supported by ISO C">,
9215 InGroup<FormatNonStandard>, DefaultIgnore;
9216def err_invalid_mask_type_size : Error<
9217 "mask type size must be between 1-byte and 8-bytes">;
9218def warn_format_invalid_annotation : Warning<
9219 "using '%0' format specifier annotation outside of os_log()/os_trace()">,
9220 InGroup<Format>;
9221def warn_format_P_no_precision : Warning<
9222 "using '%%P' format specifier without precision">,
9223 InGroup<Format>;
9224def warn_printf_ignored_flag: Warning<
9225 "flag '%0' is ignored when flag '%1' is present">,
9226 InGroup<Format>;
9227def warn_printf_empty_objc_flag: Warning<
9228 "missing object format flag">,
9229 InGroup<Format>;
9230def warn_printf_ObjCflags_without_ObjCConversion: Warning<
9231 "object format flags cannot be used with '%0' conversion specifier">,
9232 InGroup<Format>;
9233def warn_printf_invalid_objc_flag: Warning<
9234 "'%0' is not a valid object format flag">,
9235 InGroup<Format>;
9236def warn_scanf_scanlist_incomplete : Warning<
9237 "no closing ']' for '%%[' in scanf format string">,
9238 InGroup<Format>;
9239def warn_format_bool_as_character : Warning<
9240 "using '%0' format specifier, but argument has boolean value">,
9241 InGroup<Format>;
9242def note_format_string_defined : Note<"format string is defined here">;
9243def note_format_fix_specifier : Note<"did you mean to use '%0'?">;
9244def note_printf_c_str: Note<"did you mean to call the %0 method?">;
9245def note_format_security_fixit: Note<
9246 "treat the string as an argument to avoid this">;
9247
9248def warn_null_arg : Warning<
9249 "null passed to a callee that requires a non-null argument">,
9250 InGroup<NonNull>;
9251def warn_null_ret : Warning<
9252 "null returned from %select{function|method}0 that requires a non-null return value">,
9253 InGroup<NonNull>;
9254
9255def err_lifetimebound_no_object_param : Error<
9256 "'lifetimebound' attribute cannot be applied; %select{static |non-}0member "
9257 "function has no implicit object parameter">;
9258def err_lifetimebound_ctor_dtor : Error<
9259 "'lifetimebound' attribute cannot be applied to a "
9260 "%select{constructor|destructor}0">;
9261
9262// CHECK: returning address/reference of stack memory
9263def warn_ret_stack_addr_ref : Warning<
9264 "%select{address of|reference to}0 stack memory associated with "
9265 "%select{local variable|parameter}2 %1 returned">,
9266 InGroup<ReturnStackAddress>;
9267def warn_ret_local_temp_addr_ref : Warning<
9268 "returning %select{address of|reference to}0 local temporary object">,
9269 InGroup<ReturnStackAddress>;
9270def warn_ret_addr_label : Warning<
9271 "returning address of label, which is local">,
9272 InGroup<ReturnStackAddress>;
9273def err_ret_local_block : Error<
9274 "returning block that lives on the local stack">;
9275def note_local_var_initializer : Note<
9276 "%select{via initialization of|binding reference}0 variable "
9277 "%select{%2 |}1here">;
9278def note_lambda_capture_initializer : Note<
9279 "%select{implicitly |}2captured%select{| by reference}3"
9280 "%select{%select{ due to use|}2 here|"
9281 " via initialization of lambda capture %0}1">;
9282def note_init_with_default_member_initalizer : Note<
9283 "initializing field %0 with default member initializer">;
9284
9285// Check for initializing a member variable with the address or a reference to
9286// a constructor parameter.
9287def warn_bind_ref_member_to_parameter : Warning<
9288 "binding reference member %0 to stack allocated "
9289 "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9290def warn_init_ptr_member_to_parameter_addr : Warning<
9291 "initializing pointer member %0 with the stack address of "
9292 "%select{variable|parameter}2 %1">, InGroup<DanglingField>;
9293def note_ref_or_ptr_member_declared_here : Note<
9294 "%select{reference|pointer}0 member declared here">;
9295
9296def err_dangling_member : Error<
9297 "%select{reference|backing array for 'std::initializer_list'}2 "
9298 "%select{|subobject of }1member %0 "
9299 "%select{binds to|is}2 a temporary object "
9300 "whose lifetime would be shorter than the lifetime of "
9301 "the constructed object">;
9302def warn_dangling_member : Warning<
9303 "%select{reference|backing array for 'std::initializer_list'}2 "
9304 "%select{|subobject of }1member %0 "
9305 "%select{binds to|is}2 a temporary object "
9306 "whose lifetime is shorter than the lifetime of the constructed object">,
9307 InGroup<DanglingField>;
9308def warn_dangling_lifetime_pointer_member : Warning<
9309 "initializing pointer member %0 to point to a temporary object "
9310 "whose lifetime is shorter than the lifetime of the constructed object">,
9311 InGroup<DanglingGsl>;
9312def note_lifetime_extending_member_declared_here : Note<
9313 "%select{%select{reference|'std::initializer_list'}0 member|"
9314 "member with %select{reference|'std::initializer_list'}0 subobject}1 "
9315 "declared here">;
9316def warn_dangling_variable : Warning<
9317 "%select{temporary %select{whose address is used as value of|"
9318 "%select{|implicitly }2bound to}4 "
9319 "%select{%select{|reference }4member of local variable|"
9320 "local %select{variable|reference}4}1|"
9321 "array backing "
9322 "%select{initializer list subobject of local variable|"
9323 "local initializer list}1}0 "
9324 "%select{%3 |}2will be destroyed at the end of the full-expression">,
9325 InGroup<Dangling>;
9326def warn_new_dangling_reference : Warning<
9327 "temporary bound to reference member of allocated object "
9328 "will be destroyed at the end of the full-expression">,
9329 InGroup<DanglingField>;
9330def warn_dangling_lifetime_pointer : Warning<
9331 "object backing the pointer "
9332 "will be destroyed at the end of the full-expression">,
9333 InGroup<DanglingGsl>;
9334def warn_new_dangling_initializer_list : Warning<
9335 "array backing "
9336 "%select{initializer list subobject of the allocated object|"
9337 "the allocated initializer list}0 "
9338 "will be destroyed at the end of the full-expression">,
9339 InGroup<DanglingInitializerList>;
9340def warn_unsupported_lifetime_extension : Warning<
9341 "sorry, lifetime extension of "
9342 "%select{temporary|backing array of initializer list}0 created "
9343 "by aggregate initialization using default member initializer "
9344 "is not supported; lifetime of %select{temporary|backing array}0 "
9345 "will end at the end of the full-expression">, InGroup<Dangling>;
9346
9347// For non-floating point, expressions of the form x == x or x != x
9348// should result in a warning, since these always evaluate to a constant.
9349// Array comparisons have similar warnings
9350def warn_comparison_always : Warning<
9351 "%select{self-|array }0comparison always evaluates to "
9352 "%select{a constant|true|false|'std::strong_ordering::equal'}1">,
9353 InGroup<TautologicalCompare>;
9354def warn_comparison_bitwise_always : Warning<
9355 "bitwise comparison always evaluates to %select{false|true}0">,
9356 InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9357def warn_comparison_bitwise_or : Warning<
9358 "bitwise or with non-zero value always evaluates to true">,
9359 InGroup<TautologicalBitwiseCompare>, DefaultIgnore;
9360def warn_tautological_overlap_comparison : Warning<
9361 "overlapping comparisons always evaluate to %select{false|true}0">,
9362 InGroup<TautologicalOverlapCompare>, DefaultIgnore;
9363def warn_depr_array_comparison : Warning<
9364 "comparison between two arrays is deprecated; "
9365 "to compare array addresses, use unary '+' to decay operands to pointers">,
9366 InGroup<DeprecatedArrayCompare>;
9367
9368def warn_stringcompare : Warning<
9369 "result of comparison against %select{a string literal|@encode}0 is "
9370 "unspecified (use an explicit string comparison function instead)">,
9371 InGroup<StringCompare>;
9372
9373def warn_identity_field_assign : Warning<
9374 "assigning %select{field|instance variable}0 to itself">,
9375 InGroup<SelfAssignmentField>;
9376
9377// Type safety attributes
9378def err_type_tag_for_datatype_not_ice : Error<
9379 "'type_tag_for_datatype' attribute requires the initializer to be "
9380 "an %select{integer|integral}0 constant expression">;
9381def err_type_tag_for_datatype_too_large : Error<
9382 "'type_tag_for_datatype' attribute requires the initializer to be "
9383 "an %select{integer|integral}0 constant expression "
9384 "that can be represented by a 64 bit integer">;
9385def err_tag_index_out_of_range : Error<
9386 "%select{type tag|argument}0 index %1 is greater than the number of arguments specified">;
9387def warn_type_tag_for_datatype_wrong_kind : Warning<
9388 "this type tag was not designed to be used with this function">,
9389 InGroup<TypeSafety>;
9390def warn_type_safety_type_mismatch : Warning<
9391 "argument type %0 doesn't match specified %1 type tag "
9392 "%select{that requires %3|}2">, InGroup<TypeSafety>;
9393def warn_type_safety_null_pointer_required : Warning<
9394 "specified %0 type tag requires a null pointer">, InGroup<TypeSafety>;
9395
9396// Generic selections.
9397def err_assoc_type_incomplete : Error<
9398 "type %0 in generic association incomplete">;
9399def err_assoc_type_nonobject : Error<
9400 "type %0 in generic association not an object type">;
9401def err_assoc_type_variably_modified : Error<
9402 "type %0 in generic association is a variably modified type">;
9403def err_assoc_compatible_types : Error<
9404 "type %0 in generic association compatible with previously specified type %1">;
9405def note_compat_assoc : Note<
9406 "compatible type %0 specified here">;
9407def err_generic_sel_no_match : Error<
9408 "controlling expression type %0 not compatible with any generic association type">;
9409def err_generic_sel_multi_match : Error<
9410 "controlling expression type %0 compatible with %1 generic association types">;
9411
9412
9413// Blocks
9414def err_blocks_disable : Error<"blocks support disabled - compile with -fblocks"
9415 " or %select{pick a deployment target that supports them|for OpenCL 2.0}0">;
9416def err_block_returning_array_function : Error<
9417 "block cannot return %select{array|function}0 type %1">;
9418
9419// Builtin annotation
9420def err_builtin_annotation_first_arg : Error<
9421 "first argument to __builtin_annotation must be an integer">;
9422def err_builtin_annotation_second_arg : Error<
9423 "second argument to __builtin_annotation must be a non-wide string constant">;
9424def err_msvc_annotation_wide_str : Error<
9425 "arguments to __annotation must be wide string constants">;
9426
9427// CFString checking
9428def err_cfstring_literal_not_string_constant : Error<
9429 "CFString literal is not a string constant">;
9430def warn_cfstring_truncated : Warning<
9431 "input conversion stopped due to an input byte that does not "
9432 "belong to the input codeset UTF-8">,
9433 InGroup<DiagGroup<"CFString-literal">>;
9434
9435// os_log checking
9436// TODO: separate diagnostic for os_trace()
9437def err_os_log_format_not_string_constant : Error<
9438 "os_log() format argument is not a string constant">;
9439def err_os_log_argument_too_big : Error<
9440 "os_log() argument %0 is too big (%1 bytes, max %2)">;
9441def warn_os_log_format_narg : Error<
9442 "os_log() '%%n' format specifier is not allowed">, DefaultError;
9443
9444// Statements.
9445def err_continue_not_in_loop : Error<
9446 "'continue' statement not in loop statement">;
9447def err_break_not_in_loop_or_switch : Error<
9448 "'break' statement not in loop or switch statement">;
9449def warn_loop_ctrl_binds_to_inner : Warning<
9450 "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
9451 InGroup<GccCompat>;
9452def warn_break_binds_to_switch : Warning<
9453 "'break' is bound to loop, GCC binds it to switch">,
9454 InGroup<GccCompat>;
9455def err_default_not_in_switch : Error<
9456 "'default' statement not in switch statement">;
9457def err_case_not_in_switch : Error<"'case' statement not in switch statement">;
9458def warn_bool_switch_condition : Warning<
9459 "switch condition has boolean value">, InGroup<SwitchBool>;
9460def warn_case_value_overflow : Warning<
9461 "overflow converting case value to switch condition type (%0 to %1)">,
9462 InGroup<Switch>;
9463def err_duplicate_case : Error<"duplicate case value '%0'">;
9464def err_duplicate_case_differing_expr : Error<
9465 "duplicate case value: '%0' and '%1' both equal '%2'">;
9466def warn_case_empty_range : Warning<"empty case range specified">;
9467def warn_missing_case_for_condition :
9468 Warning<"no case matching constant switch condition '%0'">;
9469
9470def warn_def_missing_case : Warning<"%plural{"
9471 "1:enumeration value %1 not explicitly handled in switch|"
9472 "2:enumeration values %1 and %2 not explicitly handled in switch|"
9473 "3:enumeration values %1, %2, and %3 not explicitly handled in switch|"
9474 ":%0 enumeration values not explicitly handled in switch: %1, %2, %3...}0">,
9475 InGroup<SwitchEnum>, DefaultIgnore;
9476
9477def warn_missing_case : Warning<"%plural{"
9478 "1:enumeration value %1 not handled in switch|"
9479 "2:enumeration values %1 and %2 not handled in switch|"
9480 "3:enumeration values %1, %2, and %3 not handled in switch|"
9481 ":%0 enumeration values not handled in switch: %1, %2, %3...}0">,
9482 InGroup<Switch>;
9483
9484def warn_unannotated_fallthrough : Warning<
9485 "unannotated fall-through between switch labels">,
9486 InGroup<ImplicitFallthrough>, DefaultIgnore;
9487def warn_unannotated_fallthrough_per_function : Warning<
9488 "unannotated fall-through between switch labels in partly-annotated "
9489 "function">, InGroup<ImplicitFallthroughPerFunction>, DefaultIgnore;
9490def note_insert_fallthrough_fixit : Note<
9491 "insert '%0;' to silence this warning">;
9492def note_insert_break_fixit : Note<
9493 "insert 'break;' to avoid fall-through">;
9494def err_fallthrough_attr_wrong_target : Error<
9495 "%0 attribute is only allowed on empty statements">;
9496def note_fallthrough_insert_semi_fixit : Note<"did you forget ';'?">;
9497def err_fallthrough_attr_outside_switch : Error<
9498 "fallthrough annotation is outside switch statement">;
9499def err_fallthrough_attr_invalid_placement : Error<
9500 "fallthrough annotation does not directly precede switch label">;
9501def warn_fallthrough_attr_unreachable : Warning<
9502 "fallthrough annotation in unreachable code">,
9503 InGroup<ImplicitFallthrough>, DefaultIgnore;
9504
9505def warn_unreachable_default : Warning<
9506 "default label in switch which covers all enumeration values">,
9507 InGroup<CoveredSwitchDefault>, DefaultIgnore;
9508def warn_not_in_enum : Warning<"case value not in enumerated type %0">,
9509 InGroup<Switch>;
9510def warn_not_in_enum_assignment : Warning<"integer constant not in range "
9511 "of enumerated type %0">, InGroup<DiagGroup<"assign-enum">>, DefaultIgnore;
9512def err_typecheck_statement_requires_scalar : Error<
9513 "statement requires expression of scalar type (%0 invalid)">;
9514def err_typecheck_statement_requires_integer : Error<
9515 "statement requires expression of integer type (%0 invalid)">;
9516def err_multiple_default_labels_defined : Error<
9517 "multiple default labels in one switch">;
9518def err_switch_multiple_conversions : Error<
9519 "multiple conversions from switch condition type %0 to an integral or "
9520 "enumeration type">;
9521def note_switch_conversion : Note<
9522 "conversion to %select{integral|enumeration}0 type %1">;
9523def err_switch_explicit_conversion : Error<
9524 "switch condition type %0 requires explicit conversion to %1">;
9525def err_switch_incomplete_class_type : Error<
9526 "switch condition has incomplete class type %0">;
9527
9528def warn_empty_if_body : Warning<
9529 "if statement has empty body">, InGroup<EmptyBody>;
9530def warn_empty_for_body : Warning<
9531 "for loop has empty body">, InGroup<EmptyBody>;
9532def warn_empty_range_based_for_body : Warning<
9533 "range-based for loop has empty body">, InGroup<EmptyBody>;
9534def warn_empty_while_body : Warning<
9535 "while loop has empty body">, InGroup<EmptyBody>;
9536def warn_empty_switch_body : Warning<
9537 "switch statement has empty body">, InGroup<EmptyBody>;
9538def note_empty_body_on_separate_line : Note<
9539 "put the semicolon on a separate line to silence this warning">;
9540
9541def err_va_start_captured_stmt : Error<
9542 "'va_start' cannot be used in a captured statement">;
9543def err_va_start_outside_function : Error<
9544 "'va_start' cannot be used outside a function">;
9545def err_va_start_fixed_function : Error<
9546 "'va_start' used in function with fixed args">;
9547def err_va_start_used_in_wrong_abi_function : Error<
9548 "'va_start' used in %select{System V|Win64}0 ABI function">;
9549def err_ms_va_start_used_in_sysv_function : Error<
9550 "'__builtin_ms_va_start' used in System V ABI function">;
9551def warn_second_arg_of_va_start_not_last_named_param : Warning<
9552 "second argument to 'va_start' is not the last named parameter">,
9553 InGroup<Varargs>;
9554def warn_va_start_type_is_undefined : Warning<
9555 "passing %select{an object that undergoes default argument promotion|"
9556 "an object of reference type|a parameter declared with the 'register' "
9557 "keyword}0 to 'va_start' has undefined behavior">, InGroup<Varargs>;
9558def err_first_argument_to_va_arg_not_of_type_va_list : Error<
9559 "first argument to 'va_arg' is of type %0 and not 'va_list'">;
9560def err_second_parameter_to_va_arg_incomplete: Error<
9561 "second argument to 'va_arg' is of incomplete type %0">;
9562def err_second_parameter_to_va_arg_abstract: Error<
9563 "second argument to 'va_arg' is of abstract type %0">;
9564def warn_second_parameter_to_va_arg_not_pod : Warning<
9565 "second argument to 'va_arg' is of non-POD type %0">,
9566 InGroup<NonPODVarargs>, DefaultError;
9567def warn_second_parameter_to_va_arg_ownership_qualified : Warning<
9568 "second argument to 'va_arg' is of ARC ownership-qualified type %0">,
9569 InGroup<NonPODVarargs>, DefaultError;
9570def warn_second_parameter_to_va_arg_never_compatible : Warning<
9571 "second argument to 'va_arg' is of promotable type %0; this va_arg has "
9572 "undefined behavior because arguments will be promoted to %1">, InGroup<Varargs>;
9573
9574def warn_return_missing_expr : Warning<
9575 "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9576 InGroup<ReturnType>;
9577def ext_return_missing_expr : ExtWarn<
9578 "non-void %select{function|method}1 %0 should return a value">, DefaultError,
9579 InGroup<ReturnType>;
9580def ext_return_has_expr : ExtWarn<
9581 "%select{void function|void method|constructor|destructor}1 %0 "
9582 "should not return a value">,
9583 DefaultError, InGroup<ReturnType>;
9584def ext_return_has_void_expr : Extension<
9585 "void %select{function|method|block}1 %0 should not return void expression">;
9586def err_return_init_list : Error<
9587 "%select{void function|void method|constructor|destructor}1 %0 "
9588 "must not return a value">;
9589def err_ctor_dtor_returns_void : Error<
9590 "%select{constructor|destructor}1 %0 must not return void expression">;
9591def warn_noreturn_function_has_return_expr : Warning<
9592 "function %0 declared 'noreturn' should not return">,
9593 InGroup<InvalidNoreturn>;
9594def warn_falloff_noreturn_function : Warning<
9595 "function declared 'noreturn' should not return">,
9596 InGroup<InvalidNoreturn>;
9597def err_noreturn_block_has_return_expr : Error<
9598 "block declared 'noreturn' should not return">;
9599def err_noreturn_missing_on_first_decl : Error<
9600 "function declared '[[noreturn]]' after its first declaration">;
9601def note_noreturn_missing_first_decl : Note<
9602 "declaration missing '[[noreturn]]' attribute is here">;
9603def err_carries_dependency_missing_on_first_decl : Error<
9604 "%select{function|parameter}0 declared '[[carries_dependency]]' "
9605 "after its first declaration">;
9606def note_carries_dependency_missing_first_decl : Note<
9607 "declaration missing '[[carries_dependency]]' attribute is here">;
9608def err_carries_dependency_param_not_function_decl : Error<
9609 "'[[carries_dependency]]' attribute only allowed on parameter in a function "
9610 "declaration or lambda">;
9611def err_block_on_nonlocal : Error<
9612 "__block attribute not allowed, only allowed on local variables">;
9613def err_block_on_vm : Error<
9614 "__block attribute not allowed on declaration with a variably modified type">;
9615def err_sizeless_nonlocal : Error<
9616 "non-local variable with sizeless type %0">;
9617
9618def err_vec_builtin_non_vector : Error<
9619 "first two arguments to %0 must be vectors">;
9620def err_vec_builtin_incompatible_vector : Error<
9621 "first two arguments to %0 must have the same type">;
9622def err_vsx_builtin_nonconstant_argument : Error<
9623 "argument %0 to %1 must be a 2-bit unsigned literal (i.e. 0, 1, 2 or 3)">;
9624
9625def err_shufflevector_nonconstant_argument : Error<
9626 "index for __builtin_shufflevector must be a constant integer">;
9627def err_shufflevector_argument_too_large : Error<
9628 "index for __builtin_shufflevector must be less than the total number "
9629 "of vector elements">;
9630
9631def err_convertvector_non_vector : Error<
9632 "first argument to __builtin_convertvector must be a vector">;
9633def err_convertvector_non_vector_type : Error<
9634 "second argument to __builtin_convertvector must be a vector type">;
9635def err_convertvector_incompatible_vector : Error<
9636 "first two arguments to __builtin_convertvector must have the same number of elements">;
9637
9638def err_first_argument_to_cwsc_not_call : Error<
9639 "first argument to __builtin_call_with_static_chain must be a non-member call expression">;
9640def err_first_argument_to_cwsc_block_call : Error<
9641 "first argument to __builtin_call_with_static_chain must not be a block call">;
9642def err_first_argument_to_cwsc_builtin_call : Error<
9643 "first argument to __builtin_call_with_static_chain must not be a builtin call">;
9644def err_first_argument_to_cwsc_pdtor_call : Error<
9645 "first argument to __builtin_call_with_static_chain must not be a pseudo-destructor call">;
9646def err_second_argument_to_cwsc_not_pointer : Error<
9647 "second argument to __builtin_call_with_static_chain must be of pointer type">;
9648
9649def err_vector_incorrect_num_initializers : Error<
9650 "%select{too many|too few}0 elements in vector initialization (expected %1 elements, have %2)">;
9651def err_altivec_empty_initializer : Error<"expected initializer">;
9652
9653def err_invalid_neon_type_code : Error<
9654 "incompatible constant for this __builtin_neon function">;
9655def err_argument_invalid_range : Error<
9656 "argument value %0 is outside the valid range [%1, %2]">;
9657def warn_argument_invalid_range : Warning<
9658 "argument value %0 is outside the valid range [%1, %2]">, DefaultError,
9659 InGroup<DiagGroup<"argument-outside-range">>;
9660def err_argument_not_multiple : Error<
9661 "argument should be a multiple of %0">;
9662def err_argument_not_power_of_2 : Error<
9663 "argument should be a power of 2">;
9664def err_argument_not_shifted_byte : Error<
9665 "argument should be an 8-bit value shifted by a multiple of 8 bits">;
9666def err_argument_not_shifted_byte_or_xxff : Error<
9667 "argument should be an 8-bit value shifted by a multiple of 8 bits, or in the form 0x??FF">;
9668def err_rotation_argument_to_cadd
9669 : Error<"argument should be the value 90 or 270">;
9670def err_rotation_argument_to_cmla
9671 : Error<"argument should be the value 0, 90, 180 or 270">;
9672def warn_neon_vector_initializer_non_portable : Warning<
9673 "vector initializers are not compatible with NEON intrinsics in big endian "
9674 "mode">, InGroup<DiagGroup<"nonportable-vector-initialization">>;
9675def note_neon_vector_initializer_non_portable : Note<
9676 "consider using vld1_%0%1() to initialize a vector from memory, or "
9677 "vcreate_%0%1() to initialize from an integer constant">;
9678def note_neon_vector_initializer_non_portable_q : Note<
9679 "consider using vld1q_%0%1() to initialize a vector from memory, or "
9680 "vcombine_%0%1(vcreate_%0%1(), vcreate_%0%1()) to initialize from integer "
9681 "constants">;
9682def err_systemz_invalid_tabort_code : Error<
9683 "invalid transaction abort code">;
9684def err_64_bit_builtin_32_bit_tgt : Error<
9685 "this builtin is only available on 64-bit targets">;
9686def err_32_bit_builtin_64_bit_tgt : Error<
9687 "this builtin is only available on 32-bit targets">;
9688def err_builtin_x64_aarch64_only : Error<
9689 "this builtin is only available on x86-64 and aarch64 targets">;
9690def err_mips_builtin_requires_dsp : Error<
9691 "this builtin requires 'dsp' ASE, please use -mdsp">;
9692def err_mips_builtin_requires_dspr2 : Error<
9693 "this builtin requires 'dsp r2' ASE, please use -mdspr2">;
9694def err_mips_builtin_requires_msa : Error<
9695 "this builtin requires 'msa' ASE, please use -mmsa">;
9696def err_ppc_builtin_only_on_pwr7 : Error<
9697 "this builtin is only valid on POWER7 or later CPUs">;
9698def err_ppc_invalid_use_mma_type : Error<
9699 "invalid use of PPC MMA type">;
9700def err_x86_builtin_invalid_rounding : Error<
9701 "invalid rounding argument">;
9702def err_x86_builtin_invalid_scale : Error<
9703 "scale argument must be 1, 2, 4, or 8">;
9704def err_x86_builtin_tile_arg_duplicate : Error<
9705 "tile arguments must refer to different tiles">;
9706
9707def err_builtin_target_unsupported : Error<
9708 "builtin is not supported on this target">;
9709def err_builtin_longjmp_unsupported : Error<
9710 "__builtin_longjmp is not supported for the current target">;
9711def err_builtin_setjmp_unsupported : Error<
9712 "__builtin_setjmp is not supported for the current target">;
9713
9714def err_builtin_longjmp_invalid_val : Error<
9715 "argument to __builtin_longjmp must be a constant 1">;
9716def err_builtin_requires_language : Error<"'%0' is only available in %1">;
9717
9718def err_constant_integer_arg_type : Error<
9719 "argument to %0 must be a constant integer">;
9720
9721def ext_mixed_decls_code : Extension<
9722 "ISO C90 forbids mixing declarations and code">,
9723 InGroup<DiagGroup<"declaration-after-statement">>;
9724
9725def err_non_local_variable_decl_in_for : Error<
9726 "declaration of non-local variable in 'for' loop">;
9727def err_non_variable_decl_in_for : Error<
9728 "non-variable declaration in 'for' loop">;
9729def err_toomany_element_decls : Error<
9730 "only one element declaration is allowed">;
9731def err_selector_element_not_lvalue : Error<
9732 "selector element is not a valid lvalue">;
9733def err_selector_element_type : Error<
9734 "selector element type %0 is not a valid object">;
9735def err_selector_element_const_type : Error<
9736 "selector element of type %0 cannot be a constant lvalue expression">;
9737def err_collection_expr_type : Error<
9738 "the type %0 is not a pointer to a fast-enumerable object">;
9739def warn_collection_expr_type : Warning<
9740 "collection expression type %0 may not respond to %1">;
9741
9742def err_invalid_conversion_between_ext_vectors : Error<
9743 "invalid conversion between ext-vector type %0 and %1">;
9744
9745def warn_duplicate_attribute_exact : Warning<
9746 "attribute %0 is already applied">, InGroup<IgnoredAttributes>;
9747
9748def warn_duplicate_attribute : Warning<
9749 "attribute %0 is already applied with different arguments">,
9750 InGroup<IgnoredAttributes>;
9751
9752def warn_sync_fetch_and_nand_semantics_change : Warning<
9753 "the semantics of this intrinsic changed with GCC "
9754 "version 4.4 - the newer semantics are provided here">,
9755 InGroup<DiagGroup<"sync-fetch-and-nand-semantics-changed">>;
9756
9757// Type
9758def ext_wchar_t_sign_spec : ExtWarn<"'%0' cannot be signed or unsigned">,
9759 InGroup<DiagGroup<"signed-unsigned-wchar">>, DefaultError;
9760def warn_receiver_forward_class : Warning<
9761 "receiver %0 is a forward class and corresponding @interface may not exist">,
9762 InGroup<ForwardClassReceiver>;
9763def note_method_sent_forward_class : Note<"method %0 is used for the forward class">;
9764def ext_missing_declspec : ExtWarn<
9765 "declaration specifier missing, defaulting to 'int'">;
9766def ext_missing_type_specifier : ExtWarn<
9767 "type specifier missing, defaults to 'int'">,
9768 InGroup<ImplicitInt>;
9769def err_decimal_unsupported : Error<
9770 "GNU decimal type extension not supported">;
9771def err_missing_type_specifier : Error<
9772 "C++ requires a type specifier for all declarations">;
9773def err_objc_array_of_interfaces : Error<
9774 "array of interface %0 is invalid (probably should be an array of pointers)">;
9775def ext_c99_array_usage : Extension<
9776 "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9777 "feature">, InGroup<C99>;
9778def err_c99_array_usage_cxx : Error<
9779 "%select{qualifier in |static |}0array size %select{||'[*] '}0is a C99 "
9780 "feature, not permitted in C++">;
9781def err_type_unsupported : Error<
9782 "%0 is not supported on this target">;
9783def err_nsconsumed_attribute_mismatch : Error<
9784 "overriding method has mismatched ns_consumed attribute on its"
9785 " parameter">;
9786def err_nsreturns_retained_attribute_mismatch : Error<
9787 "overriding method has mismatched ns_returns_%select{not_retained|retained}0"
9788 " attributes">;
9789def err_nserrordomain_invalid_decl : Error<
9790 "domain argument %select{|%1 }0does not refer to global constant">;
9791def err_nserrordomain_wrong_type : Error<
9792 "domain argument %0 does not point to an NSString or CFString constant">;
9793
9794def warn_nsconsumed_attribute_mismatch : Warning<
9795 err_nsconsumed_attribute_mismatch.Text>, InGroup<NSConsumedMismatch>;
9796def warn_nsreturns_retained_attribute_mismatch : Warning<
9797 err_nsreturns_retained_attribute_mismatch.Text>, InGroup<NSReturnsMismatch>;
9798
9799def note_getter_unavailable : Note<
9800 "or because setter is declared here, but no getter method %0 is found">;
9801def err_invalid_protocol_qualifiers : Error<
9802 "invalid protocol qualifiers on non-ObjC type">;
9803def warn_ivar_use_hidden : Warning<
9804 "local declaration of %0 hides instance variable">,
9805 InGroup<ShadowIvar>;
9806def warn_direct_initialize_call : Warning<
9807 "explicit call to +initialize results in duplicate call to +initialize">,
9808 InGroup<ExplicitInitializeCall>;
9809def warn_direct_super_initialize_call : Warning<
9810 "explicit call to [super initialize] should only be in implementation "
9811 "of +initialize">,
9812 InGroup<ExplicitInitializeCall>;
9813def err_ivar_use_in_class_method : Error<
9814 "instance variable %0 accessed in class method">;
9815def err_private_ivar_access : Error<"instance variable %0 is private">,
9816 AccessControl;
9817def err_protected_ivar_access : Error<"instance variable %0 is protected">,
9818 AccessControl;
9819def warn_maynot_respond : Warning<"%0 may not respond to %1">;
9820def ext_typecheck_base_super : Warning<
9821 "method parameter type "
9822 "%diff{$ does not match super class method parameter type $|"
9823 "does not match super class method parameter type}0,1">,
9824 InGroup<SuperSubClassMismatch>, DefaultIgnore;
9825def warn_missing_method_return_type : Warning<
9826 "method has no return type specified; defaults to 'id'">,
9827 InGroup<MissingMethodReturnType>, DefaultIgnore;
9828def warn_direct_ivar_access : Warning<"instance variable %0 is being "
9829 "directly accessed">, InGroup<DiagGroup<"direct-ivar-access">>, DefaultIgnore;
9830
9831// Spell-checking diagnostics
9832def err_unknown_typename : Error<
9833 "unknown type name %0">;
9834def err_unknown_type_or_class_name_suggest : Error<
9835 "unknown %select{type|class}1 name %0; did you mean %2?">;
9836def err_unknown_typename_suggest : Error<
9837 "unknown type name %0; did you mean %1?">;
9838def err_unknown_nested_typename_suggest : Error<
9839 "no type named %0 in %1; did you mean %select{|simply }2%3?">;
9840def err_no_member_suggest : Error<"no member named %0 in %1; did you mean %select{|simply }2%3?">;
9841def err_undeclared_use_suggest : Error<
9842 "use of undeclared %0; did you mean %1?">;
9843def err_undeclared_var_use_suggest : Error<
9844 "use of undeclared identifier %0; did you mean %1?">;
9845def err_no_template : Error<"no template named %0">;
9846def err_no_template_suggest : Error<"no template named %0; did you mean %1?">;
9847def err_no_member_template : Error<"no template named %0 in %1">;
9848def err_no_member_template_suggest : Error<
9849 "no template named %0 in %1; did you mean %select{|simply }2%3?">;
9850def err_non_template_in_template_id : Error<
9851 "%0 does not name a template but is followed by template arguments">;
9852def err_non_template_in_template_id_suggest : Error<
9853 "%0 does not name a template but is followed by template arguments; "
9854 "did you mean %1?">;
9855def err_non_template_in_member_template_id_suggest : Error<
9856 "member %0 of %1 is not a template; did you mean %select{|simply }2%3?">;
9857def note_non_template_in_template_id_found : Note<
9858 "non-template declaration found by name lookup">;
9859def err_mem_init_not_member_or_class_suggest : Error<
9860 "initializer %0 does not name a non-static data member or base "
9861 "class; did you mean the %select{base class|member}1 %2?">;
9862def err_field_designator_unknown_suggest : Error<
9863 "field designator %0 does not refer to any field in type %1; did you mean "
9864 "%2?">;
9865def err_typecheck_member_reference_ivar_suggest : Error<
9866 "%0 does not have a member named %1; did you mean %2?">;
9867def err_property_not_found_suggest : Error<
9868 "property %0 not found on object of type %1; did you mean %2?">;
9869def err_class_property_found : Error<
9870 "property %0 is a class property; did you mean to access it with class '%1'?">;
9871def err_ivar_access_using_property_syntax_suggest : Error<
9872 "property %0 not found on object of type %1; did you mean to access instance variable %2?">;
9873def warn_property_access_suggest : Warning<
9874"property %0 not found on object of type %1; did you mean to access property %2?">,
9875InGroup<PropertyAccessDotSyntax>;
9876def err_property_found_suggest : Error<
9877 "property %0 found on object of type %1; did you mean to access "
9878 "it with the \".\" operator?">;
9879def err_undef_interface_suggest : Error<
9880 "cannot find interface declaration for %0; did you mean %1?">;
9881def warn_undef_interface_suggest : Warning<
9882 "cannot find interface declaration for %0; did you mean %1?">;
9883def err_undef_superclass_suggest : Error<
9884 "cannot find interface declaration for %0, superclass of %1; did you mean "
9885 "%2?">;
9886def err_undeclared_protocol_suggest : Error<
9887 "cannot find protocol declaration for %0; did you mean %1?">;
9888def note_base_class_specified_here : Note<
9889 "base class %0 specified here">;
9890def err_using_directive_suggest : Error<
9891 "no namespace named %0; did you mean %1?">;
9892def err_using_directive_member_suggest : Error<
9893 "no namespace named %0 in %1; did you mean %select{|simply }2%3?">;
9894def note_namespace_defined_here : Note<"namespace %0 defined here">;
9895def err_sizeof_pack_no_pack_name_suggest : Error<
9896 "%0 does not refer to the name of a parameter pack; did you mean %1?">;
9897def note_parameter_pack_here : Note<"parameter pack %0 declared here">;
9898
9899def err_uncasted_use_of_unknown_any : Error<
9900 "%0 has unknown type; cast it to its declared type to use it">;
9901def err_uncasted_call_of_unknown_any : Error<
9902 "%0 has unknown return type; cast the call to its declared return type">;
9903def err_uncasted_send_to_unknown_any_method : Error<
9904 "no known method %select{%objcinstance1|%objcclass1}0; cast the "
9905 "message send to the method's return type">;
9906def err_unsupported_unknown_any_decl : Error<
9907 "%0 has unknown type, which is not supported for this kind of declaration">;
9908def err_unsupported_unknown_any_expr : Error<
9909 "unsupported expression with unknown type">;
9910def err_unsupported_unknown_any_call : Error<
9911 "call to unsupported expression with unknown type">;
9912def err_unknown_any_addrof : Error<
9913 "the address of a declaration with unknown type "
9914 "can only be cast to a pointer type">;
9915def err_unknown_any_addrof_call : Error<
9916 "address-of operator cannot be applied to a call to a function with "
9917 "unknown return type">;
9918def err_unknown_any_var_function_type : Error<
9919 "variable %0 with unknown type cannot be given a function type">;
9920def err_unknown_any_function : Error<
9921 "function %0 with unknown type must be given a function type">;
9922
9923def err_filter_expression_integral : Error<
9924 "filter expression has non-integral type %0">;
9925
9926def err_non_asm_stmt_in_naked_function : Error<
9927 "non-ASM statement in naked function is not supported">;
9928def err_asm_naked_this_ref : Error<
9929 "'this' pointer references not allowed in naked functions">;
9930def err_asm_naked_parm_ref : Error<
9931 "parameter references not allowed in naked functions">;
9932
9933// OpenCL warnings and errors.
9934def err_invalid_astype_of_different_size : Error<
9935 "invalid reinterpretation: sizes of %0 and %1 must match">;
9936def err_static_kernel : Error<
9937 "kernel functions cannot be declared static">;
9938def err_method_kernel : Error<
9939 "kernel functions cannot be class members">;
9940def err_template_kernel : Error<
9941 "kernel functions cannot be used in a template declaration, instantiation or specialization">;
9942def err_opencl_ptrptr_kernel_param : Error<
9943 "kernel parameter cannot be declared as a pointer to a pointer">;
9944def err_kernel_arg_address_space : Error<
9945 "pointer arguments to kernel functions must reside in '__global', "
9946 "'__constant' or '__local' address space">;
9947def err_opencl_ext_vector_component_invalid_length : Error<
9948 "vector component access has invalid length %0. Supported: 1,2,3,4,8,16.">;
9949def err_opencl_function_variable : Error<
9950 "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">;
9951def err_opencl_addrspace_scope : Error<
9952 "variables in the %0 address space can only be declared in the outermost "
9953 "scope of a kernel function">;
9954def err_static_function_scope : Error<
9955 "variables in function scope cannot be declared static">;
9956def err_opencl_bitfields : Error<
9957 "bit-fields are not supported in OpenCL">;
9958def err_opencl_vla : Error<
9959 "variable length arrays are not supported in OpenCL">;
9960def err_opencl_scalar_type_rank_greater_than_vector_type : Error<
9961 "scalar operand type has greater rank than the type of the vector "
9962 "element. (%0 and %1)">;
9963def err_bad_kernel_param_type : Error<
9964 "%0 cannot be used as the type of a kernel parameter">;
9965def err_opencl_implicit_function_decl : Error<
9966 "implicit declaration of function %0 is invalid in OpenCL">;
9967def err_record_with_pointers_kernel_param : Error<
9968 "%select{struct|union}0 kernel parameters may not contain pointers">;
9969def note_within_field_of_type : Note<
9970 "within field of type %0 declared here">;
9971def note_illegal_field_declared_here : Note<
9972 "field of illegal %select{type|pointer type}0 %1 declared here">;
9973def err_opencl_type_struct_or_union_field : Error<
9974 "the %0 type cannot be used to declare a structure or union field">;
9975def err_event_t_addr_space_qual : Error<
9976 "the event_t type can only be used with __private address space qualifier">;
9977def err_expected_kernel_void_return_type : Error<
9978 "kernel must have void return type">;
9979def err_sampler_initializer_not_integer : Error<
9980 "sampler_t initialization requires 32-bit integer, not %0">;
9981def warn_sampler_initializer_invalid_bits : Warning<
9982 "sampler initializer has invalid %0 bits">, InGroup<SpirCompat>, DefaultIgnore;
9983def err_sampler_argument_required : Error<
9984 "sampler_t variable required - got %0">;
9985def err_wrong_sampler_addressspace: Error<
9986 "sampler type cannot be used with the __local and __global address space qualifiers">;
9987def err_opencl_nonconst_global_sampler : Error<
9988 "global sampler requires a const or constant address space qualifier">;
9989def err_opencl_cast_non_zero_to_event_t : Error<
9990 "cannot cast non-zero value '%0' to 'event_t'">;
9991def err_opencl_global_invalid_addr_space : Error<
9992 "%select{program scope|static local|extern}0 variable must reside in %1 address space">;
9993def err_missing_actual_pipe_type : Error<
9994 "missing actual type specifier for pipe">;
9995def err_reference_pipe_type : Error <
9996 "pipes packet types cannot be of reference type">;
9997def err_opencl_no_main : Error<"%select{function|kernel}0 cannot be called 'main'">;
9998def err_opencl_kernel_attr :
9999 Error<"attribute %0 can only be applied to an OpenCL kernel function">;
10000def err_opencl_return_value_with_address_space : Error<
10001 "return value cannot be qualified with address space">;
10002def err_opencl_constant_no_init : Error<
10003 "variable in constant address space must be initialized">;
10004def err_opencl_atomic_init: Error<
10005 "atomic variable can be %select{assigned|initialized}0 to a variable only "
10006 "in global address space">;
10007def err_opencl_implicit_vector_conversion : Error<
10008 "implicit conversions between vector types (%0 and %1) are not permitted">;
10009def err_opencl_invalid_type_array : Error<
10010 "array of %0 type is invalid in OpenCL">;
10011def err_opencl_ternary_with_block : Error<
10012 "block type cannot be used as expression in ternary expression in OpenCL">;
10013def err_opencl_pointer_to_type : Error<
10014 "pointer to type %0 is invalid in OpenCL">;
10015def err_opencl_type_can_only_be_used_as_function_parameter : Error <
10016 "type %0 can only be used as a function parameter in OpenCL">;
10017def err_opencl_type_not_found : Error<
10018 "%0 type %1 not found; include the base header with -finclude-default-header">;
10019def warn_opencl_attr_deprecated_ignored : Warning <
10020 "%0 attribute is deprecated and ignored in OpenCL version %1">,
10021 InGroup<IgnoredAttributes>;
10022def err_opencl_variadic_function : Error<
10023 "invalid prototype, variadic arguments are not allowed in OpenCL">;
10024def err_opencl_requires_extension : Error<
10025 "use of %select{type|declaration}0 %1 requires %2 support">;
10026def warn_opencl_generic_address_space_arg : Warning<
10027 "passing non-generic address space pointer to %0"
10028 " may cause dynamic conversion affecting performance">,
10029 InGroup<Conversion>, DefaultIgnore;
10030
10031// OpenCL v2.0 s6.13.6 -- Builtin Pipe Functions
10032def err_opencl_builtin_pipe_first_arg : Error<
10033 "first argument to %0 must be a pipe type">;
10034def err_opencl_builtin_pipe_arg_num : Error<
10035 "invalid number of arguments to function: %0">;
10036def err_opencl_builtin_pipe_invalid_arg : Error<
10037 "invalid argument type to function %0 (expecting %1 having %2)">;
10038def err_opencl_builtin_pipe_invalid_access_modifier : Error<
10039 "invalid pipe access modifier (expecting %0)">;
10040
10041// OpenCL access qualifier
10042def err_opencl_invalid_access_qualifier : Error<
10043 "access qualifier can only be used for pipe and image type">;
10044def err_opencl_invalid_read_write : Error<
10045 "access qualifier %0 can not be used for %1 %select{|prior to OpenCL version 2.0}2">;
10046def err_opencl_multiple_access_qualifiers : Error<
10047 "multiple access qualifiers">;
10048def note_opencl_typedef_access_qualifier : Note<
10049 "previously declared '%0' here">;
10050
10051// OpenCL v2.0 s6.12.5 Blocks restrictions
10052def err_opencl_block_storage_type : Error<
10053 "the __block storage type is not permitted">;
10054def err_opencl_invalid_block_declaration : Error<
10055 "invalid block variable declaration - must be %select{const qualified|initialized}0">;
10056def err_opencl_extern_block_declaration : Error<
10057 "invalid block variable declaration - using 'extern' storage class is disallowed">;
10058def err_opencl_block_ref_block : Error<
10059 "cannot refer to a block inside block">;
10060
10061// OpenCL v2.0 s6.13.9 - Address space qualifier functions.
10062def err_opencl_builtin_to_addr_invalid_arg : Error<
10063 "invalid argument %0 to function: %1, expecting a generic pointer argument">;
10064
10065// OpenCL v2.0 s6.13.17 Enqueue kernel restrictions.
10066def err_opencl_enqueue_kernel_incorrect_args : Error<
10067 "illegal call to enqueue_kernel, incorrect argument types">;
10068def err_opencl_enqueue_kernel_local_size_args : Error<
10069 "mismatch in number of block parameters and local size arguments passed">;
10070def err_opencl_enqueue_kernel_invalid_local_size_type : Error<
10071 "illegal call to enqueue_kernel, parameter needs to be specified as integer type">;
10072def err_opencl_enqueue_kernel_blocks_non_local_void_args : Error<
10073 "blocks used in enqueue_kernel call are expected to have parameters of type 'local void*'">;
10074def err_opencl_enqueue_kernel_blocks_no_args : Error<
10075 "blocks with parameters are not accepted in this prototype of enqueue_kernel call">;
10076
10077def err_opencl_builtin_expected_type : Error<
10078 "illegal call to %0, expected %1 argument type">;
10079
10080// OpenCL v3.0 s6.3.7 - Vector Components
10081def ext_opencl_ext_vector_type_rgba_selector: ExtWarn<
10082 "vector component name '%0' is an OpenCL C version 3.0 feature">,
10083 InGroup<OpenCLUnsupportedRGBA>;
10084
10085def err_openclcxx_placement_new : Error<
10086 "use of placement new requires explicit declaration">;
10087
10088// MIG routine annotations.
10089def warn_mig_server_routine_does_not_return_kern_return_t : Warning<
10090 "'mig_server_routine' attribute only applies to routines that return a kern_return_t">,
10091 InGroup<IgnoredAttributes>;
10092} // end of sema category
10093
10094let CategoryName = "OpenMP Issue" in {
10095// OpenMP support.
10096def err_omp_expected_var_arg : Error<
10097 "%0 is not a global variable, static local variable or static data member">;
10098def err_omp_expected_var_arg_suggest : Error<
10099 "%0 is not a global variable, static local variable or static data member; "
10100 "did you mean %1">;
10101def err_omp_global_var_arg : Error<
10102 "arguments of '#pragma omp %0' must have %select{global storage|static storage duration}1">;
10103def err_omp_ref_type_arg : Error<
10104 "arguments of '#pragma omp %0' cannot be of reference type %1">;
10105def err_omp_region_not_file_context : Error<
10106 "directive must be at file or namespace scope">;
10107def err_omp_var_scope : Error<
10108 "'#pragma omp %0' must appear in the scope of the %q1 variable declaration">;
10109def err_omp_var_used : Error<
10110 "'#pragma omp %0' must precede all references to variable %q1">;
10111def err_omp_var_thread_local : Error<
10112 "variable %0 cannot be threadprivate because it is %select{thread-local|a global named register variable}1">;
10113def err_omp_private_incomplete_type : Error<
10114 "a private variable with incomplete type %0">;
10115def err_omp_firstprivate_incomplete_type : Error<
10116 "a firstprivate variable with incomplete type %0">;
10117def err_omp_lastprivate_incomplete_type : Error<
10118 "a lastprivate variable with incomplete type %0">;
10119def err_omp_reduction_incomplete_type : Error<
10120 "a reduction list item with incomplete type %0">;
10121def err_omp_unexpected_clause_value : Error<
10122 "expected %0 in OpenMP clause '%1'">;
10123def err_omp_expected_var_name_member_expr : Error<
10124 "expected variable name%select{| or data member of current class}0">;
10125def err_omp_expected_var_name_member_expr_or_array_item : Error<
10126 "expected variable name%select{|, data member of current class}0, array element or array section">;
10127def err_omp_expected_addressable_lvalue_or_array_item : Error<
10128 "expected addressable lvalue expression, array element%select{ or array section|, array section or array shaping expression}0%select{| of non 'omp_depend_t' type}1">;
10129def err_omp_expected_named_var_member_or_array_expression: Error<
10130 "expected expression containing only member accesses and/or array sections based on named variables">;
10131def err_omp_bit_fields_forbidden_in_clause : Error<
10132 "bit fields cannot be used to specify storage in a '%0' clause">;
10133def err_array_section_does_not_specify_contiguous_storage : Error<
10134 "array section does not specify contiguous storage">;
10135def err_array_section_does_not_specify_length : Error<
10136 "array section does not specify length for outermost dimension">;
10137def err_omp_union_type_not_allowed : Error<
10138 "mapping of union members is not allowed">;
10139def err_omp_expected_access_to_data_field : Error<
10140 "expected access to data field">;
10141def err_omp_multiple_array_items_in_map_clause : Error<
10142 "multiple array elements associated with the same variable are not allowed in map clauses of the same construct">;
10143def err_omp_duplicate_map_type_modifier : Error<
10144 "same map type modifier has been specified more than once">;
10145def err_omp_duplicate_motion_modifier : Error<
10146 "same motion modifier has been specified more than once">;
10147def err_omp_pointer_mapped_along_with_derived_section : Error<
10148 "pointer cannot be mapped along with a section derived from itself">;
10149def err_omp_original_storage_is_shared_and_does_not_contain : Error<
10150 "original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage">;
10151def err_omp_same_pointer_dereferenced : Error<
10152 "same pointer dereferenced in multiple different ways in map clause expressions">;
10153def note_omp_task_predetermined_firstprivate_here : Note<
10154 "predetermined as a firstprivate in a task construct here">;
10155def err_omp_threadprivate_incomplete_type : Error<
10156 "threadprivate variable with incomplete type %0">;
10157def err_omp_no_dsa_for_variable : Error<
10158 "variable %0 must have explicitly specified data sharing attributes">;
10159def err_omp_defaultmap_no_attr_for_variable : Error<
10160 "variable %0 must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause">;
10161def note_omp_default_dsa_none : Note<
10162 "explicit data sharing attribute requested here">;
10163def note_omp_defaultmap_attr_none : Note<
10164 "explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here">;
10165def err_omp_wrong_dsa : Error<
10166 "%0 variable cannot be %1">;
10167def err_omp_variably_modified_type_not_supported : Error<
10168 "arguments of OpenMP clause '%0' in '#pragma omp %2' directive cannot be of variably-modified type %1">;
10169def note_omp_explicit_dsa : Note<
10170 "defined as %0">;
10171def note_omp_predetermined_dsa : Note<
10172 "%select{static data member is predetermined as shared|"
10173 "variable with static storage duration is predetermined as shared|"
10174 "loop iteration variable is predetermined as private|"
10175 "loop iteration variable is predetermined as linear|"
10176 "loop iteration variable is predetermined as lastprivate|"
10177 "constant variable is predetermined as shared|"
10178 "global variable is predetermined as shared|"
10179 "non-shared variable in a task construct is predetermined as firstprivate|"
10180 "variable with automatic storage duration is predetermined as private}0"
10181 "%select{|; perhaps you forget to enclose 'omp %2' directive into a parallel or another task region?}1">;
10182def note_omp_implicit_dsa : Note<
10183 "implicitly determined as %0">;
10184def err_omp_loop_var_dsa : Error<
10185 "loop iteration variable in the associated loop of 'omp %1' directive may not be %0, predetermined as %2">;
10186def err_omp_not_for : Error<
10187 "%select{statement after '#pragma omp %1' must be a for loop|"
10188 "expected %2 for loops after '#pragma omp %1'%select{|, but found only %4}3}0">;
10189def note_omp_collapse_ordered_expr : Note<
10190 "as specified in %select{'collapse'|'ordered'|'collapse' and 'ordered'}0 clause%select{||s}0">;
10191def err_omp_negative_expression_in_clause : Error<
10192 "argument to '%0' clause must be a %select{non-negative|strictly positive}1 integer value">;
10193def err_omp_not_integral : Error<
10194 "expression must have integral or unscoped enumeration "
10195 "type, not %0">;
10196def err_omp_threadprivate_in_target : Error<
10197 "threadprivate variables cannot be used in target constructs">;
10198def err_omp_incomplete_type : Error<
10199 "expression has incomplete class type %0">;
10200def err_omp_explicit_conversion : Error<
10201 "expression requires explicit conversion from %0 to %1">;
10202def note_omp_conversion_here : Note<
10203 "conversion to %select{integral|enumeration}0 type %1 declared here">;
10204def err_omp_ambiguous_conversion : Error<
10205 "ambiguous conversion from type %0 to an integral or unscoped "
10206 "enumeration type">;
10207def err_omp_iterator_not_integral_or_pointer : Error<
10208 "expected integral or pointer type as the iterator-type, not %0">;
10209def err_omp_iterator_step_not_integral : Error<
10210 "iterator step expression %0 is not the integral expression">;
10211def err_omp_iterator_step_constant_zero : Error<
10212 "iterator step expression %0 evaluates to 0">;
10213def err_omp_required_access : Error<
10214 "%0 variable must be %1">;
10215def err_omp_const_variable : Error<
10216 "const-qualified variable cannot be %0">;
10217def err_omp_const_not_mutable_variable : Error<
10218 "const-qualified variable without mutable fields cannot be %0">;
10219def err_omp_const_list_item : Error<
10220 "const-qualified list item cannot be %0">;
10221def err_omp_linear_incomplete_type : Error<
10222 "a linear variable with incomplete type %0">;
10223def err_omp_linear_expected_int_or_ptr : Error<
10224 "argument of a linear clause should be of integral or pointer "
10225 "type, not %0">;
10226def warn_omp_linear_step_zero : Warning<
10227 "zero linear step (%0 %select{|and other variables in clause }1should probably be const)">,
10228 InGroup<OpenMPClauses>;
10229def warn_omp_alignment_not_power_of_two : Warning<
10230 "aligned clause will be ignored because the requested alignment is not a power of 2">,
10231 InGroup<OpenMPClauses>;
10232def err_omp_invalid_target_decl : Error<
10233 "%0 used in declare target directive is not a variable or a function name">;
10234def err_omp_declare_target_to_and_link : Error<
10235 "%0 must not appear in both clauses 'to' and 'link'">;
10236def warn_omp_not_in_target_context : Warning<
10237 "declaration is not declared in any declare target region">,
10238 InGroup<OpenMPTarget>;
10239def err_omp_function_in_link_clause : Error<
10240 "function name is not allowed in 'link' clause">;
10241def err_omp_aligned_expected_array_or_ptr : Error<
10242 "argument of aligned clause should be array"
10243 "%select{ or pointer|, pointer, reference to array or reference to pointer}1"
10244 ", not %0">;
10245def err_omp_used_in_clause_twice : Error<
10246 "%select{a variable|a parameter|'this'}0 cannot appear in more than one %1 clause">;
10247def err_omp_local_var_in_threadprivate_init : Error<
10248 "variable with local storage in initial value of threadprivate variable">;
10249def err_omp_loop_not_canonical_init : Error<
10250 "initialization clause of OpenMP for loop is not in canonical form "
10251 "('var = init' or 'T var = init')">;
10252def ext_omp_loop_not_canonical_init : ExtWarn<
10253 "initialization clause of OpenMP for loop is not in canonical form "
10254 "('var = init' or 'T var = init')">, InGroup<OpenMPLoopForm>;
10255def err_omp_loop_not_canonical_cond : Error<
10256 "condition of OpenMP for loop must be a relational comparison "
10257 "('<', '<=', '>', %select{or '>='|'>=', or '!='}0) of loop variable %1">;
10258def err_omp_loop_not_canonical_incr : Error<
10259 "increment clause of OpenMP for loop must perform simple addition "
10260 "or subtraction on loop variable %0">;
10261def err_omp_loop_variable_type : Error<
10262 "variable must be of integer or %select{pointer|random access iterator}0 type">;
10263def err_omp_loop_incr_not_compatible : Error<
10264 "increment expression must cause %0 to %select{decrease|increase}1 "
10265 "on each iteration of OpenMP for loop">;
10266def note_omp_loop_cond_requres_compatible_incr : Note<
10267 "loop step is expected to be %select{negative|positive}0 due to this condition">;
10268def err_omp_loop_diff_cxx : Error<
10269 "could not calculate number of iterations calling 'operator-' with "
10270 "upper and lower loop bounds">;
10271def err_omp_loop_cannot_use_stmt : Error<
10272 "'%0' statement cannot be used in OpenMP for loop">;
10273def err_omp_simd_region_cannot_use_stmt : Error<
10274 "'%0' statement cannot be used in OpenMP simd region">;
10275def warn_omp_loop_64_bit_var : Warning<
10276 "OpenMP loop iteration variable cannot have more than 64 bits size and will be narrowed">,
10277 InGroup<OpenMPLoopForm>;
10278def err_omp_unknown_reduction_identifier : Error<
10279 "incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', "
10280 "'&&', '||', 'min' or 'max' or declare reduction for type %0">;
10281def err_omp_not_resolved_reduction_identifier : Error<
10282 "unable to resolve declare reduction construct for type %0">;
10283def err_omp_reduction_ref_type_arg : Error<
10284 "argument of OpenMP clause '%0' must reference the same object in all threads">;
10285def err_omp_clause_not_arithmetic_type_arg : Error<
10286 "arguments of OpenMP clause '%0' for 'min' or 'max' must be of %select{scalar|arithmetic}1 type">;
10287def err_omp_clause_floating_type_arg : Error<
10288 "arguments of OpenMP clause '%0' with bitwise operators cannot be of floating type">;
10289def err_omp_once_referenced : Error<
10290 "variable can appear only once in OpenMP '%0' clause">;
10291def err_omp_once_referenced_in_target_update : Error<
10292 "variable can appear only once in OpenMP 'target update' construct">;
10293def note_omp_referenced : Note<
10294 "previously referenced here">;
10295def err_omp_reduction_in_task : Error<
10296 "reduction variables may not be accessed in an explicit task">;
10297def err_omp_reduction_id_not_compatible : Error<
10298 "list item of type %0 is not valid for specified reduction operation: unable to provide default initialization value">;
10299def err_omp_reduction_identifier_mismatch : Error<
10300 "in_reduction variable must have the same reduction operation as in a task_reduction clause">;
10301def note_omp_previous_reduction_identifier : Note<
10302 "previously marked as task_reduction with different reduction operation">;
10303def err_omp_prohibited_region : Error<
10304 "region cannot be%select{| closely}0 nested inside '%1' region"
10305 "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
10306 "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
10307 "; perhaps you forget to enclose 'omp %3' directive into a target region?|"
10308 "; perhaps you forget to enclose 'omp %3' directive into a teams region?|"
10309 "; perhaps you forget to enclose 'omp %3' directive into a for, simd, for simd, parallel for, or parallel for simd region?}2">;
10310def err_omp_prohibited_region_simd : Error<
10311 "OpenMP constructs may not be nested inside a simd region%select{| except for ordered simd, simd, scan, or atomic directive}0">;
10312def err_omp_prohibited_region_atomic : Error<
10313 "OpenMP constructs may not be nested inside an atomic region">;
10314def err_omp_prohibited_region_critical_same_name : Error<
10315 "cannot nest 'critical' regions having the same name %0">;
10316def note_omp_previous_critical_region : Note<
10317 "previous 'critical' region starts here">;
10318def err_omp_several_directives_in_region : Error<
10319 "exactly one '%0' directive must appear in the loop body of an enclosing directive">;
10320def note_omp_previous_directive : Note<
10321 "previous '%0' directive used here">;
10322def err_omp_sections_not_compound_stmt : Error<
10323 "the statement for '#pragma omp sections' must be a compound statement">;
10324def err_omp_parallel_sections_not_compound_stmt : Error<
10325 "the statement for '#pragma omp parallel sections' must be a compound statement">;
10326def err_omp_orphaned_section_directive : Error<
10327 "%select{orphaned 'omp section' directives are prohibited, it|'omp section' directive}0"
10328 " must be closely nested to a sections region%select{|, not a %1 region}0">;
10329def err_omp_sections_substmt_not_section : Error<
10330 "statement in 'omp sections' directive must be enclosed into a section region">;
10331def err_omp_parallel_sections_substmt_not_section : Error<
10332 "statement in 'omp parallel sections' directive must be enclosed into a section region">;
10333def err_omp_parallel_reduction_in_task_firstprivate : Error<
10334 "argument of a reduction clause of a %0 construct must not appear in a firstprivate clause on a task construct">;
10335def err_omp_atomic_read_not_expression_statement : Error<
10336 "the statement for 'atomic read' must be an expression statement of form 'v = x;',"
10337 " where v and x are both lvalue expressions with scalar type">;
10338def note_omp_atomic_read_write: Note<
10339 "%select{expected an expression statement|expected built-in assignment operator|expected expression of scalar type|expected lvalue expression}0">;
10340def err_omp_atomic_write_not_expression_statement : Error<
10341 "the statement for 'atomic write' must be an expression statement of form 'x = expr;',"
10342 " where x is a lvalue expression with scalar type">;
10343def err_omp_atomic_update_not_expression_statement : Error<
10344 "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',"
10345 " where x is an lvalue expression with scalar type">;
10346def err_omp_atomic_not_expression_statement : Error<
10347 "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',"
10348 " where x is an lvalue expression with scalar type">;
10349def note_omp_atomic_update: Note<
10350 "%select{expected an expression statement|expected built-in binary or unary operator|expected unary decrement/increment operation|"
10351 "expected expression of scalar type|expected assignment expression|expected built-in binary operator|"
10352 "expected one of '+', '*', '-', '/', '&', '^', '%|', '<<', or '>>' built-in operations|expected in right hand side of expression}0">;
10353def err_omp_atomic_capture_not_expression_statement : Error<
10354 "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',"
10355 " where x and v are both lvalue expressions with scalar type">;
10356def err_omp_atomic_capture_not_compound_statement : Error<
10357 "the statement for 'atomic capture' must be a compound statement of form '{v = x; x binop= expr;}', '{x binop= expr; v = x;}',"
10358 " '{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;}',"
10359 " '{v = x; x++;}', '{v = x; ++x;}', '{++x; v = x;}', '{x++; v = x;}', '{v = x; x--;}', '{v = x; --x;}', '{--x; v = x;}', '{x--; v = x;}'"
10360 " where x is an lvalue expression with scalar type">;
10361def note_omp_atomic_capture: Note<
10362 "%select{expected assignment expression|expected compound statement|expected exactly two expression statements|expected in right hand side of the first expression}0">;
10363def err_omp_atomic_several_clauses : Error<
10364 "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
10365def err_omp_several_mem_order_clauses : Error<
10366 "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', 'relaxed', |}1'acq_rel', 'acquire' or 'release' clause">;
10367def err_omp_atomic_incompatible_mem_order_clause : Error<
10368 "directive '#pragma omp atomic%select{ %0|}1' cannot be used with '%2' clause">;
10369def note_omp_previous_mem_order_clause : Note<
10370 "'%0' clause used here">;
10371def err_omp_target_contains_not_only_teams : Error<
10372 "target construct with nested teams region contains statements outside of the teams construct">;
10373def note_omp_nested_teams_construct_here : Note<
10374 "nested teams construct here">;
10375def note_omp_nested_statement_here : Note<
10376 "%select{statement|directive}0 outside teams construct here">;
10377def err_omp_single_copyprivate_with_nowait : Error<
10378 "the 'copyprivate' clause must not be used with the 'nowait' clause">;
10379def note_omp_nowait_clause_here : Note<
10380 "'nowait' clause is here">;
10381def err_omp_single_decl_in_declare_simd_variant : Error<
10382 "single declaration is expected after 'declare %select{simd|variant}0' directive">;
10383def err_omp_function_expected : Error<
10384 "'#pragma omp declare %select{simd|variant}0' can only be applied to functions">;
10385def err_omp_wrong_cancel_region : Error<
10386 "one of 'for', 'parallel', 'sections' or 'taskgroup' is expected">;
10387def err_omp_parent_cancel_region_nowait : Error<
10388 "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be nowait">;
10389def err_omp_parent_cancel_region_ordered : Error<
10390 "parent region for 'omp %select{cancellation point|cancel}0' construct cannot be ordered">;
10391def 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">;
10392def 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">;
10393def err_omp_declare_reduction_redefinition : Error<"redefinition of user-defined reduction for type %0">;
10394def err_omp_mapper_wrong_type : Error<
10395 "mapper type must be of struct, union or class type">;
10396def err_omp_declare_mapper_wrong_var : Error<
10397 "only variable %0 is allowed in map clauses of this 'omp declare mapper' directive">;
10398def err_omp_declare_mapper_redefinition : Error<
10399 "redefinition of user-defined mapper for type %0 with name %1">;
10400def err_omp_invalid_mapper: Error<
10401 "cannot find a valid user-defined mapper for type %0 with name %1">;
10402def err_omp_array_section_use : Error<"OpenMP array section is not allowed here">;
10403def err_omp_array_shaping_use : Error<"OpenMP array shaping operation is not allowed here">;
10404def err_omp_iterator_use : Error<"OpenMP iterator is not allowed here">;
10405def err_omp_typecheck_section_value : Error<
10406 "subscripted value is not an array or pointer">;
10407def err_omp_typecheck_section_not_integer : Error<
10408 "array section %select{lower bound|length}0 is not an integer">;
10409def err_omp_typecheck_shaping_not_integer : Error<
10410 "array shaping operation dimension is not an integer">;
10411def err_omp_shaping_dimension_not_positive : Error<
10412 "array shaping dimension is evaluated to a non-positive value %0">;
10413def err_omp_section_function_type : Error<
10414 "section of pointer to function type %0">;
10415def warn_omp_section_is_char : Warning<"array section %select{lower bound|length}0 is of type 'char'">,
10416 InGroup<CharSubscript>, DefaultIgnore;
10417def err_omp_section_incomplete_type : Error<
10418 "section of pointer to incomplete type %0">;
10419def err_omp_section_not_subset_of_array : Error<
10420 "array section must be a subset of the original array">;
10421def err_omp_section_length_negative : Error<
10422 "section length is evaluated to a negative value %0">;
10423def err_omp_section_stride_non_positive : Error<
10424 "section stride is evaluated to a non-positive value %0">;
10425def err_omp_section_length_undefined : Error<
10426 "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">;
10427def err_omp_wrong_linear_modifier : Error<
10428 "expected %select{'val' modifier|one of 'ref', val' or 'uval' modifiers}0">;
10429def err_omp_wrong_linear_modifier_non_reference : Error<
10430 "variable of non-reference type %0 can be used only with 'val' modifier, but used with '%1'">;
10431def err_omp_wrong_simdlen_safelen_values : Error<
10432 "the value of 'simdlen' parameter must be less than or equal to the value of the 'safelen' parameter">;
10433def err_omp_wrong_if_directive_name_modifier : Error<
10434 "directive name modifier '%0' is not allowed for '#pragma omp %1'">;
10435def err_omp_no_more_if_clause : Error<
10436 "no more 'if' clause is allowed">;
10437def err_omp_unnamed_if_clause : Error<
10438 "expected%select{| one of}0 %1 directive name modifier%select{|s}0">;
10439def note_omp_previous_named_if_clause : Note<
10440 "previous clause with directive name modifier specified here">;
10441def err_omp_ordered_directive_with_param : Error<
10442 "'ordered' directive %select{without any clauses|with 'threads' clause}0 cannot be closely nested inside ordered region with specified parameter">;
10443def err_omp_ordered_directive_without_param : Error<
10444 "'ordered' directive with 'depend' clause cannot be closely nested inside ordered region without specified parameter">;
10445def note_omp_ordered_param : Note<
10446 "'ordered' clause%select{| with specified parameter}0">;
10447def err_omp_expected_base_var_name : Error<
10448 "expected variable name as a base of the array %select{subscript|section}0">;
10449def err_omp_map_shared_storage : Error<
10450 "variable already marked as mapped in current construct">;
10451def err_omp_invalid_map_type_for_directive : Error<
10452 "%select{map type '%1' is not allowed|map type must be specified}0 for '#pragma omp %2'">;
10453def err_omp_no_clause_for_directive : Error<
10454 "expected at least one %0 clause for '#pragma omp %1'">;
10455def err_omp_threadprivate_in_clause : Error<
10456 "threadprivate variables are not allowed in '%0' clause">;
10457def err_omp_wrong_ordered_loop_count : Error<
10458 "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
10459def note_collapse_loop_count : Note<
10460 "parameter of the 'collapse' clause">;
10461def err_omp_clauses_mutually_exclusive : Error<
10462 "'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
10463def note_omp_previous_clause : Note<
10464 "'%0' clause is specified here">;
10465def err_omp_hint_clause_no_name : Error<
10466 "the name of the construct must be specified in presence of 'hint' clause">;
10467def err_omp_critical_with_hint : Error<
10468 "constructs with the same name must have a 'hint' clause with the same value">;
10469def note_omp_critical_hint_here : Note<
10470 "%select{|previous }0'hint' clause with value '%1'">;
10471def note_omp_critical_no_hint : Note<
10472 "%select{|previous }0directive with no 'hint' clause specified">;
10473def err_omp_depend_clause_thread_simd : Error<
10474 "'depend' clauses cannot be mixed with '%0' clause">;
10475def err_omp_depend_sink_expected_loop_iteration : Error<
10476 "expected%select{| %1}0 loop iteration variable">;
10477def err_omp_depend_sink_unexpected_expr : Error<
10478 "unexpected expression: number of expressions is larger than the number of associated loops">;
10479def err_omp_depend_sink_expected_plus_minus : Error<
10480 "expected '+' or '-' operation">;
10481def err_omp_depend_sink_source_not_allowed : Error<
10482 "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">;
10483def err_omp_depend_zero_length_array_section_not_allowed : Error<
10484 "zero-length array section is not allowed in 'depend' clause">;
10485def err_omp_depend_sink_source_with_modifier : Error<
10486 "depend modifier cannot be used with 'sink' or 'source' depend type">;
10487def err_omp_depend_modifier_not_iterator : Error<
10488 "expected iterator specification as depend modifier">;
10489def err_omp_linear_ordered : Error<
10490 "'linear' clause cannot be specified along with 'ordered' clause with a parameter">;
10491def err_omp_unexpected_schedule_modifier : Error<
10492 "modifier '%0' cannot be used along with modifier '%1'">;
10493def err_omp_schedule_nonmonotonic_static : Error<
10494 "'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind">;
10495def err_omp_simple_clause_incompatible_with_ordered : Error<
10496 "'%0' clause with '%1' modifier cannot be specified if an 'ordered' clause is specified">;
10497def err_omp_ordered_simd : Error<
10498 "'ordered' clause with a parameter can not be specified in '#pragma omp %0' directive">;
10499def err_omp_variable_in_given_clause_and_dsa : Error<
10500 "%0 variable cannot be in a %1 clause in '#pragma omp %2' directive">;
10501def err_omp_param_or_this_in_clause : Error<
10502 "expected reference to one of the parameters of function %0%select{| or 'this'}1">;
10503def err_omp_expected_uniform_param : Error<
10504 "expected a reference to a parameter specified in a 'uniform' clause">;
10505def err_omp_expected_int_param : Error<
10506 "expected a reference to an integer-typed parameter">;
10507def err_omp_at_least_one_motion_clause_required : Error<
10508 "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">;
10509def err_omp_usedeviceptr_not_a_pointer : Error<
10510 "expected pointer or reference to pointer in 'use_device_ptr' clause">;
10511def err_omp_argument_type_isdeviceptr : Error <
10512 "expected pointer, array, reference to pointer, or reference to array in 'is_device_ptr clause'">;
10513def warn_omp_nesting_simd : Warning<
10514 "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">,
10515 InGroup<SourceUsesOpenMP>;
10516def err_omp_orphaned_device_directive : Error<
10517 "orphaned 'omp %0' directives are prohibited"
10518 "; perhaps you forget to enclose the directive into a "
10519 "%select{|||target |teams|for, simd, for simd, parallel for, or parallel for simd }1region?">;
10520def err_omp_reduction_non_addressable_expression : Error<
10521 "expected addressable reduction item for the task-based directives">;
10522def err_omp_reduction_with_nogroup : Error<
10523 "'reduction' clause cannot be used with 'nogroup' clause">;
10524def err_omp_reduction_vla_unsupported : Error<
10525 "cannot generate code for reduction on %select{|array section, which requires a }0variable length array">;
10526def err_omp_linear_distribute_var_non_loop_iteration : Error<
10527 "only loop iteration variables are allowed in 'linear' clause in distribute directives">;
10528def warn_omp_non_trivial_type_mapped : Warning<
10529 "Type %0 is not trivially copyable and not guaranteed to be mapped correctly">,
10530 InGroup<OpenMPMapping>;
10531def err_omp_requires_clause_redeclaration : Error <
10532 "Only one %0 clause can appear on a requires directive in a single translation unit">;
10533def note_omp_requires_previous_clause : Note <
10534 "%0 clause previously used here">;
10535def err_omp_directive_before_requires : Error <
10536 "'%0' region encountered before requires directive with '%1' clause">;
10537def note_omp_requires_encountered_directive : Note <
10538 "'%0' previously encountered here">;
10539def err_omp_invalid_scope : Error <
10540 "'#pragma omp %0' directive must appear only in file scope">;
10541def note_omp_invalid_length_on_this_ptr_mapping : Note <
10542 "expected length on mapping of 'this' array section expression to be '1'">;
10543def note_omp_invalid_lower_bound_on_this_ptr_mapping : Note <
10544 "expected lower bound on mapping of 'this' array section expression to be '0' or not specified">;
10545def note_omp_invalid_subscript_on_this_ptr_map : Note <
10546 "expected 'this' subscript expression on map clause to be 'this[0]'">;
10547def err_omp_invalid_map_this_expr : Error <
10548 "invalid 'this' expression on 'map' clause">;
10549def err_omp_implied_type_not_found : Error<
10550 "'%0' type not found; include <omp.h>">;
10551def err_omp_expected_omp_depend_t_lvalue : Error<
10552 "expected lvalue expression%select{ of 'omp_depend_t' type, not %1|}0">;
10553def err_omp_depobj_expected : Error<
10554 "expected depobj expression">;
10555def err_omp_depobj_single_clause_expected : Error<
10556 "exactly one of 'depend', 'destroy', or 'update' clauses is expected">;
10557def err_omp_scan_single_clause_expected : Error<
10558 "exactly one of 'inclusive' or 'exclusive' clauses is expected">;
10559def err_omp_inclusive_exclusive_not_reduction : Error<
10560 "the list item must appear in 'reduction' clause with the 'inscan' modifier "
10561 "of the parent directive">;
10562def err_omp_reduction_not_inclusive_exclusive : Error<
10563 "the inscan reduction list item must appear as a list item in an 'inclusive' or"
10564 " 'exclusive' clause on an inner 'omp scan' directive">;
10565def err_omp_wrong_inscan_reduction : Error<
10566 "'inscan' modifier can be used only in 'omp for',