1//==--- DiagnosticCommonKinds.td - common 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//===----------------------------------------------------------------------===//
10// Common Helpers
11//===----------------------------------------------------------------------===//
12
13let Component = "Common" in {
14
15// Substitutions.
16
17def select_constexpr_spec_kind : TextSubstitution<
18 "%select{<ERROR>|constexpr|consteval|constinit}0">;
19
20// Basic.
21
22def fatal_too_many_errors
23 : Error<"too many errors emitted, stopping now">, DefaultFatal;
24
25def warn_stack_exhausted : Warning<
26 "stack nearly exhausted; compilation time may suffer, and "
27 "crashes due to stack overflow are likely">,
28 InGroup<DiagGroup<"stack-exhausted">>, NoSFINAE;
29
30def note_declared_at : Note<"declared here">;
31def note_previous_definition : Note<"previous definition is here">;
32def note_previous_declaration : Note<"previous declaration is here">;
33def note_previous_implicit_declaration : Note<
34 "previous implicit declaration is here">;
35def note_previous_use : Note<"previous use is here">;
36def note_duplicate_case_prev : Note<"previous case defined here">;
37def note_forward_declaration : Note<"forward declaration of %0">;
38def note_type_being_defined : Note<
39 "definition of %0 is not complete until the closing '}'">;
40/// note_matching - this is used as a continuation of a previous diagnostic,
41/// e.g. to specify the '(' when we expected a ')'.
42def note_matching : Note<"to match this %0">;
43
44def note_using : Note<"using">;
45def note_possibility : Note<"one possibility">;
46def note_also_found : Note<"also found">;
47
48// Parse && Lex
49
50let CategoryName = "Lexical or Preprocessor Issue" in {
51
52def err_expected_colon_after_setter_name : Error<
53 "method name referenced in property setter attribute "
54 "must end with ':'">;
55def err_expected_string_literal : Error<"expected string literal "
56 "%select{in %1|for diagnostic message in static_assert|"
57 "for optional message in 'availability' attribute|"
58 "for %select{language|source container}1 name in "
59 "'external_source_symbol' attribute}0">;
60def err_invalid_string_udl : Error<
61 "string literal with user-defined suffix cannot be used here">;
62def err_invalid_character_udl : Error<
63 "character literal with user-defined suffix cannot be used here">;
64def err_invalid_numeric_udl : Error<
65 "numeric literal with user-defined suffix cannot be used here">;
66
67}
68
69// Parse && Sema
70
71let CategoryName = "Parse Issue" in {
72
73def err_expected : Error<"expected %0">;
74def err_expected_either : Error<"expected %0 or %1">;
75def err_expected_after : Error<"expected %1 after %0">;
76
77def err_param_redefinition : Error<"redefinition of parameter %0">;
78def warn_method_param_redefinition : Warning<"redefinition of method parameter %0">;
79def warn_method_param_declaration : Warning<"redeclaration of method parameter %0">,
80 InGroup<DuplicateArgDecl>, DefaultIgnore;
81def err_invalid_storage_class_in_func_decl : Error<
82 "invalid storage class specifier in function declarator">;
83def err_expected_namespace_name : Error<"expected namespace name">;
84def ext_variadic_templates : ExtWarn<
85 "variadic templates are a C++11 extension">, InGroup<CXX11>;
86def warn_cxx98_compat_variadic_templates :
87 Warning<"variadic templates are incompatible with C++98">,
88 InGroup<CXX98Compat>, DefaultIgnore;
89def err_default_special_members : Error<
90 "only special member functions %select{|and comparison operators }0"
91 "may be defaulted">;
92def err_deleted_non_function : Error<
93 "only functions can have deleted definitions">;
94def err_module_not_found : Error<"module '%0' not found">, DefaultFatal;
95def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal;
96def err_module_build_disabled: Error<
97 "module '%0' is needed but has not been provided, and implicit use of module "
98 "files is disabled">, DefaultFatal;
99def err_module_unavailable : Error<
100 "module '%0' %select{is incompatible with|requires}1 feature '%2'">;
101def err_module_header_missing : Error<
102 "%select{|umbrella }0header '%1' not found">;
103def remark_module_lock_failure : Remark<
104 "could not acquire lock file for module '%0': %1">, InGroup<ModuleBuild>;
105def remark_module_lock_timeout : Remark<
106 "timed out waiting to acquire lock file for module '%0'">, InGroup<ModuleBuild>;
107def err_module_shadowed : Error<"import of shadowed module '%0'">, DefaultFatal;
108def err_module_build_shadowed_submodule : Error<
109 "build a shadowed submodule '%0'">, DefaultFatal;
110def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,
111 DefaultFatal;
112def err_module_prebuilt : Error<
113 "error in loading module '%0' from prebuilt module path">, DefaultFatal;
114def note_pragma_entered_here : Note<"#pragma entered here">;
115def note_decl_hiding_tag_type : Note<
116 "%1 %0 is hidden by a non-type declaration of %0 here">;
117def err_attribute_not_type_attr : Error<
118 "%0 attribute cannot be applied to types">;
119def err_enum_template : Error<"enumeration cannot be a template">;
120
121def warn_cxx20_compat_consteval : Warning<
122 "'consteval' specifier is incompatible with C++ standards before C++20">,
123 InGroup<CXX20Compat>, DefaultIgnore;
124
125}
126
127let CategoryName = "Nullability Issue" in {
128
129def warn_nullability_duplicate : Warning<
130 "duplicate nullability specifier %0">,
131 InGroup<Nullability>;
132
133def warn_conflicting_nullability_attr_overriding_ret_types : Warning<
134 "conflicting nullability specifier on return types, %0 "
135 "conflicts with existing specifier %1">,
136 InGroup<Nullability>;
137
138def warn_conflicting_nullability_attr_overriding_param_types : Warning<
139 "conflicting nullability specifier on parameter types, %0 "
140 "conflicts with existing specifier %1">,
141 InGroup<Nullability>;
142
143def err_nullability_conflicting : Error<
144 "nullability specifier %0 conflicts with existing specifier %1">;
145
146}
147
148// OpenCL Section 6.8.g
149def err_opencl_unknown_type_specifier : Error<
150 "%select{OpenCL C|C++ for OpenCL}0 version %1 does not support the "
151 "'%2' %select{type qualifier|storage class specifier}3">;
152
153def warn_unknown_attribute_ignored : Warning<
154 "unknown attribute %0 ignored">, InGroup<UnknownAttributes>;
155def err_use_of_tag_name_without_tag : Error<
156 "must use '%1' tag to refer to type %0%select{| in this scope}2">;
157
158def duplicate_declspec : TextSubstitution<
159 "duplicate '%0' declaration specifier">;
160
161def ext_duplicate_declspec : Extension<"%sub{duplicate_declspec}0">,
162 InGroup<DuplicateDeclSpecifier>;
163def ext_warn_duplicate_declspec : ExtWarn<"%sub{duplicate_declspec}0">,
164 InGroup<DuplicateDeclSpecifier>;
165def warn_duplicate_declspec : Warning<"%sub{duplicate_declspec}0">,
166 InGroup<DuplicateDeclSpecifier>;
167
168def err_duplicate_declspec : Error<"%sub{duplicate_declspec}0">;
169
170def err_friend_decl_spec : Error<"'%0' is invalid in friend declarations">;
171
172def err_invalid_member_in_interface : Error<
173 "%select{data member |non-public member function |static member function |"
174 "user-declared constructor|user-declared destructor|operator |"
175 "nested class }0%1 is not permitted within an interface type">;
176
177def err_attribute_uuid_malformed_guid : Error<
178 "uuid attribute contains a malformed GUID">;
179
180// Sema && Lex
181def ext_c99_longlong : Extension<
182 "'long long' is an extension when C99 mode is not enabled">,
183 InGroup<LongLong>;
184def ext_cxx11_longlong : Extension<
185 "'long long' is a C++11 extension">,
186 InGroup<CXX11LongLong>;
187def warn_cxx98_compat_longlong : Warning<
188 "'long long' is incompatible with C++98">,
189 InGroup<CXX98CompatPedantic>, DefaultIgnore;
190def ext_cxx2b_size_t_suffix : ExtWarn<
191 "'size_t' suffix for literals is a C++2b extension">,
192 InGroup<CXX2b>;
193def warn_cxx20_compat_size_t_suffix : Warning<
194 "'size_t' suffix for literals is incompatible with C++ standards before "
195 "C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore;
196def err_cxx2b_size_t_suffix: Error<
197 "'size_t' suffix for literals is a C++2b feature">;
198def err_size_t_literal_too_large: Error<
199 "%select{signed |}0'size_t' literal is out of range of possible "
200 "%select{signed |}0'size_t' values">;
201def err_integer_literal_too_large : Error<
202 "integer literal is too large to be represented in any %select{signed |}0"
203 "integer type">;
204def ext_integer_literal_too_large_for_signed : ExtWarn<
205 "integer literal is too large to be represented in a signed integer type, "
206 "interpreting as unsigned">,
207 InGroup<ImplicitlyUnsignedLiteral>;
208def warn_old_implicitly_unsigned_long : Warning<
209 "integer literal is too large to be represented in type 'long', "
210 "interpreting as 'unsigned long' per C89; this literal will "
211 "%select{have type 'long long'|be ill-formed}0 in C99 onwards">,
212 InGroup<C99Compat>;
213def warn_old_implicitly_unsigned_long_cxx : Warning<
214 "integer literal is too large to be represented in type 'long', "
215 "interpreting as 'unsigned long' per C++98; this literal will "
216 "%select{have type 'long long'|be ill-formed}0 in C++11 onwards">,
217 InGroup<CXX11Compat>;
218def ext_old_implicitly_unsigned_long_cxx : ExtWarn<
219 "integer literal is too large to be represented in type 'long' and is "
220 "subject to undefined behavior under C++98, interpreting as 'unsigned long'; "
221 "this literal will %select{have type 'long long'|be ill-formed}0 "
222 "in C++11 onwards">,
223 InGroup<CXX11Compat>;
224def ext_clang_enable_if : Extension<"'enable_if' is a clang extension">,
225 InGroup<GccCompat>;
226def ext_clang_diagnose_if : Extension<"'diagnose_if' is a clang extension">,
227 InGroup<GccCompat>;
228def err_too_large_for_fixed_point : Error<
229 "this value is too large for this fixed point type">;
230def err_fixed_point_not_enabled : Error<"compile with "
231 "'-ffixed-point' to enable fixed point types">;
232def err_unimplemented_conversion_with_fixed_point_type : Error<
233 "conversion between fixed point and %0 is not yet supported">;
234
235// SEH
236def err_seh_expected_handler : Error<
237 "expected '__except' or '__finally' block">;
238def err_seh___except_block : Error<
239 "%0 only allowed in __except block or filter expression">;
240def err_seh___except_filter : Error<
241 "%0 only allowed in __except filter expression">;
242def err_seh___finally_block : Error<
243 "%0 only allowed in __finally block">;
244
245// Sema && AST
246def note_invalid_subexpr_in_const_expr : Note<
247 "subexpression not valid in a constant expression">;
248def note_constexpr_invalid_template_arg : Note<
249 "%select{pointer|reference}0 to %select{|subobject of }1"
250 "%select{type_info object|string literal|temporary object|"
251 "predefined '%3' variable}2 is not allowed in a template argument">;
252def err_constexpr_invalid_template_arg : Error<
253 note_constexpr_invalid_template_arg.Text>;
254
255// Sema && Frontend
256let CategoryName = "Inline Assembly Issue" in {
257 def err_asm_invalid_type_in_input : Error<
258 "invalid type %0 in asm input for constraint '%1'">;
259
260 def err_asm_invalid_type : Error<
261 "invalid type %0 in asm %select{input|output}1">;
262
263 def warn_stack_clash_protection_inline_asm : Warning<
264 "Unable to protect inline asm that clobbers stack pointer against stack clash">,
265 InGroup<DiagGroup<"stack-protector">>;
266
267 def warn_slh_does_not_support_asm_goto
268 : Warning<"Speculative load hardening does not protect functions with "
269 "asm goto">,
270 InGroup<DiagGroup<"slh-asm-goto">>;
271}
272
273// Sema && Serialization
274def warn_dup_category_def : Warning<
275 "duplicate definition of category %1 on interface %0">;
276
277// Targets
278
279def err_target_unknown_triple : Error<
280 "unknown target triple '%0', please use -triple or -arch">;
281def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
282def note_valid_options : Note<"valid target CPU values are: %0">;
283def err_target_unsupported_cpu_for_micromips : Error<
284 "micromips is not supported for target CPU '%0'">;
285def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
286def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU '%1'">;
287def err_target_unsupported_abi_for_triple : Error<
288 "ABI '%0' is not supported for '%1'">;
289def err_unsupported_abi_for_opt : Error<"'%0' can only be used with the '%1' ABI">;
290def err_mips_fp64_req : Error<
291 "'%0' can only be used if the target supports the mfhc1 and mthc1 instructions">;
292def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
293def err_target_unsupported_fpmath : Error<
294 "the '%0' unit is not supported with this instruction set">;
295def err_target_unsupported_unaligned : Error<
296 "the %0 sub-architecture does not support unaligned accesses">;
297def err_target_unsupported_execute_only : Error<
298 "execute only is not supported for the %0 sub-architecture">;
299def err_target_unsupported_mcmse : Error<
300 "-mcmse is not supported for %0">;
301def err_opt_not_valid_with_opt : Error<
302 "option '%0' cannot be specified with '%1'">;
303def err_opt_not_valid_without_opt : Error<
304 "option '%0' cannot be specified without '%1'">;
305def err_opt_not_valid_on_target : Error<
306 "option '%0' cannot be specified on this target">;
307
308// Source manager
309def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;
310def err_file_modified : Error<
311 "file '%0' modified since it was first processed">, DefaultFatal;
312def err_file_too_large : Error<
313 "sorry, unsupported: file '%0' is too large for Clang to process">;
314def err_include_too_large : Error<
315 "sorry, this include generates a translation unit too large for"
316 " Clang to process.">, DefaultFatal;
317def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but "
318 "encoding is not supported">, DefaultFatal;
319def err_unable_to_rename_temp : Error<
320 "unable to rename temporary '%0' to output file '%1': '%2'">;
321def err_unable_to_make_temp : Error<
322 "unable to make temporary file: %0">;
323
324// Modules
325def err_module_format_unhandled : Error<
326 "no handler registered for module format '%0'">, DefaultFatal;
327
328// TransformActions
329// TODO: Use a custom category name to distinguish rewriter errors.
330def err_mt_message : Error<"[rewriter] %0">, SuppressInSystemHeader;
331def warn_mt_message : Warning<"[rewriter] %0">;
332def note_mt_message : Note<"[rewriter] %0">;
333
334// ARCMigrate
335def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">;
336def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">;
337
338// C++ for OpenCL.
339def err_openclcxx_not_supported : Error<
340 "'%0' is not supported in C++ for OpenCL">;
341
342// HIP
343def warn_ignored_hip_only_option : Warning<
344 "'%0' is ignored since it is only supported for HIP">,
345 InGroup<HIPOnly>;
346
347// OpenMP
348def err_omp_more_one_clause : Error<
349 "directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">;
350def err_omp_required_clause : Error<
351 "directive '#pragma omp %0' requires the '%1' clause">;
352
353// Static Analyzer Core
354def err_unknown_analyzer_checker_or_package : Error<
355 "no analyzer checkers or packages are associated with '%0'">;
356def note_suggest_disabling_all_checkers : Note<
357 "use -analyzer-disable-all-checks to disable all static analyzer checkers">;
358
359// Poison system directories.
360def warn_poison_system_directories : Warning <
361 "include location '%0' is unsafe for cross-compilation">,
362 InGroup<DiagGroup<"poison-system-directories">>, DefaultIgnore;
363
364def warn_opencl_unsupported_core_feature : Warning<
365 "%0 is a core feature in %select{OpenCL C|C++ for OpenCL}1 version %2 but not supported on this target">,
366 InGroup<OpenCLCoreFeaturesDiagGroup>, DefaultIgnore;
367}
368