1//==--- DiagnosticASTKinds.td - libast 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
9let Component = "AST" in {
10
11// Constant expression diagnostics. These (and their users) belong in Sema.
12def note_expr_divide_by_zero : Note<"division by zero">;
13def note_constexpr_invalid_cast : Note<
14  "%select{reinterpret_cast|dynamic_cast|cast that performs the conversions of"
15  " a reinterpret_cast|cast from %1}0 is not allowed in a constant expression"
16  "%select{| in C++ standards before C++20||}0">;
17def note_constexpr_invalid_downcast : Note<
18  "cannot cast object of dynamic type %0 to type %1">;
19def note_constexpr_overflow : Note<
20  "value %0 is outside the range of representable values of type %1">;
21def note_constexpr_negative_shift : Note<"negative shift count %0">;
22def note_constexpr_large_shift : Note<
23  "shift count %0 >= width of type %1 (%2 bit%s2)">;
24def note_constexpr_lshift_of_negative : Note<"left shift of negative value %0">;
25def note_constexpr_lshift_discards : Note<"signed left shift discards bits">;
26def note_constexpr_invalid_function : Note<
27  "%select{non-constexpr|undefined}0 %select{function|constructor}1 %2 cannot "
28  "be used in a constant expression">;
29def note_constexpr_invalid_inhctor : Note<
30  "constructor inherited from base class %0 cannot be used in a "
31  "constant expression; derived class cannot be implicitly initialized">;
32def note_constexpr_no_return : Note<
33  "control reached end of constexpr function">;
34def note_constexpr_virtual_call : Note<
35  "cannot evaluate call to virtual function in a constant expression "
36  "in C++ standards before C++20">;
37def note_constexpr_pure_virtual_call : Note<
38  "pure virtual function %q0 called">;
39def note_constexpr_polymorphic_unknown_dynamic_type : Note<
40  "%select{|||||virtual function called on|dynamic_cast applied to|"
41  "typeid applied to|construction of|destruction of}0 object '%1' "
42  "whose dynamic type is not constant">;
43def note_constexpr_dynamic_cast_to_reference_failed : Note<
44  "reference dynamic_cast failed: %select{"
45  "static type %1 of operand is a non-public base class of dynamic type %2|"
46  "dynamic type %2 of operand does not have a base class of type %3|"
47  "%3 is an ambiguous base class of dynamic type %2 of operand|"
48  "%3 is a non-public base class of dynamic type %2 of operand}0">;
49def note_constexpr_virtual_base : Note<
50  "cannot construct object of type %0 with virtual base class "
51  "in a constant expression">;
52def note_constexpr_nonliteral : Note<
53  "non-literal type %0 cannot be used in a constant expression">;
54def note_constexpr_non_global : Note<
55  "%select{pointer|reference}0 to %select{|subobject of }1"
56  "%select{temporary|%3}2 is not a constant expression">;
57def note_constexpr_not_static : Note<
58  "address of non-static constexpr variable %0 may differ on each invocation "
59  "of the enclosing function; add 'static' to give it a constant address">;
60def note_constexpr_dynamic_alloc : Note<
61  "%select{pointer|reference}0 to %select{|subobject of }1"
62  "heap-allocated object is not a constant expression">;
63def note_consteval_address_accessible : Note<
64  "%select{pointer|reference}0 to a consteval declaration "
65  "is not a constant expression">;
66def note_constexpr_uninitialized : Note<
67  "%select{|sub}0object of type %1 is not initialized">;
68def note_constexpr_static_local : Note<
69  "control flows through the definition of a %select{static|thread_local}0 variable">;
70def note_constexpr_subobject_declared_here : Note<
71  "subobject declared here">;
72def note_constexpr_array_index : Note<"cannot refer to element %0 of "
73  "%select{array of %2 element%plural{1:|:s}2|non-array object}1 "
74  "in a constant expression">;
75def note_constexpr_float_arithmetic : Note<
76  "floating point arithmetic produces %select{an infinity|a NaN}0">;
77def note_constexpr_dynamic_rounding : Note<
78  "cannot evaluate this expression if rounding mode is dynamic">;
79def note_constexpr_float_arithmetic_strict : Note<
80  "compile time floating point arithmetic suppressed in strict evaluation modes">;
81def note_constexpr_pointer_subtraction_not_same_array : Note<
82  "subtracted pointers are not elements of the same array">;
83def note_constexpr_pointer_subtraction_zero_size : Note<
84  "subtraction of pointers to type %0 of zero size">;
85def note_constexpr_pointer_comparison_unspecified : Note<
86  "comparison has unspecified value">;
87def note_constexpr_pointer_comparison_base_classes : Note<
88  "comparison of addresses of subobjects of different base classes "
89  "has unspecified value">;
90def note_constexpr_pointer_comparison_base_field : Note<
91  "comparison of address of base class subobject %0 of class %1 to field %2 "
92  "has unspecified value">;
93def note_constexpr_pointer_comparison_differing_access : Note<
94  "comparison of address of fields %0 and %2 of %4 with differing access "
95  "specifiers (%1 vs %3) has unspecified value">;
96def note_constexpr_compare_virtual_mem_ptr : Note<
97  "comparison of pointer to virtual member function %0 has unspecified value">;
98def note_constexpr_past_end : Note<
99  "dereferenced pointer past the end of %select{|subobject of }0"
100  "%select{temporary|%2}1 is not a constant expression">;
101def note_constexpr_past_end_subobject : Note<
102  "cannot %select{access base class of|access derived class of|access field of|"
103  "access array element of|ERROR|"
104  "access real component of|access imaginary component of}0 "
105  "pointer past the end of object">;
106def note_non_null_attribute_failed : Note<
107  "null passed to a callee that requires a non-null argument">;
108def note_constexpr_null_subobject : Note<
109  "cannot %select{access base class of|access derived class of|access field of|"
110  "access array element of|perform pointer arithmetic on|"
111  "access real component of|"
112  "access imaginary component of}0 null pointer">;
113def note_constexpr_function_param_value_unknown : Note<
114  "function parameter %0 with unknown value cannot be used in a constant "
115  "expression">;
116def note_constexpr_var_init_unknown : Note<
117  "initializer of %0 is unknown">;
118def note_constexpr_var_init_non_constant : Note<
119  "initializer of %0 is not a constant expression">;
120def note_constexpr_var_init_weak : Note<
121  "initializer of weak variable %0 is not considered constant because "
122  "it may be different at runtime">;
123def note_constexpr_typeid_polymorphic : Note<
124  "typeid applied to expression of polymorphic type %0 is "
125  "not allowed in a constant expression in C++ standards before C++20">;
126def note_constexpr_void_comparison : Note<
127  "comparison between unequal pointers to void has unspecified result">;
128def note_constexpr_temporary_here : Note<"temporary created here">;
129def note_constexpr_dynamic_alloc_here : Note<"heap allocation performed here">;
130def note_constexpr_conditional_never_const : Note<
131  "both arms of conditional operator are unable to produce a "
132  "constant expression">;
133def note_constexpr_depth_limit_exceeded : Note<
134  "constexpr evaluation exceeded maximum depth of %0 calls">;
135def note_constexpr_call_limit_exceeded : Note<
136  "constexpr evaluation hit maximum call limit">;
137def note_constexpr_step_limit_exceeded : Note<
138  "constexpr evaluation hit maximum step limit; possible infinite loop?">;
139def note_constexpr_heap_alloc_limit_exceeded : Note<
140  "constexpr evaluation hit maximum heap allocation limit">;
141def note_constexpr_this : Note<
142  "%select{|implicit }0use of 'this' pointer is only allowed within the "
143  "evaluation of a call to a 'constexpr' member function">;
144def note_constexpr_lifetime_ended : Note<
145  "%select{read of|read of|assignment to|increment of|decrement of|"
146  "member call on|dynamic_cast of|typeid applied to|construction of|"
147  "destruction of}0 %select{temporary|variable}1 whose "
148  "%plural{8:storage duration|:lifetime}0 has ended">;
149def note_constexpr_access_uninit : Note<
150  "%select{read of|read of|assignment to|increment of|decrement of|"
151  "member call on|dynamic_cast of|typeid applied to|"
152  "construction of subobject of|destruction of}0 "
153  "%select{object outside its lifetime|uninitialized object}1 "
154  "is not allowed in a constant expression">;
155def note_constexpr_use_uninit_reference : Note<
156  "use of reference outside its lifetime "
157  "is not allowed in a constant expression">;
158def note_constexpr_modify_const_type : Note<
159  "modification of object of const-qualified type %0 is not allowed "
160  "in a constant expression">;
161def note_constexpr_access_volatile_type : Note<
162  "%select{read of|read of|assignment to|increment of|decrement of|"
163  "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
164  "volatile-qualified type %1 is not allowed in a constant expression">;
165def note_constexpr_access_volatile_obj : Note<
166  "%select{read of|read of|assignment to|increment of|decrement of|"
167  "<ERROR>|<ERROR>|<ERROR>|<ERROR>}0 "
168  "volatile %select{temporary|object %2|member %2}1 is not allowed in "
169  "a constant expression">;
170def note_constexpr_volatile_here : Note<
171  "volatile %select{temporary created|object declared|member declared}0 here">;
172def note_constexpr_access_mutable : Note<
173  "%select{read of|read of|assignment to|increment of|decrement of|"
174  "member call on|dynamic_cast of|typeid applied to|construction of|"
175  "destruction of}0 "
176  "mutable member %1 is not allowed in a constant expression">;
177def note_constexpr_ltor_non_const_int : Note<
178  "read of non-const variable %0 is not allowed in a constant expression">;
179def note_constexpr_ltor_non_integral : Note<
180  "read of variable %0 of non-integral, non-enumeration type %1 "
181  "is not allowed in a constant expression">;
182def note_constexpr_ltor_non_constexpr : Note<
183  "read of non-constexpr variable %0 is not allowed in a constant expression">;
184def note_constexpr_ltor_incomplete_type : Note<
185  "read of incomplete type %0 is not allowed in a constant expression">;
186def note_constexpr_access_null : Note<
187  "%select{read of|read of|assignment to|increment of|decrement of|"
188  "member call on|dynamic_cast of|typeid applied to|construction of|"
189  "destruction of}0 "
190  "dereferenced null pointer is not allowed in a constant expression">;
191def note_constexpr_access_past_end : Note<
192  "%select{read of|read of|assignment to|increment of|decrement of|"
193  "member call on|dynamic_cast of|typeid applied to|construction of|"
194  "destruction of}0 "
195  "dereferenced one-past-the-end pointer is not allowed "
196  "in a constant expression">;
197def note_constexpr_access_unsized_array : 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|"
200  "destruction of}0 "
201  "element of array without known bound "
202  "is not allowed in a constant expression">;
203def note_constexpr_access_inactive_union_member : Note<
204  "%select{read of|read of|assignment to|increment of|decrement of|"
205  "member call on|dynamic_cast of|typeid applied to|"
206  "construction of subobject of|destruction of}0 "
207  "member %1 of union with %select{active member %3|no active member}2 "
208  "is not allowed in a constant expression">;
209def note_constexpr_union_member_change_during_init : Note<
210  "assignment would change active union member during the initialization of "
211  "a different member of the same union">;
212def note_constexpr_access_static_temporary : Note<
213  "%select{read of|read of|assignment to|increment of|decrement of|"
214  "member call on|dynamic_cast of|typeid applied to|reconstruction of|"
215  "destruction of}0 temporary "
216  "is not allowed in a constant expression outside the expression that "
217  "created the temporary">;
218def note_constexpr_access_unreadable_object : Note<
219  "%select{read of|read of|assignment to|increment of|decrement of|"
220  "member call on|dynamic_cast of|typeid applied to|construction of|"
221  "destruction of}0 "
222  "object '%1' whose value is not known">;
223def note_constexpr_access_deleted_object : Note<
224  "%select{read of|read of|assignment to|increment of|decrement of|"
225  "member call on|dynamic_cast of|typeid applied to|construction of|"
226  "destruction of}0 "
227  "heap allocated object that has been deleted">;
228def note_constexpr_modify_global : Note<
229  "a constant expression cannot modify an object that is visible outside "
230  "that expression">;
231def note_constexpr_stmt_expr_unsupported : Note<
232  "this use of statement expressions is not supported in a "
233  "constant expression">;
234def note_constexpr_calls_suppressed : Note<
235  "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to "
236  "see all)">;
237def note_constexpr_call_here : Note<"in call to '%0'">;
238def note_constexpr_inherited_ctor_call_here : Note<
239  "in implicit initialization for inherited constructor of %0">;
240def note_constexpr_baa_insufficient_alignment : Note<
241  "%select{alignment of|offset of the aligned pointer from}0 the base pointee "
242  "object (%1 %plural{1:byte|:bytes}1) is %select{less than|not a multiple of}0 the "
243  "asserted %2 %plural{1:byte|:bytes}2">;
244def note_constexpr_baa_value_insufficient_alignment : Note<
245  "value of the aligned pointer (%0) is not a multiple of the asserted %1 "
246  "%plural{1:byte|:bytes}1">;
247def note_constexpr_invalid_alignment : Note<
248  "requested alignment %0 is not a positive power of two">;
249def note_constexpr_alignment_too_big : Note<
250  "requested alignment must be %0 or less for type %1; %2 is invalid">;
251def note_constexpr_alignment_compute : Note<
252  "cannot constant evaluate whether run-time alignment is at least %0">;
253def note_constexpr_alignment_adjust : Note<
254  "cannot constant evaluate the result of adjusting alignment to %0">;
255def note_constexpr_destroy_out_of_lifetime : Note<
256  "destroying object '%0' whose lifetime has already ended">;
257def note_constexpr_unsupported_destruction : Note<
258  "non-trivial destruction of type %0 in a constant expression is not supported">;
259def note_constexpr_unsupported_temporary_nontrivial_dtor : Note<
260  "non-trivial destruction of lifetime-extended temporary with type %0 "
261  "used in the result of a constant expression is not yet supported">;
262def note_constexpr_unsupported_unsized_array : Note<
263  "array-to-pointer decay of array member without known bound is not supported">;
264def note_constexpr_unsized_array_indexed : Note<
265  "indexing of array without known bound is not allowed "
266  "in a constant expression">;
267def note_constexpr_memcmp_unsupported : Note<
268  "constant evaluation of %0 between arrays of types %1 and %2 "
269  "is not supported; only arrays of narrow character types can be compared">;
270def note_constexpr_memchr_unsupported : Note<
271  "constant evaluation of %0 on array of type %1 "
272  "is not supported; only arrays of narrow character types can be searched">;
273def note_constexpr_memcpy_null : Note<
274  "%select{source|destination}2 of "
275  "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
276  "is %3">;
277def note_constexpr_memcpy_type_pun : Note<
278  "cannot constant evaluate '%select{memcpy|memmove}0' from object of "
279  "type %1 to object of type %2">;
280def note_constexpr_memcpy_nontrivial : Note<
281  "cannot constant evaluate '%select{memcpy|memmove}0' between objects of "
282  "non-trivially-copyable type %1">;
283def note_constexpr_memcpy_incomplete_type : Note<
284  "cannot constant evaluate '%select{memcpy|memmove}0' between objects of "
285  "incomplete type %1">;
286def note_constexpr_memcpy_overlap : Note<
287  "'%select{memcpy|wmemcpy}0' between overlapping memory regions">;
288def note_constexpr_memcpy_unsupported : Note<
289  "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' "
290  "not supported: %select{"
291  "size to copy (%4) is not a multiple of size of element type %3 (%5)|"
292  "source is not a contiguous array of at least %4 elements of type %3|"
293  "destination is not a contiguous array of at least %4 elements of type %3}2">;
294def note_constexpr_bit_cast_unsupported_type : Note<
295  "constexpr bit_cast involving type %0 is not yet supported">;
296def note_constexpr_bit_cast_unsupported_bitfield : Note<
297  "constexpr bit_cast involving bit-field is not yet supported">;
298def note_constexpr_bit_cast_invalid_type : Note<
299  "bit_cast %select{from|to}0 a %select{|type with a }1"
300  "%select{union|pointer|member pointer|volatile|reference}2 "
301  "%select{type|member}1 is not allowed in a constant expression">;
302def note_constexpr_bit_cast_invalid_subtype : Note<
303  "invalid type %0 is a %select{member|base}1 of %2">;
304def note_constexpr_bit_cast_indet_dest : Note<
305  "indeterminate value can only initialize an object of type 'unsigned char'"
306  "%select{, 'char',|}1 or 'std::byte'; %0 is invalid">;
307def note_constexpr_bit_cast_unrepresentable_value : Note<
308  "value %1 cannot be represented in type %0">;
309def note_constexpr_pseudo_destructor : Note<
310  "pseudo-destructor call is not permitted in constant expressions "
311  "until C++20">;
312def note_constexpr_construct_complex_elem : Note<
313  "construction of individual component of complex number is not yet supported "
314  "in constant expressions">;
315def note_constexpr_destroy_complex_elem : Note<
316  "destruction of individual component of complex number is not yet supported "
317  "in constant expressions">;
318def note_constexpr_new : Note<
319  "dynamic memory allocation is not permitted in constant expressions "
320  "until C++20">;
321def note_constexpr_new_non_replaceable : Note<
322  "call to %select{placement|class-specific}0 %1">;
323def note_constexpr_new_placement : Note<
324  "this placement new expression is not yet supported in constant expressions">;
325def note_constexpr_placement_new_wrong_type : Note<
326  "placement new would change type of storage from %0 to %1">;
327def note_constexpr_new_negative : Note<
328  "cannot allocate array; evaluated array bound %0 is negative">;
329def note_constexpr_new_too_large : Note<
330  "cannot allocate array; evaluated array bound %0 is too large">;
331def note_constexpr_new_too_small : Note<
332  "cannot allocate array; evaluated array bound %0 is too small to hold "
333  "%1 explicitly initialized elements">;
334def note_constexpr_new_untyped : Note<
335  "cannot allocate untyped memory in a constant expression; "
336  "use 'std::allocator<T>::allocate' to allocate memory of type 'T'">;
337def note_constexpr_new_not_complete_object_type : Note<
338  "cannot allocate memory of %select{incomplete|function}0 type %1">;
339def note_constexpr_operator_new_bad_size : Note<
340  "allocated size %0 is not a multiple of size %1 of element type %2">;
341def note_constexpr_delete_not_heap_alloc : Note<
342  "delete of pointer '%0' that does not point to a heap-allocated object">;
343def note_constexpr_double_delete : Note<
344  "delete of pointer that has already been deleted">;
345def note_constexpr_double_destroy : Note<
346  "destruction of object that is already being destroyed">;
347def note_constexpr_new_delete_mismatch : Note<
348  "%plural{2:'delete' used to delete pointer to object "
349  "allocated with 'std::allocator<...>::allocate'|"
350  ":%select{non-array delete|array delete|'std::allocator<...>::deallocate'}0 "
351  "used to delete pointer to "
352  "%select{array object of type %2|non-array object of type %2|"
353  "object allocated with 'new'}0}1">;
354def note_constexpr_deallocate_null : Note<
355  "'std::allocator<...>::deallocate' used to delete a null pointer">;
356def note_constexpr_delete_subobject : Note<
357  "delete of pointer%select{ to subobject|}1 '%0' "
358  "%select{|that does not point to complete object}1">;
359def note_constexpr_delete_base_nonvirt_dtor : Note<
360  "delete of object with dynamic type %1 through pointer to "
361  "base class type %0 with non-virtual destructor">;
362def note_constexpr_memory_leak : Note<
363  "allocation performed here was not deallocated"
364  "%plural{0:|: (along with %0 other memory leak%s0)}0">;
365def note_constexpr_unsupported_layout : Note<
366  "type %0 has unexpected layout">;
367def note_constexpr_unsupported_flexible_array : Note<
368  "flexible array initialization is not yet supported">;
369def err_experimental_clang_interp_failed : Error<
370  "the experimental clang interpreter failed to evaluate an expression">;
371
372def warn_integer_constant_overflow : Warning<
373  "overflow in expression; result is %0 with type %1">,
374  InGroup<DiagGroup<"integer-overflow">>;
375def warn_fixedpoint_constant_overflow : Warning<
376  "overflow in expression; result is %0 with type %1">,
377  InGroup<DiagGroup<"fixed-point-overflow">>;
378
379// This is a temporary diagnostic, and shall be removed once our
380// implementation is complete, and like the preceding constexpr notes belongs
381// in Sema.
382def note_unimplemented_constexpr_lambda_feature_ast : Note<
383    "unimplemented constexpr lambda feature: %0 (coming soon!)">;
384
385def warn_is_constant_evaluated_always_true_constexpr : Warning<
386  "'%0' will always evaluate to 'true' in a manifestly constant-evaluated expression">,
387  InGroup<DiagGroup<"constant-evaluated">>;
388
389// inline asm related.
390let CategoryName = "Inline Assembly Issue" in {
391  def err_asm_invalid_escape : Error<
392    "invalid %% escape in inline assembly string">;
393  def err_asm_unknown_symbolic_operand_name : Error<
394    "unknown symbolic operand name in inline assembly string">;
395
396  def err_asm_unterminated_symbolic_operand_name : Error<
397    "unterminated symbolic operand name in inline assembly string">;
398  def err_asm_empty_symbolic_operand_name : Error<
399    "empty symbolic operand name in inline assembly string">;
400  def err_asm_invalid_operand_number : Error<
401    "invalid operand number in inline asm string">;
402}
403
404// vtable related.
405let CategoryName = "VTable ABI Issue" in {
406  def err_vftable_ambiguous_component : Error<
407    "ambiguous vftable component for %0 introduced via covariant thunks; "
408    "this is an inherent limitation of the ABI">;
409  def note_covariant_thunk : Note<
410    "covariant thunk required by %0">;
411}
412
413// Importing ASTs
414def err_odr_variable_type_inconsistent : Error<
415  "external variable %0 declared with incompatible types in different "
416  "translation units (%1 vs. %2)">;
417def warn_odr_variable_type_inconsistent : Warning<
418  "external variable %0 declared with incompatible types in different "
419  "translation units (%1 vs. %2)">,
420  InGroup<ODR>;
421def err_odr_variable_multiple_def : Error<
422  "external variable %0 defined in multiple translation units">;
423def warn_odr_variable_multiple_def : Warning<
424  "external variable %0 defined in multiple translation units">,
425  InGroup<ODR>;
426def note_odr_value_here : Note<"declared here with type %0">;
427def err_odr_function_type_inconsistent : Error<
428  "external function %0 declared with incompatible types in different "
429  "translation units (%1 vs. %2)">;
430def warn_odr_function_type_inconsistent : Warning<
431  "external function %0 declared with incompatible types in different "
432  "translation units (%1 vs. %2)">,
433  InGroup<ODR>;
434def err_odr_tag_type_inconsistent
435    : Error<"type %0 has incompatible definitions in different translation "
436            "units">;
437def warn_odr_tag_type_inconsistent
438    : Warning<"type %0 has incompatible definitions in different translation "
439              "units">,
440      InGroup<ODR>;
441def note_odr_tag_kind_here: Note<
442  "%0 is a %select{struct|interface|union|class|enum}1 here">;
443def note_odr_field : Note<"field %0 has type %1 here">;
444def note_odr_field_name : Note<"field has name %0 here">;
445def note_odr_missing_field : Note<"no corresponding field here">;
446def note_odr_base : Note<"class has base type %0">;
447def note_odr_virtual_base : Note<
448  "%select{non-virtual|virtual}0 derivation here">;
449def note_odr_missing_base : Note<"no corresponding base class here">;
450def note_odr_number_of_bases : Note<
451  "class has %0 base %plural{1:class|:classes}0">;
452def note_odr_enumerator : Note<"enumerator %0 with value %1 here">;
453def note_odr_missing_enumerator : Note<"no corresponding enumerator here">;
454def err_odr_field_type_inconsistent : Error<
455  "field %0 declared with incompatible types in different "
456  "translation units (%1 vs. %2)">;
457def warn_odr_field_type_inconsistent : Warning<
458  "field %0 declared with incompatible types in different "
459  "translation units (%1 vs. %2)">,
460  InGroup<ODR>;
461
462// Importing Objective-C ASTs
463def err_odr_ivar_type_inconsistent : Error<
464  "instance variable %0 declared with incompatible types in different "
465  "translation units (%1 vs. %2)">;
466def warn_odr_ivar_type_inconsistent : Warning<
467  "instance variable %0 declared with incompatible types in different "
468  "translation units (%1 vs. %2)">,
469  InGroup<ODR>;
470def err_odr_objc_superclass_inconsistent : Error<
471  "class %0 has incompatible superclasses">;
472def warn_odr_objc_superclass_inconsistent : Warning<
473  "class %0 has incompatible superclasses">,
474  InGroup<ODR>;
475def note_odr_objc_superclass : Note<"inherits from superclass %0 here">;
476def note_odr_objc_missing_superclass : Note<"no corresponding superclass here">;
477def err_odr_objc_method_result_type_inconsistent : Error<
478  "%select{class|instance}0 method %1 has incompatible result types in "
479  "different translation units (%2 vs. %3)">;
480def warn_odr_objc_method_result_type_inconsistent : Warning<
481  "%select{class|instance}0 method %1 has incompatible result types in "
482  "different translation units (%2 vs. %3)">,
483  InGroup<ODR>;
484def err_odr_objc_method_num_params_inconsistent : Error<
485  "%select{class|instance}0 method %1 has a different number of parameters in "
486  "different translation units (%2 vs. %3)">;
487def warn_odr_objc_method_num_params_inconsistent : Warning<
488  "%select{class|instance}0 method %1 has a different number of parameters in "
489  "different translation units (%2 vs. %3)">,
490  InGroup<ODR>;
491def err_odr_objc_method_param_type_inconsistent : Error<
492  "%select{class|instance}0 method %1 has a parameter with a different types "
493  "in different translation units (%2 vs. %3)">;
494def warn_odr_objc_method_param_type_inconsistent : Warning<
495  "%select{class|instance}0 method %1 has a parameter with a different types "
496  "in different translation units (%2 vs. %3)">,
497  InGroup<ODR>;
498def err_odr_objc_method_variadic_inconsistent : Error<
499  "%select{class|instance}0 method %1 is variadic in one translation unit "
500  "and not variadic in another">;
501def warn_odr_objc_method_variadic_inconsistent : Warning<
502  "%select{class|instance}0 method %1 is variadic in one translation unit "
503  "and not variadic in another">,
504  InGroup<ODR>;
505def note_odr_objc_method_here : Note<
506  "%select{class|instance}0 method %1 also declared here">;
507def err_odr_objc_property_type_inconsistent : Error<
508  "property %0 declared with incompatible types in different "
509  "translation units (%1 vs. %2)">;
510def warn_odr_objc_property_type_inconsistent : Warning<
511  "property %0 declared with incompatible types in different "
512  "translation units (%1 vs. %2)">,
513  InGroup<ODR>;
514def err_odr_objc_property_impl_kind_inconsistent : Error<
515  "property %0 is implemented with %select{@synthesize|@dynamic}1 in one "
516  "translation but %select{@dynamic|@synthesize}1 in another translation unit">;
517def warn_odr_objc_property_impl_kind_inconsistent : Warning<
518  "property %0 is implemented with %select{@synthesize|@dynamic}1 in one "
519  "translation but %select{@dynamic|@synthesize}1 in another translation unit">,
520  InGroup<ODR>;
521def note_odr_objc_property_impl_kind : Note<
522  "property %0 is implemented with %select{@synthesize|@dynamic}1 here">;
523def err_odr_objc_synthesize_ivar_inconsistent : Error<
524  "property %0 is synthesized to different ivars in different translation "
525  "units (%1 vs. %2)">;
526def warn_odr_objc_synthesize_ivar_inconsistent : Warning<
527  "property %0 is synthesized to different ivars in different translation "
528  "units (%1 vs. %2)">,
529  InGroup<ODR>;
530def note_odr_objc_synthesize_ivar_here : Note<
531  "property is synthesized to ivar %0 here">;
532
533// Importing C++ ASTs
534def note_odr_friend : Note<"friend declared here">;
535def note_odr_missing_friend : Note<"no corresponding friend here">;
536def err_odr_different_num_template_parameters : Error<
537  "template parameter lists have a different number of parameters (%0 vs %1)">;
538def warn_odr_different_num_template_parameters : Warning<
539  "template parameter lists have a different number of parameters (%0 vs %1)">,
540  InGroup<ODR>;
541def note_odr_template_parameter_list : Note<
542  "template parameter list also declared here">;
543def err_odr_different_template_parameter_kind : Error<
544  "template parameter has different kinds in different translation units">;
545def warn_odr_different_template_parameter_kind : Warning<
546  "template parameter has different kinds in different translation units">,
547  InGroup<ODR>;
548def note_odr_template_parameter_here : Note<
549  "template parameter declared here">;
550def err_odr_parameter_pack_non_pack : Error<
551  "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">;
552def warn_odr_parameter_pack_non_pack : Warning<
553  "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">,
554  InGroup<ODR>;
555def note_odr_parameter_pack_non_pack : Note<
556  "%select{parameter|parameter pack}0 declared here">;
557def err_odr_non_type_parameter_type_inconsistent : Error<
558  "non-type template parameter declared with incompatible types in different "
559  "translation units (%0 vs. %1)">;
560def warn_odr_non_type_parameter_type_inconsistent : Warning<
561  "non-type template parameter declared with incompatible types in different "
562  "translation units (%0 vs. %1)">,
563  InGroup<ODR>;
564def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">;
565
566def remark_sanitize_address_insert_extra_padding_accepted : Remark<
567    "-fsanitize-address-field-padding applied to %0">, ShowInSystemHeader,
568    InGroup<SanitizeAddressRemarks>;
569def remark_sanitize_address_insert_extra_padding_rejected : Remark<
570    "-fsanitize-address-field-padding ignored for %0 because it "
571    "%select{is not C++|is packed|is a union|is trivially copyable|"
572    "has trivial destructor|is standard layout|is in a ignorelisted file|"
573    "is ignorelisted}1">, ShowInSystemHeader,
574    InGroup<SanitizeAddressRemarks>;
575
576def warn_npot_ms_struct : Warning<
577  "ms_struct may not produce Microsoft-compatible layouts with fundamental "
578  "data types with sizes that aren't a power of two">,
579  DefaultError, InGroup<IncompatibleMSStruct>;
580
581// -Wpadded, -Wpacked
582def warn_padded_struct_field : Warning<
583  "padding %select{struct|interface|class}0 %1 with %2 "
584  "%select{byte|bit}3%s2 to align %4">,
585  InGroup<Padded>, DefaultIgnore;
586def warn_padded_struct_anon_field : Warning<
587  "padding %select{struct|interface|class}0 %1 with %2 "
588  "%select{byte|bit}3%s2 to align anonymous bit-field">,
589  InGroup<Padded>, DefaultIgnore;
590def warn_padded_struct_size : Warning<
591  "padding size of %0 with %1 %select{byte|bit}2%s1 to alignment boundary">,
592  InGroup<Padded>, DefaultIgnore;
593def warn_unnecessary_packed : Warning<
594  "packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore;
595
596// -Wunaligned-access
597def warn_unaligned_access : Warning<
598  "field %1 within %0 is less aligned than %2 and is usually due to %0 being "
599  "packed, which can lead to unaligned accesses">, InGroup<UnalignedAccess>, DefaultIgnore;
600}
601