DiagnosticASTKinds.td 30 KB

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