Commit 7e2d2472 by Nathan Sidwell Committed by Nathan Sidwell

Prepend __ to implementation defined names.

	* inc/typeinfo (type_info): Rename _name to __name.
	(type_info::type_info): Rename parameter.
	(type_info::operator==, type_info::operator!=,
	type_info::before): Likewise.
	(type_info::is_pointer_p, type_info::is_function_p,
	type_info::do_catch, type_info::do_upcast): Prepend __. Rename
	parameters.
	* inc/cxxabi.h
	(__fundamental_type_info::__fundamental_type_info) Rename parameters.
	(__pointer_type_info::__pointer_type_info): Likewise.
	(__pointer_type_info::is_pointer_p,
	__pointer_type_info::do_catch): Prepend __. Rename parameters.
	(__array_type_info::__array_type_info): Rename parameters.
	(__function_type_info::__function_type_info): Likewise.
	(__function_type_info::is_function_p): Prepend __.
	(__enum_type_info::__enum_type_info): Rename parameters.
	(__pointer_to_member_type_info::__pointer_to_member_type_info):
	Likewise.
	(__pointer_to_member_type_info::do_catch): Prepend __. Rename
	parameters.
	(__base_class_info::is_virtual_p, is_public_p, offset): Prepend	__.
	(__class_type_info::__class_type_info): Rename parameters.
	(__class_type_info::sub_kind): Prepend __. Adjust member names.
	(__class_type_info::upcast_result,
	__class_type_info::dyncast_result): Prepend __. Move definition
	into tinfo.cc.
	(__class_type_info::do_upcast, __class_type_info::do_catch,
	__class_type_info::find_public_src,
	__class_type_info::do_dyncast,
	__class_type_info::do_find_public_src): Prepend __. Rename
	parameters.
	(__si_class_type_info::__si_class_type_info): Rename parameters.
	(__si_class_type_info::do_upcast, __si_class_type_info::do_dyncast,
	__si_class_type_info::do_find_public_src): Prepent __. Rename
	parameters.
	(__vmi_class_type_info::__vmi_class_type_info): Rename parameters.
	(__vmi_class_type_info::do_upcast, __vmi_class_type_info::do_dyncast,
	__vmi_class_type_info::do_find_public_src): Prepent __. Rename
	parameters.
	(__dynamic_cast): Rename parameters.
	* tinfo.cc (type_info::is_pointer_p, type_info::is_function_p,
	type_info::do_catch, type_info::do_upcast): Prepend __.
	(contained_p, public_p, virtual_p, contained_public_p,
	contained_nonpublic_p, contained_nonvirtual_p): Adjust.
	(__class_type_info::do_catch,
	__class_type_info::do_upcast): Prepend __. Adjust.
	(__class_type_info::__upcast_result,
	__class_type_info::__dyncast_result): Move from inc/cxxabi.h.
	Adjust.
	(__class_type_info::find_public_src): Prepend __. Adjust.
	(__class_type_info::do_find_public_src,
	__si_class_type_info::do_find_public_src,
	__vmi_class_type_info::do_find_public_src): Likewise.
	(__class_type_info::do_dyncast,
	__si_class_type_info::do_dyncast,
	__vmi_class_type_info::do_dyncast): Likewise.
	(__class_type_info::do_upcast,
	__si_class_type_info::do_upcast,
	__vmi_class_type_info::do_upcast): Likewise.
	(__dynamic_cast): Adjust.
	* tinfo2.cc (__pointer_type_info::is_pointer_p): Prepend __.
	(__function_type_info::is_function_p): Likewise.
	(__pointer_type_info::do_catch): Likewise. Adjust.
	(__pointer_to_member_type_info::do_catch): Likewise. Adjust.
	(__throw_type_match_rtti_2): Adjust.
	(__is_pointer): Adjust.

From-SVN: r33041
parent c42f056a
2000-04-09 Nathan Sidwell <nathan@codesourcery.com>
Prepend __ to implementation defined names.
* inc/typeinfo (type_info): Rename _name to __name.
(type_info::type_info): Rename parameter.
(type_info::operator==, type_info::operator!=,
type_info::before): Likewise.
(type_info::is_pointer_p, type_info::is_function_p,
type_info::do_catch, type_info::do_upcast): Prepend __. Rename
parameters.
* inc/cxxabi.h
(__fundamental_type_info::__fundamental_type_info) Rename parameters.
(__pointer_type_info::__pointer_type_info): Likewise.
(__pointer_type_info::is_pointer_p,
__pointer_type_info::do_catch): Prepend __. Rename parameters.
(__array_type_info::__array_type_info): Rename parameters.
(__function_type_info::__function_type_info): Likewise.
(__function_type_info::is_function_p): Prepend __.
(__enum_type_info::__enum_type_info): Rename parameters.
(__pointer_to_member_type_info::__pointer_to_member_type_info):
Likewise.
(__pointer_to_member_type_info::do_catch): Prepend __. Rename
parameters.
(__base_class_info::is_virtual_p, is_public_p, offset): Prepend __.
(__class_type_info::__class_type_info): Rename parameters.
(__class_type_info::sub_kind): Prepend __. Adjust member names.
(__class_type_info::upcast_result,
__class_type_info::dyncast_result): Prepend __. Move definition
into tinfo.cc.
(__class_type_info::do_upcast, __class_type_info::do_catch,
__class_type_info::find_public_src,
__class_type_info::do_dyncast,
__class_type_info::do_find_public_src): Prepend __. Rename
parameters.
(__si_class_type_info::__si_class_type_info): Rename parameters.
(__si_class_type_info::do_upcast, __si_class_type_info::do_dyncast,
__si_class_type_info::do_find_public_src): Prepent __. Rename
parameters.
(__vmi_class_type_info::__vmi_class_type_info): Rename parameters.
(__vmi_class_type_info::do_upcast, __vmi_class_type_info::do_dyncast,
__vmi_class_type_info::do_find_public_src): Prepent __. Rename
parameters.
(__dynamic_cast): Rename parameters.
* tinfo.cc (type_info::is_pointer_p, type_info::is_function_p,
type_info::do_catch, type_info::do_upcast): Prepend __.
(contained_p, public_p, virtual_p, contained_public_p,
contained_nonpublic_p, contained_nonvirtual_p): Adjust.
(__class_type_info::do_catch,
__class_type_info::do_upcast): Prepend __. Adjust.
(__class_type_info::__upcast_result,
__class_type_info::__dyncast_result): Move from inc/cxxabi.h.
Adjust.
(__class_type_info::find_public_src): Prepend __. Adjust.
(__class_type_info::do_find_public_src,
__si_class_type_info::do_find_public_src,
__vmi_class_type_info::do_find_public_src): Likewise.
(__class_type_info::do_dyncast,
__si_class_type_info::do_dyncast,
__vmi_class_type_info::do_dyncast): Likewise.
(__class_type_info::do_upcast,
__si_class_type_info::do_upcast,
__vmi_class_type_info::do_upcast): Likewise.
(__dynamic_cast): Adjust.
* tinfo2.cc (__pointer_type_info::is_pointer_p): Prepend __.
(__function_type_info::is_function_p): Likewise.
(__pointer_type_info::do_catch): Likewise. Adjust.
(__pointer_to_member_type_info::do_catch): Likewise. Adjust.
(__throw_type_match_rtti_2): Adjust.
(__is_pointer): Adjust.
2000-04-08 Mark Mitchell <mark@codesourcery.com> 2000-04-08 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (cp_tree_index): Add CPTI_COMPLETE_CTOR_IDENTIFIER. * cp-tree.h (cp_tree_index): Add CPTI_COMPLETE_CTOR_IDENTIFIER.
......
...@@ -36,8 +36,8 @@ class __fundamental_type_info ...@@ -36,8 +36,8 @@ class __fundamental_type_info
public: public:
virtual ~__fundamental_type_info (); virtual ~__fundamental_type_info ();
public: public:
explicit __fundamental_type_info (const char *n_) explicit __fundamental_type_info (const char *__n)
: std::type_info (n_) : std::type_info (__n)
{ } { }
}; };
...@@ -54,10 +54,10 @@ public: ...@@ -54,10 +54,10 @@ public:
public: public:
virtual ~__pointer_type_info (); virtual ~__pointer_type_info ();
public: public:
explicit __pointer_type_info (const char *n_, explicit __pointer_type_info (const char *__n,
int quals_, int __quals,
const std::type_info *type_) const std::type_info *__type)
: std::type_info (n_), quals (quals_), type (type_) : std::type_info (__n), quals (__quals), type (__type)
{ } { }
/* implementation defined types */ /* implementation defined types */
...@@ -69,10 +69,10 @@ public: ...@@ -69,10 +69,10 @@ public:
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool is_pointer_p () const; virtual bool __is_pointer_p () const;
protected: protected:
virtual bool do_catch (const std::type_info *thr_type, void **thr_obj, virtual bool __do_catch (const std::type_info *__thr_type, void **__thr_obj,
unsigned outer) const; unsigned __outer) const;
}; };
/* type information for array objects */ /* type information for array objects */
...@@ -83,8 +83,8 @@ class __array_type_info ...@@ -83,8 +83,8 @@ class __array_type_info
protected: protected:
virtual ~__array_type_info (); virtual ~__array_type_info ();
public: public:
explicit __array_type_info (const char *n_) explicit __array_type_info (const char *__n)
: std::type_info (n_) : std::type_info (__n)
{ } { }
}; };
...@@ -96,13 +96,13 @@ class __function_type_info ...@@ -96,13 +96,13 @@ class __function_type_info
public: public:
virtual ~__function_type_info (); virtual ~__function_type_info ();
public: public:
explicit __function_type_info (const char *n_) explicit __function_type_info (const char *__n)
: std::type_info (n_) : std::type_info (__n)
{ } { }
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool is_function_p () const; virtual bool __is_function_p () const;
}; };
/* type information for enumerations */ /* type information for enumerations */
...@@ -113,8 +113,8 @@ class __enum_type_info ...@@ -113,8 +113,8 @@ class __enum_type_info
public: public:
virtual ~__enum_type_info (); virtual ~__enum_type_info ();
public: public:
explicit __enum_type_info (const char *n_) explicit __enum_type_info (const char *__n)
: std::type_info (n_) : std::type_info (__n)
{ } { }
}; };
...@@ -132,11 +132,11 @@ public: ...@@ -132,11 +132,11 @@ public:
public: public:
virtual ~__pointer_to_member_type_info (); virtual ~__pointer_to_member_type_info ();
public: public:
explicit __pointer_to_member_type_info (const char *n_, explicit __pointer_to_member_type_info (const char *__n,
const __class_type_info *klass_, const __class_type_info *__klass,
const std::type_info *type_, const std::type_info *__type,
int quals_) int __quals)
: std::type_info (n_), klass (klass_), type (type_), quals (quals_) : std::type_info (__n), klass (__klass), type (__type), quals (__quals)
{ } { }
/* implementation defined types */ /* implementation defined types */
...@@ -148,8 +148,8 @@ public: ...@@ -148,8 +148,8 @@ public:
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool do_catch (const std::type_info *thr_type, void **thr_obj, virtual bool __do_catch (const std::type_info *__thr_type, void **__thr_obj,
unsigned outer) const; unsigned __outer) const;
}; };
class __class_type_info; class __class_type_info;
...@@ -173,11 +173,11 @@ public: ...@@ -173,11 +173,11 @@ public:
/* implementation defined member functions */ /* implementation defined member functions */
public: public:
bool is_virtual_p () const bool __is_virtual_p () const
{ return vmi_offset_flags & virtual_mask; } { return vmi_offset_flags & virtual_mask; }
bool is_public_p () const bool __is_public_p () const
{ return vmi_offset_flags & public_mask; } { return vmi_offset_flags & public_mask; }
std::ptrdiff_t offset () const std::ptrdiff_t __offset () const
{ return std::ptrdiff_t (vmi_offset_flags) >> offset_shift; } { return std::ptrdiff_t (vmi_offset_flags) >> offset_shift; }
}; };
...@@ -189,8 +189,8 @@ class __class_type_info ...@@ -189,8 +189,8 @@ class __class_type_info
public: public:
virtual ~__class_type_info (); virtual ~__class_type_info ();
public: public:
explicit __class_type_info (const char *n_) explicit __class_type_info (const char *__n)
: type_info (n_) : type_info (__n)
{ } { }
/* implementation defined types */ /* implementation defined types */
...@@ -198,71 +198,43 @@ public: ...@@ -198,71 +198,43 @@ public:
/* sub_kind tells us about how a base object is contained within a derived /* sub_kind tells us about how a base object is contained within a derived
object. We often do this lazily, hence the UNKNOWN value. At other times object. We often do this lazily, hence the UNKNOWN value. At other times
we may use NOT_CONTAINED to mean not publicly contained. */ we may use NOT_CONTAINED to mean not publicly contained. */
enum sub_kind enum __sub_kind
{ {
unknown = 0, /* we have no idea */ __unknown = 0, /* we have no idea */
not_contained, /* not contained within us (in some */ __not_contained, /* not contained within us (in some */
/* circumstances this might mean not contained */ /* circumstances this might mean not contained */
/* publicly) */ /* publicly) */
contained_ambig, /* contained ambiguously */ __contained_ambig, /* contained ambiguously */
contained_virtual_mask = __base_class_info::virtual_mask, /* via a virtual path */ __contained_virtual_mask = __base_class_info::virtual_mask, /* via a virtual path */
contained_public_mask = __base_class_info::public_mask, /* via a public path */ __contained_public_mask = __base_class_info::public_mask, /* via a public path */
contained_mask = 1 << __base_class_info::hwm_bit, /* contained within us */ __contained_mask = 1 << __base_class_info::hwm_bit, /* contained within us */
contained_private = contained_mask, __contained_private = __contained_mask,
contained_public = contained_mask | contained_public_mask __contained_public = __contained_mask | __contained_public_mask
}; };
public: public:
struct upcast_result struct __upcast_result;
{ struct __dyncast_result;
const void *dst_ptr; /* pointer to caught object */
sub_kind whole2dst; /* path from most derived object to target */
int src_details; /* hints about the source type heirarchy */
const __class_type_info *base_type; /* where we found the target, */
/* if in vbase the __class_type_info of vbase */
/* if a non-virtual base then 1 */
/* else NULL */
public:
upcast_result (int d)
:dst_ptr (NULL), whole2dst (unknown), src_details (d), base_type (NULL)
{}
};
public:
/* dyncast_result is used to hold information during traversal of a class
heirarchy when dynamic casting. */
struct dyncast_result
{
const void *dst_ptr; /* pointer to target object or NULL */
sub_kind whole2dst; /* path from most derived object to target */
sub_kind whole2src; /* path from most derived object to sub object */
sub_kind dst2src; /* path from target to sub object */
public:
dyncast_result ()
:dst_ptr (NULL), whole2dst (unknown),
whole2src (unknown), dst2src (unknown)
{}
};
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool do_upcast (const __class_type_info *dst_type, void **obj_ptr) const; virtual bool __do_upcast (const __class_type_info *__dst_type, void **__obj_ptr) const;
protected: protected:
virtual bool do_catch (const type_info *thr_type, void **thr_obj, virtual bool __do_catch (const type_info *__thr_type, void **__thr_obj,
unsigned outer) const; unsigned __outer) const;
public: public:
/* Helper for upcast. See if DST is us, or one of our bases. ACCESS_PATH */ /* Helper for upcast. See if DST is us, or one of our bases. ACCESS_PATH */
/* gives the access from the start object. Return TRUE if we know the upcast */ /* gives the access from the start object. Return TRUE if we know the upcast */
/* fails. */ /* fails. */
virtual bool do_upcast (sub_kind access_path, virtual bool __do_upcast (__sub_kind __access_path,
const __class_type_info *dst, const void *obj, const __class_type_info *__dst,
upcast_result &__restrict result) const; const void *__obj,
__upcast_result &__restrict __result) const;
public: public:
/* Indicate whether SRC_PTR of type SRC_TYPE is contained publicly within /* Indicate whether SRC_PTR of type SRC_TYPE is contained publicly within
...@@ -271,9 +243,10 @@ public: ...@@ -271,9 +243,10 @@ public:
within this type. If SRC_PTR is one of our SRC_TYPE bases, indicate the within this type. If SRC_PTR is one of our SRC_TYPE bases, indicate the
virtuality. Returns not_contained for non containment or private virtuality. Returns not_contained for non containment or private
containment. */ containment. */
inline sub_kind find_public_src (std::ptrdiff_t src2dst, const void *obj_ptr, inline __sub_kind __find_public_src (std::ptrdiff_t __src2dst,
const __class_type_info *src_type, const void *__obj_ptr,
const void *src_ptr) const; const __class_type_info *__src_type,
const void *__src_ptr) const;
public: public:
/* dynamic cast helper. ACCESS_PATH gives the access from the most derived /* dynamic cast helper. ACCESS_PATH gives the access from the most derived
...@@ -282,18 +255,22 @@ public: ...@@ -282,18 +255,22 @@ public:
indicates the static type started from and SRC_PTR points to that base indicates the static type started from and SRC_PTR points to that base
within the most derived object. Fill in RESULT with what we find. Return within the most derived object. Fill in RESULT with what we find. Return
true if we have located an ambiguous match. */ true if we have located an ambiguous match. */
virtual bool do_dyncast (std::ptrdiff_t src2dst, sub_kind access_path, virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
const __class_type_info *dst_type, const void *obj_ptr, __sub_kind __access_path,
const __class_type_info *src_type, const void *src_ptr, const __class_type_info *__dst_type,
dyncast_result &result) const; const void *__obj_ptr,
const __class_type_info *__src_type,
const void *__src_ptr,
__dyncast_result &__result) const;
public: public:
/* Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE bases are /* Helper for find_public_subobj. SRC2DST indicates how SRC_TYPE bases are
inherited by the type started from -- which is not necessarily the inherited by the type started from -- which is not necessarily the
current type. The current type will be a base of the destination type. current type. The current type will be a base of the destination type.
OBJ_PTR points to the current base. */ OBJ_PTR points to the current base. */
virtual sub_kind do_find_public_src (std::ptrdiff_t src2dst, const void *obj_ptr, virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
const __class_type_info *src_type, const void *__obj_ptr,
const void *src_ptr) const; const __class_type_info *__src_type,
const void *__src_ptr) const;
}; };
/* type information for a class with a single non-virtual base */ /* type information for a class with a single non-virtual base */
...@@ -308,23 +285,28 @@ protected: ...@@ -308,23 +285,28 @@ protected:
public: public:
virtual ~__si_class_type_info (); virtual ~__si_class_type_info ();
public: public:
explicit __si_class_type_info (const char *n_, explicit __si_class_type_info (const char *__n,
const __class_type_info *base_) const __class_type_info *__base)
: __class_type_info (n_), base (base_) : __class_type_info (__n), base (__base)
{ } { }
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool do_dyncast (std::ptrdiff_t src2dst, sub_kind access_path, virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
const __class_type_info *dst_type, const void *obj_ptr, __sub_kind __access_path,
const __class_type_info *src_type, const void *src_ptr, const __class_type_info *__dst_type,
dyncast_result &result) const; const void *__obj_ptr,
virtual sub_kind do_find_public_src (std::ptrdiff_t src2dst, const void *obj_ptr, const __class_type_info *__src_type,
const __class_type_info *src_type, const void *__src_ptr,
const void *sub_ptr) const; __dyncast_result &__result) const;
virtual bool do_upcast (sub_kind access_path, virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
const __class_type_info *dst, const void *obj, const void *__obj_ptr,
upcast_result &__restrict result) const; const __class_type_info *__src_type,
const void *__sub_ptr) const;
virtual bool __do_upcast (__sub_kind __access_path,
const __class_type_info *__dst,
const void *__obj,
__upcast_result &__restrict __result) const;
}; };
/* type information for a class with multiple and/or virtual bases */ /* type information for a class with multiple and/or virtual bases */
...@@ -342,9 +324,9 @@ public: ...@@ -342,9 +324,9 @@ public:
public: public:
virtual ~__vmi_class_type_info (); virtual ~__vmi_class_type_info ();
public: public:
explicit __vmi_class_type_info (const char *n_, explicit __vmi_class_type_info (const char *__n,
int flags_) int __flags)
: __class_type_info (n_), vmi_flags (flags_), vmi_base_count (0) : __class_type_info (__n), vmi_flags (__flags), vmi_base_count (0)
{ } { }
/* implementation defined types */ /* implementation defined types */
...@@ -355,28 +337,33 @@ public: ...@@ -355,28 +337,33 @@ public:
non_public_base_mask = 0x4, /* has non-public direct or indirect base */ non_public_base_mask = 0x4, /* has non-public direct or indirect base */
public_base_mask = 0x8, /* has public base (direct) */ public_base_mask = 0x8, /* has public base (direct) */
flags_unknown_mask = 0x10 __flags_unknown_mask = 0x10
}; };
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool do_dyncast (std::ptrdiff_t src2dst, sub_kind access_path, virtual bool __do_dyncast (std::ptrdiff_t __src2dst,
const __class_type_info *dst_type, const void *obj_ptr, __sub_kind __access_path,
const __class_type_info *src_type, const void *src_ptr, const __class_type_info *__dst_type,
dyncast_result &result) const; const void *__obj_ptr,
virtual sub_kind do_find_public_src (std::ptrdiff_t src2dst, const void *obj_ptr, const __class_type_info *__src_type,
const __class_type_info *src_type, const void *__src_ptr,
const void *src_ptr) const; __dyncast_result &__result) const;
virtual bool do_upcast (sub_kind access_path, virtual __sub_kind __do_find_public_src (std::ptrdiff_t __src2dst,
const __class_type_info *dst, const void *obj, const void *__obj_ptr,
upcast_result &__restrict result) const; const __class_type_info *__src_type,
const void *__src_ptr) const;
virtual bool __do_upcast (__sub_kind __access_path,
const __class_type_info *__dst,
const void *__obj,
__upcast_result &__restrict __result) const;
}; };
/* dynamic cast runtime */ /* dynamic cast runtime */
void *__dynamic_cast (const void *src_ptr, /* object started from */ void *__dynamic_cast (const void *__src_ptr, /* object started from */
const __class_type_info *src_type, /* static type of object */ const __class_type_info *__src_type, /* static type of object */
const __class_type_info *dst_type, /* desired target type */ const __class_type_info *__dst_type, /* desired target type */
std::ptrdiff_t src2dst); /* how src and dst are related */ std::ptrdiff_t __src2dst); /* how src and dst are related */
/* src2dst has the following possible values /* src2dst has the following possible values
>= 0: src_type is a unique public non-virtual base of dst_type >= 0: src_type is a unique public non-virtual base of dst_type
......
...@@ -38,10 +38,10 @@ private: ...@@ -38,10 +38,10 @@ private:
type_info (const type_info&); type_info (const type_info&);
protected: protected:
const char *_name; const char *__name;
protected: protected:
explicit type_info (const char *n): _name (n) { } explicit type_info (const char *__n): __name (__n) { }
public: public:
// the public interface // the public interface
...@@ -50,42 +50,43 @@ public: ...@@ -50,42 +50,43 @@ public:
// type. Uniqueness must use the _name value, not object address. // type. Uniqueness must use the _name value, not object address.
bool before (const type_info& arg) const; bool before (const type_info& arg) const;
const char* name () const const char* name () const
{ return _name; } { return __name; }
bool operator== (const type_info& arg) const; bool operator== (const type_info& __arg) const;
bool operator!= (const type_info& arg) const bool operator!= (const type_info& __arg) const
{ return !operator== (arg); } { return !operator== (__arg); }
#else #else
// In new abi we can rely on type_info's being unique, // In new abi we can rely on type_info's being unique,
// and therefore address comparisons are sufficient. // and therefore address comparisons are sufficient.
bool before (const type_info& arg) const bool before (const type_info& __arg) const
{ return this < &arg; } { return this < &__arg; }
const char* name () const const char* name () const
{ return _name; } { return __name; }
bool operator== (const type_info& arg) const bool operator== (const type_info& __arg) const
{ return &arg == this; } { return &__arg == this; }
bool operator!= (const type_info& arg) const bool operator!= (const type_info& __arg) const
{ return !operator== (arg); } { return !operator== (__arg); }
#endif #endif
// the internal interface // the internal interface
#if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100 #if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION >= 100
public: public:
// return true if this is a pointer type of some kind // return true if this is a pointer type of some kind
virtual bool is_pointer_p () const; virtual bool __is_pointer_p () const;
// return true if this is a function type // return true if this is a function type
virtual bool is_function_p () const; virtual bool __is_function_p () const;
// Try and catch a thrown type. Store an adjusted pointer to the caught type // Try and catch a thrown type. Store an adjusted pointer to the caught type
// in THR_OBJ. If THR_TYPE is not a pointer type, then THR_OBJ points to the // in THR_OBJ. If THR_TYPE is not a pointer type, then THR_OBJ points to the
// thrown object. If THR_TYPE is a pointer type, then THR_OBJ is the pointer // thrown object. If THR_TYPE is a pointer type, then THR_OBJ is the pointer
// itself. OUTER indicates the number of outer pointers, and whether they // itself. OUTER indicates the number of outer pointers, and whether they
// were const qualified. // were const qualified.
virtual bool do_catch (const type_info *thr_type, void **thr_obj, virtual bool __do_catch (const type_info *__thr_type, void **__thr_obj,
unsigned outer) const; unsigned __outer) const;
// internally used during catch matching // internally used during catch matching
virtual bool do_upcast (const __cxxabiv1::__class_type_info *target, void **obj_ptr) const; virtual bool __do_upcast (const __cxxabiv1::__class_type_info *__target,
void **__obj_ptr) const;
#endif #endif
}; };
......
...@@ -541,28 +541,28 @@ namespace std { ...@@ -541,28 +541,28 @@ namespace std {
// return true if this is a type_info for a pointer type // return true if this is a type_info for a pointer type
bool type_info:: bool type_info::
is_pointer_p () const __is_pointer_p () const
{ {
return false; return false;
} }
// return true if this is a type_info for a function type // return true if this is a type_info for a function type
bool type_info:: bool type_info::
is_function_p () const __is_function_p () const
{ {
return false; return false;
} }
// try and catch a thrown object. // try and catch a thrown object.
bool type_info:: bool type_info::
do_catch (const type_info *thr_type, void **, unsigned) const __do_catch (const type_info *thr_type, void **, unsigned) const
{ {
return *this == *thr_type; return *this == *thr_type;
} }
// upcast from this type to the target. __class_type_info will override // upcast from this type to the target. __class_type_info will override
bool type_info:: bool type_info::
do_upcast (const abi::__class_type_info *, void **) const __do_upcast (const abi::__class_type_info *, void **) const
{ {
return false; return false;
} }
...@@ -605,31 +605,34 @@ convert_to_base (void const *addr, bool is_virtual, ptrdiff_t offset) ...@@ -605,31 +605,34 @@ convert_to_base (void const *addr, bool is_virtual, ptrdiff_t offset)
return adjust_pointer<void> (addr, offset); return adjust_pointer<void> (addr, offset);
} }
// some predicate functions for __class_type_info::sub_kind // some predicate functions for __class_type_info::__sub_kind
inline bool contained_p (__class_type_info::sub_kind access_path) inline bool contained_p (__class_type_info::__sub_kind access_path)
{ {
return access_path >= __class_type_info::contained_mask; return access_path >= __class_type_info::__contained_mask;
} }
inline bool public_p (__class_type_info::sub_kind access_path) inline bool public_p (__class_type_info::__sub_kind access_path)
{ {
return access_path & __class_type_info::contained_public_mask; return access_path & __class_type_info::__contained_public_mask;
} }
inline bool virtual_p (__class_type_info::sub_kind access_path) inline bool virtual_p (__class_type_info::__sub_kind access_path)
{ {
return (access_path & __class_type_info::contained_virtual_mask); return (access_path & __class_type_info::__contained_virtual_mask);
} }
inline bool contained_public_p (__class_type_info::sub_kind access_path) inline bool contained_public_p (__class_type_info::__sub_kind access_path)
{ {
return (access_path & __class_type_info::contained_public) == __class_type_info::contained_public; return ((access_path & __class_type_info::__contained_public)
== __class_type_info::__contained_public);
} }
inline bool contained_nonpublic_p (__class_type_info::sub_kind access_path) inline bool contained_nonpublic_p (__class_type_info::__sub_kind access_path)
{ {
return (access_path & __class_type_info::contained_public) == __class_type_info::contained_mask; return ((access_path & __class_type_info::__contained_public)
== __class_type_info::__contained_mask);
} }
inline bool contained_nonvirtual_p (__class_type_info::sub_kind access_path) inline bool contained_nonvirtual_p (__class_type_info::__sub_kind access_path)
{ {
return (access_path & (__class_type_info::contained_mask | __class_type_info::contained_virtual_mask)) return ((access_path & (__class_type_info::__contained_mask
== __class_type_info::contained_mask; | __class_type_info::__contained_virtual_mask))
== __class_type_info::__contained_mask);
} }
static const __class_type_info *const nonvirtual_base_type = static const __class_type_info *const nonvirtual_base_type =
...@@ -652,83 +655,118 @@ __vmi_class_type_info:: ...@@ -652,83 +655,118 @@ __vmi_class_type_info::
~__vmi_class_type_info () ~__vmi_class_type_info ()
{} {}
// __upcast_result is used to hold information during traversal of a class
// heirarchy when catch matching.
struct __class_type_info::__upcast_result
{
const void *dst_ptr; // pointer to caught object
__sub_kind whole2dst; // path from most derived object to target
int src_details; // hints about the source type heirarchy
const __class_type_info *base_type; // where we found the target,
// if in vbase the __class_type_info of vbase
// if a non-virtual base then 1
// else NULL
public:
__upcast_result (int d)
:dst_ptr (NULL), whole2dst (__unknown), src_details (d), base_type (NULL)
{}
};
// __dyncast_result is used to hold information during traversal of a class
// heirarchy when dynamic casting.
struct __class_type_info::__dyncast_result
{
const void *dst_ptr; // pointer to target object or NULL
__sub_kind whole2dst; // path from most derived object to target
__sub_kind whole2src; // path from most derived object to sub object
__sub_kind dst2src; // path from target to sub object
public:
__dyncast_result ()
:dst_ptr (NULL), whole2dst (__unknown),
whole2src (__unknown), dst2src (__unknown)
{}
};
bool __class_type_info:: bool __class_type_info::
do_catch (const type_info *thr_type, void **thr_obj, __do_catch (const type_info *thr_type,
unsigned outer) const void **thr_obj,
unsigned outer) const
{ {
if (*this == *thr_type) if (*this == *thr_type)
return true; return true;
if (outer >= 4) if (outer >= 4)
// Neither `A' nor `A *'. // Neither `A' nor `A *'.
return false; return false;
return thr_type->do_upcast (this, thr_obj); return thr_type->__do_upcast (this, thr_obj);
} }
bool __class_type_info:: bool __class_type_info::
do_upcast (const __class_type_info *dst_type, void **obj_ptr) const __do_upcast (const __class_type_info *dst_type,
void **obj_ptr) const
{ {
upcast_result result (__vmi_class_type_info::flags_unknown_mask); __upcast_result result (__vmi_class_type_info::__flags_unknown_mask);
if (do_upcast (contained_public, dst_type, *obj_ptr, result)) if (__do_upcast (__contained_public, dst_type, *obj_ptr, result))
return false; return false;
*obj_ptr = const_cast <void *> (result.dst_ptr); *obj_ptr = const_cast <void *> (result.dst_ptr);
return contained_public_p (result.whole2dst); return contained_public_p (result.whole2dst);
} }
inline __class_type_info::sub_kind __class_type_info:: inline __class_type_info::__sub_kind __class_type_info::
find_public_src (ptrdiff_t src2dst, __find_public_src (ptrdiff_t src2dst,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr) const const void *src_ptr) const
{ {
if (src2dst >= 0) if (src2dst >= 0)
return adjust_pointer <void> (obj_ptr, src2dst) == src_ptr return adjust_pointer <void> (obj_ptr, src2dst) == src_ptr
? contained_public : not_contained; ? __contained_public : __not_contained;
if (src2dst == -2) if (src2dst == -2)
return not_contained; return __not_contained;
return do_find_public_src (src2dst, obj_ptr, src_type, src_ptr); return __do_find_public_src (src2dst, obj_ptr, src_type, src_ptr);
} }
__class_type_info::sub_kind __class_type_info:: __class_type_info::__sub_kind __class_type_info::
do_find_public_src (ptrdiff_t, __do_find_public_src (ptrdiff_t,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *, const __class_type_info *,
const void *src_ptr) const const void *src_ptr) const
{ {
if (src_ptr == obj_ptr) if (src_ptr == obj_ptr)
// Must be our type, as the pointers match. // Must be our type, as the pointers match.
return contained_public; return __contained_public;
return not_contained; return __not_contained;
} }
__class_type_info::sub_kind __si_class_type_info:: __class_type_info::__sub_kind __si_class_type_info::
do_find_public_src (ptrdiff_t src2dst, __do_find_public_src (ptrdiff_t src2dst,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr) const const void *src_ptr) const
{ {
if (src_ptr == obj_ptr && *this == *src_type) if (src_ptr == obj_ptr && *this == *src_type)
return contained_public; return __contained_public;
return base->do_find_public_src (src2dst, obj_ptr, src_type, src_ptr); return base->__do_find_public_src (src2dst, obj_ptr, src_type, src_ptr);
} }
__class_type_info::sub_kind __vmi_class_type_info:: __class_type_info::__sub_kind __vmi_class_type_info::
do_find_public_src (ptrdiff_t src2dst, __do_find_public_src (ptrdiff_t src2dst,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr) const const void *src_ptr) const
{ {
if (obj_ptr == src_ptr && *this == *src_type) if (obj_ptr == src_ptr && *this == *src_type)
return contained_public; return __contained_public;
for (size_t i = vmi_base_count; i--;) for (size_t i = vmi_base_count; i--;)
{ {
if (!vmi_bases[i].is_public_p ()) if (!vmi_bases[i].__is_public_p ())
continue; // Not public, can't be here. continue; // Not public, can't be here.
const void *base = obj_ptr; const void *base = obj_ptr;
ptrdiff_t offset = vmi_bases[i].offset (); ptrdiff_t offset = vmi_bases[i].__offset ();
bool is_virtual = vmi_bases[i].is_virtual_p (); bool is_virtual = vmi_bases[i].__is_virtual_p ();
if (is_virtual) if (is_virtual)
{ {
...@@ -737,27 +775,27 @@ do_find_public_src (ptrdiff_t src2dst, ...@@ -737,27 +775,27 @@ do_find_public_src (ptrdiff_t src2dst,
} }
base = convert_to_base (base, is_virtual, offset); base = convert_to_base (base, is_virtual, offset);
sub_kind base_kind = vmi_bases[i].base->do_find_public_src __sub_kind base_kind = vmi_bases[i].base->__do_find_public_src
(src2dst, base, src_type, src_ptr); (src2dst, base, src_type, src_ptr);
if (contained_p (base_kind)) if (contained_p (base_kind))
{ {
if (is_virtual) if (is_virtual)
base_kind = sub_kind (base_kind | contained_virtual_mask); base_kind = __sub_kind (base_kind | __contained_virtual_mask);
return base_kind; return base_kind;
} }
} }
return not_contained; return __not_contained;
} }
bool __class_type_info:: bool __class_type_info::
do_dyncast (ptrdiff_t, __do_dyncast (ptrdiff_t,
sub_kind access_path, __sub_kind access_path,
const __class_type_info *dst_type, const __class_type_info *dst_type,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr, const void *src_ptr,
dyncast_result &__restrict result) const __dyncast_result &__restrict result) const
{ {
if (obj_ptr == src_ptr && *this == *src_type) if (obj_ptr == src_ptr && *this == *src_type)
{ {
...@@ -770,20 +808,20 @@ do_dyncast (ptrdiff_t, ...@@ -770,20 +808,20 @@ do_dyncast (ptrdiff_t,
{ {
result.dst_ptr = obj_ptr; result.dst_ptr = obj_ptr;
result.whole2dst = access_path; result.whole2dst = access_path;
result.dst2src = not_contained; result.dst2src = __not_contained;
return false; return false;
} }
return false; return false;
} }
bool __si_class_type_info:: bool __si_class_type_info::
do_dyncast (ptrdiff_t src2dst, __do_dyncast (ptrdiff_t src2dst,
sub_kind access_path, __sub_kind access_path,
const __class_type_info *dst_type, const __class_type_info *dst_type,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr, const void *src_ptr,
dyncast_result &__restrict result) const __dyncast_result &__restrict result) const
{ {
if (*this == *dst_type) if (*this == *dst_type)
{ {
...@@ -791,9 +829,9 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -791,9 +829,9 @@ do_dyncast (ptrdiff_t src2dst,
result.whole2dst = access_path; result.whole2dst = access_path;
if (src2dst >= 0) if (src2dst >= 0)
result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr
? contained_public : not_contained; ? __contained_public : __not_contained;
else if (src2dst == -2) else if (src2dst == -2)
result.dst2src = not_contained; result.dst2src = __not_contained;
return false; return false;
} }
if (obj_ptr == src_ptr && *this == *src_type) if (obj_ptr == src_ptr && *this == *src_type)
...@@ -803,8 +841,8 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -803,8 +841,8 @@ do_dyncast (ptrdiff_t src2dst,
result.whole2src = access_path; result.whole2src = access_path;
return false; return false;
} }
return base->do_dyncast (src2dst, access_path, dst_type, obj_ptr, return base->__do_dyncast (src2dst, access_path, dst_type, obj_ptr,
src_type, src_ptr, result); src_type, src_ptr, result);
} }
// This is a big hairy function. Although the run-time behaviour of // This is a big hairy function. Although the run-time behaviour of
...@@ -817,13 +855,13 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -817,13 +855,13 @@ do_dyncast (ptrdiff_t src2dst,
// work by filling in things lazily (when we know we need the information), // work by filling in things lazily (when we know we need the information),
// and opportunisticly take early success or failure results. // and opportunisticly take early success or failure results.
bool __vmi_class_type_info:: bool __vmi_class_type_info::
do_dyncast (ptrdiff_t src2dst, __do_dyncast (ptrdiff_t src2dst,
sub_kind access_path, __sub_kind access_path,
const __class_type_info *dst_type, const __class_type_info *dst_type,
const void *obj_ptr, const void *obj_ptr,
const __class_type_info *src_type, const __class_type_info *src_type,
const void *src_ptr, const void *src_ptr,
dyncast_result &__restrict result) const __dyncast_result &__restrict result) const
{ {
if (obj_ptr == src_ptr && *this == *src_type) if (obj_ptr == src_ptr && *this == *src_type)
{ {
...@@ -838,34 +876,34 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -838,34 +876,34 @@ do_dyncast (ptrdiff_t src2dst,
result.whole2dst = access_path; result.whole2dst = access_path;
if (src2dst >= 0) if (src2dst >= 0)
result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr
? contained_public : not_contained; ? __contained_public : __not_contained;
else if (src2dst == -2) else if (src2dst == -2)
result.dst2src = not_contained; result.dst2src = __not_contained;
return false; return false;
} }
bool result_ambig = false; bool result_ambig = false;
for (size_t i = vmi_base_count; i--;) for (size_t i = vmi_base_count; i--;)
{ {
dyncast_result result2; __dyncast_result result2;
void const *base = obj_ptr; void const *base = obj_ptr;
sub_kind base_access = access_path; __sub_kind base_access = access_path;
ptrdiff_t offset = vmi_bases[i].offset (); ptrdiff_t offset = vmi_bases[i].__offset ();
bool is_virtual = vmi_bases[i].is_virtual_p (); bool is_virtual = vmi_bases[i].__is_virtual_p ();
if (is_virtual) if (is_virtual)
base_access = sub_kind (base_access | contained_virtual_mask); base_access = __sub_kind (base_access | __contained_virtual_mask);
base = convert_to_base (base, is_virtual, offset); base = convert_to_base (base, is_virtual, offset);
if (!vmi_bases[i].is_public_p ()) if (!vmi_bases[i].__is_public_p ())
base_access = sub_kind (base_access & ~contained_public_mask); base_access = __sub_kind (base_access & ~__contained_public_mask);
bool result2_ambig bool result2_ambig
= vmi_bases[i].base->do_dyncast (src2dst, base_access, = vmi_bases[i].base->__do_dyncast (src2dst, base_access,
dst_type, base, dst_type, base,
src_type, src_ptr, result2); src_type, src_ptr, result2);
result.whole2src = sub_kind (result.whole2src | result2.whole2src); result.whole2src = __sub_kind (result.whole2src | result2.whole2src);
if (result2.dst2src == contained_public if (result2.dst2src == __contained_public
|| result2.dst2src == contained_ambig) || result2.dst2src == __contained_ambig)
{ {
result.dst_ptr = result2.dst_ptr; result.dst_ptr = result2.dst_ptr;
result.whole2dst = result2.whole2dst; result.whole2dst = result2.whole2dst;
...@@ -887,7 +925,7 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -887,7 +925,7 @@ do_dyncast (ptrdiff_t src2dst,
// Found at same address, must be via virtual. Pick the most // Found at same address, must be via virtual. Pick the most
// accessible path. // accessible path.
result.whole2dst = result.whole2dst =
sub_kind (result.whole2dst | result2.whole2dst); __sub_kind (result.whole2dst | result2.whole2dst);
} }
else if ((result.dst_ptr && result2.dst_ptr) else if ((result.dst_ptr && result2.dst_ptr)
|| (result_ambig && result2.dst_ptr) || (result_ambig && result2.dst_ptr)
...@@ -901,45 +939,45 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -901,45 +939,45 @@ do_dyncast (ptrdiff_t src2dst,
// but don't yet fail as we might later find a third base which does // but don't yet fail as we might later find a third base which does
// contain SRC_PTR. // contain SRC_PTR.
sub_kind new_sub_kind = result2.dst2src; __sub_kind new_sub_kind = result2.dst2src;
sub_kind old_sub_kind = result.dst2src; __sub_kind old_sub_kind = result.dst2src;
if (contained_nonvirtual_p (result.whole2src)) if (contained_nonvirtual_p (result.whole2src))
{ {
// We already found SRC_PTR as a non-virtual base of most // We already found SRC_PTR as a non-virtual base of most
// derived. Therefore if it is in either choice, it can only be // derived. Therefore if it is in either choice, it can only be
// in one of them, and we will already know. // in one of them, and we will already know.
if (old_sub_kind == unknown) if (old_sub_kind == __unknown)
old_sub_kind = not_contained; old_sub_kind = __not_contained;
if (new_sub_kind == unknown) if (new_sub_kind == __unknown)
new_sub_kind = not_contained; new_sub_kind = __not_contained;
} }
else else
{ {
if (old_sub_kind >= not_contained) if (old_sub_kind >= __not_contained)
;// already calculated ;// already calculated
else if (contained_nonvirtual_p (new_sub_kind)) else if (contained_nonvirtual_p (new_sub_kind))
// Already found non-virtually inside the other choice, // Already found non-virtually inside the other choice,
// cannot be in this. // cannot be in this.
old_sub_kind = not_contained; old_sub_kind = __not_contained;
else else
old_sub_kind = dst_type->find_public_src old_sub_kind = dst_type->__find_public_src
(src2dst, result.dst_ptr, src_type, src_ptr); (src2dst, result.dst_ptr, src_type, src_ptr);
if (new_sub_kind >= not_contained) if (new_sub_kind >= __not_contained)
;// already calculated ;// already calculated
else if (contained_nonvirtual_p (old_sub_kind)) else if (contained_nonvirtual_p (old_sub_kind))
// Already found non-virtually inside the other choice, // Already found non-virtually inside the other choice,
// cannot be in this. // cannot be in this.
new_sub_kind = not_contained; new_sub_kind = __not_contained;
else else
new_sub_kind = dst_type->find_public_src new_sub_kind = dst_type->__find_public_src
(src2dst, result2.dst_ptr, src_type, src_ptr); (src2dst, result2.dst_ptr, src_type, src_ptr);
} }
// Neither sub_kind can be contained_ambig -- we bail out early // Neither sub_kind can be contained_ambig -- we bail out early
// when we find those. // when we find those.
if (contained_p (sub_kind (new_sub_kind ^ old_sub_kind))) if (contained_p (__sub_kind (new_sub_kind ^ old_sub_kind)))
{ {
// Only on one choice, not ambiguous. // Only on one choice, not ambiguous.
if (contained_p (new_sub_kind)) if (contained_p (new_sub_kind))
...@@ -956,11 +994,11 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -956,11 +994,11 @@ do_dyncast (ptrdiff_t src2dst,
if (!virtual_p (result.dst2src)) if (!virtual_p (result.dst2src))
return false; // Found non-virtually can't be bettered return false; // Found non-virtually can't be bettered
} }
else if (contained_p (sub_kind (new_sub_kind & old_sub_kind))) else if (contained_p (__sub_kind (new_sub_kind & old_sub_kind)))
{ {
// In both. // In both.
result.dst_ptr = NULL; result.dst_ptr = NULL;
result.dst2src = contained_ambig; result.dst2src = __contained_ambig;
return true; // Fail. return true; // Fail.
} }
else else
...@@ -969,12 +1007,12 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -969,12 +1007,12 @@ do_dyncast (ptrdiff_t src2dst,
// looking. It is possible that it was private in one or // looking. It is possible that it was private in one or
// both and therefore we should fail, but that's just tough. // both and therefore we should fail, but that's just tough.
result.dst_ptr = NULL; result.dst_ptr = NULL;
result.dst2src = not_contained; result.dst2src = __not_contained;
result_ambig = true; result_ambig = true;
} }
} }
if (result.whole2src == contained_private) if (result.whole2src == __contained_private)
// We found SRC_PTR as a private non-virtual base, therefore all // We found SRC_PTR as a private non-virtual base, therefore all
// cross casts will fail. We have already found a down cast, if // cross casts will fail. We have already found a down cast, if
// there is one. // there is one.
...@@ -985,9 +1023,9 @@ do_dyncast (ptrdiff_t src2dst, ...@@ -985,9 +1023,9 @@ do_dyncast (ptrdiff_t src2dst,
} }
bool __class_type_info:: bool __class_type_info::
do_upcast (sub_kind access_path, __do_upcast (__sub_kind access_path,
const __class_type_info *dst, const void *obj, const __class_type_info *dst, const void *obj,
upcast_result &__restrict result) const __upcast_result &__restrict result) const
{ {
if (*this == *dst) if (*this == *dst)
{ {
...@@ -1000,9 +1038,9 @@ do_upcast (sub_kind access_path, ...@@ -1000,9 +1038,9 @@ do_upcast (sub_kind access_path,
} }
bool __si_class_type_info:: bool __si_class_type_info::
do_upcast (sub_kind access_path, __do_upcast (__sub_kind access_path,
const __class_type_info *dst, const void *obj_ptr, const __class_type_info *dst, const void *obj_ptr,
upcast_result &__restrict result) const __upcast_result &__restrict result) const
{ {
if (*this == *dst) if (*this == *dst)
{ {
...@@ -1011,13 +1049,13 @@ do_upcast (sub_kind access_path, ...@@ -1011,13 +1049,13 @@ do_upcast (sub_kind access_path,
result.whole2dst = access_path; result.whole2dst = access_path;
return contained_nonpublic_p (access_path); return contained_nonpublic_p (access_path);
} }
return base->do_upcast (access_path, dst, obj_ptr, result); return base->__do_upcast (access_path, dst, obj_ptr, result);
} }
bool __vmi_class_type_info:: bool __vmi_class_type_info::
do_upcast (sub_kind access_path, __do_upcast (__sub_kind access_path,
const __class_type_info *dst, const void *obj_ptr, const __class_type_info *dst, const void *obj_ptr,
upcast_result &__restrict result) const __upcast_result &__restrict result) const
{ {
if (*this == *dst) if (*this == *dst)
{ {
...@@ -1028,30 +1066,30 @@ do_upcast (sub_kind access_path, ...@@ -1028,30 +1066,30 @@ do_upcast (sub_kind access_path,
} }
int src_details = result.src_details; int src_details = result.src_details;
if (src_details & flags_unknown_mask) if (src_details & __flags_unknown_mask)
src_details = vmi_flags; src_details = vmi_flags;
for (size_t i = vmi_base_count; i--;) for (size_t i = vmi_base_count; i--;)
{ {
upcast_result result2 (src_details); __upcast_result result2 (src_details);
const void *base = obj_ptr; const void *base = obj_ptr;
sub_kind sub_access = access_path; __sub_kind sub_access = access_path;
ptrdiff_t offset = vmi_bases[i].offset (); ptrdiff_t offset = vmi_bases[i].__offset ();
bool is_virtual = vmi_bases[i].is_virtual_p (); bool is_virtual = vmi_bases[i].__is_virtual_p ();
if (!vmi_bases[i].is_public_p ()) if (!vmi_bases[i].__is_public_p ())
{ {
if (!(src_details & non_diamond_repeat_mask)) if (!(src_details & non_diamond_repeat_mask))
// original cannot have an ambiguous base // original cannot have an ambiguous base
continue; continue;
sub_access = sub_kind (sub_access & ~contained_public_mask); sub_access = __sub_kind (sub_access & ~__contained_public_mask);
} }
if (is_virtual) if (is_virtual)
sub_access = sub_kind (sub_access | contained_virtual_mask); sub_access = __sub_kind (sub_access | __contained_virtual_mask);
if (base) if (base)
base = convert_to_base (base, is_virtual, offset); base = convert_to_base (base, is_virtual, offset);
if (vmi_bases[i].base->do_upcast (sub_access, dst, base, result2)) if (vmi_bases[i].base->__do_upcast (sub_access, dst, base, result2))
return true; // must fail return true; // must fail
if (result2.base_type) if (result2.base_type)
{ {
...@@ -1068,14 +1106,14 @@ do_upcast (sub_kind access_path, ...@@ -1068,14 +1106,14 @@ do_upcast (sub_kind access_path,
{ {
// Found an ambiguity. // Found an ambiguity.
result.dst_ptr = NULL; result.dst_ptr = NULL;
result.whole2dst = contained_ambig; result.whole2dst = __contained_ambig;
return true; return true;
} }
else if (result.dst_ptr) else if (result.dst_ptr)
{ {
// Ok, found real object via a virtual path. // Ok, found real object via a virtual path.
result.whole2dst result.whole2dst
= sub_kind (result.whole2dst | result2.whole2dst); = __sub_kind (result.whole2dst | result2.whole2dst);
} }
else else
{ {
...@@ -1087,7 +1125,7 @@ do_upcast (sub_kind access_path, ...@@ -1087,7 +1125,7 @@ do_upcast (sub_kind access_path,
{ {
// Already ambiguous, not virtual or via different virtuals. // Already ambiguous, not virtual or via different virtuals.
// Cannot match. // Cannot match.
result.whole2dst = contained_ambig; result.whole2dst = __contained_ambig;
return true; return true;
} }
} }
...@@ -1110,15 +1148,15 @@ __dynamic_cast (const void *src_ptr, // object started from ...@@ -1110,15 +1148,15 @@ __dynamic_cast (const void *src_ptr, // object started from
const void *whole_ptr = const void *whole_ptr =
adjust_pointer <void> (src_ptr, prefix->whole_object); adjust_pointer <void> (src_ptr, prefix->whole_object);
const __class_type_info *whole_type = prefix->whole_type; const __class_type_info *whole_type = prefix->whole_type;
__class_type_info::dyncast_result result; __class_type_info::__dyncast_result result;
whole_type->do_dyncast (src2dst, __class_type_info::contained_public, whole_type->__do_dyncast (src2dst, __class_type_info::__contained_public,
dst_type, whole_ptr, src_type, src_ptr, result); dst_type, whole_ptr, src_type, src_ptr, result);
if (!result.dst_ptr) if (!result.dst_ptr)
return NULL; return NULL;
if (contained_public_p (result.dst2src)) if (contained_public_p (result.dst2src))
return const_cast <void *> (result.dst_ptr); return const_cast <void *> (result.dst_ptr);
if (contained_public_p (__class_type_info::sub_kind (result.whole2src & result.whole2dst))) if (contained_public_p (__class_type_info::__sub_kind (result.whole2src & result.whole2dst)))
// Found a valid cross cast // Found a valid cross cast
return const_cast <void *> (result.dst_ptr); return const_cast <void *> (result.dst_ptr);
if (contained_nonvirtual_p (result.whole2src)) if (contained_nonvirtual_p (result.whole2src))
...@@ -1129,9 +1167,9 @@ __dynamic_cast (const void *src_ptr, // object started from ...@@ -1129,9 +1167,9 @@ __dynamic_cast (const void *src_ptr, // object started from
// whole type has no private bases // whole type has no private bases
return const_cast <void *> (result.dst_ptr); return const_cast <void *> (result.dst_ptr);
#endif #endif
if (result.dst2src == __class_type_info::unknown) if (result.dst2src == __class_type_info::__unknown)
result.dst2src = dst_type->find_public_src (src2dst, result.dst_ptr, result.dst2src = dst_type->__find_public_src (src2dst, result.dst_ptr,
src_type, src_ptr); src_type, src_ptr);
if (contained_public_p (result.dst2src)) if (contained_public_p (result.dst2src))
// Found a valid down cast // Found a valid down cast
return const_cast <void *> (result.dst_ptr); return const_cast <void *> (result.dst_ptr);
......
...@@ -127,21 +127,21 @@ __pointer_to_member_type_info:: ...@@ -127,21 +127,21 @@ __pointer_to_member_type_info::
{} {}
bool __pointer_type_info:: bool __pointer_type_info::
is_pointer_p () const __is_pointer_p () const
{ {
return true; return true;
} }
bool __function_type_info:: bool __function_type_info::
is_function_p () const __is_function_p () const
{ {
return true; return true;
} }
bool __pointer_type_info:: bool __pointer_type_info::
do_catch (const type_info *thr_type, __do_catch (const type_info *thr_type,
void **thr_obj, void **thr_obj,
unsigned outer) const unsigned outer) const
{ {
if (*this == *thr_type) if (*this == *thr_type)
return true; // same type return true; // same type
...@@ -167,16 +167,16 @@ do_catch (const type_info *thr_type, ...@@ -167,16 +167,16 @@ do_catch (const type_info *thr_type,
if (outer < 2 && *type == typeid (void)) if (outer < 2 && *type == typeid (void))
{ {
// conversion to void // conversion to void
return !thrown_type->is_function_p (); return !thrown_type->__is_function_p ();
} }
return type->do_catch (thrown_type->type, thr_obj, outer + 2); return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
} }
bool __pointer_to_member_type_info:: bool __pointer_to_member_type_info::
do_catch (const type_info *thr_type, __do_catch (const type_info *thr_type,
void **thr_obj, void **thr_obj,
unsigned outer) const unsigned outer) const
{ {
if (*this == *thr_type) if (*this == *thr_type)
return true; // same type return true; // same type
...@@ -202,7 +202,7 @@ do_catch (const type_info *thr_type, ...@@ -202,7 +202,7 @@ do_catch (const type_info *thr_type,
if (*klass != *thrown_type->klass) if (*klass != *thrown_type->klass)
return false; // not pointers to member of same class return false; // not pointers to member of same class
return type->do_catch (thrown_type->type, thr_obj, outer + 2); return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
} }
} // namespace std } // namespace std
...@@ -338,7 +338,7 @@ __throw_type_match_rtti_2 (const void *catch_type_r, const void *throw_type_r, ...@@ -338,7 +338,7 @@ __throw_type_match_rtti_2 (const void *catch_type_r, const void *throw_type_r,
#else #else
// new abi // new abi
return catch_type.do_catch (&throw_type, valp, 1); return catch_type.__do_catch (&throw_type, valp, 1);
#endif #endif
return 0; return 0;
} }
...@@ -371,7 +371,7 @@ __is_pointer (void *p) ...@@ -371,7 +371,7 @@ __is_pointer (void *p)
return pt != 0; return pt != 0;
#else #else
// new abi // new abi
return t->is_pointer_p (); return t->__is_pointer_p ();
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment