1 //==--- DiagnosticASTKinds.td - libast diagnostics ------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 let Component = "AST" in {
11 // Constant expression diagnostics. These (and their users) belong in Sema.
12 def note_expr_divide_by_zero : Note<"division by zero">;
13 def note_constexpr_invalid_cast : Note<
14 "%select{reinterpret_cast|dynamic_cast|%select{this conversion|cast that"
15 " performs the conversions of a reinterpret_cast}1|cast from %1}0"
16 " is not allowed in a constant expression"
17 "%select{| in C++ standards before C++20||}0">;
18 def note_constexpr_invalid_void_star_cast : Note<
19 "cast from %0 is not allowed in a constant expression "
20 "%select{in C++ standards before C++2c|because the pointed object "
21 "type %2 is not similar to the target type %3}1">;
22 def note_constexpr_invalid_downcast : Note<
23 "cannot cast object of dynamic type %0 to type %1">;
24 def note_constexpr_overflow : Note<
25 "value %0 is outside the range of representable values of type %1">;
26 def note_constexpr_negative_shift : Note<"negative shift count %0">;
27 def note_constexpr_large_shift : Note<
28 "shift count %0 >= width of type %1 (%2 bit%s2)">;
29 def note_constexpr_lshift_of_negative : Note<"left shift of negative value %0">;
30 def note_constexpr_lshift_discards : Note<"signed left shift discards bits">;
31 def note_constexpr_invalid_function : Note<
32 "%select{non-constexpr|undefined}0 %select{function|constructor}1 %2 cannot "
33 "be used in a constant expression">;
34 def note_constexpr_invalid_inhctor : Note<
35 "constructor inherited from base class %0 cannot be used in a "
36 "constant expression; derived class cannot be implicitly initialized">;
37 def note_constexpr_no_return : Note<
38 "control reached end of constexpr function">;
39 def note_constexpr_virtual_call : Note<
40 "cannot evaluate call to virtual function in a constant expression "
41 "in C++ standards before C++20">;
42 def note_constexpr_pure_virtual_call : Note<
43 "pure virtual function %q0 called">;
44 def note_constexpr_polymorphic_unknown_dynamic_type : Note<
45 "%select{|||||virtual function called on|dynamic_cast applied to|"
46 "typeid applied to|construction of|destruction of}0 object '%1' "
47 "whose dynamic type is not constant">;
48 def note_constexpr_dynamic_cast_to_reference_failed : Note<
49 "reference dynamic_cast failed: %select{"
50 "static type %1 of operand is a non-public base class of dynamic type %2|"
51 "dynamic type %2 of operand does not have a base class of type %3|"
52 "%3 is an ambiguous base class of dynamic type %2 of operand|"
53 "%3 is a non-public base class of dynamic type %2 of operand}0">;
54 def note_constexpr_virtual_base : Note<
55 "cannot construct object of type %0 with virtual base class "
56 "in a constant expression">;
57 def note_constexpr_nonliteral : Note<
58 "non-literal type %0 cannot be used in a constant expression">;
59 def note_constexpr_non_global : Note<
60 "%select{pointer|reference}0 to %select{|subobject of }1"
61 "%select{temporary|%3}2 is not a constant expression">;
62 def note_constexpr_not_static : Note<
63 "address of non-static constexpr variable %0 may differ on each invocation "
64 "of the enclosing function; add 'static' to give it a constant address">;
65 def note_constexpr_dynamic_alloc : Note<
66 "%select{pointer|reference}0 to %select{|subobject of }1"
67 "heap-allocated object is not a constant expression">;
68 def note_consteval_address_accessible : Note<
69 "%select{pointer|reference}0 to a consteval declaration "
70 "is not a constant expression">;
71 def note_constexpr_uninitialized : Note<
72 "subobject %0 is not initialized">;
73 def note_constexpr_uninitialized_base : Note<
74 "constructor of base class %0 is not called">;
75 def note_constexpr_static_local : Note<
76 "control flows through the definition of a %select{static|thread_local}0 variable">;
77 def note_constexpr_subobject_declared_here : Note<
78 "subobject declared here">;
79 def note_constexpr_array_index : Note<"cannot refer to element %0 of "
80 "%select{array of %2 element%plural{1:|:s}2|non-array object}1 "
81 "in a constant expression">;
82 def note_constexpr_float_arithmetic : Note<
83 "floating point arithmetic produces %select{an infinity|a NaN}0">;
84 def note_constexpr_dynamic_rounding : Note<
85 "cannot evaluate this expression if rounding mode is dynamic">;
86 def note_constexpr_float_arithmetic_strict : Note<
87 "compile time floating point arithmetic suppressed in strict evaluation modes">;
88 def note_constexpr_pointer_subtraction_not_same_array : Note<
89 "subtracted pointers are not elements of the same array">;
90 def note_constexpr_pointer_subtraction_zero_size : Note<
91 "subtraction of pointers to type %0 of zero size">;
92 def note_constexpr_pointer_comparison_unspecified : Note<
93 "comparison between '%0' and '%1' has unspecified value">;
94 def note_constexpr_pointer_constant_comparison : Note<
95 "comparison of numeric address '%0' with pointer '%1' can only be performed "
97 def note_constexpr_literal_comparison : Note<
98 "comparison of addresses of literals has unspecified value">;
99 def note_constexpr_pointer_weak_comparison : Note<
100 "comparison against address of weak declaration '%0' can only be performed "
102 def note_constexpr_mem_pointer_weak_comparison : Note<
103 "comparison against pointer to weak member %q0 can only be performed "
105 def note_constexpr_pointer_comparison_past_end : Note<
106 "comparison against pointer '%0' that points past the end of a "
107 "complete object has unspecified value">;
108 def note_constexpr_pointer_comparison_zero_sized : Note<
109 "comparison of pointers '%0' and '%1' to unrelated zero-sized objects">;
110 def note_constexpr_pointer_comparison_base_classes : Note<
111 "comparison of addresses of subobjects of different base classes "
112 "has unspecified value">;
113 def note_constexpr_pointer_comparison_base_field : Note<
114 "comparison of address of base class subobject %0 of class %1 to field %2 "
115 "has unspecified value">;
116 def note_constexpr_pointer_comparison_differing_access : Note<
117 "comparison of address of fields %0 and %2 of %4 with differing access "
118 "specifiers (%1 vs %3) has unspecified value">;
119 def note_constexpr_compare_virtual_mem_ptr : Note<
120 "comparison of pointer to virtual member function %0 has unspecified value">;
121 def note_constexpr_past_end : Note<
122 "dereferenced pointer past the end of %select{|subobject of }0"
123 "%select{temporary|%2}1 is not a constant expression">;
124 def note_constexpr_past_end_subobject : Note<
125 "cannot %select{access base class of|access derived class of|access field of|"
126 "access array element of|ERROR|"
127 "access real component of|access imaginary component of}0 "
128 "pointer past the end of object">;
129 def note_non_null_attribute_failed : Note<
130 "null passed to a callee that requires a non-null argument">;
131 def note_constexpr_null_subobject : Note<
132 "cannot %select{access base class of|access derived class of|access field of|"
133 "access array element of|perform pointer arithmetic on|"
134 "access real component of|"
135 "access imaginary component of}0 null pointer">;
136 def note_constexpr_null_callee : Note<
137 "'%0' evaluates to a null function pointer">;
138 def note_constexpr_function_param_value_unknown : Note<
139 "function parameter %0 with unknown value cannot be used in a constant "
141 def note_constexpr_var_init_unknown : Note<
142 "initializer of %0 is unknown">;
143 def note_constexpr_var_init_non_constant : Note<
144 "initializer of %0 is not a constant expression">;
145 def note_constexpr_var_init_weak : Note<
146 "initializer of weak variable %0 is not considered constant because "
147 "it may be different at runtime">;
148 def note_constexpr_typeid_polymorphic : Note<
149 "typeid applied to expression of polymorphic type %0 is "
150 "not allowed in a constant expression in C++ standards before C++20">;
151 def note_constexpr_void_comparison : Note<
152 "comparison between unequal pointers to void has unspecified result">;
153 def note_constexpr_temporary_here : Note<"temporary created here">;
154 def note_constexpr_dynamic_alloc_here : Note<"heap allocation performed here">;
155 def note_constexpr_conditional_never_const : Note<
156 "both arms of conditional operator are unable to produce a "
157 "constant expression">;
158 def note_constexpr_depth_limit_exceeded : Note<
159 "constexpr evaluation exceeded maximum depth of %0 calls">;
160 def note_constexpr_call_limit_exceeded : Note<
161 "constexpr evaluation hit maximum call limit">;
162 def note_constexpr_step_limit_exceeded : Note<
163 "constexpr evaluation hit maximum step limit; possible infinite loop?">;
164 def note_constexpr_heap_alloc_limit_exceeded : Note<
165 "constexpr evaluation hit maximum heap allocation limit">;
166 def note_constexpr_this : Note<
167 "%select{|implicit }0use of 'this' pointer is only allowed within the "
168 "evaluation of a call to a 'constexpr' member function">;
169 def note_constexpr_lifetime_ended : Note<
170 "%select{read of|read of|assignment to|increment of|decrement of|"
171 "member call on|dynamic_cast of|typeid applied to|construction of|"
172 "destruction of}0 %select{temporary|variable}1 whose "
173 "%plural{8:storage duration|:lifetime}0 has ended">;
174 def note_constexpr_access_uninit : Note<
175 "%select{read of|read of|assignment to|increment of|decrement of|"
176 "member call on|dynamic_cast of|typeid applied to|"
177 "construction of subobject of|destruction of}0 "
178 "%select{object outside its lifetime|uninitialized object}1 "
179 "is not allowed in a constant expression">;
180 def note_constexpr_use_uninit_reference : Note<
181 "use of reference outside its lifetime "
182 "is not allowed in a constant expression">;
183 def note_constexpr_modify_const_type : Note<
184 "modification of object of const-qualified type %0 is not allowed "
185 "in a constant expression">;
186 def note_constexpr_access_volatile_type : Note<
187 "%select{read of|read of|assignment to|increment of|decrement of|"
188 "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
189 "volatile-qualified type %1 is not allowed in a constant expression">;
190 def note_constexpr_access_volatile_obj : Note<
191 "%select{read of|read of|assignment to|increment of|decrement of|"
192 "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
193 "volatile %select{temporary|object %2|member %2}1 is not allowed in "
194 "a constant expression">;
195 def note_constexpr_volatile_here : Note<
196 "volatile %select{temporary created|object declared|member declared}0 here">;
197 def note_constexpr_access_mutable : Note<
198 "%select{read of|read of|assignment to|increment of|decrement of|"
199 "member call on|dynamic_cast of|typeid applied to|construction of|"
201 "mutable member %1 is not allowed in a constant expression">;
202 def note_constexpr_ltor_non_const_int : Note<
203 "read of non-const variable %0 is not allowed in a constant expression">;
204 def note_constexpr_ltor_non_integral : Note<
205 "read of variable %0 of non-integral, non-enumeration type %1 "
206 "is not allowed in a constant expression">;
207 def note_constexpr_ltor_non_constexpr : Note<
208 "read of non-constexpr variable %0 is not allowed in a constant expression">;
209 def note_constexpr_ltor_incomplete_type : Note<
210 "read of incomplete type %0 is not allowed in a constant expression">;
211 def note_constexpr_access_null : Note<
212 "%select{read of|read of|assignment to|increment of|decrement of|"
213 "member call on|dynamic_cast of|typeid applied to|construction of|"
215 "dereferenced null pointer is not allowed in a constant expression">;
216 def note_constexpr_access_past_end : Note<
217 "%select{read of|read of|assignment to|increment of|decrement of|"
218 "member call on|dynamic_cast of|typeid applied to|construction of|"
220 "dereferenced one-past-the-end pointer is not allowed "
221 "in a constant expression">;
222 def note_constexpr_access_unsized_array : Note<
223 "%select{read of|read of|assignment to|increment of|decrement of|"
224 "member call on|dynamic_cast of|typeid applied to|construction of|"
226 "element of array without known bound "
227 "is not allowed in a constant expression">;
228 def note_constexpr_access_inactive_union_member : Note<
229 "%select{read of|read of|assignment to|increment of|decrement of|"
230 "member call on|dynamic_cast of|typeid applied to|"
231 "construction of subobject of|destruction of}0 "
232 "member %1 of union with %select{active member %3|no active member}2 "
233 "is not allowed in a constant expression">;
234 def note_constexpr_union_member_change_during_init : Note<
235 "assignment would change active union member during the initialization of "
236 "a different member of the same union">;
237 def note_constexpr_access_static_temporary : Note<
238 "%select{read of|read of|assignment to|increment of|decrement of|"
239 "member call on|dynamic_cast of|typeid applied to|reconstruction of|"
240 "destruction of}0 temporary "
241 "is not allowed in a constant expression outside the expression that "
242 "created the temporary">;
243 def note_constexpr_access_unreadable_object : Note<
244 "%select{read of|read of|assignment to|increment of|decrement of|"
245 "member call on|dynamic_cast of|typeid applied to|construction of|"
247 "object '%1' whose value is not known">;
248 def note_constexpr_access_deleted_object : Note<
249 "%select{read of|read of|assignment to|increment of|decrement of|"
250 "member call on|dynamic_cast of|typeid applied to|construction of|"
252 "heap allocated object that has been deleted">;
253 def note_constexpr_modify_global : Note<
254 "a constant expression cannot modify an object that is visible outside "
256 def note_constexpr_stmt_expr_unsupported : Note<
257 "this use of statement expressions is not supported in a "
258 "constant expression">;
259 def note_constexpr_calls_suppressed : Note<
260 "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to "
262 def note_constexpr_call_here : Note<"in call to '%0'">;
263 def note_constexpr_inherited_ctor_call_here : Note<
264 "in implicit initialization for inherited constructor of %0">;
265 def note_constexpr_baa_insufficient_alignment : Note<
266 "%select{alignment of|offset of the aligned pointer from}0 the base pointee "
267 "object (%1 %plural{1:byte|:bytes}1) is %select{less than|not a multiple of}0 the "
268 "asserted %2 %plural{1:byte|:bytes}2">;
269 def note_constexpr_baa_value_insufficient_alignment : Note<
270 "value of the aligned pointer (%0) is not a multiple of the asserted %1 "
271 "%plural{1:byte|:bytes}1">;
272 def note_constexpr_invalid_alignment : Note<
273 "requested alignment %0 is not a positive power of two">;
274 def note_constexpr_alignment_too_big : Note<
275 "requested alignment must be %0 or less for type %1; %2 is invalid">;
276 def note_constexpr_alignment_compute : Note<
277 "cannot constant evaluate whether run-time alignment is at least %0">;
278 def note_constexpr_alignment_adjust : Note<
279 "cannot constant evaluate the result of adjusting alignment to %0">;
280 def note_constexpr_destroy_out_of_lifetime : Note<
281 "destroying object '%0' whose lifetime has already ended">;
282 def note_constexpr_unsupported_destruction : Note<
283 "non-trivial destruction of type %0 in a constant expression is not supported">;
284 def note_constexpr_unsupported_temporary_nontrivial_dtor : Note<
285 "non-trivial destruction of lifetime-extended temporary with type %0 "
286 "used in the result of a constant expression is not yet supported">;
287 def note_constexpr_unsupported_unsized_array : Note<
288 "array-to-pointer decay of array member without known bound is not supported">;
289 def note_constexpr_unsized_array_indexed : Note<
290 "indexing of array without known bound is not allowed "
291 "in a constant expression">;
292 def note_constexpr_memcmp_unsupported : Note<
293 "constant evaluation of %0 between arrays of types %1 and %2 "
294 "is not supported; only arrays of narrow character types can be compared">;
295 def note_constexpr_memchr_unsupported : Note<
296 "constant evaluation of %0 on array of type %1 "
297 "is not supported; only arrays of narrow character types can be searched">;
298 def note_constexpr_memcpy_null : Note<
299 "%select{source|destination}2 of "
300 "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
302 def note_constexpr_memcpy_type_pun : Note<
303 "cannot constant evaluate '%select{memcpy|memmove}0' from object of "
304 "type %1 to object of type %2">;
305 def note_constexpr_memcpy_nontrivial : Note<
306 "cannot constant evaluate '%select{memcpy|memmove}0' between objects of "
307 "non-trivially-copyable type %1">;
308 def note_constexpr_memcpy_incomplete_type : Note<
309 "cannot constant evaluate '%select{memcpy|memmove}0' between objects of "
310 "incomplete type %1">;
311 def note_constexpr_memcpy_overlap : Note<
312 "'%select{memcpy|wmemcpy}0' between overlapping memory regions">;
313 def note_constexpr_memcpy_unsupported : Note<
314 "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
315 "not supported: %select{"
316 "size to copy (%4) is not a multiple of size of element type %3 (%5)|"
317 "source is not a contiguous array of at least %4 elements of type %3|"
318 "destination is not a contiguous array of at least %4 elements of type %3}2">;
319 def note_constexpr_bit_cast_unsupported_type : Note<
320 "constexpr bit_cast involving type %0 is not yet supported">;
321 def note_constexpr_bit_cast_unsupported_bitfield : Note<
322 "constexpr bit_cast involving bit-field is not yet supported">;
323 def note_constexpr_bit_cast_invalid_type : Note<
324 "bit_cast %select{from|to}0 a %select{|type with a }1"
325 "%select{union|pointer|member pointer|volatile|reference}2 "
326 "%select{type|member}1 is not allowed in a constant expression">;
327 def note_constexpr_bit_cast_invalid_subtype : Note<
328 "invalid type %0 is a %select{member|base}1 of %2">;
329 def note_constexpr_bit_cast_indet_dest : Note<
330 "indeterminate value can only initialize an object of type 'unsigned char'"
331 "%select{, 'char',|}1 or 'std::byte'; %0 is invalid">;
332 def note_constexpr_bit_cast_unrepresentable_value : Note<
333 "value %1 cannot be represented in type %0">;
334 def note_constexpr_pseudo_destructor : Note<
335 "pseudo-destructor call is not permitted in constant expressions "
337 def note_constexpr_construct_complex_elem : Note<
338 "construction of individual component of complex number is not yet supported "
339 "in constant expressions">;
340 def note_constexpr_destroy_complex_elem : Note<
341 "destruction of individual component of complex number is not yet supported "
342 "in constant expressions">;
343 def note_constexpr_new : Note<
344 "dynamic memory allocation is not permitted in constant expressions "
346 def note_constexpr_new_non_replaceable : Note<
347 "call to %select{placement|class-specific}0 %1">;
348 def note_constexpr_new_placement : Note<
349 "this placement new expression is not yet supported in constant expressions">;
350 def note_constexpr_placement_new_wrong_type : Note<
351 "placement new would change type of storage from %0 to %1">;
352 def note_constexpr_new_negative : Note<
353 "cannot allocate array; evaluated array bound %0 is negative">;
354 def note_constexpr_new_too_large : Note<
355 "cannot allocate array; evaluated array bound %0 is too large">;
356 def note_constexpr_new_too_small : Note<
357 "cannot allocate array; evaluated array bound %0 is too small to hold "
358 "%1 explicitly initialized elements">;
359 def note_constexpr_new_untyped : Note<
360 "cannot allocate untyped memory in a constant expression; "
361 "use 'std::allocator<T>::allocate' to allocate memory of type 'T'">;
362 def note_constexpr_new_not_complete_object_type : Note<
363 "cannot allocate memory of %select{incomplete|function}0 type %1">;
364 def note_constexpr_operator_new_bad_size : Note<
365 "allocated size %0 is not a multiple of size %1 of element type %2">;
366 def note_constexpr_delete_not_heap_alloc : Note<
367 "delete of pointer '%0' that does not point to a heap-allocated object">;
368 def note_constexpr_double_delete : Note<
369 "delete of pointer that has already been deleted">;
370 def note_constexpr_double_destroy : Note<
371 "destruction of object that is already being destroyed">;
372 def note_constexpr_new_delete_mismatch : Note<
373 "%plural{2:'delete' used to delete pointer to object "
374 "allocated with 'std::allocator<...>::allocate'|"
375 ":%select{non-array delete|array delete|'std::allocator<...>::deallocate'}0 "
376 "used to delete pointer to "
377 "%select{array object of type %2|non-array object of type %2|"
378 "object allocated with 'new'}0}1">;
379 def note_constexpr_deallocate_null : Note<
380 "'std::allocator<...>::deallocate' used to delete a null pointer">;
381 def note_constexpr_delete_subobject : Note<
382 "delete of pointer%select{ to subobject|}1 '%0' "
383 "%select{|that does not point to complete object}1">;
384 def note_constexpr_delete_base_nonvirt_dtor : Note<
385 "delete of object with dynamic type %1 through pointer to "
386 "base class type %0 with non-virtual destructor">;
387 def note_constexpr_memory_leak : Note<
388 "allocation performed here was not deallocated"
389 "%plural{0:|: (along with %0 other memory leak%s0)}0">;
390 def note_constexpr_unsupported_layout : Note<
391 "type %0 has unexpected layout">;
392 def note_constexpr_unsupported_flexible_array : Note<
393 "flexible array initialization is not yet supported">;
394 def err_experimental_clang_interp_failed : Error<
395 "the experimental clang interpreter failed to evaluate an expression">;
397 def warn_integer_constant_overflow : Warning<
398 "overflow in expression; result is %0 with type %1">,
399 InGroup<DiagGroup<"integer-overflow">>;
400 def warn_fixedpoint_constant_overflow : Warning<
401 "overflow in expression; result is %0 with type %1">,
402 InGroup<DiagGroup<"fixed-point-overflow">>;
403 def warn_constexpr_unscoped_enum_out_of_range : Warning<
404 "integer value %0 is outside the valid range of values [%1, %2] for the "
405 "enumeration type %3">, DefaultError, InGroup<DiagGroup<"enum-constexpr-conversion">>;
407 // This is a temporary diagnostic, and shall be removed once our
408 // implementation is complete, and like the preceding constexpr notes belongs
410 def note_unimplemented_constexpr_lambda_feature_ast : Note<
411 "unimplemented constexpr lambda feature: %0 (coming soon!)">;
413 def warn_is_constant_evaluated_always_true_constexpr : Warning<
414 "'%0' will always evaluate to 'true' in a manifestly constant-evaluated expression">,
415 InGroup<DiagGroup<"constant-evaluated">>;
417 // inline asm related.
418 let CategoryName = "Inline Assembly Issue" in {
419 def err_asm_invalid_escape : Error<
420 "invalid %% escape in inline assembly string">;
421 def err_asm_unknown_symbolic_operand_name : Error<
422 "unknown symbolic operand name in inline assembly string">;
424 def err_asm_unterminated_symbolic_operand_name : Error<
425 "unterminated symbolic operand name in inline assembly string">;
426 def err_asm_empty_symbolic_operand_name : Error<
427 "empty symbolic operand name in inline assembly string">;
428 def err_asm_invalid_operand_number : Error<
429 "invalid operand number in inline asm string">;
433 let CategoryName = "VTable ABI Issue" in {
434 def err_vftable_ambiguous_component : Error<
435 "ambiguous vftable component for %0 introduced via covariant thunks; "
436 "this is an inherent limitation of the ABI">;
437 def note_covariant_thunk : Note<
438 "covariant thunk required by %0">;
442 def err_odr_variable_type_inconsistent : Error<
443 "external variable %0 declared with incompatible types in different "
444 "translation units (%1 vs. %2)">;
445 def warn_odr_variable_type_inconsistent : Warning<
446 "external variable %0 declared with incompatible types in different "
447 "translation units (%1 vs. %2)">,
449 def err_odr_variable_multiple_def : Error<
450 "external variable %0 defined in multiple translation units">;
451 def warn_odr_variable_multiple_def : Warning<
452 "external variable %0 defined in multiple translation units">,
454 def note_odr_value_here : Note<"declared here with type %0">;
455 def err_odr_function_type_inconsistent : Error<
456 "external function %0 declared with incompatible types in different "
457 "translation units (%1 vs. %2)">;
458 def warn_odr_function_type_inconsistent : Warning<
459 "external function %0 declared with incompatible types in different "
460 "translation units (%1 vs. %2)">,
462 def err_odr_tag_type_inconsistent
463 : Error<"type %0 has incompatible definitions in different translation "
465 def warn_odr_tag_type_inconsistent
466 : Warning<"type %0 has incompatible definitions in different translation "
469 def note_odr_tag_kind_here: Note<
470 "%0 is a %select{struct|interface|union|class|enum}1 here">;
471 def note_odr_field : Note<"field %0 has type %1 here">;
472 def note_odr_field_name : Note<"field has name %0 here">;
473 def note_odr_missing_field : Note<"no corresponding field here">;
474 def note_odr_base : Note<"class has base type %0">;
475 def note_odr_virtual_base : Note<
476 "%select{non-virtual|virtual}0 derivation here">;
477 def note_odr_missing_base : Note<"no corresponding base class here">;
478 def note_odr_number_of_bases : Note<
479 "class has %0 base %plural{1:class|:classes}0">;
480 def note_odr_enumerator : Note<"enumerator %0 with value %1 here">;
481 def note_odr_missing_enumerator : Note<"no corresponding enumerator here">;
482 def err_odr_field_type_inconsistent : Error<
483 "field %0 declared with incompatible types in different "
484 "translation units (%1 vs. %2)">;
485 def warn_odr_field_type_inconsistent : Warning<
486 "field %0 declared with incompatible types in different "
487 "translation units (%1 vs. %2)">,
490 // Importing Objective-C ASTs
491 def err_odr_ivar_type_inconsistent : Error<
492 "instance variable %0 declared with incompatible types in different "
493 "translation units (%1 vs. %2)">;
494 def warn_odr_ivar_type_inconsistent : Warning<
495 "instance variable %0 declared with incompatible types in different "
496 "translation units (%1 vs. %2)">,
498 def err_odr_objc_superclass_inconsistent : Error<
499 "class %0 has incompatible superclasses">;
500 def warn_odr_objc_superclass_inconsistent : Warning<
501 "class %0 has incompatible superclasses">,
503 def note_odr_objc_superclass : Note<"inherits from superclass %0 here">;
504 def note_odr_objc_missing_superclass : Note<"no corresponding superclass here">;
505 def err_odr_objc_method_result_type_inconsistent : Error<
506 "%select{class|instance}0 method %1 has incompatible result types in "
507 "different translation units (%2 vs. %3)">;
508 def warn_odr_objc_method_result_type_inconsistent : Warning<
509 "%select{class|instance}0 method %1 has incompatible result types in "
510 "different translation units (%2 vs. %3)">,
512 def err_odr_objc_method_num_params_inconsistent : Error<
513 "%select{class|instance}0 method %1 has a different number of parameters in "
514 "different translation units (%2 vs. %3)">;
515 def warn_odr_objc_method_num_params_inconsistent : Warning<
516 "%select{class|instance}0 method %1 has a different number of parameters in "
517 "different translation units (%2 vs. %3)">,
519 def err_odr_objc_method_param_type_inconsistent : Error<
520 "%select{class|instance}0 method %1 has a parameter with a different types "
521 "in different translation units (%2 vs. %3)">;
522 def warn_odr_objc_method_param_type_inconsistent : Warning<
523 "%select{class|instance}0 method %1 has a parameter with a different types "
524 "in different translation units (%2 vs. %3)">,
526 def err_odr_objc_method_variadic_inconsistent : Error<
527 "%select{class|instance}0 method %1 is variadic in one translation unit "
528 "and not variadic in another">;
529 def warn_odr_objc_method_variadic_inconsistent : Warning<
530 "%select{class|instance}0 method %1 is variadic in one translation unit "
531 "and not variadic in another">,
533 def note_odr_objc_method_here : Note<
534 "%select{class|instance}0 method %1 also declared here">;
535 def err_odr_objc_property_type_inconsistent : Error<
536 "property %0 declared with incompatible types in different "
537 "translation units (%1 vs. %2)">;
538 def warn_odr_objc_property_type_inconsistent : Warning<
539 "property %0 declared with incompatible types in different "
540 "translation units (%1 vs. %2)">,
542 def err_odr_objc_property_impl_kind_inconsistent : Error<
543 "property %0 is implemented with %select{@synthesize|@dynamic}1 in one "
544 "translation but %select{@dynamic|@synthesize}1 in another translation unit">;
545 def warn_odr_objc_property_impl_kind_inconsistent : Warning<
546 "property %0 is implemented with %select{@synthesize|@dynamic}1 in one "
547 "translation but %select{@dynamic|@synthesize}1 in another translation unit">,
549 def note_odr_objc_property_impl_kind : Note<
550 "property %0 is implemented with %select{@synthesize|@dynamic}1 here">;
551 def err_odr_objc_synthesize_ivar_inconsistent : Error<
552 "property %0 is synthesized to different ivars in different translation "
553 "units (%1 vs. %2)">;
554 def warn_odr_objc_synthesize_ivar_inconsistent : Warning<
555 "property %0 is synthesized to different ivars in different translation "
556 "units (%1 vs. %2)">,
558 def note_odr_objc_synthesize_ivar_here : Note<
559 "property is synthesized to ivar %0 here">;
561 // Importing C++ ASTs
562 def note_odr_friend : Note<"friend declared here">;
563 def note_odr_missing_friend : Note<"no corresponding friend here">;
564 def err_odr_different_num_template_parameters : Error<
565 "template parameter lists have a different number of parameters (%0 vs %1)">;
566 def warn_odr_different_num_template_parameters : Warning<
567 "template parameter lists have a different number of parameters (%0 vs %1)">,
569 def note_odr_template_parameter_list : Note<
570 "template parameter list also declared here">;
571 def err_odr_different_template_parameter_kind : Error<
572 "template parameter has different kinds in different translation units">;
573 def warn_odr_different_template_parameter_kind : Warning<
574 "template parameter has different kinds in different translation units">,
576 def note_odr_template_parameter_here : Note<
577 "template parameter declared here">;
578 def err_odr_parameter_pack_non_pack : Error<
579 "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">;
580 def warn_odr_parameter_pack_non_pack : Warning<
581 "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">,
583 def note_odr_parameter_pack_non_pack : Note<
584 "%select{parameter|parameter pack}0 declared here">;
585 def err_odr_non_type_parameter_type_inconsistent : Error<
586 "non-type template parameter declared with incompatible types in different "
587 "translation units (%0 vs. %1)">;
588 def warn_odr_non_type_parameter_type_inconsistent : Warning<
589 "non-type template parameter declared with incompatible types in different "
590 "translation units (%0 vs. %1)">,
592 def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">;
594 // Compare ODR hashes
595 def err_module_odr_violation_different_definitions : Error<
596 "%q0 has different definitions in different modules; "
597 "%select{definition in module '%2' is here|defined here}1">;
598 def note_first_module_difference : Note<
599 "in first definition, possible difference is here">;
600 def note_module_odr_violation_different_definitions : Note<
601 "definition in module '%0' is here">;
602 def note_second_module_difference : Note<
603 "in second definition, possible difference is here">;
605 def err_module_odr_violation_definition_data : Error <
606 "%q0 has different definitions in different modules; first difference is "
607 "%select{definition in module '%2'|defined here}1 found "
609 "%4 base %plural{1:class|:classes}4|"
610 "%4 virtual base %plural{1:class|:classes}4|"
611 "%ordinal4 base class with type %5|"
612 "%ordinal4 %select{non-virtual|virtual}5 base class %6|"
613 "%ordinal4 base class %5 with "
614 "%select{public|protected|private|no}6 access specifier}3">;
616 def note_module_odr_violation_definition_data : Note <
619 "%2 base %plural{1:class|:classes}2|"
620 "%2 virtual base %plural{1:class|:classes}2|"
621 "%ordinal2 base class with different type %3|"
622 "%ordinal2 %select{non-virtual|virtual}3 base class %4|"
623 "%ordinal2 base class %3 with "
624 "%select{public|protected|private|no}4 access specifier}1">;
626 def err_module_odr_violation_objc_interface : Error <
627 "%0 has different definitions in different modules; first difference is "
628 "%select{definition in module '%2'|defined here}1 found "
630 "%select{no super class|super class with type %5}4|"
631 "instance variable '%4' access control is "
632 "%select{|@private|@protected|@public|@package}5"
634 def note_module_odr_violation_objc_interface : Note <
635 "but in %select{'%1'|definition here}0 found "
637 "%select{no super class|super class with type %4}3|"
638 "instance variable '%3' access control is "
639 "%select{|@private|@protected|@public|@package}4"
642 def err_module_odr_violation_template_parameter : Error <
643 "%q0 has different definitions in different modules; first difference is "
644 "%select{definition in module '%2'|defined here}1 found "
646 "unnamed template parameter|"
647 "template parameter %5|"
648 "template parameter with %select{no |}4default argument|"
649 "template parameter with default argument}3">;
651 def note_module_odr_violation_template_parameter : Note <
654 "unnamed template parameter %2|"
655 "template parameter %3|"
656 "template parameter with %select{no |}2default argument|"
657 "template parameter with different default argument}1">;
659 def err_module_odr_violation_mismatch_decl : Error<
660 "%q0 has different definitions in different modules; first difference is "
661 "%select{definition in module '%2'|defined here}1 found "
662 "%select{end of class|public access specifier|private access specifier|"
663 "protected access specifier|static assert|field|method|type alias|typedef|"
664 "data member|friend declaration|function template|method|instance variable|"
666 def note_module_odr_violation_mismatch_decl : Note<
667 "but in %select{'%1'|definition here}0 found "
668 "%select{end of class|public access specifier|private access specifier|"
669 "protected access specifier|static assert|field|method|type alias|typedef|"
670 "data member|friend declaration|function template|method|instance variable|"
673 def err_module_odr_violation_record : Error<
674 "%q0 has different definitions in different modules; first difference is "
675 "%select{definition in module '%2'|defined here}1 found "
677 "static assert with condition|"
678 "static assert with message|"
679 "static assert with %select{|no }4message|"
680 "%select{method %5|constructor|destructor}4|"
681 "%select{method %5|constructor|destructor}4 "
682 "is %select{not deleted|deleted}6|"
683 "%select{method %5|constructor|destructor}4 "
684 "is %select{not defaulted|defaulted}6|"
685 "%select{method %5|constructor|destructor}4 "
686 "is %select{|pure }6%select{not virtual|virtual}7|"
687 "%select{method %5|constructor|destructor}4 "
688 "is %select{not static|static}6|"
689 "%select{method %5|constructor|destructor}4 "
690 "is %select{not volatile|volatile}6|"
691 "%select{method %5|constructor|destructor}4 "
692 "is %select{not const|const}6|"
693 "%select{method %5|constructor|destructor}4 "
694 "is %select{not inline|inline}6|"
695 "%select{method %5|constructor|destructor}4 "
696 "with %ordinal6 parameter with%select{out|}7 a default argument|"
697 "%select{method %5|constructor|destructor}4 "
698 "with %ordinal6 parameter with a default argument|"
699 "%select{method %5|constructor|destructor}4 "
700 "with %select{no |}6template arguments|"
701 "%select{method %5|constructor|destructor}4 "
702 "with %6 template argument%s6|"
703 "%select{method %5|constructor|destructor}4 "
704 "with %6 for %ordinal7 template argument|"
705 "%select{method %5|constructor|destructor}4 "
706 "with %select{no body|body}6|"
707 "%select{method %5|constructor|destructor}4 "
709 "friend %select{class|function}4|"
711 "friend function %4|"
712 "function template %4 with %5 template parameter%s5|"
713 "function template %4 with %ordinal5 template parameter being a "
714 "%select{type|non-type|template}6 template parameter|"
715 "function template %4 with %ordinal5 template parameter "
716 "%select{with no name|named %7}6|"
717 "function template %4 with %ordinal5 template parameter with "
718 "%select{no |}6default argument|"
719 "function template %4 with %ordinal5 template parameter with "
720 "default argument %6|"
721 "function template %4 with %ordinal5 template parameter with one type|"
722 "function template %4 with %ordinal5 template parameter %select{not |}6"
723 "being a template parameter pack|"
726 def note_module_odr_violation_record : Note<"but in '%0' found "
728 "static assert with different condition|"
729 "static assert with different message|"
730 "static assert with %select{|no }2message|"
731 "%select{method %3|constructor|destructor}2|"
732 "%select{method %3|constructor|destructor}2 "
733 "is %select{not deleted|deleted}4|"
734 "%select{method %3|constructor|destructor}2 "
735 "is %select{not defaulted|defaulted}4|"
736 "%select{method %3|constructor|destructor}2 "
737 "is %select{|pure }4%select{not virtual|virtual}5|"
738 "%select{method %3|constructor|destructor}2 "
739 "is %select{not static|static}4|"
740 "%select{method %3|constructor|destructor}2 "
741 "is %select{not volatile|volatile}4|"
742 "%select{method %3|constructor|destructor}2 "
743 "is %select{not const|const}4|"
744 "%select{method %3|constructor|destructor}2 "
745 "is %select{not inline|inline}4|"
746 "%select{method %3|constructor|destructor}2 "
747 "with %ordinal4 parameter with%select{out|}5 a default argument|"
748 "%select{method %3|constructor|destructor}2 "
749 "with %ordinal4 parameter with a different default argument|"
750 "%select{method %3|constructor|destructor}2 "
751 "with %select{no |}4template arguments|"
752 "%select{method %3|constructor|destructor}2 "
753 "with %4 template argument%s4|"
754 "%select{method %3|constructor|destructor}2 "
755 "with %4 for %ordinal5 template argument|"
756 "%select{method %3|constructor|destructor}2 "
757 "with %select{no body|body}4|"
758 "%select{method %3|constructor|destructor}2 "
759 "with different body|"
760 "friend %select{class|function}2|"
762 "friend function %2|"
763 "function template %2 with %3 template parameter%s3|"
764 "function template %2 with %ordinal3 template paramter being a "
765 "%select{type|non-type|template}4 template parameter|"
766 "function template %2 with %ordinal3 template parameter "
767 "%select{with no name|named %5}4|"
768 "function template %2 with %ordinal3 template parameter with "
769 "%select{no |}4default argument|"
770 "function template %2 with %ordinal3 template parameter with "
771 "default argument %4|"
772 "function template %2 with %ordinal3 template parameter with different type|"
773 "function template %2 with %ordinal3 template parameter %select{not |}4"
774 "being a template parameter pack|"
777 def err_module_odr_violation_field : Error<
778 "%q0 has different definitions in different modules; first difference is "
779 "%select{definition in module '%2'|defined here}1 found "
782 "field %4 with type %5|"
783 "%select{non-|}5bitfield %4|"
784 "bitfield %4 with one width expression|"
785 "%select{non-|}5mutable field %4|"
786 "field %4 with %select{no|an}5 initializer|"
787 "field %4 with an initializer"
789 def note_module_odr_violation_field : Note<
790 "but in %select{'%1'|definition here}0 found "
793 "field %3 with type %4|"
794 "%select{non-|}4bitfield %3|"
795 "bitfield %3 with different width expression|"
796 "%select{non-|}4mutable field %3|"
797 "field %3 with %select{no|an}4 initializer|"
798 "field %3 with a different initializer"
801 def err_module_odr_violation_typedef : Error<
802 "%q0 has different definitions in different modules; first difference is "
803 "%select{definition in module '%2'|defined here}1 found "
805 "%select{typedef|type alias}4 name %5|"
806 "%select{typedef|type alias}4 %5 with underlying type %6"
808 def note_module_odr_violation_typedef : Note<"but in '%0' found "
810 "%select{typedef|type alias}2 name %3|"
811 "%select{typedef|type alias}2 %3 with different underlying type %4"
814 def err_module_odr_violation_variable : Error<
815 "%q0 has different definitions in different modules; first difference is "
816 "%select{definition in module '%2'|defined here}1 found "
818 "data member with name %4|"
819 "data member %4 with type %5|"
820 "data member %4 with%select{out|}5 an initializer|"
821 "data member %4 with an initializer|"
822 "data member %4 %select{is constexpr|is not constexpr}5"
824 def note_module_odr_violation_variable : Note<"but in '%0' found "
826 "data member with name %2|"
827 "data member %2 with different type %3|"
828 "data member %2 with%select{out|}3 an initializer|"
829 "data member %2 with a different initializer|"
830 "data member %2 %select{is constexpr|is not constexpr}3"
833 def err_module_odr_violation_function : Error<
834 "%q0 has different definitions in different modules; "
835 "%select{definition in module '%2'|defined here}1 "
836 "first difference is "
839 "%ordinal4 parameter with name %5|"
840 "%ordinal4 parameter with type %5%select{| decayed from %7}6|"
841 "%ordinal4 parameter with%select{out|}5 a default argument|"
842 "%ordinal4 parameter with a default argument|"
846 def note_module_odr_violation_function : Note<"but in '%0' found "
848 "different return type %2|"
849 "%ordinal2 parameter with name %3|"
850 "%ordinal2 parameter with type %3%select{| decayed from %5}4|"
851 "%ordinal2 parameter with%select{out|}3 a default argument|"
852 "%ordinal2 parameter with a different default argument|"
856 def err_module_odr_violation_enum : Error<
857 "%q0 has different definitions in different modules; "
858 "%select{definition in module '%2'|defined here}1 "
859 "first difference is "
861 "enum that is %select{not scoped|scoped}4|"
862 "enum scoped with keyword %select{struct|class}4|"
863 "enum %select{without|with}4 specified type|"
864 "enum with specified type %4|"
865 "enum with %4 element%s4|"
866 "%ordinal4 element has name %5|"
867 "%ordinal4 element %5 %select{has|does not have}6 an initializer|"
868 "%ordinal4 element %5 has an initializer|"
871 def note_module_odr_violation_enum : Note<"but in '%0' found "
873 "enum that is %select{not scoped|scoped}2|"
874 "enum scoped with keyword %select{struct|class}2|"
875 "enum %select{without|with}2 specified type|"
876 "enum with specified type %2|"
877 "enum with %2 element%s2|"
878 "%ordinal2 element has name %3|"
879 "%ordinal2 element %3 %select{has|does not have}4 an initializer|"
880 "%ordinal2 element %3 has different initializer|"
883 def err_module_odr_violation_referenced_protocols : Error <
884 "%q0 has different definitions in different modules; first difference is "
885 "%select{definition in module '%2'|defined here}1 found "
887 "%4 referenced %plural{1:protocol|:protocols}4|"
888 "%ordinal4 referenced protocol with name %5"
890 def note_module_odr_violation_referenced_protocols : Note <
891 "but in %select{'%1'|definition here}0 found "
893 "%3 referenced %plural{1:protocol|:protocols}3|"
894 "%ordinal3 referenced protocol with different name %4"
897 def err_module_odr_violation_objc_method : Error<
898 "%q0 has different definitions in different modules; first difference is "
899 "%select{definition in module '%2'|defined here}1 found "
901 "method %4 with return type %5|"
902 "%select{class|instance}5 method %4|"
903 "%select{no|'required'|'optional'}4 method control|"
904 "method %4 with %select{no designated initializer|designated initializer}5|"
905 "%select{regular|direct}5 method %4|"
908 def note_module_odr_violation_objc_method : Note<
909 "but in %select{'%1'|definition here}0 found "
911 "method %3 with different return type %4|"
912 "method %3 as %select{class|instance}4 method|"
913 "%select{no|'required'|'optional'}3 method control|"
914 "method %3 with %select{no designated initializer|designated initializer}4|"
915 "%select{regular|direct}4 method %3|"
916 "different method %3"
919 def err_module_odr_violation_method_params : Error<
920 "%q0 has different definitions in different modules; first difference is "
921 "%select{definition in module '%2'|defined here}1 found "
923 "%select{method %5|constructor|destructor}4 "
924 "that has %6 parameter%s6|"
925 "%select{method %5|constructor|destructor}4 "
926 "with %ordinal6 parameter of type %7%select{| decayed from %9}8|"
927 "%select{method %5|constructor|destructor}4 "
928 "with %ordinal6 parameter named %7"
930 def note_module_odr_violation_method_params : Note<
931 "but in %select{'%1'|definition here}0 found "
933 "%select{method %4|constructor|destructor}3 "
934 "that has %5 parameter%s5|"
935 "%select{method %4|constructor|destructor}3 "
936 "with %ordinal5 parameter of type %6%select{| decayed from %8}7|"
937 "%select{method %4|constructor|destructor}3 "
938 "with %ordinal5 parameter named %6"
941 def err_module_odr_violation_objc_property : Error<
942 "%q0 has different definitions in different modules; first difference is "
943 "%select{definition in module '%2'|defined here}1 found "
946 "property %4 with type %5|"
947 "%select{no|'required'|'optional'}4 property control|"
948 "property %4 with %select{default |}6'%select{none|readonly|getter|assign|"
949 "readwrite|retain|copy|nonatomic|setter|atomic|weak|strong|"
950 "unsafe_unretained|nullability|null_resettable|class|direct}5' attribute"
952 def note_module_odr_violation_objc_property : Note<
953 "but in %select{'%1'|definition here}0 found "
956 "property %3 with type %4|"
957 "%select{no|'required'|'optional'}3 property control|"
958 "property %3 with different '%select{none|readonly|getter|assign|"
959 "readwrite|retain|copy|nonatomic|setter|atomic|weak|strong|"
960 "unsafe_unretained|nullability|null_resettable|class|direct}4' attribute"
963 def err_module_odr_violation_mismatch_decl_unknown : Error<
964 "%q0 %select{with definition in module '%2'|defined here}1 has different "
965 "definitions in different modules; first difference is this "
966 "%select{||||static assert|field|method|type alias|typedef|data member|"
967 "friend declaration|function template|method|instance variable|"
968 "property|unexpected decl}3">;
969 def note_module_odr_violation_mismatch_decl_unknown : Note<
970 "but in %select{'%1'|definition here}0 found "
971 "%select{||||different static assert|different field|different method|"
972 "different type alias|different typedef|different data member|"
973 "different friend declaration|different function template|different method|"
974 "different instance variable|different property|another unexpected decl}2">;
977 def remark_sanitize_address_insert_extra_padding_accepted : Remark<
978 "-fsanitize-address-field-padding applied to %0">, ShowInSystemHeader,
979 InGroup<SanitizeAddressRemarks>;
980 def remark_sanitize_address_insert_extra_padding_rejected : Remark<
981 "-fsanitize-address-field-padding ignored for %0 because it "
982 "%select{is not C++|is packed|is a union|is trivially copyable|"
983 "has trivial destructor|is standard layout|is in a ignorelisted file|"
984 "is ignorelisted}1">, ShowInSystemHeader,
985 InGroup<SanitizeAddressRemarks>;
987 def warn_npot_ms_struct : Warning<
988 "ms_struct may not produce Microsoft-compatible layouts with fundamental "
989 "data types with sizes that aren't a power of two">,
990 DefaultError, InGroup<IncompatibleMSStruct>;
992 // -Wpadded, -Wpacked
993 def warn_padded_struct_field : Warning<
994 "padding %select{struct|interface|class}0 %1 with %2 "
995 "%select{byte|bit}3%s2 to align %4">,
996 InGroup<Padded>, DefaultIgnore;
997 def warn_padded_struct_anon_field : Warning<
998 "padding %select{struct|interface|class}0 %1 with %2 "
999 "%select{byte|bit}3%s2 to align anonymous bit-field">,
1000 InGroup<Padded>, DefaultIgnore;
1001 def warn_padded_struct_size : Warning<
1002 "padding size of %0 with %1 %select{byte|bit}2%s1 to alignment boundary">,
1003 InGroup<Padded>, DefaultIgnore;
1004 def warn_unnecessary_packed : Warning<
1005 "packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore;
1006 def warn_unpacked_field
1008 "not packing field %0 as it is non-POD for the purposes of layout">,
1009 InGroup<PackedNonPod>,
1012 // -Wunaligned-access
1013 def warn_unaligned_access : Warning<
1014 "field %1 within %0 is less aligned than %2 and is usually due to %0 being "
1015 "packed, which can lead to unaligned accesses">, InGroup<UnalignedAccess>, DefaultIgnore;