1*e4b17023SJohn Marino // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007, 2009
2*e4b17023SJohn Marino // Free Software Foundation
3*e4b17023SJohn Marino //
4*e4b17023SJohn Marino // This file is part of GCC.
5*e4b17023SJohn Marino //
6*e4b17023SJohn Marino // GCC is free software; you can redistribute it and/or modify
7*e4b17023SJohn Marino // it under the terms of the GNU General Public License as published by
8*e4b17023SJohn Marino // the Free Software Foundation; either version 3, or (at your option)
9*e4b17023SJohn Marino // any later version.
10*e4b17023SJohn Marino 
11*e4b17023SJohn Marino // GCC is distributed in the hope that it will be useful,
12*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of
13*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*e4b17023SJohn Marino // GNU General Public License for more details.
15*e4b17023SJohn Marino 
16*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional
17*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version
18*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation.
19*e4b17023SJohn Marino 
20*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and
21*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program;
22*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>.
24*e4b17023SJohn Marino 
25*e4b17023SJohn Marino #include "tinfo.h"
26*e4b17023SJohn Marino 
27*e4b17023SJohn Marino namespace __cxxabiv1 {
28*e4b17023SJohn Marino 
29*e4b17023SJohn Marino __si_class_type_info::
~__si_class_type_info()30*e4b17023SJohn Marino ~__si_class_type_info ()
31*e4b17023SJohn Marino {}
32*e4b17023SJohn Marino 
33*e4b17023SJohn Marino __class_type_info::__sub_kind __si_class_type_info::
__do_find_public_src(ptrdiff_t src2dst,const void * obj_ptr,const __class_type_info * src_type,const void * src_ptr) const34*e4b17023SJohn Marino __do_find_public_src (ptrdiff_t src2dst,
35*e4b17023SJohn Marino                       const void *obj_ptr,
36*e4b17023SJohn Marino                       const __class_type_info *src_type,
37*e4b17023SJohn Marino                       const void *src_ptr) const
38*e4b17023SJohn Marino {
39*e4b17023SJohn Marino   if (src_ptr == obj_ptr && *this == *src_type)
40*e4b17023SJohn Marino     return __contained_public;
41*e4b17023SJohn Marino   return __base_type->__do_find_public_src (src2dst, obj_ptr, src_type, src_ptr);
42*e4b17023SJohn Marino }
43*e4b17023SJohn Marino 
44*e4b17023SJohn Marino bool __si_class_type_info::
__do_dyncast(ptrdiff_t src2dst,__sub_kind access_path,const __class_type_info * dst_type,const void * obj_ptr,const __class_type_info * src_type,const void * src_ptr,__dyncast_result & __restrict result) const45*e4b17023SJohn Marino __do_dyncast (ptrdiff_t src2dst,
46*e4b17023SJohn Marino               __sub_kind access_path,
47*e4b17023SJohn Marino               const __class_type_info *dst_type,
48*e4b17023SJohn Marino               const void *obj_ptr,
49*e4b17023SJohn Marino               const __class_type_info *src_type,
50*e4b17023SJohn Marino               const void *src_ptr,
51*e4b17023SJohn Marino               __dyncast_result &__restrict result) const
52*e4b17023SJohn Marino {
53*e4b17023SJohn Marino   if (*this == *dst_type)
54*e4b17023SJohn Marino     {
55*e4b17023SJohn Marino       result.dst_ptr = obj_ptr;
56*e4b17023SJohn Marino       result.whole2dst = access_path;
57*e4b17023SJohn Marino       if (src2dst >= 0)
58*e4b17023SJohn Marino         result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr
59*e4b17023SJohn Marino               ? __contained_public : __not_contained;
60*e4b17023SJohn Marino       else if (src2dst == -2)
61*e4b17023SJohn Marino         result.dst2src = __not_contained;
62*e4b17023SJohn Marino       return false;
63*e4b17023SJohn Marino     }
64*e4b17023SJohn Marino   if (obj_ptr == src_ptr && *this == *src_type)
65*e4b17023SJohn Marino     {
66*e4b17023SJohn Marino       // The src object we started from. Indicate how we are accessible from
67*e4b17023SJohn Marino       // the most derived object.
68*e4b17023SJohn Marino       result.whole2src = access_path;
69*e4b17023SJohn Marino       return false;
70*e4b17023SJohn Marino     }
71*e4b17023SJohn Marino   return __base_type->__do_dyncast (src2dst, access_path, dst_type, obj_ptr,
72*e4b17023SJohn Marino                              src_type, src_ptr, result);
73*e4b17023SJohn Marino }
74*e4b17023SJohn Marino 
75*e4b17023SJohn Marino bool __si_class_type_info::
__do_upcast(const __class_type_info * dst,const void * obj_ptr,__upcast_result & __restrict result) const76*e4b17023SJohn Marino __do_upcast (const __class_type_info *dst, const void *obj_ptr,
77*e4b17023SJohn Marino              __upcast_result &__restrict result) const
78*e4b17023SJohn Marino {
79*e4b17023SJohn Marino   if (__class_type_info::__do_upcast (dst, obj_ptr, result))
80*e4b17023SJohn Marino     return true;
81*e4b17023SJohn Marino 
82*e4b17023SJohn Marino   return __base_type->__do_upcast (dst, obj_ptr, result);
83*e4b17023SJohn Marino }
84*e4b17023SJohn Marino 
85*e4b17023SJohn Marino }
86