1 // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007
2 // 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 2, 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 // You should have received a copy of the GNU General Public License
17 // along with GCC; see the file COPYING. If not, write to
18 // the Free Software Foundation, 51 Franklin Street, Fifth Floor,
19 // Boston, MA 02110-1301, USA.
21 // As a special exception, you may use this file as part of a free software
22 // library without restriction. Specifically, if other files instantiate
23 // templates or use macros or inline enums from this file, or you compile
24 // this file and link it with other files to produce an executable, this
25 // file does not by itself cause the resulting executable to be covered by
26 // the GNU General Public License. This exception does not however
27 // invalidate any other reasons why the executable file might be covered by
28 // the GNU General Public License.
32 namespace __cxxabiv1 {
38 bool __class_type_info::
39 __do_catch (const type_info *thr_type,
43 if (*this == *thr_type)
46 // Neither `A' nor `A *'.
48 return thr_type->__do_upcast (this, thr_obj);
51 bool __class_type_info::
52 __do_upcast (const __class_type_info *dst_type,
55 __upcast_result result (__vmi_class_type_info::__flags_unknown_mask);
57 __do_upcast (dst_type, *obj_ptr, result);
58 if (!contained_public_p (result.part2dst))
60 *obj_ptr = const_cast <void *> (result.dst_ptr);
64 __class_type_info::__sub_kind __class_type_info::
65 __do_find_public_src (ptrdiff_t,
67 const __class_type_info *,
68 const void *src_ptr) const
70 if (src_ptr == obj_ptr)
71 // Must be our type, as the pointers match.
72 return __contained_public;
73 return __not_contained;
76 bool __class_type_info::
77 __do_dyncast (ptrdiff_t,
78 __sub_kind access_path,
79 const __class_type_info *dst_type,
81 const __class_type_info *src_type,
83 __dyncast_result &__restrict result) const
85 if (obj_ptr == src_ptr && *this == *src_type)
87 // The src object we started from. Indicate how we are accessible from
88 // the most derived object.
89 result.whole2src = access_path;
92 if (*this == *dst_type)
94 result.dst_ptr = obj_ptr;
95 result.whole2dst = access_path;
96 result.dst2src = __not_contained;
102 bool __class_type_info::
103 __do_upcast (const __class_type_info *dst, const void *obj,
104 __upcast_result &__restrict result) const
108 result.dst_ptr = obj;
109 result.base_type = nonvirtual_base_type;
110 result.part2dst = __contained_public;