reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
//===--- Features.def - Features and Extensions database --------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file defines features exposed via __has_feature and extensions exposed
// via __has_extension. Users of this file must either define the FEATURE or
// EXTENSION macros (or both) to make use of this information. Note that these
// macros expect the following declarations to be available for the Predicate:
//
//   const LangOptions &LangOpts;
//   const Preprocessor &PP;
//
// The Predicate field dictates the conditions under which the feature or
// extension will be made available.
//
// FEATURE(...) should be used to advertise support for standard language
// features, whereas EXTENSION(...) should be used for clang extensions. Note
// that many of the identifiers in this file don't follow this rule for backward
// compatibility reasons.
//
//===----------------------------------------------------------------------===//

#if !defined(FEATURE) && !defined(EXTENSION)
#  error Define either the FEATURE or EXTENSION macro to handle features
#endif

#ifndef FEATURE
#define FEATURE(Name, Predicate)
#endif

#ifndef EXTENSION
#define EXTENSION(Name, Predicate)
#endif

FEATURE(address_sanitizer,
        LangOpts.Sanitize.hasOneOf(SanitizerKind::Address |
                                   SanitizerKind::KernelAddress))
FEATURE(leak_sanitizer,
        LangOpts.Sanitize.has(SanitizerKind::Leak))
FEATURE(hwaddress_sanitizer,
        LangOpts.Sanitize.hasOneOf(SanitizerKind::HWAddress |
                                   SanitizerKind::KernelHWAddress))
FEATURE(memtag_sanitizer, LangOpts.Sanitize.has(SanitizerKind::MemTag))
FEATURE(xray_instrument, LangOpts.XRayInstrument)
FEATURE(undefined_behavior_sanitizer,
        LangOpts.Sanitize.hasOneOf(SanitizerKind::Undefined))
FEATURE(assume_nonnull, true)
FEATURE(attribute_analyzer_noreturn, true)
FEATURE(attribute_availability, true)
FEATURE(attribute_availability_with_message, true)
FEATURE(attribute_availability_app_extension, true)
FEATURE(attribute_availability_with_version_underscores, true)
FEATURE(attribute_availability_tvos, true)
FEATURE(attribute_availability_watchos, true)
FEATURE(attribute_availability_with_strict, true)
FEATURE(attribute_availability_with_replacement, true)
FEATURE(attribute_availability_in_templates, true)
FEATURE(attribute_availability_swift, true)
FEATURE(attribute_cf_returns_not_retained, true)
FEATURE(attribute_cf_returns_retained, true)
FEATURE(attribute_cf_returns_on_parameters, true)
FEATURE(attribute_deprecated_with_message, true)
FEATURE(attribute_deprecated_with_replacement, true)
FEATURE(attribute_ext_vector_type, true)
FEATURE(attribute_ns_returns_not_retained, true)
FEATURE(attribute_ns_returns_retained, true)
FEATURE(attribute_ns_consumes_self, true)
FEATURE(attribute_ns_consumed, true)
FEATURE(attribute_cf_consumed, true)
FEATURE(attribute_objc_ivar_unused, true)
FEATURE(attribute_objc_method_family, true)
FEATURE(attribute_overloadable, true)
FEATURE(attribute_unavailable_with_message, true)
FEATURE(attribute_unused_on_fields, true)
FEATURE(attribute_diagnose_if_objc, true)
FEATURE(blocks, LangOpts.Blocks)
FEATURE(c_thread_safety_attributes, true)
FEATURE(cxx_exceptions, LangOpts.CXXExceptions)
FEATURE(cxx_rtti, LangOpts.RTTI &&LangOpts.RTTIData)
FEATURE(enumerator_attributes, true)
FEATURE(nullability, true)
FEATURE(nullability_on_arrays, true)
FEATURE(memory_sanitizer,
        LangOpts.Sanitize.hasOneOf(SanitizerKind::Memory |
                                   SanitizerKind::KernelMemory))
FEATURE(thread_sanitizer, LangOpts.Sanitize.has(SanitizerKind::Thread))
FEATURE(dataflow_sanitizer, LangOpts.Sanitize.has(SanitizerKind::DataFlow))
FEATURE(scudo, LangOpts.Sanitize.hasOneOf(SanitizerKind::Scudo))
// Objective-C features
FEATURE(objc_arr, LangOpts.ObjCAutoRefCount) // FIXME: REMOVE?
FEATURE(objc_arc, LangOpts.ObjCAutoRefCount)
FEATURE(objc_arc_fields, true)
FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
FEATURE(objc_fixed_enum, LangOpts.ObjC)
FEATURE(objc_instancetype, LangOpts.ObjC)
FEATURE(objc_kindof, LangOpts.ObjC)
FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)
FEATURE(objc_nonfragile_abi, LangOpts.ObjCRuntime.isNonFragile())
FEATURE(objc_property_explicit_atomic, true)
FEATURE(objc_protocol_qualifier_mangling, true)
FEATURE(objc_weak_class, LangOpts.ObjCRuntime.hasWeakClassImport())
FEATURE(ownership_holds, true)
FEATURE(ownership_returns, true)
FEATURE(ownership_takes, true)
FEATURE(objc_bool, true)
FEATURE(objc_subscripting, LangOpts.ObjCRuntime.isNonFragile())
FEATURE(objc_array_literals, LangOpts.ObjC)
FEATURE(objc_dictionary_literals, LangOpts.ObjC)
FEATURE(objc_boxed_expressions, LangOpts.ObjC)
FEATURE(objc_boxed_nsvalue_expressions, LangOpts.ObjC)
FEATURE(arc_cf_code_audited, true)
FEATURE(objc_bridge_id, true)
FEATURE(objc_bridge_id_on_typedefs, true)
FEATURE(objc_generics, LangOpts.ObjC)
FEATURE(objc_generics_variance, LangOpts.ObjC)
FEATURE(objc_class_property, LangOpts.ObjC)
FEATURE(objc_c_static_assert, LangOpts.C11)
FEATURE(objc_cxx_static_assert, LangOpts.CPlusPlus11)
EXTENSION(objc_c_static_assert, true)
// C11 features
FEATURE(c_alignas, LangOpts.C11)
FEATURE(c_alignof, LangOpts.C11)
FEATURE(c_atomic, LangOpts.C11)
FEATURE(c_generic_selections, LangOpts.C11)
FEATURE(c_static_assert, LangOpts.C11)
FEATURE(c_thread_local, LangOpts.C11 &&PP.getTargetInfo().isTLSSupported())
// C++11 features
FEATURE(cxx_access_control_sfinae, LangOpts.CPlusPlus11)
FEATURE(cxx_alias_templates, LangOpts.CPlusPlus11)
FEATURE(cxx_alignas, LangOpts.CPlusPlus11)
FEATURE(cxx_alignof, LangOpts.CPlusPlus11)
FEATURE(cxx_atomic, LangOpts.CPlusPlus11)
FEATURE(cxx_attributes, LangOpts.CPlusPlus11)
FEATURE(cxx_auto_type, LangOpts.CPlusPlus11)
FEATURE(cxx_constexpr, LangOpts.CPlusPlus11)
FEATURE(cxx_constexpr_string_builtins, LangOpts.CPlusPlus11)
FEATURE(cxx_decltype, LangOpts.CPlusPlus11)
FEATURE(cxx_decltype_incomplete_return_types, LangOpts.CPlusPlus11)
FEATURE(cxx_default_function_template_args, LangOpts.CPlusPlus11)
FEATURE(cxx_defaulted_functions, LangOpts.CPlusPlus11)
FEATURE(cxx_delegating_constructors, LangOpts.CPlusPlus11)
FEATURE(cxx_deleted_functions, LangOpts.CPlusPlus11)
FEATURE(cxx_explicit_conversions, LangOpts.CPlusPlus11)
FEATURE(cxx_generalized_initializers, LangOpts.CPlusPlus11)
FEATURE(cxx_implicit_moves, LangOpts.CPlusPlus11)
FEATURE(cxx_inheriting_constructors, LangOpts.CPlusPlus11)
FEATURE(cxx_inline_namespaces, LangOpts.CPlusPlus11)
FEATURE(cxx_lambdas, LangOpts.CPlusPlus11)
FEATURE(cxx_local_type_template_args, LangOpts.CPlusPlus11)
FEATURE(cxx_nonstatic_member_init, LangOpts.CPlusPlus11)
FEATURE(cxx_noexcept, LangOpts.CPlusPlus11)
FEATURE(cxx_nullptr, LangOpts.CPlusPlus11)
FEATURE(cxx_override_control, LangOpts.CPlusPlus11)
FEATURE(cxx_range_for, LangOpts.CPlusPlus11)
FEATURE(cxx_raw_string_literals, LangOpts.CPlusPlus11)
FEATURE(cxx_reference_qualified_functions, LangOpts.CPlusPlus11)
FEATURE(cxx_rvalue_references, LangOpts.CPlusPlus11)
FEATURE(cxx_strong_enums, LangOpts.CPlusPlus11)
FEATURE(cxx_static_assert, LangOpts.CPlusPlus11)
FEATURE(cxx_thread_local,
        LangOpts.CPlusPlus11 &&PP.getTargetInfo().isTLSSupported())
FEATURE(cxx_trailing_return, LangOpts.CPlusPlus11)
FEATURE(cxx_unicode_literals, LangOpts.CPlusPlus11)
FEATURE(cxx_unrestricted_unions, LangOpts.CPlusPlus11)
FEATURE(cxx_user_literals, LangOpts.CPlusPlus11)
FEATURE(cxx_variadic_templates, LangOpts.CPlusPlus11)
// C++14 features
FEATURE(cxx_aggregate_nsdmi, LangOpts.CPlusPlus14)
FEATURE(cxx_binary_literals, LangOpts.CPlusPlus14)
FEATURE(cxx_contextual_conversions, LangOpts.CPlusPlus14)
FEATURE(cxx_decltype_auto, LangOpts.CPlusPlus14)
FEATURE(cxx_generic_lambdas, LangOpts.CPlusPlus14)
FEATURE(cxx_init_captures, LangOpts.CPlusPlus14)
FEATURE(cxx_relaxed_constexpr, LangOpts.CPlusPlus14)
FEATURE(cxx_return_type_deduction, LangOpts.CPlusPlus14)
FEATURE(cxx_variable_templates, LangOpts.CPlusPlus14)
// NOTE: For features covered by SD-6, it is preferable to provide *only*
// the SD-6 macro and not a __has_feature check.

// C++ TSes
// FEATURE(cxx_runtime_arrays, LangOpts.CPlusPlusTSArrays)
// FEATURE(cxx_concepts, LangOpts.CPlusPlusTSConcepts)
// FIXME: Should this be __has_feature or __has_extension?
// FEATURE(raw_invocation_type, LangOpts.CPlusPlus)
// Type traits
// N.B. Additional type traits should not be added to the following list.
// Instead, they should be detected by has_builtin.
FEATURE(has_nothrow_assign, LangOpts.CPlusPlus)
FEATURE(has_nothrow_copy, LangOpts.CPlusPlus)
FEATURE(has_nothrow_constructor, LangOpts.CPlusPlus)
FEATURE(has_trivial_assign, LangOpts.CPlusPlus)
FEATURE(has_trivial_copy, LangOpts.CPlusPlus)
FEATURE(has_trivial_constructor, LangOpts.CPlusPlus)
FEATURE(has_trivial_destructor, LangOpts.CPlusPlus)
FEATURE(has_virtual_destructor, LangOpts.CPlusPlus)
FEATURE(is_abstract, LangOpts.CPlusPlus)
FEATURE(is_base_of, LangOpts.CPlusPlus)
FEATURE(is_class, LangOpts.CPlusPlus)
FEATURE(is_constructible, LangOpts.CPlusPlus)
FEATURE(is_convertible_to, LangOpts.CPlusPlus)
FEATURE(is_empty, LangOpts.CPlusPlus)
FEATURE(is_enum, LangOpts.CPlusPlus)
FEATURE(is_final, LangOpts.CPlusPlus)
FEATURE(is_literal, LangOpts.CPlusPlus)
FEATURE(is_standard_layout, LangOpts.CPlusPlus)
FEATURE(is_pod, LangOpts.CPlusPlus)
FEATURE(is_polymorphic, LangOpts.CPlusPlus)
FEATURE(is_sealed, LangOpts.CPlusPlus &&LangOpts.MicrosoftExt)
FEATURE(is_trivial, LangOpts.CPlusPlus)
FEATURE(is_trivially_assignable, LangOpts.CPlusPlus)
FEATURE(is_trivially_constructible, LangOpts.CPlusPlus)
FEATURE(is_trivially_copyable, LangOpts.CPlusPlus)
FEATURE(is_union, LangOpts.CPlusPlus)
FEATURE(modules, LangOpts.Modules)
FEATURE(safe_stack, LangOpts.Sanitize.has(SanitizerKind::SafeStack))
FEATURE(shadow_call_stack,
        LangOpts.Sanitize.has(SanitizerKind::ShadowCallStack))
FEATURE(tls, PP.getTargetInfo().isTLSSupported())
FEATURE(underlying_type, LangOpts.CPlusPlus)

// C11 features supported by other languages as extensions.
EXTENSION(c_alignas, true)
EXTENSION(c_alignof, true)
EXTENSION(c_atomic, true)
EXTENSION(c_generic_selections, true)
EXTENSION(c_static_assert, true)
EXTENSION(c_thread_local, PP.getTargetInfo().isTLSSupported())
// C++11 features supported by other languages as extensions.
EXTENSION(cxx_atomic, LangOpts.CPlusPlus)
EXTENSION(cxx_deleted_functions, LangOpts.CPlusPlus)
EXTENSION(cxx_explicit_conversions, LangOpts.CPlusPlus)
EXTENSION(cxx_inline_namespaces, LangOpts.CPlusPlus)
EXTENSION(cxx_local_type_template_args, LangOpts.CPlusPlus)
EXTENSION(cxx_nonstatic_member_init, LangOpts.CPlusPlus)
EXTENSION(cxx_override_control, LangOpts.CPlusPlus)
EXTENSION(cxx_range_for, LangOpts.CPlusPlus)
EXTENSION(cxx_reference_qualified_functions, LangOpts.CPlusPlus)
EXTENSION(cxx_rvalue_references, LangOpts.CPlusPlus)
EXTENSION(cxx_variadic_templates, LangOpts.CPlusPlus)
EXTENSION(cxx_fixed_enum, true)
// C++14 features supported by other languages as extensions.
EXTENSION(cxx_binary_literals, true)
EXTENSION(cxx_init_captures, LangOpts.CPlusPlus11)
EXTENSION(cxx_variable_templates, LangOpts.CPlusPlus)
// Miscellaneous language extensions
EXTENSION(overloadable_unmarked, true)
EXTENSION(pragma_clang_attribute_namespaces, true)
EXTENSION(pragma_clang_attribute_external_declaration, true)
EXTENSION(gnu_asm, LangOpts.GNUAsm)

#undef EXTENSION
#undef FEATURE