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