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 | |
9 | let Component = "AST" in { |
10 | |
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|cast that performs the conversions of" |
15 | " a reinterpret_cast|cast from %1}0 is not allowed in a constant expression">; |
16 | def note_constexpr_invalid_downcast : Note< |
17 | "cannot cast object of dynamic type %0 to type %1">; |
18 | def note_constexpr_overflow : Note< |
19 | "value %0 is outside the range of representable values of type %1">; |
20 | def note_constexpr_negative_shift : Note<"negative shift count %0">; |
21 | def note_constexpr_large_shift : Note< |
22 | "shift count %0 >= width of type %1 (%2 bit%s2)">; |
23 | def note_constexpr_lshift_of_negative : Note<"left shift of negative value %0">; |
24 | def note_constexpr_lshift_discards : Note<"signed left shift discards bits">; |
25 | def note_constexpr_invalid_function : Note< |
26 | "%select{non-constexpr|undefined}0 %select{function|constructor}1 %2 cannot " |
27 | "be used in a constant expression">; |
28 | def note_constexpr_invalid_inhctor : Note< |
29 | "constructor inherited from base class %0 cannot be used in a " |
30 | "constant expression; derived class cannot be implicitly initialized">; |
31 | def note_constexpr_no_return : Note< |
32 | "control reached end of constexpr function">; |
33 | def note_constexpr_virtual_call : Note< |
34 | "cannot evaluate virtual function call in a constant expression">; |
35 | def note_constexpr_virtual_base : Note< |
36 | "cannot construct object of type %0 with virtual base class " |
37 | "in a constant expression">; |
38 | def note_constexpr_nonliteral : Note< |
39 | "non-literal type %0 cannot be used in a constant expression">; |
40 | def note_constexpr_non_global : Note< |
41 | "%select{pointer|reference}0 to %select{|subobject of }1" |
42 | "%select{temporary|%3}2 is not a constant expression">; |
43 | def note_constexpr_uninitialized : Note< |
44 | "%select{|sub}0object of type %1 is not initialized">; |
45 | def note_constexpr_array_index : Note<"cannot refer to element %0 of " |
46 | "%select{array of %2 element%plural{1:|:s}2|non-array object}1 " |
47 | "in a constant expression">; |
48 | def note_constexpr_float_arithmetic : Note< |
49 | "floating point arithmetic produces %select{an infinity|a NaN}0">; |
50 | def note_constexpr_pointer_subtraction_not_same_array : Note< |
51 | "subtracted pointers are not elements of the same array">; |
52 | def note_constexpr_pointer_subtraction_zero_size : Note< |
53 | "subtraction of pointers to type %0 of zero size">; |
54 | def note_constexpr_pointer_comparison_base_classes : Note< |
55 | "comparison of addresses of subobjects of different base classes " |
56 | "has unspecified value">; |
57 | def note_constexpr_pointer_comparison_base_field : Note< |
58 | "comparison of address of base class subobject %0 of class %1 to field %2 " |
59 | "has unspecified value">; |
60 | def note_constexpr_pointer_comparison_differing_access : Note< |
61 | "comparison of address of fields %0 and %2 of %4 with differing access " |
62 | "specifiers (%1 vs %3) has unspecified value">; |
63 | def note_constexpr_compare_virtual_mem_ptr : Note< |
64 | "comparison of pointer to virtual member function %0 has unspecified value">; |
65 | def note_constexpr_past_end : Note< |
66 | "dereferenced pointer past the end of %select{|subobject of }0" |
67 | "%select{temporary|%2}1 is not a constant expression">; |
68 | def note_constexpr_past_end_subobject : Note< |
69 | "cannot %select{access base class of|access derived class of|access field of|" |
70 | "access array element of|ERROR|call member function on|" |
71 | "access real component of|access imaginary component of}0 " |
72 | "pointer past the end of object">; |
73 | def note_constexpr_null_subobject : Note< |
74 | "cannot %select{access base class of|access derived class of|access field of|" |
75 | "access array element of|perform pointer arithmetic on|" |
76 | "call member function on|access real component of|" |
77 | "access imaginary component of}0 null pointer">; |
78 | def note_constexpr_var_init_non_constant : Note< |
79 | "initializer of %0 is not a constant expression">; |
80 | def note_constexpr_typeid_polymorphic : Note< |
81 | "typeid applied to expression of polymorphic type %0 is " |
82 | "not allowed in a constant expression">; |
83 | def note_constexpr_void_comparison : Note< |
84 | "comparison between unequal pointers to void has unspecified result">; |
85 | def note_constexpr_temporary_here : Note<"temporary created here">; |
86 | def note_constexpr_conditional_never_const : Note< |
87 | "both arms of conditional operator are unable to produce a " |
88 | "constant expression">; |
89 | def note_constexpr_depth_limit_exceeded : Note< |
90 | "constexpr evaluation exceeded maximum depth of %0 calls">; |
91 | def note_constexpr_call_limit_exceeded : Note< |
92 | "constexpr evaluation hit maximum call limit">; |
93 | def note_constexpr_step_limit_exceeded : Note< |
94 | "constexpr evaluation hit maximum step limit; possible infinite loop?">; |
95 | def note_constexpr_this : Note< |
96 | "%select{|implicit }0use of 'this' pointer is only allowed within the " |
97 | "evaluation of a call to a 'constexpr' member function">; |
98 | def note_constexpr_lifetime_ended : Note< |
99 | "%select{read of|assignment to|increment of|decrement of}0 " |
100 | "%select{temporary|variable}1 whose lifetime has ended">; |
101 | def note_constexpr_access_uninit : Note< |
102 | "%select{read of|assignment to|increment of|decrement of}0 " |
103 | "object outside its lifetime is not allowed in a constant expression">; |
104 | def note_constexpr_use_uninit_reference : Note< |
105 | "use of reference outside its lifetime " |
106 | "is not allowed in a constant expression">; |
107 | def note_constexpr_modify_const_type : Note< |
108 | "modification of object of const-qualified type %0 is not allowed " |
109 | "in a constant expression">; |
110 | def note_constexpr_access_volatile_type : Note< |
111 | "%select{read of|assignment to|increment of|decrement of}0 " |
112 | "volatile-qualified type %1 is not allowed in a constant expression">; |
113 | def note_constexpr_access_volatile_obj : Note< |
114 | "%select{read of|assignment to|increment of|decrement of}0 volatile " |
115 | "%select{temporary|object %2|member %2}1 is not allowed in " |
116 | "a constant expression">; |
117 | def note_constexpr_ltor_mutable : Note< |
118 | "read of mutable member %0 is not allowed in a constant expression">; |
119 | def note_constexpr_ltor_non_const_int : Note< |
120 | "read of non-const variable %0 is not allowed in a constant expression">; |
121 | def note_constexpr_ltor_non_constexpr : Note< |
122 | "read of non-constexpr variable %0 is not allowed in a constant expression">; |
123 | def note_constexpr_ltor_incomplete_type : Note< |
124 | "read of incomplete type %0 is not allowed in a constant expression">; |
125 | def note_constexpr_access_null : Note< |
126 | "%select{read of|assignment to|increment of|decrement of}0 " |
127 | "dereferenced null pointer is not allowed in a constant expression">; |
128 | def note_constexpr_access_past_end : Note< |
129 | "%select{read of|assignment to|increment of|decrement of}0 " |
130 | "dereferenced one-past-the-end pointer is not allowed in a constant expression">; |
131 | def note_constexpr_access_unsized_array : Note< |
132 | "%select{read of|assignment to|increment of|decrement of}0 " |
133 | "pointer to element of array without known bound " |
134 | "is not allowed in a constant expression">; |
135 | def note_constexpr_access_inactive_union_member : Note< |
136 | "%select{read of|assignment to|increment of|decrement of}0 " |
137 | "member %1 of union with %select{active member %3|no active member}2 " |
138 | "is not allowed in a constant expression">; |
139 | def note_constexpr_access_static_temporary : Note< |
140 | "%select{read of|assignment to|increment of|decrement of}0 temporary " |
141 | "is not allowed in a constant expression outside the expression that " |
142 | "created the temporary">; |
143 | def note_constexpr_modify_global : Note< |
144 | "a constant expression cannot modify an object that is visible outside " |
145 | "that expression">; |
146 | def note_constexpr_stmt_expr_unsupported : Note< |
147 | "this use of statement expressions is not supported in a " |
148 | "constant expression">; |
149 | def note_constexpr_calls_suppressed : Note< |
150 | "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to " |
151 | "see all)">; |
152 | def note_constexpr_call_here : Note<"in call to '%0'">; |
153 | def note_constexpr_inherited_ctor_call_here : Note< |
154 | "in implicit initialization for inherited constructor of %0">; |
155 | def note_constexpr_baa_insufficient_alignment : Note< |
156 | "%select{alignment of|offset of the aligned pointer from}0 the base pointee " |
157 | "object (%1 %plural{1:byte|:bytes}1) is %select{less than|not a multiple of}0 the " |
158 | "asserted %2 %plural{1:byte|:bytes}2">; |
159 | def note_constexpr_baa_value_insufficient_alignment : Note< |
160 | "value of the aligned pointer (%0) is not a multiple of the asserted %1 " |
161 | "%plural{1:byte|:bytes}1">; |
162 | def note_constexpr_unsupported_unsized_array : Note< |
163 | "array-to-pointer decay of array member without known bound is not supported">; |
164 | def note_constexpr_unsized_array_indexed : Note< |
165 | "indexing of array without known bound is not allowed " |
166 | "in a constant expression">; |
167 | def note_constexpr_memcpy_null : Note< |
168 | "%select{source|destination}2 of " |
169 | "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' " |
170 | "is %3">; |
171 | def note_constexpr_memcpy_type_pun : Note< |
172 | "cannot constant evaluate '%select{memcpy|memmove}0' from object of " |
173 | "type %1 to object of type %2">; |
174 | def note_constexpr_memcpy_nontrivial : Note< |
175 | "cannot constant evaluate '%select{memcpy|memmove}0' between objects of " |
176 | "non-trivially-copyable type %1">; |
177 | def note_constexpr_memcpy_incomplete_type : Note< |
178 | "cannot constant evaluate '%select{memcpy|memmove}0' between objects of " |
179 | "incomplete type %1">; |
180 | def note_constexpr_memcpy_overlap : Note< |
181 | "'%select{memcpy|wmemcpy}0' between overlapping memory regions">; |
182 | def note_constexpr_memcpy_unsupported : Note< |
183 | "'%select{%select{memcpy|wmemcpy}1|%select{memmove|wmemmove}1}0' " |
184 | "not supported: %select{" |
185 | "size to copy (%4) is not a multiple of size of element type %3 (%5)|" |
186 | "source is not a contiguous array of at least %4 elements of type %3|" |
187 | "destination is not a contiguous array of at least %4 elements of type %3}2">; |
188 | |
189 | def warn_integer_constant_overflow : Warning< |
190 | "overflow in expression; result is %0 with type %1">, |
191 | InGroup<DiagGroup<"integer-overflow">>; |
192 | |
193 | // This is a temporary diagnostic, and shall be removed once our |
194 | // implementation is complete, and like the preceding constexpr notes belongs |
195 | // in Sema. |
196 | def note_unimplemented_constexpr_lambda_feature_ast : Note< |
197 | "unimplemented constexpr lambda feature: %0 (coming soon!)">; |
198 | |
199 | // inline asm related. |
200 | let CategoryName = "Inline Assembly Issue" in { |
201 | def err_asm_invalid_escape : Error< |
202 | "invalid %% escape in inline assembly string">; |
203 | def err_asm_unknown_symbolic_operand_name : Error< |
204 | "unknown symbolic operand name in inline assembly string">; |
205 | |
206 | def err_asm_unterminated_symbolic_operand_name : Error< |
207 | "unterminated symbolic operand name in inline assembly string">; |
208 | def err_asm_empty_symbolic_operand_name : Error< |
209 | "empty symbolic operand name in inline assembly string">; |
210 | def err_asm_invalid_operand_number : Error< |
211 | "invalid operand number in inline asm string">; |
212 | } |
213 | |
214 | // vtable related. |
215 | let CategoryName = "VTable ABI Issue" in { |
216 | def err_vftable_ambiguous_component : Error< |
217 | "ambiguous vftable component for %0 introduced via covariant thunks; " |
218 | "this is an inherent limitation of the ABI">; |
219 | def note_covariant_thunk : Note< |
220 | "covariant thunk required by %0">; |
221 | } |
222 | |
223 | // Importing ASTs |
224 | def err_odr_variable_type_inconsistent : Error< |
225 | "external variable %0 declared with incompatible types in different " |
226 | "translation units (%1 vs. %2)">; |
227 | def err_odr_variable_multiple_def : Error< |
228 | "external variable %0 defined in multiple translation units">; |
229 | def note_odr_value_here : Note<"declared here with type %0">; |
230 | def note_odr_defined_here : Note<"also defined here">; |
231 | def err_odr_function_type_inconsistent : Error< |
232 | "external function %0 declared with incompatible types in different " |
233 | "translation units (%1 vs. %2)">; |
234 | def warn_odr_tag_type_inconsistent |
235 | : Warning<"type %0 has incompatible definitions in different translation " |
236 | "units">, |
237 | InGroup<DiagGroup<"odr">>; |
238 | def err_odr_tag_type_inconsistent |
239 | : Error<"type %0 has incompatible definitions in different translation " |
240 | "units">; |
241 | def note_odr_tag_kind_here: Note< |
242 | "%0 is a %select{struct|interface|union|class|enum}1 here">; |
243 | def note_odr_field : Note<"field %0 has type %1 here">; |
244 | def note_odr_field_name : Note<"field has name %0 here">; |
245 | def note_odr_missing_field : Note<"no corresponding field here">; |
246 | def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">; |
247 | def note_odr_not_bit_field : Note<"field %0 is not a bit-field">; |
248 | def note_odr_base : Note<"class has base type %0">; |
249 | def note_odr_virtual_base : Note< |
250 | "%select{non-virtual|virtual}0 derivation here">; |
251 | def note_odr_missing_base : Note<"no corresponding base class here">; |
252 | def note_odr_number_of_bases : Note< |
253 | "class has %0 base %plural{1:class|:classes}0">; |
254 | def note_odr_enumerator : Note<"enumerator %0 with value %1 here">; |
255 | def note_odr_missing_enumerator : Note<"no corresponding enumerator here">; |
256 | |
257 | def err_odr_field_type_inconsistent : Error< |
258 | "field %0 declared with incompatible types in different " |
259 | "translation units (%1 vs. %2)">; |
260 | |
261 | // Importing Objective-C ASTs |
262 | def err_odr_ivar_type_inconsistent : Error< |
263 | "instance variable %0 declared with incompatible types in different " |
264 | "translation units (%1 vs. %2)">; |
265 | def err_odr_objc_superclass_inconsistent : Error< |
266 | "class %0 has incompatible superclasses">; |
267 | def note_odr_objc_superclass : Note<"inherits from superclass %0 here">; |
268 | def note_odr_objc_missing_superclass : Note<"no corresponding superclass here">; |
269 | def err_odr_objc_method_result_type_inconsistent : Error< |
270 | "%select{class|instance}0 method %1 has incompatible result types in " |
271 | "different translation units (%2 vs. %3)">; |
272 | def err_odr_objc_method_num_params_inconsistent : Error< |
273 | "%select{class|instance}0 method %1 has a different number of parameters in " |
274 | "different translation units (%2 vs. %3)">; |
275 | def err_odr_objc_method_param_type_inconsistent : Error< |
276 | "%select{class|instance}0 method %1 has a parameter with a different types " |
277 | "in different translation units (%2 vs. %3)">; |
278 | def err_odr_objc_method_variadic_inconsistent : Error< |
279 | "%select{class|instance}0 method %1 is variadic in one translation unit " |
280 | "and not variadic in another">; |
281 | def note_odr_objc_method_here : Note< |
282 | "%select{class|instance}0 method %1 also declared here">; |
283 | def err_odr_objc_property_type_inconsistent : Error< |
284 | "property %0 declared with incompatible types in different " |
285 | "translation units (%1 vs. %2)">; |
286 | def err_odr_objc_property_impl_kind_inconsistent : Error< |
287 | "property %0 is implemented with %select{@synthesize|@dynamic}1 in one " |
288 | "translation but %select{@dynamic|@synthesize}1 in another translation unit">; |
289 | def note_odr_objc_property_impl_kind : Note< |
290 | "property %0 is implemented with %select{@synthesize|@dynamic}1 here">; |
291 | def err_odr_objc_synthesize_ivar_inconsistent : Error< |
292 | "property %0 is synthesized to different ivars in different translation " |
293 | "units (%1 vs. %2)">; |
294 | def note_odr_objc_synthesize_ivar_here : Note< |
295 | "property is synthesized to ivar %0 here">; |
296 | |
297 | // Importing C++ ASTs |
298 | def note_odr_friend : Note<"friend declared here">; |
299 | def note_odr_missing_friend : Note<"no corresponding friend here">; |
300 | def err_odr_different_num_template_parameters : Error< |
301 | "template parameter lists have a different number of parameters (%0 vs %1)">; |
302 | def note_odr_template_parameter_list : Note< |
303 | "template parameter list also declared here">; |
304 | def err_odr_different_template_parameter_kind : Error< |
305 | "template parameter has different kinds in different translation units">; |
306 | def note_odr_template_parameter_here : Note< |
307 | "template parameter declared here">; |
308 | def err_odr_parameter_pack_non_pack : Error< |
309 | "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">; |
310 | def note_odr_parameter_pack_non_pack : Note< |
311 | "%select{parameter|parameter pack}0 declared here">; |
312 | def err_odr_non_type_parameter_type_inconsistent : Error< |
313 | "non-type template parameter declared with incompatible types in different " |
314 | "translation units (%0 vs. %1)">; |
315 | def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">; |
316 | |
317 | def remark_sanitize_address_insert_extra_padding_accepted : Remark< |
318 | "-fsanitize-address-field-padding applied to %0">, ShowInSystemHeader, |
319 | InGroup<SanitizeAddressRemarks>; |
320 | def remark_sanitize_address_insert_extra_padding_rejected : Remark< |
321 | "-fsanitize-address-field-padding ignored for %0 because it " |
322 | "%select{is not C++|is packed|is a union|is trivially copyable|" |
323 | "has trivial destructor|is standard layout|is in a blacklisted file|" |
324 | "is blacklisted}1">, ShowInSystemHeader, |
325 | InGroup<SanitizeAddressRemarks>; |
326 | |
327 | def warn_npot_ms_struct : Warning< |
328 | "ms_struct may not produce Microsoft-compatible layouts with fundamental " |
329 | "data types with sizes that aren't a power of two">, |
330 | DefaultError, InGroup<IncompatibleMSStruct>; |
331 | |
332 | // -Wpadded, -Wpacked |
333 | def warn_padded_struct_field : Warning< |
334 | "padding %select{struct|interface|class}0 %1 with %2 " |
335 | "%select{byte|bit}3%s2 to align %4">, |
336 | InGroup<Padded>, DefaultIgnore; |
337 | def warn_padded_struct_anon_field : Warning< |
338 | "padding %select{struct|interface|class}0 %1 with %2 " |
339 | "%select{byte|bit}3%s2 to align anonymous bit-field">, |
340 | InGroup<Padded>, DefaultIgnore; |
341 | def warn_padded_struct_size : Warning< |
342 | "padding size of %0 with %1 %select{byte|bit}2%s1 to alignment boundary">, |
343 | InGroup<Padded>, DefaultIgnore; |
344 | def warn_unnecessary_packed : Warning< |
345 | "packed attribute is unnecessary for %0">, InGroup<Packed>, DefaultIgnore; |
346 | } |
347 | |