1
//===------------------------ private_typeinfo.h --------------------------===//
3
// The LLVM Compiler Infrastructure
5
// This file is dual licensed under the MIT and the University of Illinois Open
6
// Source Licenses. See LICENSE.TXT for details.
8
//===----------------------------------------------------------------------===//
10
#ifndef __PRIVATE_TYPEINFO_H_
11
#define __PRIVATE_TYPEINFO_H_
19
#pragma GCC visibility push(hidden)
21
class __attribute__ ((__visibility__("default"))) __shim_type_info
22
: public std::type_info
25
__attribute__ ((__visibility__("hidden"))) virtual ~__shim_type_info();
27
__attribute__ ((__visibility__("hidden"))) virtual void noop1() const;
28
__attribute__ ((__visibility__("hidden"))) virtual void noop2() const;
29
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info* thrown_type, void*& adjustedPtr) const = 0;
32
class __attribute__ ((__visibility__("default"))) __fundamental_type_info
33
: public __shim_type_info
36
__attribute__ ((__visibility__("hidden"))) virtual ~__fundamental_type_info();
37
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
40
class __attribute__ ((__visibility__("default"))) __array_type_info
41
: public __shim_type_info
44
__attribute__ ((__visibility__("hidden"))) virtual ~__array_type_info();
45
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
48
class __attribute__ ((__visibility__("default"))) __function_type_info
49
: public __shim_type_info
52
__attribute__ ((__visibility__("hidden"))) virtual ~__function_type_info();
53
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
56
class __attribute__ ((__visibility__("default"))) __enum_type_info
57
: public __shim_type_info
60
__attribute__ ((__visibility__("hidden"))) virtual ~__enum_type_info();
61
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
73
class __attribute__ ((__visibility__("default"))) __class_type_info;
75
struct __dynamic_cast_info
77
// const data supplied to the search:
79
const __class_type_info* dst_type;
80
const void* static_ptr;
81
const __class_type_info* static_type;
82
std::ptrdiff_t src2dst_offset;
84
// Data that represents the answer:
86
// pointer to a dst_type which has (static_ptr, static_type) above it
87
const void* dst_ptr_leading_to_static_ptr;
88
// pointer to a dst_type which does not have (static_ptr, static_type) above it
89
const void* dst_ptr_not_leading_to_static_ptr;
91
// The following three paths are either unknown, public_path or not_public_path.
92
// access of path from dst_ptr_leading_to_static_ptr to (static_ptr, static_type)
93
int path_dst_ptr_to_static_ptr;
94
// access of path from (dynamic_ptr, dynamic_type) to (static_ptr, static_type)
95
// when there is no dst_type along the path
96
int path_dynamic_ptr_to_static_ptr;
97
// access of path from (dynamic_ptr, dynamic_type) to dst_type
98
// (not used if there is a (static_ptr, static_type) above a dst_type).
99
int path_dynamic_ptr_to_dst_ptr;
101
// Number of dst_types below (static_ptr, static_type)
102
int number_to_static_ptr;
103
// Number of dst_types not below (static_ptr, static_type)
104
int number_to_dst_ptr;
106
// Data that helps stop the search before the entire tree is searched:
108
// is_dst_type_derived_from_static_type is either unknown, yes or no.
109
int is_dst_type_derived_from_static_type;
110
// Number of dst_type in tree. If 0, then that means unknown.
111
int number_of_dst_type;
112
// communicates to a dst_type node that (static_ptr, static_type) was found
114
bool found_our_static_ptr;
115
// communicates to a dst_type node that a static_type was found
116
// above it, but it wasn't (static_ptr, static_type)
117
bool found_any_static_type;
118
// Set whenever a search can be stopped
123
class __attribute__ ((__visibility__("default"))) __class_type_info
124
: public __shim_type_info
127
__attribute__ ((__visibility__("hidden"))) virtual ~__class_type_info();
129
__attribute__ ((__visibility__("hidden")))
130
void process_static_type_above_dst(__dynamic_cast_info*, const void*, const void*, int) const;
131
__attribute__ ((__visibility__("hidden")))
132
void process_static_type_below_dst(__dynamic_cast_info*, const void*, int) const;
133
__attribute__ ((__visibility__("hidden")))
134
void process_found_base_class(__dynamic_cast_info*, void*, int) const;
135
__attribute__ ((__visibility__("hidden")))
136
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const;
137
__attribute__ ((__visibility__("hidden")))
138
virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const;
139
__attribute__ ((__visibility__("hidden")))
140
virtual bool can_catch(const __shim_type_info*, void*&) const;
141
__attribute__ ((__visibility__("hidden")))
142
virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
145
// Has one non-virtual public base class at offset zero
146
class __attribute__ ((__visibility__("default"))) __si_class_type_info
147
: public __class_type_info
150
const __class_type_info* __base_type;
152
__attribute__ ((__visibility__("hidden"))) virtual ~__si_class_type_info();
154
__attribute__ ((__visibility__("hidden")))
155
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const;
156
__attribute__ ((__visibility__("hidden")))
157
virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const;
158
__attribute__ ((__visibility__("hidden")))
159
virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
162
struct __base_class_type_info
165
const __class_type_info* __base_type;
168
enum __offset_flags_masks
170
__virtual_mask = 0x1,
171
__public_mask = 0x2, // base is public
175
void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const;
176
void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const;
177
void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
180
// Has one or more base classes
181
class __attribute__ ((__visibility__("default"))) __vmi_class_type_info
182
: public __class_type_info
185
unsigned int __flags;
186
unsigned int __base_count;
187
__base_class_type_info __base_info[1];
191
__non_diamond_repeat_mask = 0x1, // has two or more distinct base class
192
// objects of the same type
193
__diamond_shaped_mask = 0x2 // has base class object with two or
194
// more derived objects
197
__attribute__ ((__visibility__("hidden"))) virtual ~__vmi_class_type_info();
199
__attribute__ ((__visibility__("hidden")))
200
virtual void search_above_dst(__dynamic_cast_info*, const void*, const void*, int, bool) const;
201
__attribute__ ((__visibility__("hidden")))
202
virtual void search_below_dst(__dynamic_cast_info*, const void*, int, bool) const;
203
__attribute__ ((__visibility__("hidden")))
204
virtual void has_unambiguous_public_base(__dynamic_cast_info*, void*, int) const;
207
class __attribute__ ((__visibility__("default"))) __pbase_type_info
208
: public __shim_type_info
211
unsigned int __flags;
212
const __shim_type_info* __pointee;
217
__volatile_mask = 0x2,
218
__restrict_mask = 0x4,
219
__incomplete_mask = 0x8,
220
__incomplete_class_mask = 0x10
223
__attribute__ ((__visibility__("hidden"))) virtual ~__pbase_type_info();
224
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
227
class __attribute__ ((__visibility__("default"))) __pointer_type_info
228
: public __pbase_type_info
231
__attribute__ ((__visibility__("hidden"))) virtual ~__pointer_type_info();
232
__attribute__ ((__visibility__("hidden"))) virtual bool can_catch(const __shim_type_info*, void*&) const;
235
class __attribute__ ((__visibility__("default"))) __pointer_to_member_type_info
236
: public __pbase_type_info
239
const __class_type_info* __context;
241
__attribute__ ((__visibility__("hidden"))) virtual ~__pointer_to_member_type_info();
244
#pragma GCC visibility pop
248
#endif // __PRIVATE_TYPEINFO_H_