EventAnalysis  1.3.0
private_typeinfo.h
Go to the documentation of this file.
1 //===------------------------ private_typeinfo.h --------------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef __PRIVATE_TYPEINFO_H_
11 #define __PRIVATE_TYPEINFO_H_
12 
13 #include "__cxxabi_config.h"
14 
15 #include <cstddef>
16 #include <typeinfo>
17 
18 namespace __cxxabiv1 {
19 
20 class _LIBCXXABI_TYPE_VIS __shim_type_info : public std::type_info {
21 public:
22  _LIBCXXABI_HIDDEN virtual ~__shim_type_info();
23 
24  _LIBCXXABI_HIDDEN virtual void noop1() const;
25  _LIBCXXABI_HIDDEN virtual void noop2() const;
26  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *thrown_type, void *&adjustedPtr) const = 0;
27 };
28 
29 class _LIBCXXABI_TYPE_VIS __fundamental_type_info : public __shim_type_info {
30 public:
31  _LIBCXXABI_HIDDEN virtual ~__fundamental_type_info();
32  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
33 };
34 
35 class _LIBCXXABI_TYPE_VIS __array_type_info : public __shim_type_info {
36 public:
37  _LIBCXXABI_HIDDEN virtual ~__array_type_info();
38  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
39 };
40 
41 class _LIBCXXABI_TYPE_VIS __function_type_info : public __shim_type_info {
42 public:
43  _LIBCXXABI_HIDDEN virtual ~__function_type_info();
44  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
45 };
46 
47 class _LIBCXXABI_TYPE_VIS __enum_type_info : public __shim_type_info {
48 public:
49  _LIBCXXABI_HIDDEN virtual ~__enum_type_info();
50  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
51 };
52 
54 
55 class _LIBCXXABI_TYPE_VIS __class_type_info;
56 
57 struct _LIBCXXABI_HIDDEN __dynamic_cast_info {
58  // const data supplied to the search:
59 
61  const void *static_ptr;
63  std::ptrdiff_t src2dst_offset;
64 
65  // Data that represents the answer:
66 
67  // pointer to a dst_type which has (static_ptr, static_type) above it
69  // pointer to a dst_type which does not have (static_ptr, static_type) above
70  // it
72 
73  // The following three paths are either unknown, public_path or
74  // not_public_path. access of path from dst_ptr_leading_to_static_ptr to
75  // (static_ptr, static_type)
77  // access of path from (dynamic_ptr, dynamic_type) to (static_ptr,
78  // static_type)
79  // when there is no dst_type along the path
81  // access of path from (dynamic_ptr, dynamic_type) to dst_type
82  // (not used if there is a (static_ptr, static_type) above a dst_type).
84 
85  // Number of dst_types below (static_ptr, static_type)
87  // Number of dst_types not below (static_ptr, static_type)
89 
90  // Data that helps stop the search before the entire tree is searched:
91 
92  // is_dst_type_derived_from_static_type is either unknown, yes or no.
94  // Number of dst_type in tree. If 0, then that means unknown.
96  // communicates to a dst_type node that (static_ptr, static_type) was found
97  // above it.
99  // communicates to a dst_type node that a static_type was found
100  // above it, but it wasn't (static_ptr, static_type)
102  // Set whenever a search can be stopped
104 };
105 
106 // Has no base class
107 class _LIBCXXABI_TYPE_VIS __class_type_info : public __shim_type_info {
108 public:
109  _LIBCXXABI_HIDDEN virtual ~__class_type_info();
110 
111  _LIBCXXABI_HIDDEN void process_static_type_above_dst(__dynamic_cast_info *, const void *, const void *, int) const;
112  _LIBCXXABI_HIDDEN void process_static_type_below_dst(__dynamic_cast_info *, const void *, int) const;
113  _LIBCXXABI_HIDDEN void process_found_base_class(__dynamic_cast_info *, void *, int) const;
114  _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, const void *, const void *, int, bool) const;
115  _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const;
116  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
117  _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const;
118 };
119 
120 // Has one non-virtual public base class at offset zero
121 class _LIBCXXABI_TYPE_VIS __si_class_type_info : public __class_type_info {
122 public:
124 
125  _LIBCXXABI_HIDDEN virtual ~__si_class_type_info();
126 
127  _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, const void *, const void *, int, bool) const;
128  _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const;
129  _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const;
130 };
131 
132 struct _LIBCXXABI_HIDDEN __base_class_type_info {
133 public:
136 
138  __virtual_mask = 0x1,
139  __public_mask = 0x2, // base is public
140  __offset_shift = 8
141  };
142 
143  void search_above_dst(__dynamic_cast_info *, const void *, const void *, int, bool) const;
144  void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const;
145  void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const;
146 };
147 
148 // Has one or more base classes
149 class _LIBCXXABI_TYPE_VIS __vmi_class_type_info : public __class_type_info {
150 public:
151  unsigned int __flags;
152  unsigned int __base_count;
153  __base_class_type_info __base_info[1];
154 
156  __non_diamond_repeat_mask = 0x1, // has two or more distinct base class
157  // objects of the same type
158  __diamond_shaped_mask = 0x2 // has base class object with two or
159  // more derived objects
160  };
161 
162  _LIBCXXABI_HIDDEN virtual ~__vmi_class_type_info();
163 
164  _LIBCXXABI_HIDDEN virtual void search_above_dst(__dynamic_cast_info *, const void *, const void *, int, bool) const;
165  _LIBCXXABI_HIDDEN virtual void search_below_dst(__dynamic_cast_info *, const void *, int, bool) const;
166  _LIBCXXABI_HIDDEN virtual void has_unambiguous_public_base(__dynamic_cast_info *, void *, int) const;
167 };
168 
169 class _LIBCXXABI_TYPE_VIS __pbase_type_info : public __shim_type_info {
170 public:
171  unsigned int __flags;
173 
174  enum __masks {
175  __const_mask = 0x1,
176  __volatile_mask = 0x2,
177  __restrict_mask = 0x4,
178  __incomplete_mask = 0x8,
179  __incomplete_class_mask = 0x10,
180  __transaction_safe_mask = 0x20,
181  // This implements the following proposal from cxx-abi-dev (not yet part of
182  // the ABI document):
183  //
184  // http://sourcerytools.com/pipermail/cxx-abi-dev/2016-October/002986.html
185  //
186  // This is necessary for support of http://wg21.link/p0012, which permits
187  // throwing noexcept function and member function pointers and catching
188  // them as non-noexcept pointers.
189  __noexcept_mask = 0x40,
190 
191  // Flags that cannot be removed by a standard conversion.
192  __no_remove_flags_mask = __const_mask | __volatile_mask | __restrict_mask,
193  // Flags that cannot be added by a standard conversion.
194  __no_add_flags_mask = __transaction_safe_mask | __noexcept_mask
195  };
196 
197  _LIBCXXABI_HIDDEN virtual ~__pbase_type_info();
198  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
199 };
200 
201 class _LIBCXXABI_TYPE_VIS __pointer_type_info : public __pbase_type_info {
202 public:
203  _LIBCXXABI_HIDDEN virtual ~__pointer_type_info();
204  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
205  _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const;
206 };
207 
208 class _LIBCXXABI_TYPE_VIS __pointer_to_member_type_info : public __pbase_type_info {
209 public:
211 
212  _LIBCXXABI_HIDDEN virtual ~__pointer_to_member_type_info();
213  _LIBCXXABI_HIDDEN virtual bool can_catch(const __shim_type_info *, void *&) const;
214  _LIBCXXABI_HIDDEN bool can_catch_nested(const __shim_type_info *) const;
215 };
216 
217 } // namespace __cxxabiv1
218 
219 #endif // __PRIVATE_TYPEINFO_H_
Definition: private_typeinfo.h:53
Definition: private_typeinfo.h:53
Definition: private_typeinfo.h:132
Definition: private_typeinfo.h:201
Definition: private_typeinfo.h:107
__offset_flags_masks
Definition: private_typeinfo.h:137
long __offset_flags
Definition: private_typeinfo.h:135
Definition: private_typeinfo.h:208
Definition: private_typeinfo.h:20
int is_dst_type_derived_from_static_type
Definition: private_typeinfo.h:93
Definition: private_typeinfo.h:57
const __shim_type_info * __pointee
Definition: private_typeinfo.h:172
const void * dst_ptr_leading_to_static_ptr
Definition: private_typeinfo.h:68
Definition: private_typeinfo.h:35
bool search_done
Definition: private_typeinfo.h:103
const __class_type_info * __context
Definition: private_typeinfo.h:210
Definition: private_typeinfo.h:18
const void * static_ptr
Definition: private_typeinfo.h:61
int number_to_dst_ptr
Definition: private_typeinfo.h:88
int number_of_dst_type
Definition: private_typeinfo.h:95
int path_dynamic_ptr_to_static_ptr
Definition: private_typeinfo.h:80
Definition: private_typeinfo.h:121
bool found_any_static_type
Definition: private_typeinfo.h:101
Definition: private_typeinfo.h:169
unsigned int __flags
Definition: private_typeinfo.h:151
int number_to_static_ptr
Definition: private_typeinfo.h:86
Definition: private_typeinfo.h:149
Definition: private_typeinfo.h:53
Definition: private_typeinfo.h:41
__flags_masks
Definition: private_typeinfo.h:155
unsigned int __flags
Definition: private_typeinfo.h:171
int path_dst_ptr_to_static_ptr
Definition: private_typeinfo.h:76
Definition: private_typeinfo.h:53
unsigned int __base_count
Definition: private_typeinfo.h:152
const __class_type_info * dst_type
Definition: private_typeinfo.h:60
const __class_type_info * __base_type
Definition: private_typeinfo.h:134
const __class_type_info * static_type
Definition: private_typeinfo.h:62
Definition: private_typeinfo.h:29
std::ptrdiff_t src2dst_offset
Definition: private_typeinfo.h:63
const __class_type_info * __base_type
Definition: private_typeinfo.h:123
bool found_our_static_ptr
Definition: private_typeinfo.h:98
__masks
Definition: private_typeinfo.h:174
const void * dst_ptr_not_leading_to_static_ptr
Definition: private_typeinfo.h:71
Definition: private_typeinfo.h:47
int path_dynamic_ptr_to_dst_ptr
Definition: private_typeinfo.h:83
Definition: private_typeinfo.h:53