Commit 6d61f400 by Nathan Sidwell Committed by Nathan Sidwell

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
parent 4b7ee615
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. Lwis <loewis@informatik.hu-berlin.de> 2000-04-10 Martin v. Lwis <loewis@informatik.hu-berlin.de>
* lex.c (init_parse): Remove traces of classof and headof. * lex.c (init_parse): Remove traces of classof and headof.
......
...@@ -64,15 +64,22 @@ public: ...@@ -64,15 +64,22 @@ public:
public: public:
enum quals_masks { enum quals_masks {
const_mask = 0x1, const_mask = 0x1,
volatile_mask = 0x2 volatile_mask = 0x2,
restrict_mask = 0x4,
incomplete_mask = 0x8
}; };
/* implementation defined member functions */ /* implementation defined member functions */
protected: protected:
virtual bool __is_pointer_p () const; virtual bool __is_pointer_p () const;
protected: 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; 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 */ /* type information for array objects */
...@@ -120,36 +127,30 @@ public: ...@@ -120,36 +127,30 @@ public:
/* type information for a pointer to member variable (not function) */ /* type information for a pointer to member variable (not function) */
class __pointer_to_member_type_info class __pointer_to_member_type_info
: public std::type_info : public __pointer_type_info
{ {
/* abi defined member variables */ /* abi defined member variables */
public: public:
const __class_type_info *klass; /* class of the member */ 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 */ /* abi defined member functions */
public: public:
virtual ~__pointer_to_member_type_info (); virtual ~__pointer_to_member_type_info ();
public: public:
explicit __pointer_to_member_type_info (const char *__n, explicit __pointer_to_member_type_info (const char *__n,
const __class_type_info *__klass, int __quals,
const std::type_info *__type, const std::type_info *__type,
int __quals) const __class_type_info *__klass)
: std::type_info (__n), klass (__klass), type (__type), quals (__quals) : __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 */ /* implementation defined member functions */
protected: protected:
virtual bool __do_catch (const std::type_info *__thr_type, void **__thr_obj, virtual bool __is_pointer_p () const;
unsigned __outer) const; protected:
virtual bool __pointer_catch (const __pointer_type_info *__thr_type,
void **__thr_obj,
unsigned __outer) const;
}; };
class __class_type_info; class __class_type_info;
......
...@@ -1286,6 +1286,8 @@ qualifier_flags (type) ...@@ -1286,6 +1286,8 @@ qualifier_flags (type)
flags |= 1; flags |= 1;
if (quals & TYPE_QUAL_VOLATILE) if (quals & TYPE_QUAL_VOLATILE)
flags |= 2; flags |= 2;
if (quals & TYPE_QUAL_RESTRICT)
flags |= 4;
return flags; return flags;
} }
...@@ -1369,14 +1371,14 @@ ptmd_initializer (desc, target) ...@@ -1369,14 +1371,14 @@ ptmd_initializer (desc, target)
tree klass = TYPE_PTRMEM_CLASS_TYPE (target); tree klass = TYPE_PTRMEM_CLASS_TYPE (target);
int flags = qualifier_flags (to); int flags = qualifier_flags (to);
init = tree_cons (NULL_TREE, init = tree_cons (NULL_TREE, build_int_2 (flags, 0), init);
build_unary_op (ADDR_EXPR, get_tinfo_decl (klass), 0),
init);
init = tree_cons (NULL_TREE, init = tree_cons (NULL_TREE,
build_unary_op (ADDR_EXPR, build_unary_op (ADDR_EXPR,
get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0), get_tinfo_decl (TYPE_MAIN_VARIANT (to)), 0),
init); 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)); init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, nreverse (init));
TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1; TREE_HAS_CONSTRUCTOR (init) = TREE_CONSTANT (init) = TREE_STATIC (init) = 1;
...@@ -1821,7 +1823,8 @@ create_tinfo_types () ...@@ -1821,7 +1823,8 @@ create_tinfo_types ()
("__class_type_info", 0, ("__class_type_info", 0,
NULL); 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_desc_type_node = create_pseudo_type_info
("__si_class_type_info", 0, ("__si_class_type_info", 0,
build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info), build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
...@@ -1843,13 +1846,14 @@ create_tinfo_types () ...@@ -1843,13 +1846,14 @@ create_tinfo_types ()
/* General heirarchy is created as necessary in this vector. */ /* General heirarchy is created as necessary in this vector. */
vmi_class_desc_type_node = make_tree_vec (10); vmi_class_desc_type_node = make_tree_vec (10);
/* Pointer to member data type_info. Add pointer to the class, pointer /* Pointer to member data type_info. Add qualifications flags,
to the member's type info and 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 ptmd_desc_type_node = create_pseudo_type_info
("__pointer_to_member_type_info", 0, ("__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, ptr_type_info), build_lang_decl (FIELD_DECL, NULL_TREE, ptr_type_info),
build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
NULL); NULL);
pop_nested_namespace (abi_node); pop_nested_namespace (abi_node);
......
...@@ -138,6 +138,13 @@ __is_function_p () const ...@@ -138,6 +138,13 @@ __is_function_p () const
return true; return true;
} }
bool __pointer_to_member_type_info::
__is_pointer_p () const
{
return false;
}
bool __pointer_type_info:: bool __pointer_type_info::
__do_catch (const type_info *thr_type, __do_catch (const type_info *thr_type,
void **thr_obj, void **thr_obj,
...@@ -146,7 +153,7 @@ __do_catch (const type_info *thr_type, ...@@ -146,7 +153,7 @@ __do_catch (const type_info *thr_type,
if (*this == *thr_type) if (*this == *thr_type)
return true; // same type return true; // same type
if (typeid (*this) != typeid (*thr_type)) if (typeid (*this) != typeid (*thr_type))
return false; // not both pointers return false; // not both same kind of pointers
if (!(outer & 1)) if (!(outer & 1))
// We're not the same and our outer pointers are not all const qualified // 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, ...@@ -164,41 +171,33 @@ __do_catch (const type_info *thr_type,
if (!(quals & const_mask)) if (!(quals & const_mask))
outer &= ~1; 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)) if (outer < 2 && *type == typeid (void))
{ {
// conversion to 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); return type->__do_catch (thrown_type->type, thr_obj, outer + 2);
} }
bool __pointer_to_member_type_info:: bool __pointer_to_member_type_info::
__do_catch (const type_info *thr_type, __pointer_catch (const __pointer_type_info *thr_type,
void **thr_obj, void **thr_obj,
unsigned outer) const unsigned outer) const
{ {
if (*this == *thr_type) // This static cast is always valid, as our caller will have determined that
return true; // same type // thr_type is really a __pointer_to_member_type_info.
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;
const __pointer_to_member_type_info *thrown_type = const __pointer_to_member_type_info *thrown_type =
static_cast <const __pointer_to_member_type_info *> (thr_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) if (*klass != *thrown_type->klass)
return false; // not pointers to member of same class return false; // not pointers to member of same class
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment