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 48def warn_next_larger_fp_type_same_size_than_fp : Warning< 49 "higher precision floating-point type size has the same size than " 50 "floating-point type size">, 51 InGroup<DiagGroup<"higher-precision-fp">>; 52 53// Parse && Lex 54 55let CategoryName = "Lexical or Preprocessor Issue" in { 56 57def err_expected_colon_after_setter_name : Error< 58 "method name referenced in property setter attribute " 59 "must end with ':'">; 60def err_expected_string_literal : Error<"expected string literal " 61 "%select{in %1|for diagnostic message in static_assert|" 62 "for optional message in 'availability' attribute|" 63 "for %select{language name|source container name|USR}1 in " 64 "'external_source_symbol' attribute|" 65 "as argument of '%1' attribute}0">; 66 67def err_invalid_string_udl : Error< 68 "string literal with user-defined suffix cannot be used here">; 69def err_invalid_character_udl : Error< 70 "character literal with user-defined suffix cannot be used here">; 71def err_invalid_numeric_udl : Error< 72 "numeric literal with user-defined suffix cannot be used here">; 73def warn_pragma_debug_missing_argument : Warning< 74 "missing argument to debug command '%0'">, InGroup<IgnoredPragmas>; 75def warn_pragma_debug_unexpected_argument : Warning< 76 "unexpected argument to debug command">, InGroup<IgnoredPragmas>; 77 78def warn_fp_nan_inf_when_disabled : Warning< 79 "use of %select{infinity|NaN}0%select{| via a macro}1 is undefined behavior " 80 "due to the currently enabled floating-point options">, 81 InGroup<DiagGroup<"nan-infinity-disabled", [], NanInfDisabledDocs>>; 82} 83 84// Parse && Sema 85 86let CategoryName = "Parse Issue" in { 87 88def err_expected : Error<"expected %0">; 89def err_expected_either : Error<"expected %0 or %1">; 90def err_expected_after : Error<"expected %1 after %0">; 91 92def err_param_redefinition : Error<"redefinition of parameter %0">; 93def warn_method_param_redefinition : Warning<"redefinition of method parameter %0">; 94def warn_method_param_declaration : Warning<"redeclaration of method parameter %0">, 95 InGroup<DuplicateArgDecl>, DefaultIgnore; 96def err_invalid_storage_class_in_func_decl : Error< 97 "invalid storage class specifier in function declarator">; 98def err_expected_namespace_name : Error<"expected namespace name">; 99def ext_variadic_templates : ExtWarn< 100 "variadic templates are a C++11 extension">, InGroup<CXX11>; 101def warn_cxx98_compat_variadic_templates : 102 Warning<"variadic templates are incompatible with C++98">, 103 InGroup<CXX98Compat>, DefaultIgnore; 104def err_default_special_members : Error< 105 "only special member functions %select{|and comparison operators }0" 106 "may be defaulted">; 107def err_deleted_non_function : Error< 108 "only functions can have deleted definitions">; 109def err_module_not_found : Error<"module '%0' not found">, DefaultFatal; 110def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal; 111def err_module_build_disabled: Error< 112 "module '%0' is needed but has not been provided, and implicit use of module " 113 "files is disabled">, DefaultFatal; 114def err_module_unavailable : Error< 115 "module '%0' %select{is incompatible with|requires}1 feature '%2'">; 116def err_module_header_missing : Error< 117 "%select{|umbrella }0header '%1' not found">; 118def remark_module_lock_failure : Remark< 119 "could not acquire lock file for module '%0': %1">, InGroup<ModuleBuild>; 120def remark_module_lock_timeout : Remark< 121 "timed out waiting to acquire lock file for module '%0'">, InGroup<ModuleBuild>; 122def err_module_shadowed : Error<"import of shadowed module '%0'">, DefaultFatal; 123def err_module_build_shadowed_submodule : Error< 124 "build a shadowed submodule '%0'">, DefaultFatal; 125def err_module_cycle : Error<"cyclic dependency in module '%0': %1">, 126 DefaultFatal; 127def err_module_prebuilt : Error< 128 "error in loading module '%0' from prebuilt module path">, DefaultFatal; 129def err_module_rebuild_finalized : Error< 130 "cannot rebuild module '%0' as it is already finalized">, DefaultFatal; 131def note_pragma_entered_here : Note<"#pragma entered here">; 132def note_decl_hiding_tag_type : Note< 133 "%1 %0 is hidden by a non-type declaration of %0 here">; 134def err_attribute_not_type_attr : Error< 135 "%0%select{ attribute|}1 cannot be applied to types">; 136def err_enum_template : Error<"enumeration cannot be a template">; 137 138def warn_cxx20_compat_consteval : Warning< 139 "'consteval' specifier is incompatible with C++ standards before C++20">, 140 InGroup<CXX20Compat>, DefaultIgnore; 141def warn_missing_type_specifier : Warning< 142 "type specifier missing, defaults to 'int'">, 143 InGroup<ImplicitInt>, DefaultIgnore; 144 145def ext_c_empty_initializer : Extension< 146 "use of an empty initializer is a C23 extension">, InGroup<C23>; 147def warn_c23_compat_empty_initializer : Warning< 148 "use of an empty initializer is incompatible with C standards before C23">, 149 InGroup<CPre23Compat>, DefaultIgnore; 150} 151 152let CategoryName = "Nullability Issue" in { 153 154def warn_nullability_duplicate : Warning< 155 "duplicate nullability specifier %0">, 156 InGroup<Nullability>; 157 158def warn_conflicting_nullability_attr_overriding_ret_types : Warning< 159 "conflicting nullability specifier on return types, %0 " 160 "conflicts with existing specifier %1">, 161 InGroup<Nullability>; 162 163def warn_conflicting_nullability_attr_overriding_param_types : Warning< 164 "conflicting nullability specifier on parameter types, %0 " 165 "conflicts with existing specifier %1">, 166 InGroup<Nullability>; 167 168def err_nullability_conflicting : Error< 169 "nullability specifier %0 conflicts with existing specifier %1">; 170 171def warn_incompatible_branch_protection_option: Warning < 172 "'-mbranch-protection=' option is incompatible with the '%0' architecture">, 173 InGroup<BranchProtection>; 174 175def warn_target_unsupported_branch_protection_attribute: Warning < 176 "ignoring the 'branch-protection' attribute because the '%0' architecture does not support it">, 177 InGroup<BranchProtection>; 178} 179 180// OpenCL Section 6.8.g 181def err_opencl_unknown_type_specifier : Error< 182 "%0 does not support the '%1' " 183 "%select{type qualifier|storage class specifier}2">; 184 185def warn_unknown_attribute_ignored : Warning< 186 "unknown attribute %0 ignored">, InGroup<UnknownAttributes>; 187def warn_attribute_ignored : Warning<"%0 attribute ignored">, 188 InGroup<IgnoredAttributes>; 189def err_keyword_not_supported_on_target : Error< 190 "%0 is not supported on this target">; 191def err_use_of_tag_name_without_tag : Error< 192 "must use '%1' tag to refer to type %0%select{| in this scope}2">; 193 194def duplicate_declspec : TextSubstitution< 195 "duplicate '%0' declaration specifier">; 196 197def ext_duplicate_declspec : Extension<"%sub{duplicate_declspec}0">, 198 InGroup<DuplicateDeclSpecifier>; 199def ext_warn_duplicate_declspec : ExtWarn<"%sub{duplicate_declspec}0">, 200 InGroup<DuplicateDeclSpecifier>; 201def warn_duplicate_declspec : Warning<"%sub{duplicate_declspec}0">, 202 InGroup<DuplicateDeclSpecifier>; 203 204def err_duplicate_declspec : Error<"%sub{duplicate_declspec}0">; 205 206def err_friend_decl_spec : Error<"'%0' is invalid in friend declarations">; 207 208def err_invalid_member_in_interface : Error< 209 "%select{data member |non-public member function |static member function |" 210 "user-declared constructor|user-declared destructor|operator |" 211 "nested class }0%1 is not permitted within an interface type">; 212 213def err_attribute_uuid_malformed_guid : Error< 214 "uuid attribute contains a malformed GUID">; 215 216// Sema && Lex 217def ext_c99_longlong : Extension< 218 "'long long' is an extension when C99 mode is not enabled">, 219 InGroup<LongLong>; 220def ext_cxx11_longlong : Extension< 221 "'long long' is a C++11 extension">, 222 InGroup<CXX11LongLong>; 223def warn_cxx98_compat_longlong : Warning< 224 "'long long' is incompatible with C++98">, 225 InGroup<CXX98CompatPedantic>, DefaultIgnore; 226def ext_cxx23_size_t_suffix : ExtWarn< 227 "'size_t' suffix for literals is a C++23 extension">, 228 InGroup<CXX23>; 229def warn_cxx20_compat_size_t_suffix : Warning< 230 "'size_t' suffix for literals is incompatible with C++ standards before " 231 "C++23">, InGroup<CXXPre23Compat>, DefaultIgnore; 232def err_cxx23_size_t_suffix: Error< 233 "'size_t' suffix for literals is a C++23 feature">; 234def err_size_t_literal_too_large: Error< 235 "%select{signed |}0'size_t' literal is out of range of possible " 236 "%select{signed |}0'size_t' values">; 237def ext_cxx_bitint_suffix : Extension< 238 "'_BitInt' suffix for literals is a Clang extension">, 239 InGroup<BitIntExtension>; 240def ext_c23_bitint_suffix : ExtWarn< 241 "'_BitInt' suffix for literals is a C23 extension">, 242 InGroup<C23>; 243def warn_c23_compat_bitint_suffix : Warning< 244 "'_BitInt' suffix for literals is incompatible with C standards before C23">, 245 InGroup<CPre23Compat>, DefaultIgnore; 246def err_integer_literal_too_large : Error< 247 "integer literal is too large to be represented in any %select{signed |}0" 248 "integer type">; 249def ext_integer_literal_too_large_for_signed : ExtWarn< 250 "integer literal is too large to be represented in a signed integer type, " 251 "interpreting as unsigned">, 252 InGroup<ImplicitlyUnsignedLiteral>; 253def warn_old_implicitly_unsigned_long : Warning< 254 "integer literal is too large to be represented in type 'long', " 255 "interpreting as 'unsigned long' per C89; this literal will " 256 "%select{have type 'long long'|be ill-formed}0 in C99 onwards">, 257 InGroup<C99Compat>; 258def warn_old_implicitly_unsigned_long_cxx : Warning< 259 "integer literal is too large to be represented in type 'long', " 260 "interpreting as 'unsigned long' per C++98; this literal will " 261 "%select{have type 'long long'|be ill-formed}0 in C++11 onwards">, 262 InGroup<CXX11Compat>; 263def ext_old_implicitly_unsigned_long_cxx : ExtWarn< 264 "integer literal is too large to be represented in type 'long' and is " 265 "subject to undefined behavior under C++98, interpreting as 'unsigned long'; " 266 "this literal will %select{have type 'long long'|be ill-formed}0 " 267 "in C++11 onwards">, 268 InGroup<CXX11Compat>; 269def ext_clang_enable_if : Extension<"'enable_if' is a clang extension">, 270 InGroup<GccCompat>; 271def ext_clang_diagnose_if : Extension<"'diagnose_if' is a clang extension">, 272 InGroup<GccCompat>; 273def err_too_large_for_fixed_point : Error< 274 "this value is too large for this fixed point type">; 275def err_unimplemented_conversion_with_fixed_point_type : Error< 276 "conversion between fixed point and %0 is not yet supported">; 277 278def err_requires_positive_value : Error< 279 "%select{invalid value '%0'; must be positive|value '%0' is too large}1">; 280 281// SEH 282def err_seh_expected_handler : Error< 283 "expected '__except' or '__finally' block">; 284def err_seh___except_block : Error< 285 "%0 only allowed in __except block or filter expression">; 286def err_seh___except_filter : Error< 287 "%0 only allowed in __except filter expression">; 288def err_seh___finally_block : Error< 289 "%0 only allowed in __finally block">; 290 291// Sema && AST 292def note_invalid_subexpr_in_const_expr : Note< 293 "subexpression not valid in a constant expression">; 294def note_constexpr_invalid_template_arg : Note< 295 "%select{pointer|reference}0 to %select{|subobject of }1" 296 "%select{type_info object|string literal|temporary object|" 297 "predefined '%3' variable}2 is not allowed in a template argument">; 298def err_constexpr_invalid_template_arg : Error< 299 note_constexpr_invalid_template_arg.Summary>; 300 301// Sema && Frontend 302let CategoryName = "Inline Assembly Issue" in { 303def err_asm_invalid_type_in_input : Error< 304 "invalid type %0 in asm input for constraint '%1'">; 305 306def err_asm_invalid_type : Error< 307 "invalid type %0 in asm %select{input|output}1">; 308 309def err_ms_asm_bitfield_unsupported : Error< 310 "an inline asm block cannot have an operand which is a bit-field">; 311 312def warn_stack_clash_protection_inline_asm : Warning< 313 "unable to protect inline asm that clobbers stack pointer against stack " 314 "clash">, InGroup<DiagGroup<"stack-protector">>; 315 316def warn_slh_does_not_support_asm_goto : Warning< 317 "speculative load hardening does not protect functions with asm goto">, 318 InGroup<DiagGroup<"slh-asm-goto">>; 319} 320 321// Sema && Serialization 322def warn_dup_category_def : Warning< 323 "duplicate definition of category %1 on interface %0">, 324 InGroup<DiagGroup<"objc-duplicate-category-definition">>; 325 326// Targets 327 328def err_target_unknown_triple : Error< 329 "unknown target triple '%0'">; 330def err_target_unknown_cpu : Error<"unknown target CPU '%0'">; 331def note_valid_options : Note<"valid target CPU values are: %0">; 332def err_target_unsupported_cpu_for_micromips : Error< 333 "micromips is not supported for target CPU '%0'">; 334def err_target_unknown_abi : Error<"unknown target ABI '%0'">; 335def err_target_unsupported_abi : Error<"ABI '%0' is not supported on CPU '%1'">; 336def err_target_unsupported_abi_for_triple : Error< 337 "ABI '%0' is not supported for '%1'">; 338def err_unsupported_abi_for_opt : Error<"'%0' can only be used with the '%1' ABI">; 339def err_mips_fp64_req : Error< 340 "'%0' can only be used if the target supports the mfhc1 and mthc1 instructions">; 341def err_target_unknown_fpmath : Error<"unknown FP unit '%0'">; 342def err_target_unsupported_fpmath : Error< 343 "the '%0' unit is not supported with this instruction set">; 344def err_target_unsupported_unaligned : Error< 345 "the %0 sub-architecture does not support unaligned accesses">; 346def err_target_unsupported_execute_only : Error< 347 "execute only is not supported for the %0 sub-architecture">; 348def err_target_unsupported_tp_hard : Error< 349 "hardware TLS register is not supported for the %0 sub-architecture">; 350def err_target_unsupported_mcmse : Error< 351 "-mcmse is not supported for %0">; 352def err_opt_not_valid_with_opt : Error< 353 "option '%0' cannot be specified with '%1'">; 354def err_opt_not_valid_with_opt_on_target : Error< 355 "option '%0' cannot be specified with '%1' for the %2 sub-architecture">; 356def err_opt_not_valid_without_opt : Error< 357 "option '%0' cannot be specified without '%1'">; 358def err_opt_not_valid_on_target : Error< 359 "option '%0' cannot be specified on this target">; 360def err_invalid_feature_combination : Error< 361 "invalid feature combination: %0">; 362def warn_invalid_feature_combination : Warning< 363 "invalid feature combination: %0">, InGroup<DiagGroup<"invalid-feature-combination">>; 364def warn_target_unrecognized_env : Warning< 365 "mismatch between architecture and environment in target triple '%0'; did you mean '%1'?">, 366 InGroup<InvalidCommandLineArgument>; 367def err_target_unsupported_abi_with_fpu : Error< 368 "'%0' ABI is not supported with FPU">; 369 370def err_ppc_impossible_musttail: Error< 371 "'musttail' attribute for this call is impossible because %select{" 372 "long calls can not be tail called on PPC|" 373 "indirect calls can not be tail called on PPC|" 374 "external calls can not be tail called on PPC}0" 375 >; 376def err_aix_musttail_unsupported: Error< 377 "'musttail' attribute is not supported on AIX">; 378 379// Source manager 380def err_cannot_open_file : Error<"cannot open file '%0': %1">, DefaultFatal; 381def err_file_modified : Error< 382 "file '%0' modified since it was first processed">, DefaultFatal; 383def err_file_too_large : Error< 384 "file '%0' is too large for Clang to process">; 385def err_sloc_space_too_large : Error< 386 "translation unit is too large for Clang to process: ran out of source locations">, DefaultFatal; 387def err_unsupported_bom : Error<"%0 byte order mark detected in '%1', but " 388 "encoding is not supported">, DefaultFatal; 389def err_unable_to_rename_temp : Error< 390 "unable to rename temporary '%0' to output file '%1': '%2'">; 391def err_unable_to_make_temp : Error< 392 "unable to make temporary file: %0">; 393def remark_sloc_usage : Remark< 394 "source manager location address space usage:">, 395 InGroup<DiagGroup<"sloc-usage">>, DefaultRemark, ShowInSystemHeader; 396def note_total_sloc_usage : Note< 397 "%0B in local locations, %1B in locations loaded from AST files, for a total " 398 "of %2B (%3%% of available space)">; 399def note_file_sloc_usage : Note< 400 "file entered %0 time%s0 using %1B of space" 401 "%plural{0:|: plus %2B for macro expansions}2">; 402def note_file_misc_sloc_usage : Note< 403 "%0 additional files entered using a total of %1B of space">; 404 405// Modules 406def err_module_format_unhandled : Error< 407 "no handler registered for module format '%0'">, DefaultFatal; 408 409// TransformActions 410// TODO: Use a custom category name to distinguish rewriter errors. 411def err_mt_message : Error<"[rewriter] %0">, SuppressInSystemHeader; 412def warn_mt_message : Warning<"[rewriter] %0">; 413def note_mt_message : Note<"[rewriter] %0">; 414 415// ARCMigrate 416def warn_arcmt_nsalloc_realloc : Warning<"[rewriter] call returns pointer to GC managed memory; it will become unmanaged in ARC">; 417def err_arcmt_nsinvocation_ownership : Error<"NSInvocation's %0 is not safe to be used with an object with ownership other than __unsafe_unretained">; 418 419// API notes 420def err_apinotes_message : Error<"%0">; 421def warn_apinotes_message : Warning<"%0">, InGroup<DiagGroup<"apinotes">>; 422def note_apinotes_message : Note<"%0">; 423 424class NonportablePrivateAPINotesPath : Warning< 425 "private API notes file for module '%0' should be named " 426 "'%0_private.apinotes', not '%1'">; 427def warn_apinotes_private_case : NonportablePrivateAPINotesPath, 428 InGroup<DiagGroup<"nonportable-private-apinotes-path">>; 429def warn_apinotes_private_case_system : NonportablePrivateAPINotesPath, 430 DefaultIgnore, InGroup<DiagGroup<"nonportable-private-system-apinotes-path">>; 431 432// C++ for OpenCL. 433def err_openclcxx_not_supported : Error< 434 "'%0' is not supported in C++ for OpenCL">; 435 436// HIP 437def warn_ignored_hip_only_option : Warning< 438 "'%0' is ignored since it is only supported for HIP">, 439 InGroup<HIPOnly>; 440 441// OpenMP 442def err_omp_more_one_clause : Error< 443 "directive '#pragma omp %0' cannot contain more than one '%1' clause%select{| with '%3' name modifier| with 'source' dependence}2">; 444def err_omp_required_clause : Error< 445 "directive '#pragma omp %0' requires the '%1' clause">; 446 447// Static Analyzer Core 448def err_unknown_analyzer_checker_or_package : Error< 449 "no analyzer checkers or packages are associated with '%0'">; 450def note_suggest_disabling_all_checkers : Note< 451 "use -analyzer-disable-all-checks to disable all static analyzer checkers">; 452 453// Poison system directories. 454def warn_poison_system_directories : Warning < 455 "include location '%0' is unsafe for cross-compilation">, 456 InGroup<DiagGroup<"poison-system-directories">>, DefaultIgnore; 457 458def warn_opencl_unsupported_core_feature : Warning< 459 "%0 is a core feature in %select{OpenCL C|C++ for OpenCL}1 version %2 but not supported on this target">, 460 InGroup<OpenCLCoreFeaturesDiagGroup>, DefaultIgnore; 461 462def err_opencl_extension_and_feature_differs : Error< 463 "options %0 and %1 are set to different values">; 464def err_opencl_feature_requires : Error< 465 "feature %0 requires support of %1 feature">; 466 467def warn_throw_not_valid_on_target : Warning< 468 "target '%0' does not support exception handling;" 469 " 'throw' is assumed to be never reached">, 470 InGroup<OpenMPTargetException>; 471def warn_try_not_valid_on_target : Warning< 472 "target '%0' does not support exception handling;" 473 " 'catch' block is ignored">, 474 InGroup<OpenMPTargetException>; 475} 476