DiagnosticCommonKinds.td revision 360784
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 err_integer_literal_too_large : Error<
191  "integer literal is too large to be represented in any %select{signed |}0"
192  "integer type">;
193def ext_integer_literal_too_large_for_signed : ExtWarn<
194  "integer literal is too large to be represented in a signed integer type, "
195  "interpreting as unsigned">,
196  InGroup<ImplicitlyUnsignedLiteral>;
197def warn_old_implicitly_unsigned_long : Warning<
198  "integer literal is too large to be represented in type 'long', "
199  "interpreting as 'unsigned long' per C89; this literal will "
200  "%select{have type 'long long'|be ill-formed}0 in C99 onwards">,
201  InGroup<C99Compat>;
202def warn_old_implicitly_unsigned_long_cxx : Warning<
203  "integer literal is too large to be represented in type 'long', "
204  "interpreting as 'unsigned long' per C++98; this literal will "
205  "%select{have type 'long long'|be ill-formed}0 in C++11 onwards">,
206  InGroup<CXX11Compat>;
207def ext_old_implicitly_unsigned_long_cxx : ExtWarn<
208  "integer literal is too large to be represented in type 'long' and is "
209  "subject to undefined behavior under C++98, interpreting as 'unsigned long'; "
210  "this literal will %select{have type 'long long'|be ill-formed}0 "
211  "in C++11 onwards">,
212  InGroup<CXX11Compat>;
213def ext_clang_enable_if : Extension<"'enable_if' is a clang extension">,
214                          InGroup<GccCompat>;
215def ext_clang_diagnose_if : Extension<"'diagnose_if' is a clang extension">,
216                            InGroup<GccCompat>;
217def err_too_large_for_fixed_point : Error<
218  "this value is too large for this fixed point type">;
219def err_fixed_point_not_enabled : Error<"compile with "
220  "'-ffixed-point' to enable fixed point types">;
221def err_unimplemented_conversion_with_fixed_point_type : Error<
222  "conversion between fixed point and %0 is not yet supported">;
223
224// SEH
225def err_seh_expected_handler : Error<
226  "expected '__except' or '__finally' block">;
227def err_seh___except_block : Error<
228  "%0 only allowed in __except block or filter expression">;
229def err_seh___except_filter : Error<
230  "%0 only allowed in __except filter expression">;
231def err_seh___finally_block : Error<
232  "%0 only allowed in __finally block">;
233
234// Sema && AST
235def note_invalid_subexpr_in_const_expr : Note<
236  "subexpression not valid in a constant expression">;
237
238// Sema && Frontend
239let CategoryName = "Inline Assembly Issue" in {
240  def err_asm_invalid_type_in_input : Error<
241    "invalid type %0 in asm input for constraint '%1'">;
242}
243
244// Sema && Serialization
245def warn_dup_category_def : Warning<
246  "duplicate definition of category %1 on interface %0">;
247
248// Targets
249
250def err_target_unknown_triple : Error<
251  "unknown target triple '%0', please use -triple or -arch">;
252def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
253def note_valid_options : Note<"valid target CPU values are: %0">;
254def err_target_unsupported_cpu_for_micromips : Error<
255  "micromips is not supported for target CPU '%0'">;
256def err_target_unknown_abi : Error<"unknown target ABI '%0'">;
257def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU '%1'">;
258def err_target_unsupported_abi_for_triple : Error<
259  "ABI '%0' is not supported for '%1'">;
260def err_unsupported_abi_for_opt : Error<"'%0' can only be used with the '%1' ABI">;
261def err_mips_fp64_req : Error<
262    "'%0' can only be used if the target supports the mfhc1 and mthc1 instructions">;
263def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">;
264def err_target_unsupported_fpmath : Error<
265    "the '%0' unit is not supported with this instruction set">;
266def err_target_unsupported_unaligned : Error<
267  "the %0 sub-architecture does not support unaligned accesses">;
268def err_target_unsupported_execute_only : Error<
269  "execute only is not supported for the %0 sub-architecture">;
270def err_target_unsupported_mcmse : Error<
271  "-mcmse is not supported for %0">;
272def err_opt_not_valid_with_opt : Error<
273  "option '%0' cannot be specified with '%1'">;
274def err_opt_not_valid_without_opt : Error<
275  "option '%0' cannot be specified without '%1'">;
276def err_opt_not_valid_on_target : Error<
277  "option '%0' cannot be specified on this target">;
278
279// Source manager
280def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal;
281def err_file_modified : Error<
282  "file '%0' modified since it was first processed">, DefaultFatal;
283def err_file_too_large : Error<
284  "sorry, unsupported: file '%0' is too large for Clang to process">;
285def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but "
286  "encoding is not supported">, DefaultFatal;
287def err_unable_to_rename_temp : Error<
288  "unable to rename temporary '%0' to output file '%1': '%2'">;
289def err_unable_to_make_temp : Error<
290  "unable to make temporary file: %0">;
291
292// Modules
293def err_module_format_unhandled : Error<
294  "no handler registered for module format '%0'">, DefaultFatal;
295
296// TransformActions
297// TODO: Use a custom category name to distinguish rewriter errors.
298def err_mt_message : Error<"[rewriter] %0">, SuppressInSystemHeader;
299def warn_mt_message : Warning<"[rewriter] %0">;
300def note_mt_message : Note<"[rewriter] %0">;
301
302// ARCMigrate
303def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">;
304def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">;
305
306// C++ for OpenCL.
307def err_openclcxx_not_supported : Error<
308  "'%0' is not supported in C++ for OpenCL">;
309
310// HIP
311def warn_ignored_hip_only_option : Warning<
312  "'%0' is ignored since it is only supported for HIP">,
313  InGroup<HIPOnly>;
314
315// OpenMP
316def err_omp_more_one_clause : Error<
317  "directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">;
318
319// Static Analyzer Core
320def err_unknown_analyzer_checker_or_package : Error<
321    "no analyzer checkers or packages are associated with '%0'">;
322def note_suggest_disabling_all_checkers : Note<
323    "use -analyzer-disable-all-checks to disable all static analyzer checkers">;
324
325// Poison system directories.
326def warn_poison_system_directories : Warning <
327  "include location '%0' is unsafe for cross-compilation">,
328  InGroup<DiagGroup<"poison-system-directories">>, DefaultIgnore;
329}
330