Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:43:47

0001 //===--- DemangleConfig.h ---------------------------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file contains a variety of feature test macros copied from
0010 // include/llvm/Support/Compiler.h so that LLVMDemangle does not need to take
0011 // a dependency on LLVMSupport.
0012 //
0013 //===----------------------------------------------------------------------===//
0014 
0015 #ifndef LLVM_DEMANGLE_DEMANGLECONFIG_H
0016 #define LLVM_DEMANGLE_DEMANGLECONFIG_H
0017 
0018 #ifndef __has_feature
0019 #define __has_feature(x) 0
0020 #endif
0021 
0022 #ifndef __has_cpp_attribute
0023 #define __has_cpp_attribute(x) 0
0024 #endif
0025 
0026 #ifndef __has_attribute
0027 #define __has_attribute(x) 0
0028 #endif
0029 
0030 #ifndef __has_builtin
0031 #define __has_builtin(x) 0
0032 #endif
0033 
0034 #ifndef DEMANGLE_GNUC_PREREQ
0035 #if defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
0036 #define DEMANGLE_GNUC_PREREQ(maj, min, patch)                           \
0037   ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) + __GNUC_PATCHLEVEL__ >=          \
0038    ((maj) << 20) + ((min) << 10) + (patch))
0039 #elif defined(__GNUC__) && defined(__GNUC_MINOR__)
0040 #define DEMANGLE_GNUC_PREREQ(maj, min, patch)                           \
0041   ((__GNUC__ << 20) + (__GNUC_MINOR__ << 10) >= ((maj) << 20) + ((min) << 10))
0042 #else
0043 #define DEMANGLE_GNUC_PREREQ(maj, min, patch) 0
0044 #endif
0045 #endif
0046 
0047 #if __has_attribute(used) || DEMANGLE_GNUC_PREREQ(3, 1, 0)
0048 #define DEMANGLE_ATTRIBUTE_USED __attribute__((__used__))
0049 #else
0050 #define DEMANGLE_ATTRIBUTE_USED
0051 #endif
0052 
0053 #if __has_builtin(__builtin_unreachable) || DEMANGLE_GNUC_PREREQ(4, 5, 0)
0054 #define DEMANGLE_UNREACHABLE __builtin_unreachable()
0055 #elif defined(_MSC_VER)
0056 #define DEMANGLE_UNREACHABLE __assume(false)
0057 #else
0058 #define DEMANGLE_UNREACHABLE
0059 #endif
0060 
0061 #if __has_attribute(noinline) || DEMANGLE_GNUC_PREREQ(3, 4, 0)
0062 #define DEMANGLE_ATTRIBUTE_NOINLINE __attribute__((noinline))
0063 #elif defined(_MSC_VER)
0064 #define DEMANGLE_ATTRIBUTE_NOINLINE __declspec(noinline)
0065 #else
0066 #define DEMANGLE_ATTRIBUTE_NOINLINE
0067 #endif
0068 
0069 #if !defined(NDEBUG)
0070 #define DEMANGLE_DUMP_METHOD DEMANGLE_ATTRIBUTE_NOINLINE DEMANGLE_ATTRIBUTE_USED
0071 #else
0072 #define DEMANGLE_DUMP_METHOD DEMANGLE_ATTRIBUTE_NOINLINE
0073 #endif
0074 
0075 #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
0076 #define DEMANGLE_FALLTHROUGH [[fallthrough]]
0077 #elif __has_cpp_attribute(gnu::fallthrough)
0078 #define DEMANGLE_FALLTHROUGH [[gnu::fallthrough]]
0079 #elif !__cplusplus
0080 // Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious
0081 // error when __has_cpp_attribute is given a scoped attribute in C mode.
0082 #define DEMANGLE_FALLTHROUGH
0083 #elif __has_cpp_attribute(clang::fallthrough)
0084 #define DEMANGLE_FALLTHROUGH [[clang::fallthrough]]
0085 #else
0086 #define DEMANGLE_FALLTHROUGH
0087 #endif
0088 
0089 #ifndef DEMANGLE_ASSERT
0090 #include <cassert>
0091 #define DEMANGLE_ASSERT(__expr, __msg) assert((__expr) && (__msg))
0092 #endif
0093 
0094 #define DEMANGLE_NAMESPACE_BEGIN namespace llvm { namespace itanium_demangle {
0095 #define DEMANGLE_NAMESPACE_END } }
0096 
0097 #endif