1 // RTTI support for -*- C++ -*-
2 // Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free Software Foundation
4 // This file is part of GNU CC.
6 // GNU CC 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 // GNU CC 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 GNU CC; see the file COPYING. If not, write to
18 // the Free Software Foundation, 59 Temple Place - Suite 330,
19 // Boston, MA 02111-1307, 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 functions 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.
39 class __class_type_info;
40 } // namespace __cxxabiv1
43 // If weak symbols are not supported, typeinfo names are not merged.
44 #define __GXX_MERGED_TYPEINFO_NAMES 0
46 // On platforms that support weak symbols, typeinfo names are merged.
47 #define __GXX_MERGED_TYPEINFO_NAMES 1
55 // Destructor. Being the first non-inline virtual function, this
56 // controls in which translation unit the vtable is emitted. The
57 // compiler makes use of that information to know where to emit
58 // the runtime-mandated type_info structures in the new-abi.
62 // Assigning type_info is not supported. made private.
63 type_info& operator=(const type_info&);
64 type_info(const type_info&);
70 explicit type_info(const char *__n): __name(__n) { }
73 // the public interface
74 const char* name() const
77 #if !__GXX_MERGED_TYPEINFO_NAMES
78 bool before(const type_info& arg) const;
79 // In old abi, or when weak symbols are not supported, there can
80 // be multiple instances of a type_info object for one
81 // type. Uniqueness must use the _name value, not object address.
82 bool operator==(const type_info& __arg) const;
84 // In new abi we can rely on type_info's NTBS being unique,
85 // and therefore address comparisons are sufficient.
86 bool before(const type_info& __arg) const
87 { return __name < __arg.__name; }
88 bool operator==(const type_info& __arg) const
89 { return __name == __arg.__name; }
91 bool operator!=(const type_info& __arg) const
92 { return !operator==(__arg); }
94 // the internal interface
96 // return true if this is a pointer type of some kind
97 virtual bool __is_pointer_p() const;
98 // return true if this is a function type
99 virtual bool __is_function_p() const;
101 // Try and catch a thrown type. Store an adjusted pointer to the
102 // caught type in THR_OBJ. If THR_TYPE is not a pointer type, then
103 // THR_OBJ points to the thrown object. If THR_TYPE is a pointer
104 // type, then THR_OBJ is the pointer itself. OUTER indicates the
105 // number of outer pointers, and whether they were const
107 virtual bool __do_catch(const type_info *__thr_type, void **__thr_obj,
108 unsigned __outer) const;
110 // internally used during catch matching
111 virtual bool __do_upcast(const __cxxabiv1::__class_type_info *__target,
112 void **__obj_ptr) const;
115 class bad_cast : public exception
118 bad_cast() throw() { }
119 virtual ~bad_cast() throw();
122 class bad_typeid : public exception
125 bad_typeid () throw() { }
126 virtual ~bad_typeid () throw();