]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libstdc++-v3/contrib/libstdc++-v3-4.3.3/libsupc++/si_class_type_info.cc
update
[l4.git] / l4 / pkg / libstdc++-v3 / contrib / libstdc++-v3-4.3.3 / libsupc++ / si_class_type_info.cc
1 // Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2007
2 // Free Software Foundation
3 //
4 // This file is part of GCC.
5 //
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)
9 // any later version.
10
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.
15
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. 
20
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.
29
30 #include "tinfo.h"
31
32 namespace __cxxabiv1 {
33
34 __si_class_type_info::
35 ~__si_class_type_info ()
36 {}
37
38 __class_type_info::__sub_kind __si_class_type_info::
39 __do_find_public_src (ptrdiff_t src2dst,
40                       const void *obj_ptr,
41                       const __class_type_info *src_type,
42                       const void *src_ptr) const
43 {
44   if (src_ptr == obj_ptr && *this == *src_type)
45     return __contained_public;
46   return __base_type->__do_find_public_src (src2dst, obj_ptr, src_type, src_ptr);
47 }
48
49 bool __si_class_type_info::
50 __do_dyncast (ptrdiff_t src2dst,
51               __sub_kind access_path,
52               const __class_type_info *dst_type,
53               const void *obj_ptr,
54               const __class_type_info *src_type,
55               const void *src_ptr,
56               __dyncast_result &__restrict result) const
57 {
58   if (*this == *dst_type)
59     {
60       result.dst_ptr = obj_ptr;
61       result.whole2dst = access_path;
62       if (src2dst >= 0)
63         result.dst2src = adjust_pointer <void> (obj_ptr, src2dst) == src_ptr
64               ? __contained_public : __not_contained;
65       else if (src2dst == -2)
66         result.dst2src = __not_contained;
67       return false;
68     }
69   if (obj_ptr == src_ptr && *this == *src_type)
70     {
71       // The src object we started from. Indicate how we are accessible from
72       // the most derived object.
73       result.whole2src = access_path;
74       return false;
75     }
76   return __base_type->__do_dyncast (src2dst, access_path, dst_type, obj_ptr,
77                              src_type, src_ptr, result);
78 }
79
80 bool __si_class_type_info::
81 __do_upcast (const __class_type_info *dst, const void *obj_ptr,
82              __upcast_result &__restrict result) const
83 {
84   if (__class_type_info::__do_upcast (dst, obj_ptr, result))
85     return true;
86   
87   return __base_type->__do_upcast (dst, obj_ptr, result);
88 }
89
90 }