aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2004-07-05 09:35:44 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2004-07-05 09:35:44 +0000
commit95b4aca6a30bfa889277649da9f092d070a6a687 (patch)
tree345ee905cf45afd981c579fc9648f137846a592f /gcc/cp
parentacf8677f4e8df04a0285d37c653eb69d12e0cb64 (diff)
downloadgcc-95b4aca6a30bfa889277649da9f092d070a6a687.zip
gcc-95b4aca6a30bfa889277649da9f092d070a6a687.tar.gz
gcc-95b4aca6a30bfa889277649da9f092d070a6a687.tar.bz2
c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1.
* c-tree.h (TYPE_ACTUAL_ARG_TYPES): Use TYPE_LANG_SLOT_1. * dwarf2out.c (add_data_member_location_attribute): Check for TREE_BINFO. * tree.c (tree_node_kinds): Add "binfos". (binfo_lang_slots): New. (make_node_stat): Add TREE_BINFO. (make_tree_binfo_stat): New. (tree_node_structure): Add TREE_BINFO. * tree.def (TREE_BINFO): New. * tree.h (REC_OR_UNION_CHECK): Rename to ... (RECORD_OR_UNION_CHECK): ... here. (NOT_RECORD_OR_UNION_CHECK): New. (TRE_VIA_VIRTUAL): Allow TREE_LIST or TREE_BINFO. (TYPE_FIELDS, TYPE_METHODS, TYPE_VFIELD): Adjust for RECORD_OR_UNION_CHECK. (TYPE_BINFO): Use RECORD_OR_UNION_CHECK. (TYPE_LANG_SLOT_1): New. (BINFO_TYPE, BINFO_OFFSET, BINFO_VTABLE, BINFO_VIRTUALS, BINFO_BASETYPES, TYPE_BINFO_BASETYPES, BINFO_VPTR_FIELD, BINFO_BASEACCESSES, BINFO_INHERITANCE_CHAIN): Adjust. (BINFO_ELTS): Remove. (BINFO_LANG_SLOT): New. (struct tree_binfo): New. (binfo_lang_slots): Declare. (enum tree_node_structure_enum): Add TS_BINFO. (union tree_node): Add binfo. (make_tree_binfo_stat): Declare. (make_tree_binfo): New. (enum tree_node_kind): Add binfo_kind. * cp/call.c (enforce_access): Expect TREE_BINFO. * cp/class.c (binfo_ctor_vtable): Check TREE_BINFO. * cp/cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove. (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF): Adjust. (BINFO_LANG_ELTS): Remove. (BINFO_LANG_SLOTS): New. (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1. (CLASSTYPE_TEMPLATE_INFO): Adjust. * cp/pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case. * cp/search.c (lookup_member): Check TREE_BINFO. * cp/semantics.c (perform_or_defer_access_check): Likewise. (check_accessibility_of_qualified_id): Check deferred_access_no_check. * cp/tree.c (make_binfo): Use make_tree_binfo. * java/class.c (make_class): Use make_tree_binfo. (set_super_info, add_interface_do): Likewise. * java/java-tree.h (CLASS_HAS_SUPER_FLAG): Expect a BINFO. * objc/objc-act.c (start_class, objc_declare_protocols, start_protocols): Use TYPE_LANG_SLOT_1. * objc/objc-act.h (CLASS_BINFO_ELTS, PROTOCOL_BINFO_ELTS): Rename to ... (CLASS_LANG_SLOT_ELTS, PROTOCOL_LANG_SLOT_ELTS): ... here. (CLASS_IVARS, CLASS_RAW_IVARS, CLASS_STATIC_TEMPLATE, CLASS_CATEGORY_LIST, CLASS_PROTOCOL_LIST, CLASS_OWN_IVARS, PROTOCOL_LIST, PROTOCOL_FORWARD_DECL): Use TYPE_LANG_SLOT_1. From-SVN: r84110
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog18
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/class.c2
-rw-r--r--gcc/cp/cp-tree.h20
-rw-r--r--gcc/cp/pt.c41
-rw-r--r--gcc/cp/search.c2
-rw-r--r--gcc/cp/semantics.c6
-rw-r--r--gcc/cp/tree.c4
8 files changed, 58 insertions, 37 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a15f152..f611cb3 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,21 @@
+2004-07-05 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (enforce_access): Expect TREE_BINFO.
+ * class.c (binfo_ctor_vtable): Check TREE_BINFO.
+ * cp-tree.h (RECORD_OR_UNION_TYPE_CHECK): Remove.
+ (BINFO_SUBVTT_INDEX, BINFO_VPTR_INDEX, BINFO_PRIMARY_BASE_OF):
+ Adjust.
+ (BINFO_LANG_ELTS): Remove.
+ (BINFO_LANG_SLOTS): New.
+ (TYPE_RAISES_EXCEPTIONS, ENUM_TEMPLATE_INFO): Use TYPE_LANG_SLOT_1.
+ (CLASSTYPE_TEMPLATE_INFO): Adjust.
+ * pt.c (tsubst): Split TREE_BINFO case from TREE_VEC case.
+ * search.c (lookup_member): Check TREE_BINFO.
+ * semantics.c (perform_or_defer_access_check): Likewise.
+ (check_accessibility_of_qualified_id): Check
+ deferred_access_no_check.
+ * tree.c (make_binfo): Use make_tree_binfo.
+
2004-07-04 Mark Mitchell <mark@codesourcery.com>
* method.c (implicitly_declare_fn): Set linkage of generated
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 76f0291..82355c29 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4049,7 +4049,7 @@ build_op_delete_call (enum tree_code code, tree addr, tree size,
bool
enforce_access (tree basetype_path, tree decl)
{
- my_friendly_assert (TREE_CODE (basetype_path) == TREE_VEC, 20030624);
+ my_friendly_assert (TREE_CODE (basetype_path) == TREE_BINFO, 20030624);
if (!accessible_p (basetype_path, decl))
{
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index fdf15e1..85f8864 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6873,7 +6873,7 @@ binfo_ctor_vtable (tree binfo)
vt = BINFO_VTABLE (binfo);
if (TREE_CODE (vt) == TREE_LIST)
vt = TREE_VALUE (vt);
- if (TREE_CODE (vt) == TREE_VEC)
+ if (TREE_CODE (vt) == TREE_BINFO)
binfo = vt;
else
break;
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 8dfe109..4ae4f44 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -119,7 +119,7 @@ struct diagnostic_context;
forth as a substitute for the mark bits provided in `lang_type'.
At present, only the six low-order bits are used.
- TYPE_BINFO
+ TYPE_LANG_SLOT_1
For an ENUMERAL_TYPE, this is ENUM_TEMPLATE_INFO.
For a FUNCTION_TYPE or METHOD_TYPE, this is TYPE_RAISES_EXCEPTIONS
@@ -169,9 +169,6 @@ struct diagnostic_context;
#define VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK(NODE) \
TREE_CHECK4(NODE,VAR_DECL,FUNCTION_DECL,TYPE_DECL,TEMPLATE_DECL)
-#define RECORD_OR_UNION_TYPE_CHECK(NODE) \
- TREE_CHECK2(NODE,RECORD_TYPE,UNION_TYPE)
-
#define BOUND_TEMPLATE_TEMPLATE_PARM_TYPE_CHECK(NODE) \
TREE_CHECK(NODE,BOUND_TEMPLATE_TEMPLATE_PARM)
@@ -1436,21 +1433,21 @@ struct lang_type GTY(())
/* The index in the VTT where this subobject's sub-VTT can be found.
NULL_TREE if there is no sub-VTT. */
-#define BINFO_SUBVTT_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 0)
+#define BINFO_SUBVTT_INDEX(NODE) BINFO_LANG_SLOT(NODE, 0)
/* The index in the VTT where the vptr for this subobject can be
found. NULL_TREE if there is no secondary vptr in the VTT. */
-#define BINFO_VPTR_INDEX(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 1)
+#define BINFO_VPTR_INDEX(NODE) BINFO_LANG_SLOT(NODE, 1)
/* The binfo of which NODE is a primary base. (This is different from
BINFO_INHERITANCE_CHAIN for virtual base because a virtual base is
sometimes a primary base for a class for which it is not an
immediate base.) */
-#define BINFO_PRIMARY_BASE_OF(NODE) TREE_VEC_ELT (NODE, BINFO_ELTS + 2)
+#define BINFO_PRIMARY_BASE_OF(NODE) BINFO_LANG_SLOT(NODE, 2)
/* C++ binfos have 3 additional entries. */
-#define BINFO_LANG_ELTS (BINFO_ELTS + 3)
+#define BINFO_LANG_SLOTS (3)
/* Nonzero if this binfo is for a dependent base - one that should not
be searched. */
@@ -1528,7 +1525,7 @@ struct lang_type GTY(())
this type can raise. Each TREE_VALUE is a _TYPE. The TREE_VALUE
will be NULL_TREE to indicate a throw specification of `()', or
no exceptions allowed. */
-#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_BINFO (NODE)
+#define TYPE_RAISES_EXCEPTIONS(NODE) TYPE_LANG_SLOT_1 (NODE)
/* For FUNCTION_TYPE or METHOD_TYPE, return 1 iff it is declared `throw()'. */
#define TYPE_NOTHROW_P(NODE) \
@@ -2087,13 +2084,14 @@ struct lang_decl GTY(())
/* Template information for a RECORD_TYPE or UNION_TYPE. */
#define CLASSTYPE_TEMPLATE_INFO(NODE) \
- (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_TYPE_CHECK (NODE))->template_info)
+ (LANG_TYPE_CLASS_CHECK (RECORD_OR_UNION_CHECK (NODE))->template_info)
/* Template information for an ENUMERAL_TYPE. Although an enumeration may
not be a primary template, it may be declared within the scope of a
primary template and the enumeration constants may depend on
non-type template parameters. */
-#define ENUM_TEMPLATE_INFO(NODE) (TYPE_BINFO (ENUMERAL_TYPE_CHECK (NODE)))
+#define ENUM_TEMPLATE_INFO(NODE) \
+ (TYPE_LANG_SLOT_1 (ENUMERAL_TYPE_CHECK (NODE)))
/* Template information for a template template parameter. */
#define TEMPLATE_TEMPLATE_PARM_TEMPLATE_INFO(NODE) \
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 88a77a5..ca52f65 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6877,29 +6877,30 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
return t;
return hash_tree_cons (purpose, value, chain);
}
- case TREE_VEC:
- if (type != NULL_TREE)
- {
- /* A binfo node. We always need to make a copy, of the node
- itself and of its BINFO_BASETYPES. */
-
- t = copy_node (t);
-
- /* Make sure type isn't a typedef copy. */
- type = BINFO_TYPE (TYPE_BINFO (type));
+
+ case TREE_BINFO:
+ /* A binfo node. We always need to make a copy, of the node
+ itself and of its BINFO_BASETYPES. */
+ my_friendly_assert (type, 20040628);
+
+ t = copy_node (t);
- TREE_TYPE (t) = complete_type (type);
- if (IS_AGGR_TYPE (type))
- {
- BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
- BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
- if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
- BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
- }
- return t;
+ /* Make sure type isn't a typedef copy. */
+ type = BINFO_TYPE (TYPE_BINFO (type));
+
+ TREE_TYPE (t) = complete_type (type);
+ if (IS_AGGR_TYPE (type))
+ {
+ BINFO_VTABLE (t) = TYPE_BINFO_VTABLE (type);
+ BINFO_VIRTUALS (t) = TYPE_BINFO_VIRTUALS (type);
+ if (TYPE_BINFO_BASETYPES (type) != NULL_TREE)
+ BINFO_BASETYPES (t) = copy_node (TYPE_BINFO_BASETYPES (type));
}
+ return t;
- /* Otherwise, a vector of template arguments. */
+ case TREE_VEC:
+ /* A vector of template arguments. */
+ my_friendly_assert (!type, 20040628);
return tsubst_template_args (t, args, complain, in_decl);
case POINTER_TYPE:
diff --git a/gcc/cp/search.c b/gcc/cp/search.c
index 4bf87a3..b28d7a2 100644
--- a/gcc/cp/search.c
+++ b/gcc/cp/search.c
@@ -1248,7 +1248,7 @@ lookup_member (tree xbasetype, tree name, int protect, bool want_type)
my_friendly_assert (TREE_CODE (name) == IDENTIFIER_NODE, 20030624);
- if (TREE_CODE (xbasetype) == TREE_VEC)
+ if (TREE_CODE (xbasetype) == TREE_BINFO)
{
type = BINFO_TYPE (xbasetype);
basetype_path = xbasetype;
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 5974a7a..15cd946 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -306,7 +306,7 @@ perform_or_defer_access_check (tree binfo, tree decl)
if (deferred_access_no_check)
return;
- my_friendly_assert (TREE_CODE (binfo) == TREE_VEC, 20030623);
+ my_friendly_assert (TREE_CODE (binfo) == TREE_BINFO, 20030623);
ptr = VEC_last (deferred_access, deferred_access_stack);
@@ -1337,6 +1337,10 @@ check_accessibility_of_qualified_id (tree decl,
{
tree scope;
tree qualifying_type = NULL_TREE;
+
+ /* If we're not checking, return imediately. */
+ if (deferred_access_no_check)
+ return;
/* Determine the SCOPE of DECL. */
scope = context_for_name_lookup (decl);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index deee9dc..c91164d 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -771,10 +771,10 @@ hash_chainon (tree list1, tree list2)
tree
make_binfo (tree offset, tree binfo, tree vtable, tree virtuals)
{
- tree new_binfo = make_tree_vec (BINFO_LANG_ELTS);
+ tree new_binfo = make_tree_binfo (BINFO_LANG_SLOTS);
tree type;
- if (TREE_CODE (binfo) == TREE_VEC)
+ if (TREE_CODE (binfo) == TREE_BINFO)
{
type = BINFO_TYPE (binfo);
BINFO_DEPENDENT_BASE_P (new_binfo) = BINFO_DEPENDENT_BASE_P (binfo);