diff options
-rw-r--r-- | gcc/cp/ChangeLog | 14 | ||||
-rw-r--r-- | gcc/cp/inc/cxxabi.h | 116 | ||||
-rw-r--r-- | gcc/cp/tinfo2.cc | 41 |
3 files changed, 105 insertions, 66 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 11df3c1..db9cb15a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,19 @@ 2000-05-25 Nathan Sidwell <nathan@codesourcery.com> + * inc/cxxabi.h (__pbase_type_info): Define, based on + __pointer_type_info. + (__pointer_type_info): Derive from __pbase_type_info. Adjust. + (__pointer_to_member_type_info): Likewise. + * tinfo2.cc (__pbase_type_info::~__pbase_type_info): Implement. + (__pointer_to_member_type_info::__is_pointer_p): Remove. + (__pointer_type_info::__do_catch): Rename to ... + (__pbase_type_info::__do_catch): ... here. Adjust. + (__pbase_type_info::__pointer_catch): Implement. + (__pointer_type_info::__pointer_catch): Adjust. + (__pointer_to_member_type_info::__pointer_catch): Adjust. + +2000-05-25 Nathan Sidwell <nathan@codesourcery.com> + * tinfo.h (__user_type_info::contained_virtual_p): New predicate. * tinfo.cc (__user_type_info::do_upcast): Fix bug with diamond diff --git a/gcc/cp/inc/cxxabi.h b/gcc/cp/inc/cxxabi.h index c5eec5c..ad918c4 100644 --- a/gcc/cp/inc/cxxabi.h +++ b/gcc/cp/inc/cxxabi.h @@ -73,48 +73,6 @@ public: { } }; -/* type information for pointer to data or function, but not pointer to member */ -class __pointer_type_info - : public std::type_info -{ -/* abi defined member variables */ -public: - int quals; /* qualification of the target object */ - const std::type_info *type; /* type of pointed to object */ - -/* abi defined member functions */ -public: - virtual ~__pointer_type_info (); -public: - explicit __pointer_type_info (const char *__n, - int __quals, - const std::type_info *__type) - : std::type_info (__n), quals (__quals), type (__type) - { } - -/* implementation defined types */ -public: - enum quals_masks { - const_mask = 0x1, - volatile_mask = 0x2, - restrict_mask = 0x4, - incomplete_mask = 0x8, - incomplete_class_mask = 0x10 - }; - -/* implementation defined member functions */ -protected: - virtual bool __is_pointer_p () const; -protected: - virtual bool __do_catch (const std::type_info *__thr_type, - void **__thr_obj, - unsigned __outer) const; -protected: - virtual bool __pointer_catch (const __pointer_type_info *__thr_type, - void **__thr_obj, - unsigned __outer) const; -}; - /* type information for array objects */ class __array_type_info : public std::type_info @@ -158,9 +116,73 @@ public: { } }; -/* type information for a pointer to member variable (not function) */ +/* common type information for simple pointers and pointers to member */ +class __pbase_type_info + : public std::type_info +{ +/* abi defined member variables */ +public: + int quals; /* qualification of the target object */ + const std::type_info *type; /* type of pointed to object */ + +/* abi defined member functions */ +public: + virtual ~__pbase_type_info (); +public: + explicit __pbase_type_info (const char *__n, + int __quals, + const std::type_info *__type) + : std::type_info (__n), quals (__quals), type (__type) + { } + +/* implementation defined types */ +public: + enum quals_masks { + const_mask = 0x1, + volatile_mask = 0x2, + restrict_mask = 0x4, + incomplete_mask = 0x8, + incomplete_class_mask = 0x10 + }; + +/* implementation defined member functions */ +protected: + virtual bool __do_catch (const std::type_info *__thr_type, + void **__thr_obj, + unsigned __outer) const; +protected: + inline virtual bool __pointer_catch (const __pbase_type_info *__thr_type, + void **__thr_obj, + unsigned __outer) const; +}; + +/* type information for simple pointers */ +class __pointer_type_info + : public __pbase_type_info +{ +/* abi defined member functions */ +public: + virtual ~__pointer_type_info (); +public: + explicit __pointer_type_info (const char *__n, + int __quals, + const std::type_info *__type) + : __pbase_type_info (__n, __quals, __type) + { } + +/* implementation defined member functions */ +protected: + virtual bool __is_pointer_p () const; + +protected: + virtual bool __pointer_catch (const __pbase_type_info *__thr_type, + void **__thr_obj, + unsigned __outer) const; +}; + +/* type information for a pointer to member variable */ class __pointer_to_member_type_info - : public __pointer_type_info + : public __pbase_type_info { /* abi defined member variables */ public: @@ -174,14 +196,12 @@ public: int __quals, const std::type_info *__type, const __class_type_info *__klass) - : __pointer_type_info (__n, __quals, __type), klass (__klass) + : __pbase_type_info (__n, __quals, __type), klass (__klass) { } /* implementation defined member functions */ protected: - virtual bool __is_pointer_p () const; -protected: - virtual bool __pointer_catch (const __pointer_type_info *__thr_type, + virtual bool __pointer_catch (const __pbase_type_info *__thr_type, void **__thr_obj, unsigned __outer) const; }; diff --git a/gcc/cp/tinfo2.cc b/gcc/cp/tinfo2.cc index 2b364c9..442967b 100644 --- a/gcc/cp/tinfo2.cc +++ b/gcc/cp/tinfo2.cc @@ -108,10 +108,6 @@ __fundamental_type_info:: ~__fundamental_type_info () {} -__pointer_type_info:: -~__pointer_type_info () -{} - __array_type_info:: ~__array_type_info () {} @@ -124,6 +120,14 @@ __enum_type_info:: ~__enum_type_info () {} +__pbase_type_info:: +~__pbase_type_info () +{} + +__pointer_type_info:: +~__pointer_type_info () +{} + __pointer_to_member_type_info:: ~__pointer_to_member_type_info () {} @@ -140,14 +144,7 @@ __is_function_p () const return true; } -bool __pointer_to_member_type_info:: -__is_pointer_p () const -{ - return false; -} - - -bool __pointer_type_info:: +bool __pbase_type_info:: __do_catch (const type_info *thr_type, void **thr_obj, unsigned outer) const @@ -163,8 +160,8 @@ __do_catch (const type_info *thr_type, // But for that to be valid, our outer pointers must be const qualified. return false; - const __pointer_type_info *thrown_type = - static_cast <const __pointer_type_info *> (thr_type); + const __pbase_type_info *thrown_type = + static_cast <const __pbase_type_info *> (thr_type); if (thrown_type->quals & ~quals) // We're less qualified. @@ -176,8 +173,16 @@ __do_catch (const type_info *thr_type, return __pointer_catch (thrown_type, thr_obj, outer); } +inline bool __pbase_type_info:: +__pointer_catch (const __pbase_type_info *thrown_type, + void **thr_obj, + unsigned outer) const +{ + return type->__do_catch (thrown_type->type, thr_obj, outer + 2); +} + bool __pointer_type_info:: -__pointer_catch (const __pointer_type_info *thrown_type, +__pointer_catch (const __pbase_type_info *thrown_type, void **thr_obj, unsigned outer) const { @@ -187,11 +192,11 @@ __pointer_catch (const __pointer_type_info *thrown_type, return !thrown_type->type->__is_function_p (); } - return type->__do_catch (thrown_type->type, thr_obj, outer + 2); + return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer); } bool __pointer_to_member_type_info:: -__pointer_catch (const __pointer_type_info *thr_type, +__pointer_catch (const __pbase_type_info *thr_type, void **thr_obj, unsigned outer) const { @@ -203,7 +208,7 @@ __pointer_catch (const __pointer_type_info *thr_type, if (*klass != *thrown_type->klass) return false; // not pointers to member of same class - return type->__do_catch (thrown_type->type, thr_obj, outer + 2); + return __pbase_type_info::__pointer_catch (thrown_type, thr_obj, outer); } } // namespace std |