aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2000-04-10 16:21:28 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2000-04-10 16:21:28 +0000
commit6d61f400fd019ac06026d7aaa412e076096a7d37 (patch)
tree3768b8d8cee3530ee2196a4ce4071d1941cdee6e
parent4b7ee6157ab47830d9b198c2f968dbef9388e768 (diff)
downloadgcc-6d61f400fd019ac06026d7aaa412e076096a7d37.zip
gcc-6d61f400fd019ac06026d7aaa412e076096a7d37.tar.gz
gcc-6d61f400fd019ac06026d7aaa412e076096a7d37.tar.bz2
cxxabi.h (__pointer_type_info): Add restrict and incomplete flags.
* inc/cxxabi.h (__pointer_type_info): Add restrict and incomplete flags. (__pointer_type_info::__pointer_catch): New virtual function. (__pointer_to_member_type_info): Derive from __pointer_type_info. Adjust. (__pointer_to_member_type_info::__do_catch): Remove. (__pointer_to_member_type_info::__is_pointer_p): Declare. (__pointer_to_member_type_info::__pointer_catch): Declare. * rtti.c (qualifier_flags): Add restrict flag. (ptmd_initializer): Reorder members. (create_tinfo_types): Expand comments. Reorder ptmd_desc_type_node members. * tinfo2.cc (__pointer_to_member_type_info::__is_pointer_p): Implement. (__pointer_type_info::__do_catch): Move specific code into __pointer_catch. Call it. (__pointer_type_info::__pointer_catch): Non-pointer-to-member specific catch checking. Fix void conversion check. (__pointer_to_member_type_info::__do_catch): Remove. (__pointer_to_member_type_info::__pointer_catch): Implement. From-SVN: r33061
-rw-r--r--gcc/cp/ChangeLog23
-rw-r--r--gcc/cp/inc/cxxabi.h35
-rw-r--r--gcc/cp/rtti.c20
-rw-r--r--gcc/cp/tinfo2.cc45
4 files changed, 75 insertions, 48 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0d773d9..b7c8a05 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,26 @@
+2000-04-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * inc/cxxabi.h (__pointer_type_info): Add restrict and
+ incomplete flags.
+ (__pointer_type_info::__pointer_catch): New virtual function.
+ (__pointer_to_member_type_info): Derive from
+ __pointer_type_info. Adjust.
+ (__pointer_to_member_type_info::__do_catch): Remove.
+ (__pointer_to_member_type_info::__is_pointer_p): Declare.
+ (__pointer_to_member_type_info::__pointer_catch): Declare.
+ * rtti.c (qualifier_flags): Add restrict flag.
+ (ptmd_initializer): Reorder members.
+ (create_tinfo_types): Expand comments. Reorder
+ ptmd_desc_type_node members.
+ * tinfo2.cc (__pointer_to_member_type_info::__is_pointer_p):
+ Implement.
+ (__pointer_type_info::__do_catch): Move specific code into
+ __pointer_catch. Call it.
+ (__pointer_type_info::__pointer_catch): Non-pointer-to-member
+ specific catch checking. Fix void conversion check.
+ (__pointer_to_member_type_info::__do_catch): Remove.
+ (__pointer_to_member_type_info::__pointer_catch): Implement.
+
2000-04-10 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* lex.c (init_parse): Remove traces of classof and headof.
diff --git a/gcc/cp/inc/cxxabi.h b/gcc/cp/inc/cxxabi.h
index 66a6607..a40482c 100644
--- a/gcc/cp/inc/cxxabi.h
+++ b/gcc/cp/inc/cxxabi.h
@@ -64,15 +64,22 @@ public:
public:
enum quals_masks {
const_mask = 0x1,
- volatile_mask = 0x2
+ volatile_mask = 0x2,
+ restrict_mask = 0x4,
+ incomplete_mask = 0x8
};
/* implementation defined member functions */
protected:
virtual bool __is_pointer_p () const;
protected:
- virtual bool __do_catch (const std::type_info *__thr_type, void **__thr_obj,
+ virtual bool __do_catch (const std::type_info *__thr_type,
+ void **__thr_obj,
unsigned __outer) const;
+protected:
+ virtual bool __pointer_catch (const __pointer_type_info *__thr_type,
+ void **__thr_obj,
+ unsigned __outer) const;
};
/* type information for array objects */
@@ -120,36 +127,30 @@ public:
/* type information for a pointer to member variable (not function) */
class __pointer_to_member_type_info
- : public std::type_info
+ : public __pointer_type_info
{
/* abi defined member variables */
public:
const __class_type_info *klass; /* class of the member */
- const std::type_info *type; /* type of the pointed to member */
- int quals; /* qualifications of the pointed to type */
/* abi defined member functions */
public:
virtual ~__pointer_to_member_type_info ();
public:
explicit __pointer_to_member_type_info (const char *__n,
- const __class_type_info *__klass,
+ int __quals,
const std::type_info *__type,
- int __quals)
- : std::type_info (__n), klass (__klass), type (__type), quals (__quals)
+ const __class_type_info *__klass)
+ : __pointer_type_info (__n, __quals, __type), klass (__klass)
{ }
-/* implementation defined types */
-public:
- enum quals_masks {
- const_mask = 0x1,
- volatile_mask = 0x2
- };
-
/* implementation defined member functions */
protected:
- virtual bool __do_catch (const std::type_info *__thr_type, void **__thr_obj,
- unsigned __outer) const;
+ virtual bool __is_pointer_p () const;
+protected:
+ virtual bool __pointer_catch (const __pointer_type_info *__thr_type,
+ void **__thr_obj,
+ unsigned __outer) const;
};
class __class_type_info;
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c
index 3a0a484..029d4d8 100644
--- a/gcc/cp/rtti.c
+++ b/gcc/cp/rtti.c
@@ -1286,6 +1286,8 @@ qualifier_flags (type)
flags |= 1;
if (quals & TYPE_QUAL_VOLATILE)
flags |= 2;
+ if (quals & TYPE_QUAL_RESTRICT)
+ flags |= 4;
return flags;
}
@@ -1369,14 +1371,14 @@ ptmd_initializer (desc, target)
tree klass = TYPE_PTRMEM_CLASS_TYPE (target);
int flags = qualifier_flags (to);
- init = tree_cons (NULL_TREE,
- build_unary_op (ADDR_EXPR, get_tinfo_decl (klass), 0),
- init);
+ init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
init = tree_cons (NULL_TREE,
build_unary_op (ADDR_EXPR,
get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
init);
- init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
+ init = tree_cons (NULL_TREE,
+ build_unary_op (ADDR_EXPR, get_tinfo_decl (klass), 0),
+ init);
init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
@@ -1821,7 +1823,8 @@ create_tinfo_types ()
("__class_type_info", 0,
NULL);
- /* Single public non-virtual base class. Add pointer to base class. */
+ /* Single public non-virtual base class. Add pointer to base class.
+ This is really a descendant of __class_type_info. */
si_class_desc_type_node = create_pseudo_type_info
("__si_class_type_info", 0,
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
@@ -1843,13 +1846,14 @@ create_tinfo_types ()
/* General heirarchy is created as necessary in this vector. */
vmi_class_desc_type_node = make_tree_vec (10);
- /* Pointer to member data type_info. Add pointer to the class, pointer
- to the member's type info and qualifications flags. */
+ /* Pointer to member data type_info. Add qualifications flags,
+ pointer to the member's type info and pointer to the class.
+ This is really a descendant of __pointer_type_info. */
ptmd_desc_type_node = create_pseudo_type_info
("__pointer_to_member_type_info", 0,
+ build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
- build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
NULL);
pop_nested_namespace (abi_node);
diff --git a/gcc/cp/tinfo2.cc b/gcc/cp/tinfo2.cc
index b41b071..3d3c66a 100644
--- a/gcc/cp/tinfo2.cc
+++ b/gcc/cp/tinfo2.cc
@@ -138,6 +138,13 @@ __is_function_p () const
return true;
}
+bool __pointer_to_member_type_info::
+__is_pointer_p () const
+{
+ return false;
+}
+
+
bool __pointer_type_info::
__do_catch (const type_info *thr_type,
void **thr_obj,
@@ -146,7 +153,7 @@ __do_catch (const type_info *thr_type,
if (*this == *thr_type)
return true; // same type
if (typeid (*this) != typeid (*thr_type))
- return false; // not both pointers
+ return false; // not both same kind of pointers
if (!(outer & 1))
// We're not the same and our outer pointers are not all const qualified
@@ -164,41 +171,33 @@ __do_catch (const type_info *thr_type,
if (!(quals & const_mask))
outer &= ~1;
+ return __pointer_catch (thrown_type, thr_obj, outer);
+}
+
+bool __pointer_type_info::
+__pointer_catch (const __pointer_type_info *thrown_type,
+ void **thr_obj,
+ unsigned outer) const
+{
if (outer < 2 && *type == typeid (void))
{
// conversion to void
- return !thrown_type->__is_function_p ();
+ return !thrown_type->type->__is_function_p ();
}
return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
}
bool __pointer_to_member_type_info::
-__do_catch (const type_info *thr_type,
- void **thr_obj,
- unsigned outer) const
+__pointer_catch (const __pointer_type_info *thr_type,
+ void **thr_obj,
+ unsigned outer) const
{
- if (*this == *thr_type)
- return true; // same type
- if (typeid (*this) != typeid (*thr_type))
- return false; // not both pointers to member
-
- if (!(outer & 1))
- // We're not the same and our outer pointers are not all const qualified
- // Therefore there must at least be a qualification conversion involved.
- // But for that to be valid, our outer pointers must be const qualified.
- return false;
-
+ // This static cast is always valid, as our caller will have determined that
+ // thr_type is really a __pointer_to_member_type_info.
const __pointer_to_member_type_info *thrown_type =
static_cast <const __pointer_to_member_type_info *> (thr_type);
- if (thrown_type->quals & ~quals)
- // We're less qualified.
- return false;
-
- if (!(quals & const_mask))
- outer &= ~1;
-
if (*klass != *thrown_type->klass)
return false; // not pointers to member of same class