aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1999-05-19 00:48:10 +0000
committerJason Merrill <jason@gcc.gnu.org>1999-05-18 20:48:10 -0400
commit829fd7e0f5033b32e00ad99a95c797cc72b4a6ea (patch)
treec5504a2824f51329807cdc105f88ee9ca8fb9e8f
parent965f45361ecb69fcd1fe43ae97b63609b0a1dc53 (diff)
downloadgcc-829fd7e0f5033b32e00ad99a95c797cc72b4a6ea.zip
gcc-829fd7e0f5033b32e00ad99a95c797cc72b4a6ea.tar.gz
gcc-829fd7e0f5033b32e00ad99a95c797cc72b4a6ea.tar.bz2
call.c (find_scoped_type, [...]): Lose.
* call.c (find_scoped_type, resolve_scope_to_name): Lose. * class.c (finish_struct_1): Use CLASS_TYPE_P. * ptree.c (print_lang_type): Likewise. * typeck.c (build_modify_expr, c_expand_asm_operands): Use IS_AGGR_TYPE_CODE. * typeck2.c (digest_init): Likewise. From-SVN: r27001
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/call.c125
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/ptree.c6
-rw-r--r--gcc/cp/typeck.c6
-rw-r--r--gcc/cp/typeck2.c2
6 files changed, 14 insertions, 137 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index d781f20..b2277da 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+1999-05-19 Jason Merrill <jason@yorick.cygnus.com>
+
+ * call.c (find_scoped_type, resolve_scope_to_name): Lose.
+ * class.c (finish_struct_1): Use CLASS_TYPE_P.
+ * ptree.c (print_lang_type): Likewise.
+ * typeck.c (build_modify_expr, c_expand_asm_operands): Use
+ IS_AGGR_TYPE_CODE.
+ * typeck2.c (digest_init): Likewise.
+
1999-05-18 Jason Merrill <jason@yorick.cygnus.com>
* call.c (joust): Compare the types of the conv ops, not the
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 7e7a969..e4b1a00 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -42,7 +42,6 @@ extern tree ctor_label, dtor_label;
static tree build_new_method_call PROTO((tree, tree, tree, tree, int));
static tree build_field_call PROTO((tree, tree, tree, tree));
-static tree find_scoped_type PROTO((tree, tree, tree));
static struct z_candidate * tourney PROTO((struct z_candidate *));
static int joust PROTO((struct z_candidate *, struct z_candidate *, int));
static int compare_ics PROTO((tree, tree));
@@ -164,130 +163,6 @@ build_field_call (basetype_path, instance_ptr, name, parms)
return NULL_TREE;
}
-static tree
-find_scoped_type (type, inner_name, inner_types)
- tree type, inner_name, inner_types;
-{
- tree tags = CLASSTYPE_TAGS (type);
-
- while (tags)
- {
- /* The TREE_PURPOSE of an enum tag (which becomes a member of the
- enclosing class) is set to the name for the enum type. So, if
- inner_name is `bar', and we strike `baz' for `enum bar { baz }',
- then this test will be true. */
- if (TREE_PURPOSE (tags) == inner_name)
- {
- if (inner_types == NULL_TREE)
- return TYPE_MAIN_DECL (TREE_VALUE (tags));
- return resolve_scope_to_name (TREE_VALUE (tags), inner_types);
- }
- tags = TREE_CHAIN (tags);
- }
-
- /* Look for a TYPE_DECL. */
- for (tags = TYPE_FIELDS (type); tags; tags = TREE_CHAIN (tags))
- if (TREE_CODE (tags) == TYPE_DECL && DECL_NAME (tags) == inner_name)
- {
- /* Code by raeburn. */
- if (inner_types == NULL_TREE)
- return tags;
- return resolve_scope_to_name (TREE_TYPE (tags), inner_types);
- }
-
- return NULL_TREE;
-}
-
-/* Resolve an expression NAME1::NAME2::...::NAMEn to
- the name that names the above nested type. INNER_TYPES
- is a chain of nested type names (held together by SCOPE_REFs);
- OUTER_TYPE is the type we know to enclose INNER_TYPES.
- Returns NULL_TREE if there is an error. */
-
-tree
-resolve_scope_to_name (outer_type, inner_stuff)
- tree outer_type, inner_stuff;
-{
- register tree tmp;
- tree inner_name, inner_type;
-
- if (outer_type == NULL_TREE && current_class_type != NULL_TREE)
- {
- /* We first try to look for a nesting in our current class context,
- then try any enclosing classes. */
- tree type = current_class_type;
-
- while (type && (TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE))
- {
- tree rval = resolve_scope_to_name (type, inner_stuff);
-
- if (rval != NULL_TREE)
- return rval;
- type = DECL_CONTEXT (TYPE_MAIN_DECL (type));
- }
- }
-
- if (TREE_CODE (inner_stuff) == SCOPE_REF)
- {
- inner_name = TREE_OPERAND (inner_stuff, 0);
- inner_type = TREE_OPERAND (inner_stuff, 1);
- }
- else
- {
- inner_name = inner_stuff;
- inner_type = NULL_TREE;
- }
-
- if (outer_type == NULL_TREE)
- {
- tree x;
- /* If we have something that's already a type by itself,
- use that. */
- if (IDENTIFIER_HAS_TYPE_VALUE (inner_name))
- {
- if (inner_type)
- return resolve_scope_to_name (IDENTIFIER_TYPE_VALUE (inner_name),
- inner_type);
- return inner_name;
- }
-
- x = lookup_name (inner_name, 0);
-
- if (x && TREE_CODE (x) == NAMESPACE_DECL)
- {
- x = lookup_namespace_name (x, inner_type);
- return x;
- }
- return NULL_TREE;
- }
-
- if (! IS_AGGR_TYPE (outer_type))
- return NULL_TREE;
-
- /* Look for member classes or enums. */
- tmp = find_scoped_type (outer_type, inner_name, inner_type);
-
- /* If it's not a type in this class, then go down into the
- base classes and search there. */
- if (! tmp && TYPE_BINFO (outer_type))
- {
- tree binfos = TYPE_BINFO_BASETYPES (outer_type);
- int i, n_baselinks = binfos ? TREE_VEC_LENGTH (binfos) : 0;
-
- for (i = 0; i < n_baselinks; i++)
- {
- tree base_binfo = TREE_VEC_ELT (binfos, i);
- tmp = resolve_scope_to_name (BINFO_TYPE (base_binfo), inner_stuff);
- if (tmp)
- return tmp;
- }
- tmp = NULL_TREE;
- }
-
- return tmp;
-}
-
/* Returns nonzero iff the destructor name specified in NAME
(a BIT_NOT_EXPR) matches BASETYPE. The operand of NAME can take many
forms... */
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f7998c1..00f9d32 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -3526,8 +3526,7 @@ finish_struct_1 (t, warn_anon)
while (TREE_CODE (type) == ARRAY_TYPE)
type = TREE_TYPE (type);
- if (TYPE_LANG_SPECIFIC (type) && ! ANON_UNION_P (x)
- && ! TYPE_PTRMEMFUNC_P (type))
+ if (CLASS_TYPE_P (type))
{
/* Never let anything with uninheritable virtuals
make it through without complaint. */
diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c
index 1f17aec..502c1f0 100644
--- a/gcc/cp/ptree.c
+++ b/gcc/cp/ptree.c
@@ -79,11 +79,7 @@ print_lang_type (file, node, indent)
return;
}
- if (! (TREE_CODE (node) == RECORD_TYPE
- || TREE_CODE (node) == UNION_TYPE))
- return;
-
- if (!TYPE_LANG_SPECIFIC (node))
+ if (! CLASS_TYPE_P (node))
return;
indent_to (file, indent + 3);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 4822dbd..a6d08be 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6116,8 +6116,7 @@ build_modify_expr (lhs, modifycode, rhs)
/* Functions are not modifiable, even though they are
lvalues. */
|| TREE_CODE (TREE_TYPE (lhs)) == FUNCTION_TYPE
- || ((TREE_CODE (lhstype) == RECORD_TYPE
- || TREE_CODE (lhstype) == UNION_TYPE)
+ || (IS_AGGR_TYPE_CODE (TREE_CODE (lhstype))
&& C_TYPE_FIELDS_READONLY (lhstype))
|| (TREE_CODE (lhstype) == REFERENCE_TYPE
&& CP_TYPE_CONST_P (TREE_TYPE (lhstype)))))
@@ -7268,8 +7267,7 @@ c_expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
{
tree type = TREE_TYPE (o[i]);
if (CP_TYPE_CONST_P (type)
- || ((TREE_CODE (type) == RECORD_TYPE
- || TREE_CODE (type) == UNION_TYPE)
+ || (IS_AGGR_TYPE_CODE (TREE_CODE (type))
&& C_TYPE_FIELDS_READONLY (type)))
readonly_error (o[i], "modification by `asm'", 1);
}
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 76a30b2..971b388 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -835,7 +835,7 @@ digest_init (type, init, tail)
return error_mark_node;
}
- if (code == ARRAY_TYPE || code == RECORD_TYPE || code == UNION_TYPE)
+ if (code == ARRAY_TYPE || IS_AGGR_TYPE_CODE (code))
{
if (raw_constructor && TYPE_NON_AGGREGATE_CLASS (type))
{