Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6554 serge 1
// Copyright (C) 1994-2015 Free Software Foundation, Inc.
2
//
3
// This file is part of GCC.
4
//
5
// GCC is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3, or (at your option)
8
// any later version.
9
 
10
// GCC is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
// GNU General Public License for more details.
14
 
15
// Under Section 7 of GPL version 3, you are granted additional
16
// permissions described in the GCC Runtime Library Exception, version
17
// 3.1, as published by the Free Software Foundation.
18
 
19
// You should have received a copy of the GNU General Public License and
20
// a copy of the GCC Runtime Library Exception along with this program;
21
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
22
// .
23
 
24
#include "tinfo.h"
25
 
26
namespace __cxxabiv1 {
27
 
28
__class_type_info::
29
~__class_type_info ()
30
{}
31
 
32
bool __class_type_info::
33
__do_catch (const type_info *thr_type,
34
            void **thr_obj,
35
            unsigned outer) const
36
{
37
  if (*this == *thr_type)
38
    return true;
39
  if (outer >= 4)
40
    // Neither `A' nor `A *'.
41
    return false;
42
  return thr_type->__do_upcast (this, thr_obj);
43
}
44
 
45
bool __class_type_info::
46
__do_upcast (const __class_type_info *dst_type,
47
             void **obj_ptr) const
48
{
49
  __upcast_result result (__vmi_class_type_info::__flags_unknown_mask);
50
 
51
  __do_upcast (dst_type, *obj_ptr, result);
52
  if (!contained_public_p (result.part2dst))
53
    return false;
54
  *obj_ptr = const_cast  (result.dst_ptr);
55
  return true;
56
}
57
 
58
__class_type_info::__sub_kind __class_type_info::
59
__do_find_public_src (ptrdiff_t,
60
                      const void *obj_ptr,
61
                      const __class_type_info *,
62
                      const void *src_ptr) const
63
{
64
  if (src_ptr == obj_ptr)
65
    // Must be our type, as the pointers match.
66
    return __contained_public;
67
  return __not_contained;
68
}
69
 
70
bool __class_type_info::
71
__do_dyncast (ptrdiff_t,
72
              __sub_kind access_path,
73
              const __class_type_info *dst_type,
74
              const void *obj_ptr,
75
              const __class_type_info *src_type,
76
              const void *src_ptr,
77
              __dyncast_result &__restrict result) const
78
{
79
  if (obj_ptr == src_ptr && *this == *src_type)
80
    {
81
      // The src object we started from. Indicate how we are accessible from
82
      // the most derived object.
83
      result.whole2src = access_path;
84
      return false;
85
    }
86
  if (*this == *dst_type)
87
    {
88
      result.dst_ptr = obj_ptr;
89
      result.whole2dst = access_path;
90
      result.dst2src = __not_contained;
91
      return false;
92
    }
93
  return false;
94
}
95
 
96
bool __class_type_info::
97
__do_upcast (const __class_type_info *dst, const void *obj,
98
             __upcast_result &__restrict result) const
99
{
100
  if (*this == *dst)
101
    {
102
      result.dst_ptr = obj;
103
      result.base_type = nonvirtual_base_type;
104
      result.part2dst = __contained_public;
105
      return true;
106
    }
107
  return false;
108
}
109
 
110
}