1 // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007,
2 // 2009 Free Software Foundation
4 // This file is part of GCC.
6 // GCC is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3, or (at your option)
11 // GCC is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // Under Section 7 of GPL version 3, you are granted additional
17 // permissions described in the GCC Runtime Library Exception, version
18 // 3.1, as published by the Free Software Foundation.
20 // You should have received a copy of the GNU General Public License and
21 // a copy of the GCC Runtime Library Exception along with this program;
22 // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
23 // <http://www.gnu.org/licenses/>.
27 namespace __cxxabiv1
{
33 bool __class_type_info::
34 __do_catch (const type_info
*thr_type
,
38 if (*this == *thr_type
)
41 // Neither `A' nor `A *'.
43 return thr_type
->__do_upcast (this, thr_obj
);
46 bool __class_type_info::
47 __do_upcast (const __class_type_info
*dst_type
,
50 __upcast_result
result (__vmi_class_type_info::__flags_unknown_mask
);
52 __do_upcast (dst_type
, *obj_ptr
, result
);
53 if (!contained_public_p (result
.part2dst
))
55 *obj_ptr
= const_cast <void *> (result
.dst_ptr
);
59 __class_type_info::__sub_kind
__class_type_info::
60 __do_find_public_src (ptrdiff_t,
62 const __class_type_info
*,
63 const void *src_ptr
) const
65 if (src_ptr
== obj_ptr
)
66 // Must be our type, as the pointers match.
67 return __contained_public
;
68 return __not_contained
;
71 bool __class_type_info::
72 __do_dyncast (ptrdiff_t,
73 __sub_kind access_path
,
74 const __class_type_info
*dst_type
,
76 const __class_type_info
*src_type
,
78 __dyncast_result
&__restrict result
) const
80 if (obj_ptr
== src_ptr
&& *this == *src_type
)
82 // The src object we started from. Indicate how we are accessible from
83 // the most derived object.
84 result
.whole2src
= access_path
;
87 if (*this == *dst_type
)
89 result
.dst_ptr
= obj_ptr
;
90 result
.whole2dst
= access_path
;
91 result
.dst2src
= __not_contained
;
97 bool __class_type_info::
98 __do_upcast (const __class_type_info
*dst
, const void *obj
,
99 __upcast_result
&__restrict result
) const
103 result
.dst_ptr
= obj
;
104 result
.base_type
= nonvirtual_base_type
;
105 result
.part2dst
= __contained_public
;