| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2018 Jaroslav Jindrak
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #ifndef LIBCPP_BITS_ABI
|
|---|
| 8 | #define LIBCPP_BITS_ABI
|
|---|
| 9 |
|
|---|
| 10 | #include <cstddef>
|
|---|
| 11 | #include <cstdint>
|
|---|
| 12 | #include <typeinfo>
|
|---|
| 13 |
|
|---|
| 14 | namespace __cxxabiv1
|
|---|
| 15 | {
|
|---|
| 16 | /**
|
|---|
| 17 | * Static constructor/destructor helpers.
|
|---|
| 18 | */
|
|---|
| 19 |
|
|---|
| 20 | extern "C" int __cxa_atexit(void (*)(void*), void*, void*);
|
|---|
| 21 |
|
|---|
| 22 | extern "C" void __cxa_finalize(void*);
|
|---|
| 23 |
|
|---|
| 24 | /**
|
|---|
| 25 | * Itanium C++ ABI type infos.
|
|---|
| 26 | * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
|
|---|
| 27 | *
|
|---|
| 28 | * Note: The memory representation of these classes must not
|
|---|
| 29 | * be modified! (Wel, no modifications at all shall be done.)
|
|---|
| 30 | *
|
|---|
| 31 | * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
|
|---|
| 32 | */
|
|---|
| 33 |
|
|---|
| 34 | class __fundamental_type_info: public std::type_info
|
|---|
| 35 | {
|
|---|
| 36 | public:
|
|---|
| 37 | virtual ~__fundamental_type_info();
|
|---|
| 38 | };
|
|---|
| 39 |
|
|---|
| 40 | class __array_type_info: public std::type_info
|
|---|
| 41 | {
|
|---|
| 42 | public:
|
|---|
| 43 | virtual ~__array_type_info();
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 | class __function_type_info: public std::type_info
|
|---|
| 47 | {
|
|---|
| 48 | public:
|
|---|
| 49 | virtual ~__function_type_info();
|
|---|
| 50 | };
|
|---|
| 51 |
|
|---|
| 52 | class __enum_type_info: public std::type_info
|
|---|
| 53 | {
|
|---|
| 54 | public:
|
|---|
| 55 | virtual ~__enum_type_info();
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | class __class_type_info: public std::type_info
|
|---|
| 59 | {
|
|---|
| 60 | public:
|
|---|
| 61 | virtual ~__class_type_info();
|
|---|
| 62 | };
|
|---|
| 63 |
|
|---|
| 64 | class __si_class_type_info: public __class_type_info
|
|---|
| 65 | {
|
|---|
| 66 | public:
|
|---|
| 67 | virtual ~__si_class_type_info();
|
|---|
| 68 |
|
|---|
| 69 | const __class_type_info* __base_type;
|
|---|
| 70 | };
|
|---|
| 71 |
|
|---|
| 72 | struct __base_class_type_info
|
|---|
| 73 | {
|
|---|
| 74 | const __class_type_info* __base_type;
|
|---|
| 75 | long __offset_flags;
|
|---|
| 76 |
|
|---|
| 77 | enum __ofset_flags_masks
|
|---|
| 78 | {
|
|---|
| 79 | __virtual_mask = 0x1,
|
|---|
| 80 | __public_mask = 0x2,
|
|---|
| 81 | __offset_shift = 0x8
|
|---|
| 82 | };
|
|---|
| 83 | };
|
|---|
| 84 |
|
|---|
| 85 | class __vmi_class_type_info: public __class_type_info
|
|---|
| 86 | {
|
|---|
| 87 | public:
|
|---|
| 88 | virtual ~__vmi_class_type_info();
|
|---|
| 89 |
|
|---|
| 90 | std::uint32_t __flags;
|
|---|
| 91 | std::uint32_t __base_count;
|
|---|
| 92 |
|
|---|
| 93 | __base_class_type_info __base_info[1];
|
|---|
| 94 |
|
|---|
| 95 | enum __flags_mask
|
|---|
| 96 | {
|
|---|
| 97 | __non_diamond_repeat_mask = 0x1,
|
|---|
| 98 | __diamond_shaped_mask = 0x2
|
|---|
| 99 | };
|
|---|
| 100 | };
|
|---|
| 101 |
|
|---|
| 102 | class __pbase_type_info: public std::type_info
|
|---|
| 103 | {
|
|---|
| 104 | public:
|
|---|
| 105 | virtual ~__pbase_type_info();
|
|---|
| 106 |
|
|---|
| 107 | std::uint32_t __flags;
|
|---|
| 108 | const std::type_info* __pointee;
|
|---|
| 109 |
|
|---|
| 110 | enum __masks
|
|---|
| 111 | {
|
|---|
| 112 | __const_mask = 0x01,
|
|---|
| 113 | __volatile_mask = 0x02,
|
|---|
| 114 | __restrict_mask = 0x04,
|
|---|
| 115 | __incomplete_mask = 0x08,
|
|---|
| 116 | __incomplete_class_mask = 0x10,
|
|---|
| 117 | __transaction_safe_mask = 0x20,
|
|---|
| 118 | __noexcept_mask = 0x40
|
|---|
| 119 | };
|
|---|
| 120 | };
|
|---|
| 121 |
|
|---|
| 122 | class __pointer_type_info: public __pbase_type_info
|
|---|
| 123 | {
|
|---|
| 124 | public:
|
|---|
| 125 | virtual ~__pointer_type_info();
|
|---|
| 126 | };
|
|---|
| 127 |
|
|---|
| 128 | class __pointer_to_member_type_info: public __pbase_type_info
|
|---|
| 129 | {
|
|---|
| 130 | public:
|
|---|
| 131 | virtual ~__pointer_to_member_type_info();
|
|---|
| 132 |
|
|---|
| 133 | const __class_type_info* __context;
|
|---|
| 134 | };
|
|---|
| 135 |
|
|---|
| 136 | extern "C" void* __dynamic_cast(const void*, const __class_type_info*,
|
|---|
| 137 | const __class_type_info*, std::ptrdiff_t);
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | namespace abi = __cxxabiv1;
|
|---|
| 141 |
|
|---|
| 142 | #endif
|
|---|