1//==--- DiagnosticASTKinds.td - libast diagnostics ------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10let Component = "AST" in {
11
12// Constant expression diagnostics. These (and their users) belong in Sema.
13def note_expr_divide_by_zero : Note<"division by zero">;
14def 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">;
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_no_return : Note<
30  "control reached end of constexpr function">;
31def note_constexpr_virtual_call : Note<
32  "cannot evaluate virtual function call in a constant expression">;
33def note_constexpr_virtual_base : Note<
34  "cannot construct object of type %0 with virtual base class "
35  "in a constant expression">;
36def note_constexpr_nonliteral : Note<
37  "non-literal type %0 cannot be used in a constant expression">;
38def note_constexpr_non_global : Note<
39  "%select{pointer|reference}0 to %select{|subobject of }1"
40  "%select{temporary|%3}2 is not a constant expression">;
41def note_constexpr_uninitialized : Note<
42  "%select{|sub}0object of type %1 is not initialized">;
43def note_constexpr_array_index : Note<"cannot refer to element %0 of "
44  "%select{array of %2 elements|non-array object}1 in a constant expression">;
45def note_constexpr_float_arithmetic : Note<
46  "floating point arithmetic produces %select{an infinity|a NaN}0">;
47def note_constexpr_pointer_subtraction_not_same_array : Note<
48  "subtracted pointers are not elements of the same array">;
49def note_constexpr_pointer_subtraction_zero_size : Note<
50  "subtraction of pointers to type %0 of zero size">;
51def note_constexpr_pointer_comparison_base_classes : Note<
52  "comparison of addresses of subobjects of different base classes "
53  "has unspecified value">;
54def note_constexpr_pointer_comparison_base_field : Note<
55  "comparison of address of base class subobject %0 of class %1 to field %2 "
56  "has unspecified value">;
57def note_constexpr_pointer_comparison_differing_access : Note<
58  "comparison of address of fields %0 and %2 of %4 with differing access "
59  "specifiers (%1 vs %3) has unspecified value">;
60def note_constexpr_compare_virtual_mem_ptr : Note<
61  "comparison of pointer to virtual member function %0 has unspecified value">;
62def note_constexpr_past_end : Note<
63  "dereferenced pointer past the end of %select{|subobject of }0"
64  "%select{temporary|%2}1 is not a constant expression">;
65def note_constexpr_past_end_subobject : Note<
66  "cannot %select{access base class of|access derived class of|access field of|"
67  "access array element of|ERROR|call member function on|"
68  "access real component of|access imaginary component of}0 "
69  "pointer past the end of object">;
70def note_constexpr_null_subobject : Note<
71  "cannot %select{access base class of|access derived class of|access field of|"
72  "access array element of|perform pointer arithmetic on|"
73  "call member function on|access real component of|"
74  "access imaginary component of}0 null pointer">;
75def note_constexpr_var_init_non_constant : Note<
76  "initializer of %0 is not a constant expression">;
77def note_constexpr_typeid_polymorphic : Note<
78  "typeid applied to expression of polymorphic type %0 is "
79  "not allowed in a constant expression">;
80def note_constexpr_void_comparison : Note<
81  "comparison between unequal pointers to void has unspecified result">;
82def note_constexpr_temporary_here : Note<"temporary created here">;
83def note_constexpr_conditional_never_const : Note<
84  "both arms of conditional operator are unable to produce a "
85  "constant expression">;
86def note_constexpr_depth_limit_exceeded : Note<
87  "constexpr evaluation exceeded maximum depth of %0 calls">;
88def note_constexpr_call_limit_exceeded : Note<
89  "constexpr evaluation hit maximum call limit">;
90def note_constexpr_step_limit_exceeded : Note<
91  "constexpr evaluation hit maximum step limit; possible infinite loop?">;
92def note_constexpr_this : Note<
93  "%select{|implicit }0use of 'this' pointer is only allowed within the "
94  "evaluation of a call to a 'constexpr' member function">;
95def note_constexpr_lifetime_ended : Note<
96  "%select{read of|assignment to|increment of|decrement of}0 "
97  "%select{temporary|variable}1 whose lifetime has ended">;
98def note_constexpr_access_uninit : Note<
99  "%select{read of|assignment to|increment of|decrement of}0 "
100  "object outside its lifetime is not allowed in a constant expression">;
101def note_constexpr_use_uninit_reference : Note<
102  "use of reference outside its lifetime "
103  "is not allowed in a constant expression">;
104def note_constexpr_modify_const_type : Note<
105  "modification of object of const-qualified type %0 is not allowed "
106  "in a constant expression">;
107def note_constexpr_access_volatile_type : Note<
108  "%select{read of|assignment to|increment of|decrement of}0 "
109  "volatile-qualified type %1 is not allowed in a constant expression">;
110def note_constexpr_access_volatile_obj : Note<
111  "%select{read of|assignment to|increment of|decrement of}0 volatile "
112  "%select{temporary|object %2|member %2}1 is not allowed in "
113  "a constant expression">;
114def note_constexpr_ltor_mutable : Note<
115  "read of mutable member %0 is not allowed in a constant expression">;
116def note_constexpr_ltor_non_const_int : Note<
117  "read of non-const variable %0 is not allowed in a constant expression">;
118def note_constexpr_ltor_non_constexpr : Note<
119  "read of non-constexpr variable %0 is not allowed in a constant expression">;
120def note_constexpr_access_null : Note<
121  "%select{read of|assignment to|increment of|decrement of}0 "
122  "dereferenced null pointer is not allowed in a constant expression">;
123def note_constexpr_access_past_end : Note<
124  "%select{read of|assignment to|increment of|decrement of}0 "
125  "dereferenced one-past-the-end pointer is not allowed in a constant expression">;
126def note_constexpr_access_inactive_union_member : Note<
127  "%select{read of|assignment to|increment of|decrement of}0 "
128  "member %1 of union with %select{active member %3|no active member}2 "
129  "is not allowed in a constant expression">;
130def note_constexpr_access_static_temporary : Note<
131  "%select{read of|assignment to|increment of|decrement of}0 temporary "
132  "is not allowed in a constant expression outside the expression that "
133  "created the temporary">;
134def note_constexpr_modify_global : Note<
135  "a constant expression cannot modify an object that is visible outside "
136  "that expression">;
137def note_constexpr_stmt_expr_unsupported : Note<
138  "this use of statement expressions is not supported in a "
139  "constant expression">;
140def note_constexpr_calls_suppressed : Note<
141  "(skipping %0 call%s0 in backtrace; use -fconstexpr-backtrace-limit=0 to "
142  "see all)">;
143def note_constexpr_call_here : Note<"in call to '%0'">;
144
145def warn_integer_constant_overflow : Warning<
146  "overflow in expression; result is %0 with type %1">,
147  InGroup<DiagGroup<"integer-overflow">>;
148
149// inline asm related.
150let CategoryName = "Inline Assembly Issue" in {
151  def err_asm_invalid_escape : Error<
152    "invalid %% escape in inline assembly string">;
153  def err_asm_unknown_symbolic_operand_name : Error<
154    "unknown symbolic operand name in inline assembly string">;
155
156  def err_asm_unterminated_symbolic_operand_name : Error<
157    "unterminated symbolic operand name in inline assembly string">;
158  def err_asm_empty_symbolic_operand_name : Error<
159    "empty symbolic operand name in inline assembly string">;
160  def err_asm_invalid_operand_number : Error<
161    "invalid operand number in inline asm string">;
162}
163
164
165// Importing ASTs
166def err_odr_variable_type_inconsistent : Error<
167  "external variable %0 declared with incompatible types in different "
168  "translation units (%1 vs. %2)">;
169def err_odr_variable_multiple_def : Error<
170  "external variable %0 defined in multiple translation units">;
171def note_odr_value_here : Note<"declared here with type %0">;
172def note_odr_defined_here : Note<"also defined here">;
173def err_odr_function_type_inconsistent : Error<
174  "external function %0 declared with incompatible types in different "
175  "translation units (%1 vs. %2)">;
176def warn_odr_tag_type_inconsistent : Warning<
177  "type %0 has incompatible definitions in different translation units">,
178  InGroup<DiagGroup<"odr">>;
179def note_odr_tag_kind_here: Note<
180  "%0 is a %select{struct|interface|union|class|enum}1 here">;
181def note_odr_field : Note<"field %0 has type %1 here">;
182def note_odr_missing_field : Note<"no corresponding field here">;
183def note_odr_bit_field : Note<"bit-field %0 with type %1 and length %2 here">;
184def note_odr_not_bit_field : Note<"field %0 is not a bit-field">;
185def note_odr_base : Note<"class has base type %0">;
186def note_odr_virtual_base : Note<
187  "%select{non-virtual|virtual}0 derivation here">;
188def note_odr_missing_base : Note<"no corresponding base class here">;
189def note_odr_number_of_bases : Note<
190  "class has %0 base %plural{1:class|:classes}0">;
191def note_odr_enumerator : Note<"enumerator %0 with value %1 here">;
192def note_odr_missing_enumerator : Note<"no corresponding enumerator here">;
193
194def err_odr_field_type_inconsistent : Error<
195  "field %0 declared with incompatible types in different "
196  "translation units (%1 vs. %2)">;
197
198// Importing Objective-C ASTs
199def err_odr_ivar_type_inconsistent : Error<
200  "instance variable %0 declared with incompatible types in different "
201  "translation units (%1 vs. %2)">;
202def err_odr_objc_superclass_inconsistent : Error<
203  "class %0 has incompatible superclasses">;
204def note_odr_objc_superclass : Note<"inherits from superclass %0 here">;
205def note_odr_objc_missing_superclass : Note<"no corresponding superclass here">;
206def err_odr_objc_method_result_type_inconsistent : Error<
207  "%select{class|instance}0 method %1 has incompatible result types in "
208  "different translation units (%2 vs. %3)">;
209def err_odr_objc_method_num_params_inconsistent : Error<
210  "%select{class|instance}0 method %1 has a different number of parameters in "
211  "different translation units (%2 vs. %3)">;
212def err_odr_objc_method_param_type_inconsistent : Error<
213  "%select{class|instance}0 method %1 has a parameter with a different types "
214  "in different translation units (%2 vs. %3)">;
215def err_odr_objc_method_variadic_inconsistent : Error<
216  "%select{class|instance}0 method %1 is variadic in one translation unit "
217  "and not variadic in another">;
218def note_odr_objc_method_here : Note<
219  "%select{class|instance}0 method %1 also declared here">;
220def err_odr_objc_property_type_inconsistent : Error<
221  "property %0 declared with incompatible types in different "
222  "translation units (%1 vs. %2)">;
223def err_odr_objc_property_impl_kind_inconsistent : Error<
224  "property %0 is implemented with %select{@synthesize|@dynamic}1 in one "
225  "translation but %select{@dynamic|@synthesize}1 in another translation unit">;
226def note_odr_objc_property_impl_kind : Note<
227  "property %0 is implemented with %select{@synthesize|@dynamic}1 here">;
228def err_odr_objc_synthesize_ivar_inconsistent : Error<
229  "property %0 is synthesized to different ivars in different translation "
230  "units (%1 vs. %2)">;
231def note_odr_objc_synthesize_ivar_here : Note<
232  "property is synthesized to ivar %0 here">;
233
234// Importing C++ ASTs
235def err_odr_different_num_template_parameters : Error<
236  "template parameter lists have a different number of parameters (%0 vs %1)">;
237def note_odr_template_parameter_list : Note<
238  "template parameter list also declared here">;
239def err_odr_different_template_parameter_kind : Error<
240  "template parameter has different kinds in different translation units">;
241def note_odr_template_parameter_here : Note<
242  "template parameter declared here">;
243def err_odr_parameter_pack_non_pack : Error<
244  "parameter kind mismatch; parameter is %select{not a|a}0 parameter pack">;
245def note_odr_parameter_pack_non_pack : Note<
246  "%select{parameter|parameter pack}0 declared here">;
247def err_odr_non_type_parameter_type_inconsistent : Error<
248  "non-type template parameter declared with incompatible types in different "
249  "translation units (%0 vs. %1)">;
250def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">;
251}
252