summaryrefslogtreecommitdiff
path: root/src/private_typeinfo.h
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2012-01-11 23:49:18 +0000
committerHoward Hinnant <hhinnant@apple.com>2012-01-11 23:49:18 +0000
commitf877d21f16d5ecb32570a89148e614ff68d632be (patch)
tree7192275af4e736a2b14a11f9bb2dd9d30265f403 /src/private_typeinfo.h
parent16650b58dfc7d1a2632b052843dc4e21ae949b07 (diff)
Initial implementaiton of __dynamic_cast. There is still lots of debugging code in here that needs to be stripped out. And many, many unit tests need to be written. And comments and probably code cleanliness needs to be improved. But I *think* the basic algorithm is sound. There also may still be some oportunities for algorithm optimization, I'm not positive.
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@147981 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'src/private_typeinfo.h')
-rw-r--r--src/private_typeinfo.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/private_typeinfo.h b/src/private_typeinfo.h
index 766febe..0035836 100644
--- a/src/private_typeinfo.h
+++ b/src/private_typeinfo.h
@@ -11,6 +11,7 @@
#define __PRIVATE_TYPEINFO_H_
#include <typeinfo>
+#include <cstddef>
namespace __cxxabiv1
{
@@ -43,6 +44,49 @@ public:
virtual ~__enum_type_info();
};
+enum
+{
+ unknown = 0,
+ public_path,
+ not_public_path
+};
+
+class __class_type_info;
+
+struct __dynamic_cast_info
+{
+ // const data supplied to the search
+
+ const __class_type_info* const dst_type;
+ const void* const static_ptr;
+ const __class_type_info* const static_type;
+ const std::ptrdiff_t src2dst_offset;
+
+ // non-const data learned during the search
+
+ // pointer to a dst_type which has (static_ptr, static_type) above it
+ const void* dst_ptr_leading_to_static_ptr;
+ // pointer to a dst_type which does not have (static_ptr, static_type) above it
+ const void* dst_ptr_not_leading_to_static_ptr;
+ // access of path from dst_ptr_leading_to_static_ptr to (static_ptr, static_type)
+ int path_dst_ptr_to_static_ptr;
+ // access of path from (dynamic_ptr, dynamic_type) to (static_ptr, static_type)
+ // when there is no dst_type along the path
+ int path_dynamic_ptr_to_static_ptr;
+ // access of path from (dynamic_ptr, dynamic_type) to dst_type
+ // (not used if there is a (static_ptr, static_type) above a dst_type).
+ int path_dynamic_ptr_to_dst_ptr;
+ // Number of dst_types below (static_ptr, static_type)
+ int number_to_static_ptr;
+ // Number of dst_types not below (static_ptr, static_type)
+ int number_to_dst_ptr;
+ // true when the search is above a dst_type, else false
+ bool above_dst_ptr;
+ // communicates to a dst_type node that (static_ptr, static_type) was found
+ // above it.
+ bool found_static_ptr;
+};
+
// Has no base class
class __class_type_info
: public std::type_info
@@ -50,6 +94,8 @@ class __class_type_info
public:
virtual ~__class_type_info();
+ virtual int search1(__dynamic_cast_info*, const void*, int) const;
+ virtual int search2(__dynamic_cast_info*, const void*, int) const;
virtual void display(const void* obj) const;
};
@@ -62,6 +108,8 @@ public:
virtual ~__si_class_type_info();
+ virtual int search1(__dynamic_cast_info*, const void*, int) const;
+ virtual int search2(__dynamic_cast_info*, const void*, int) const;
virtual void display(const void* obj) const;
};
@@ -78,6 +126,8 @@ public:
__offset_shift = 8
};
+ int search1(__dynamic_cast_info*, const void*, int) const;
+ int search2(__dynamic_cast_info*, const void*, int) const;
void display(const void* obj) const;
};
@@ -100,6 +150,8 @@ public:
virtual ~__vmi_class_type_info();
+ virtual int search1(__dynamic_cast_info*, const void*, int) const;
+ virtual int search2(__dynamic_cast_info*, const void*, int) const;
virtual void display(const void* obj) const;
};