[1b6477e] | 1 | /*
|
---|
| 2 | * Copyright (c) 2017 Jaroslav Jindrak
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | #include <cstdint>
|
---|
| 30 | #include <typeinfo>
|
---|
| 31 |
|
---|
| 32 | namespace __cxxabiv1
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Itanium C++ ABI type infos.
|
---|
| 36 | * See section 2.9.4 (RTTI Layout) of the Itanium C++ ABI spec.
|
---|
| 37 | *
|
---|
| 38 | * Note: The memory representation of these classes must not
|
---|
| 39 | * be modified! (Wel, no modifications at all shall be done.)
|
---|
| 40 | *
|
---|
| 41 | * Source: https://itanium-cxx-abi.github.io/cxx-abi/abi.html
|
---|
| 42 | */
|
---|
| 43 |
|
---|
| 44 | class __fundamental_type_info: public std::type_info
|
---|
| 45 | {
|
---|
| 46 | public:
|
---|
| 47 | virtual ~__fundamental_type_info();
|
---|
| 48 | };
|
---|
| 49 |
|
---|
| 50 | class __array_type_info: public std::type_info
|
---|
| 51 | {
|
---|
| 52 | public:
|
---|
| 53 | virtual ~__array_type_info();
|
---|
| 54 | };
|
---|
| 55 |
|
---|
| 56 | class __function_type_info: public std::type_info
|
---|
| 57 | {
|
---|
| 58 | public:
|
---|
| 59 | virtual ~__function_type_info();
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 | class __enum_type_info: public std::type_info
|
---|
| 63 | {
|
---|
| 64 | public:
|
---|
| 65 | virtual ~__enum_type_info();
|
---|
| 66 | };
|
---|
| 67 |
|
---|
| 68 | class __class_type_info: public std::type_info
|
---|
| 69 | {
|
---|
| 70 | public:
|
---|
| 71 | virtual ~__class_type_info();
|
---|
| 72 | };
|
---|
| 73 |
|
---|
| 74 | class __si_class_type_info: public __class_type_info
|
---|
| 75 | {
|
---|
| 76 | public:
|
---|
| 77 | virtual ~__si_class_type_info();
|
---|
| 78 |
|
---|
| 79 | const __class_type_info* __base_type;
|
---|
| 80 | };
|
---|
| 81 |
|
---|
| 82 | struct __base_class_type_info
|
---|
| 83 | {
|
---|
| 84 | const __class_type_info* __base_type;
|
---|
| 85 | long __offset_flags;
|
---|
| 86 |
|
---|
| 87 | enum __ofset_flags_masks
|
---|
| 88 | {
|
---|
| 89 | __virtual_mask = 0x1,
|
---|
| 90 | __public_mask = 0x2,
|
---|
| 91 | __offset_shift = 0x8
|
---|
| 92 | };
|
---|
| 93 | };
|
---|
| 94 |
|
---|
| 95 | class __vmi_class_type_info: public __class_type_info
|
---|
| 96 | {
|
---|
| 97 | public:
|
---|
| 98 | virtual ~__vmi_class_type_info();
|
---|
| 99 |
|
---|
| 100 | std::uint32_t __flags;
|
---|
| 101 | std::uint32_t __base_count;
|
---|
| 102 |
|
---|
| 103 | __base_class_type_info __base_info[1];
|
---|
| 104 |
|
---|
| 105 | enum __flags_mask
|
---|
| 106 | {
|
---|
| 107 | __non_diamond_repeat_mask = 0x1,
|
---|
| 108 | __diamond_shaped_mask = 0x2
|
---|
| 109 | };
|
---|
| 110 | };
|
---|
| 111 |
|
---|
| 112 | class __pbase_type_info: public std::type_info
|
---|
| 113 | {
|
---|
| 114 | public:
|
---|
| 115 | virtual ~__pbase_type_info();
|
---|
| 116 |
|
---|
| 117 | std::uint32_t __flags;
|
---|
| 118 | const std::type_info* __pointee;
|
---|
| 119 |
|
---|
| 120 | enum __masks
|
---|
| 121 | {
|
---|
| 122 | __const_mask = 0x01,
|
---|
| 123 | __volatile_mask = 0x02,
|
---|
| 124 | __restrict_mask = 0x04,
|
---|
| 125 | __incomplete_mask = 0x08,
|
---|
| 126 | __incomplete_class_mask = 0x10,
|
---|
| 127 | __transaction_safe_mask = 0x20,
|
---|
| 128 | __noexcept_mask = 0x40
|
---|
| 129 | };
|
---|
| 130 | };
|
---|
| 131 |
|
---|
| 132 | class __pointer_type_info: public __pbase_type_info
|
---|
| 133 | {
|
---|
| 134 | public:
|
---|
| 135 | virtual ~__pointer_type_info();
|
---|
| 136 | };
|
---|
| 137 |
|
---|
| 138 | class __pointer_to_member_type_info: public __pbase_type_info
|
---|
| 139 | {
|
---|
| 140 | public:
|
---|
| 141 | virtual ~__pointer_to_member_type_info();
|
---|
| 142 |
|
---|
| 143 | const __class_type_info* __context;
|
---|
| 144 | };
|
---|
| 145 |
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | namespace abi = __cxxabiv1;
|
---|