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 err_module_rebuild_finalized : Error< 115 "cannot rebuild module '%0' as it is already finalized">, DefaultFatal; 116def note_pragma_entered_here : Note<"#pragma entered here">; 117def note_decl_hiding_tag_type : Note< 118 "%1 %0 is hidden by a non-type declaration of %0 here">; 119def err_attribute_not_type_attr : Error< 120 "%0 attribute cannot be applied to types">; 121def err_enum_template : Error<"enumeration cannot be a template">; 122 123def warn_cxx20_compat_consteval : Warning< 124 "'consteval' specifier is incompatible with C++ standards before C++20">, 125 InGroup<CXX20Compat>, DefaultIgnore; 126def warn_missing_type_specifier : Warning< 127 "type specifier missing, defaults to 'int'">, 128 InGroup<ImplicitInt>, DefaultIgnore; 129} 130 131let CategoryName = "Nullability Issue" in { 132 133def warn_nullability_duplicate : Warning< 134 "duplicate nullability specifier %0">, 135 InGroup<Nullability>; 136 137def warn_conflicting_nullability_attr_overriding_ret_types : Warning< 138 "conflicting nullability specifier on return types, %0 " 139 "conflicts with existing specifier %1">, 140 InGroup<Nullability>; 141 142def warn_conflicting_nullability_attr_overriding_param_types : Warning< 143 "conflicting nullability specifier on parameter types, %0 " 144 "conflicts with existing specifier %1">, 145 InGroup<Nullability>; 146 147def err_nullability_conflicting : Error< 148 "nullability specifier %0 conflicts with existing specifier %1">; 149 150def warn_incompatible_branch_protection_option: Warning < 151 "'-mbranch-protection=' option is incompatible with the '%0' architecture">, 152 InGroup<BranchProtection>; 153 154def warn_target_unsupported_branch_protection_attribute: Warning < 155 "ignoring the 'branch-protection' attribute because the '%0' architecture does not support it">, 156 InGroup<BranchProtection>; 157} 158 159// OpenCL Section 6.8.g 160def err_opencl_unknown_type_specifier : Error< 161 "%0 does not support the '%1' " 162 "%select{type qualifier|storage class specifier}2">; 163 164def warn_unknown_attribute_ignored : Warning< 165 "unknown attribute %0 ignored">, InGroup<UnknownAttributes>; 166def warn_attribute_ignored : Warning<"%0 attribute ignored">, 167 InGroup<IgnoredAttributes>; 168def err_use_of_tag_name_without_tag : Error< 169 "must use '%1' tag to refer to type %0%select{| in this scope}2">; 170 171def duplicate_declspec : TextSubstitution< 172 "duplicate '%0' declaration specifier">; 173 174def ext_duplicate_declspec : Extension<"%sub{duplicate_declspec}0">, 175 InGroup<DuplicateDeclSpecifier>; 176def ext_warn_duplicate_declspec : ExtWarn<"%sub{duplicate_declspec}0">, 177 InGroup<DuplicateDeclSpecifier>; 178def warn_duplicate_declspec : Warning<"%sub{duplicate_declspec}0">, 179 InGroup<DuplicateDeclSpecifier>; 180 181def err_duplicate_declspec : Error<"%sub{duplicate_declspec}0">; 182 183def err_friend_decl_spec : Error<"'%0' is invalid in friend declarations">; 184 185def err_invalid_member_in_interface : Error< 186 "%select{data member |non-public member function |static member function |" 187 "user-declared constructor|user-declared destructor|operator |" 188 "nested class }0%1 is not permitted within an interface type">; 189 190def err_attribute_uuid_malformed_guid : Error< 191 "uuid attribute contains a malformed GUID">; 192 193// Sema && Lex 194def ext_c99_longlong : Extension< 195 "'long long' is an extension when C99 mode is not enabled">, 196 InGroup<LongLong>; 197def ext_cxx11_longlong : Extension< 198 "'long long' is a C++11 extension">, 199 InGroup<CXX11LongLong>; 200def warn_cxx98_compat_longlong : Warning< 201 "'long long' is incompatible with C++98">, 202 InGroup<CXX98CompatPedantic>, DefaultIgnore; 203def ext_cxx2b_size_t_suffix : ExtWarn< 204 "'size_t' suffix for literals is a C++2b extension">, 205 InGroup<CXX2b>; 206def warn_cxx20_compat_size_t_suffix : Warning< 207 "'size_t' suffix for literals is incompatible with C++ standards before " 208 "C++2b">, InGroup<CXXPre2bCompat>, DefaultIgnore; 209def err_cxx2b_size_t_suffix: Error< 210 "'size_t' suffix for literals is a C++2b feature">; 211def err_size_t_literal_too_large: Error< 212 "%select{signed |}0'size_t' literal is out of range of possible " 213 "%select{signed |}0'size_t' values">; 214def ext_c2x_bitint_suffix : ExtWarn< 215 "'_BitInt' suffix for literals is a C2x extension">, 216 InGroup<C2x>; 217def warn_c2x_compat_bitint_suffix : Warning< 218 "'_BitInt' suffix for literals is incompatible with C standards before C2x">, 219 InGroup<CPre2xCompat>, DefaultIgnore; 220def err_integer_literal_too_large : Error< 221 "integer literal is too large to be represented in any %select{signed |}0" 222 "integer type">; 223def ext_integer_literal_too_large_for_signed : ExtWarn< 224 "integer literal is too large to be represented in a signed integer type, " 225 "interpreting as unsigned">, 226 InGroup<ImplicitlyUnsignedLiteral>; 227def warn_old_implicitly_unsigned_long : Warning< 228 "integer literal is too large to be represented in type 'long', " 229 "interpreting as 'unsigned long' per C89; this literal will " 230 "%select{have type 'long long'|be ill-formed}0 in C99 onwards">, 231 InGroup<C99Compat>; 232def warn_old_implicitly_unsigned_long_cxx : Warning< 233 "integer literal is too large to be represented in type 'long', " 234 "interpreting as 'unsigned long' per C++98; this literal will " 235 "%select{have type 'long long'|be ill-formed}0 in C++11 onwards">, 236 InGroup<CXX11Compat>; 237def ext_old_implicitly_unsigned_long_cxx : ExtWarn< 238 "integer literal is too large to be represented in type 'long' and is " 239 "subject to undefined behavior under C++98, interpreting as 'unsigned long'; " 240 "this literal will %select{have type 'long long'|be ill-formed}0 " 241 "in C++11 onwards">, 242 InGroup<CXX11Compat>; 243def ext_clang_enable_if : Extension<"'enable_if' is a clang extension">, 244 InGroup<GccCompat>; 245def ext_clang_diagnose_if : Extension<"'diagnose_if' is a clang extension">, 246 InGroup<GccCompat>; 247def err_too_large_for_fixed_point : Error< 248 "this value is too large for this fixed point type">; 249def err_fixed_point_not_enabled : Error<"compile with " 250 "'-ffixed-point' to enable fixed point types">; 251def err_unimplemented_conversion_with_fixed_point_type : Error< 252 "conversion between fixed point and %0 is not yet supported">; 253 254// SEH 255def err_seh_expected_handler : Error< 256 "expected '__except' or '__finally' block">; 257def err_seh___except_block : Error< 258 "%0 only allowed in __except block or filter expression">; 259def err_seh___except_filter : Error< 260 "%0 only allowed in __except filter expression">; 261def err_seh___finally_block : Error< 262 "%0 only allowed in __finally block">; 263 264// Sema && AST 265def note_invalid_subexpr_in_const_expr : Note< 266 "subexpression not valid in a constant expression">; 267def note_constexpr_invalid_template_arg : Note< 268 "%select{pointer|reference}0 to %select{|subobject of }1" 269 "%select{type_info object|string literal|temporary object|" 270 "predefined '%3' variable}2 is not allowed in a template argument">; 271def err_constexpr_invalid_template_arg : Error< 272 note_constexpr_invalid_template_arg.Text>; 273 274// Sema && Frontend 275let CategoryName = "Inline Assembly Issue" in { 276 def err_asm_invalid_type_in_input : Error< 277 "invalid type %0 in asm input for constraint '%1'">; 278 279 def err_asm_invalid_type : Error< 280 "invalid type %0 in asm %select{input|output}1">; 281 282 def warn_stack_clash_protection_inline_asm : Warning< 283 "Unable to protect inline asm that clobbers stack pointer against stack clash">, 284 InGroup<DiagGroup<"stack-protector">>; 285 286 def warn_slh_does_not_support_asm_goto 287 : Warning<"Speculative load hardening does not protect functions with " 288 "asm goto">, 289 InGroup<DiagGroup<"slh-asm-goto">>; 290} 291 292// Sema && Serialization 293def warn_dup_category_def : Warning< 294 "duplicate definition of category %1 on interface %0">; 295 296// Targets 297 298def err_target_unknown_triple : Error< 299 "unknown target triple '%0', please use -triple or -arch">; 300def err_target_unknown_cpu : Error<"unknown target CPU '%0'">; 301def note_valid_options : Note<"valid target CPU values are: %0">; 302def err_target_unsupported_cpu_for_micromips : Error< 303 "micromips is not supported for target CPU '%0'">; 304def err_target_unknown_abi : Error<"unknown target ABI '%0'">; 305def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU '%1'">; 306def err_target_unsupported_abi_for_triple : Error< 307 "ABI '%0' is not supported for '%1'">; 308def err_unsupported_abi_for_opt : Error<"'%0' can only be used with the '%1' ABI">; 309def err_mips_fp64_req : Error< 310 "'%0' can only be used if the target supports the mfhc1 and mthc1 instructions">; 311def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">; 312def err_target_unsupported_fpmath : Error< 313 "the '%0' unit is not supported with this instruction set">; 314def err_target_unsupported_unaligned : Error< 315 "the %0 sub-architecture does not support unaligned accesses">; 316def err_target_unsupported_execute_only : Error< 317 "execute only is not supported for the %0 sub-architecture">; 318def err_target_unsupported_tp_hard : Error< 319 "hardware TLS register is not supported for the %0 sub-architecture">; 320def err_target_unsupported_mcmse : Error< 321 "-mcmse is not supported for %0">; 322def err_opt_not_valid_with_opt : Error< 323 "option '%0' cannot be specified with '%1'">; 324def err_opt_not_valid_without_opt : Error< 325 "option '%0' cannot be specified without '%1'">; 326def err_opt_not_valid_on_target : Error< 327 "option '%0' cannot be specified on this target">; 328def err_invalid_feature_combination : Error< 329 "invalid feature combination: %0">; 330 331// Source manager 332def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; 333def err_file_modified : Error< 334 "file '%0' modified since it was first processed">, DefaultFatal; 335def err_file_too_large : Error< 336 "sorry, unsupported: file '%0' is too large for Clang to process">; 337def err_include_too_large : Error< 338 "sorry, this include generates a translation unit too large for" 339 " Clang to process.">, DefaultFatal; 340def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but " 341 "encoding is not supported">, DefaultFatal; 342def err_unable_to_rename_temp : Error< 343 "unable to rename temporary '%0' to output file '%1': '%2'">; 344def err_unable_to_make_temp : Error< 345 "unable to make temporary file: %0">; 346 347// Modules 348def err_module_format_unhandled : Error< 349 "no handler registered for module format '%0'">, DefaultFatal; 350 351// TransformActions 352// TODO: Use a custom category name to distinguish rewriter errors. 353def err_mt_message : Error<"[rewriter] %0">, SuppressInSystemHeader; 354def warn_mt_message : Warning<"[rewriter] %0">; 355def note_mt_message : Note<"[rewriter] %0">; 356 357// ARCMigrate 358def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">; 359def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">; 360 361// C++ for OpenCL. 362def err_openclcxx_not_supported : Error< 363 "'%0' is not supported in C++ for OpenCL">; 364 365// HIP 366def warn_ignored_hip_only_option : Warning< 367 "'%0' is ignored since it is only supported for HIP">, 368 InGroup<HIPOnly>; 369 370// OpenMP 371def err_omp_more_one_clause : Error< 372 "directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">; 373def err_omp_required_clause : Error< 374 "directive '#pragma omp %0' requires the '%1' clause">; 375 376// Static Analyzer Core 377def err_unknown_analyzer_checker_or_package : Error< 378 "no analyzer checkers or packages are associated with '%0'">; 379def note_suggest_disabling_all_checkers : Note< 380 "use -analyzer-disable-all-checks to disable all static analyzer checkers">; 381 382// Poison system directories. 383def warn_poison_system_directories : Warning < 384 "include location '%0' is unsafe for cross-compilation">, 385 InGroup<DiagGroup<"poison-system-directories">>, DefaultIgnore; 386 387def warn_opencl_unsupported_core_feature : Warning< 388 "%0 is a core feature in %select{OpenCL C|C++ for OpenCL}1 version %2 but not supported on this target">, 389 InGroup<OpenCLCoreFeaturesDiagGroup>, DefaultIgnore; 390 391def err_opencl_extension_and_feature_differs : Error< 392 "options %0 and %1 are set to different values">; 393def err_opencl_feature_requires : Error< 394 "feature %0 requires support of %1 feature">; 395} 396