This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Generalize use of DECL_P adn TYPE_P macros
- Subject: Re: PATCH: Generalize use of DECL_P adn TYPE_P macros
- From: Theodore Papadopoulo <Theodore dot Papadopoulo at sophia dot inria dot fr>
- Date: Mon, 20 Mar 2000 20:01:07 +0100
- cc: gcc-patches at gcc dot gnu dot org
[Oups, two typo corrections in the files gengenrtl.c cp/search.c erroneously
slipped in. Here is the real patch (without the typo corrections that
I can submit later). Sorry for the confusion. ]
This patch looks huge but is just a replacement of TREE_CODE_CLASS(TREE_CODE(X)) == 'd'
with DECL_P(X) and TREE_CODE_CLASS(TREE_CODE(X)) == 't' with TYPE_P(X)
across the gcc and g++ directories. I have been careful to handle !=
correctly (triple checked but one more look at it is certainly good).
Compared with http://gcc.gnu.org/ml/gcc-testresults/2000-03/msg00137.html there are no regressions
(actually some failures disappeared but I doubt it comes from this patch).
Theo.
gcc/ChangeLog:
2000-03-20 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
* builtin.c (get_pointer_alignment): Use DECL_P and TYPE_P macros.
* c-common.c (decl_attributes,check_format_info,truthvalue_conversion,
c_get_alias_set): Likewise.
* c-decl.c (duplicate_decls): Likewise.
* c-typeck.c (default_conversion,build_unary_op): Likewise.
* calls.c (initialize_argument_information): Likewise.
* dwarf2out.c (decl_class_context,add_abstract_origin_attribute): Likewise.
* dwarfout.c (decl_class_context,output_type): Likewise.
* expr.c (get_inner_reference): Likewise.
* fold-const.c (simple_operand_p,fold): Likewise.
* function.c (aggregate_value_p): Likewise.
* stmt.c (expand_asm_operands): Likewise.
* varasm.c (named_section): Likewise.
gcc/cp/ChangeLog:
* call.c (check_dtor_name,build_new_method_call): Likewise.
* decl.c (push_class_binding,poplevel,pushtag,lookup_namespace_name,
make_typename_type,check_initializer,cp_finish_decl,xref_tag): Likewise.
* decl2.c (grokfield,build_expr_from_tree,build_expr_from_tree,
decl_namespace,arg_assoc_template_arg,arg_assoc,
validate_nonmember_using_decl,do_class_using_decl): Likewise.
* error.c (dump_template_argument,dump_expr,cp_file_of,cp_line_of,
args_to_string): Likewise.
* friend.c (is_friend): Likewise.
* lex.c (note_got_semicolon,note_list_got_semicolon,is_global): Likewise.
* method.c (build_overload_nested_name,build_overload_value,
build_qualified_name,build_qualified_name,hack_identifier): Likewise.
* parse.y (typename_sub,typename_sub1): Likewise.
* pt.c (push_inline_template_parms_recursive,check_template_shadow,
process_partial_specialization,convert_template_argument,
template_args_equal,add_pending_template,lookup_template_class,
for_each_template_parm_r,maybe_fold_nontype_arg,
tsubst,instantiate_template,type_unification_real,unify,
instantiate_pending_templates,set_mangled_name_for_template_decl): Likewise.
* repo.c (repo_get_id,repo_template_used): Likewise.
* search.c (lookup_field_1): Likewise.
* tree.c (walk_tree,get_type_decl,cp_tree_equal,member_p): Likewise.
* xref.c (classname): Likewise.
Index: gcc/builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.36
diff -c -3 -p -r1.36 builtins.c
*** builtins.c 2000/03/11 00:30:06 1.36
--- builtins.c 2000/03/20 14:50:14
*************** get_pointer_alignment (exp, max_align)
*** 171,177 ****
exp = TREE_OPERAND (exp, 0);
if (TREE_CODE (exp) == FUNCTION_DECL)
align = FUNCTION_BOUNDARY;
! else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
align = DECL_ALIGN (exp);
#ifdef CONSTANT_ALIGNMENT
else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
--- 171,177 ----
exp = TREE_OPERAND (exp, 0);
if (TREE_CODE (exp) == FUNCTION_DECL)
align = FUNCTION_BOUNDARY;
! else if (DECL_P (exp))
align = DECL_ALIGN (exp);
#ifdef CONSTANT_ALIGNMENT
else if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c')
Index: gcc/c-common.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-common.c,v
retrieving revision 1.97
diff -c -3 -p -r1.97 c-common.c
*** c-common.c 2000/03/08 11:21:26 1.97
--- c-common.c 2000/03/20 14:50:20
*************** decl_attributes (node, attributes, prefi
*** 494,506 ****
if (attrtab_idx == 0)
init_attributes ();
! if (TREE_CODE_CLASS (TREE_CODE (node)) == 'd')
{
decl = node;
type = TREE_TYPE (decl);
is_type = TREE_CODE (node) == TYPE_DECL;
}
! else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't')
type = node, is_type = 1;
#ifdef PRAGMA_INSERT_ATTRIBUTES
--- 494,506 ----
if (attrtab_idx == 0)
init_attributes ();
! if (DECL_P (node))
{
decl = node;
type = TREE_TYPE (decl);
is_type = TREE_CODE (node) == TYPE_DECL;
}
! else if (TYPE_P (node))
type = node, is_type = 1;
#ifdef PRAGMA_INSERT_ATTRIBUTES
*************** check_format_info (info, params)
*** 1954,1961 ****
&& (TYPE_READONLY (cur_type)
|| (cur_param != 0
&& (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c'
! || (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'd'
! && TREE_READONLY (cur_param))))))
warning ("writing into constant object (arg %d)", arg_num);
/* Check the type of the "real" argument, if there's a type we want. */
--- 1954,1960 ----
&& (TYPE_READONLY (cur_type)
|| (cur_param != 0
&& (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c'
! || (DECL_P (cur_param) && TREE_READONLY (cur_param))))))
warning ("writing into constant object (arg %d)", arg_num);
/* Check the type of the "real" argument, if there's a type we want. */
*************** truthvalue_conversion (expr)
*** 2882,2888 ****
case ADDR_EXPR:
/* If we are taking the address of a external decl, it might be zero
if it is weak, so we cannot optimize. */
! if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (expr, 0))) == 'd'
&& DECL_EXTERNAL (TREE_OPERAND (expr, 0)))
break;
--- 2881,2887 ----
case ADDR_EXPR:
/* If we are taking the address of a external decl, it might be zero
if it is weak, so we cannot optimize. */
! if (DECL_P (TREE_OPERAND (expr, 0))
&& DECL_EXTERNAL (TREE_OPERAND (expr, 0)))
break;
*************** c_get_alias_set (t)
*** 3315,3322 ****
if (t == error_mark_node)
return 0;
! type = (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
! ? t : TREE_TYPE (t);
if (type == error_mark_node)
return 0;
--- 3314,3320 ----
if (t == error_mark_node)
return 0;
! type = (TYPE_P (t)) ? t : TREE_TYPE (t);
if (type == error_mark_node)
return 0;
Index: gcc/c-decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-decl.c,v
retrieving revision 1.102
diff -c -3 -p -r1.102 c-decl.c
*** c-decl.c 2000/03/08 11:21:26 1.102
--- c-decl.c 2000/03/20 14:50:30
*************** duplicate_decls (newdecl, olddecl, diffe
*** 1380,1386 ****
tree newtype = TREE_TYPE (newdecl);
int errmsg = 0;
! if (TREE_CODE_CLASS (TREE_CODE (olddecl)) == 'd')
DECL_MACHINE_ATTRIBUTES (newdecl)
= merge_machine_decl_attributes (olddecl, newdecl);
--- 1380,1386 ----
tree newtype = TREE_TYPE (newdecl);
int errmsg = 0;
! if (DECL_P (olddecl))
DECL_MACHINE_ATTRIBUTES (newdecl)
= merge_machine_decl_attributes (olddecl, newdecl);
Index: gcc/c-typeck.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/c-typeck.c,v
retrieving revision 1.57
diff -c -3 -p -r1.57 c-typeck.c
*** c-typeck.c 2000/03/17 17:31:53 1.57
--- c-typeck.c 2000/03/20 14:50:37
*************** default_conversion (exp)
*** 951,958 ****
int constp = 0;
int volatilep = 0;
! if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r'
! || TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
{
constp = TREE_READONLY (exp);
volatilep = TREE_THIS_VOLATILE (exp);
--- 951,957 ----
int constp = 0;
int volatilep = 0;
! if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'r' || DECL_P (exp))
{
constp = TREE_READONLY (exp);
volatilep = TREE_THIS_VOLATILE (exp);
*************** build_unary_op (code, xarg, noconvert)
*** 2988,2995 ****
to which the address will point. Note that you can't get a
restricted pointer by taking the address of something, so we
only have to deal with `const' and `volatile' here. */
! if (TREE_CODE_CLASS (TREE_CODE (arg)) == 'd'
! || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
{
if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
argtype = c_build_type_variant (argtype,
--- 2987,2993 ----
to which the address will point. Note that you can't get a
restricted pointer by taking the address of something, so we
only have to deal with `const' and `volatile' here. */
! if (DECL_P (arg) || TREE_CODE_CLASS (TREE_CODE (arg)) == 'r')
{
if (TREE_READONLY (arg) || TREE_THIS_VOLATILE (arg))
argtype = c_build_type_variant (argtype,
Index: gcc/calls.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/calls.c,v
retrieving revision 1.97
diff -c -3 -p -r1.97 calls.c
*** calls.c 2000/03/17 22:40:43 1.97
--- calls.c 2000/03/20 14:50:43
*************** initialize_argument_information (num_act
*** 1083,1091 ****
make a bitwise copy of the argument. */
if (TREE_CODE (args[i].tree_value) == TARGET_EXPR
! && (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND
! (args[i].tree_value, 1)))
! == 'd')
&& ! REG_P (DECL_RTL (TREE_OPERAND (args[i].tree_value, 1))))
args[i].tree_value = TREE_OPERAND (args[i].tree_value, 1);
--- 1083,1089 ----
make a bitwise copy of the argument. */
if (TREE_CODE (args[i].tree_value) == TARGET_EXPR
! && (DECL_P (TREE_OPERAND (args[i].tree_value, 1)))
&& ! REG_P (DECL_RTL (TREE_OPERAND (args[i].tree_value, 1))))
args[i].tree_value = TREE_OPERAND (args[i].tree_value, 1);
Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.163
diff -c -3 -p -r1.163 dwarf2out.c
*** dwarf2out.c 2000/03/18 19:59:34 1.163
--- dwarf2out.c 2000/03/20 14:50:58
*************** decl_class_context (decl)
*** 3476,3482 ****
context = TYPE_MAIN_VARIANT
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
! if (context && TREE_CODE_CLASS (TREE_CODE (context)) != 't')
context = NULL_TREE;
return context;
--- 3476,3482 ----
context = TYPE_MAIN_VARIANT
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
! if (context && !TYPE_P (context))
context = NULL_TREE;
return context;
*************** add_abstract_origin_attribute (die, orig
*** 7395,7403 ****
gen_abstract_function (fn);
}
! if (TREE_CODE_CLASS (TREE_CODE (origin)) == 'd')
origin_die = lookup_decl_die (origin);
! else if (TREE_CODE_CLASS (TREE_CODE (origin)) == 't')
origin_die = lookup_type_die (origin);
if (origin_die == NULL)
--- 7395,7403 ----
gen_abstract_function (fn);
}
! if (DECL_P (origin))
origin_die = lookup_decl_die (origin);
! else if (TYPE_P (origin))
origin_die = lookup_type_die (origin);
if (origin_die == NULL)
Index: gcc/dwarfout.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarfout.c,v
retrieving revision 1.61
diff -c -3 -p -r1.61 dwarfout.c
*** dwarfout.c 2000/03/17 17:31:53 1.61
--- dwarfout.c 2000/03/20 14:51:04
*************** decl_class_context (decl)
*** 1217,1223 ****
context = TYPE_MAIN_VARIANT
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
! if (context && TREE_CODE_CLASS (TREE_CODE (context)) != 't')
context = NULL_TREE;
return context;
--- 1217,1223 ----
context = TYPE_MAIN_VARIANT
(TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
! if (context && !TYPE_P (context))
context = NULL_TREE;
return context;
*************** output_type (type, containing_scope)
*** 4286,4292 ****
written out yet, writing it out will cover this one, too. */
if (TYPE_CONTEXT (type)
! && TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
&& ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
{
output_type (TYPE_CONTEXT (type), containing_scope);
--- 4286,4292 ----
written out yet, writing it out will cover this one, too. */
if (TYPE_CONTEXT (type)
! && TYPE_P (TYPE_CONTEXT (type))
&& ! TREE_ASM_WRITTEN (TYPE_CONTEXT (type)))
{
output_type (TYPE_CONTEXT (type), containing_scope);
Index: gcc/expr.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/expr.c,v
retrieving revision 1.216
diff -c -3 -p -r1.216 expr.c
*** expr.c 2000/03/19 05:13:15 1.216
--- expr.c 2000/03/20 14:51:14
*************** get_inner_reference (exp, pbitsize, pbit
*** 5094,5100 ****
exp = TREE_OPERAND (exp, 0);
}
! if (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd')
alignment = MIN (alignment, DECL_ALIGN (exp));
else if (TREE_TYPE (exp) != 0)
alignment = MIN (alignment, TYPE_ALIGN (TREE_TYPE (exp)));
--- 5094,5100 ----
exp = TREE_OPERAND (exp, 0);
}
! if (DECL_P (exp))
alignment = MIN (alignment, DECL_ALIGN (exp));
else if (TREE_TYPE (exp) != 0)
alignment = MIN (alignment, TYPE_ALIGN (TREE_TYPE (exp)));
Index: gcc/fold-const.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/fold-const.c,v
retrieving revision 1.110
diff -c -3 -p -r1.110 fold-const.c
*** fold-const.c 2000/03/19 11:37:39 1.110
--- fold-const.c 2000/03/20 14:51:20
*************** simple_operand_p (exp)
*** 3181,3187 ****
exp = TREE_OPERAND (exp, 0);
return (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
! || (TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
&& ! TREE_ADDRESSABLE (exp)
&& ! TREE_THIS_VOLATILE (exp)
&& ! DECL_NONLOCAL (exp)
--- 3181,3187 ----
exp = TREE_OPERAND (exp, 0);
return (TREE_CODE_CLASS (TREE_CODE (exp)) == 'c'
! || (DECL_P (exp)
&& ! TREE_ADDRESSABLE (exp)
&& ! TREE_THIS_VOLATILE (exp)
&& ! DECL_NONLOCAL (exp)
*************** fold (expr)
*** 6968,6977 ****
/* If the second operand is simpler than the third, swap them
since that produces better jump optimization results. */
! if ((TREE_CONSTANT (arg1) || TREE_CODE_CLASS (TREE_CODE (arg1)) == 'd'
|| TREE_CODE (arg1) == SAVE_EXPR)
&& ! (TREE_CONSTANT (TREE_OPERAND (t, 2))
! || TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 2))) == 'd'
|| TREE_CODE (TREE_OPERAND (t, 2)) == SAVE_EXPR))
{
/* See if this can be inverted. If it can't, possibly because
--- 6968,6977 ----
/* If the second operand is simpler than the third, swap them
since that produces better jump optimization results. */
! if ((TREE_CONSTANT (arg1) || DECL_P (arg1)
|| TREE_CODE (arg1) == SAVE_EXPR)
&& ! (TREE_CONSTANT (TREE_OPERAND (t, 2))
! || DECL_P (TREE_OPERAND (t, 2))
|| TREE_CODE (TREE_OPERAND (t, 2)) == SAVE_EXPR))
{
/* See if this can be inverted. If it can't, possibly because
Index: gcc/function.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/function.c,v
retrieving revision 1.178
diff -c -3 -p -r1.178 function.c
*** function.c 2000/03/19 18:25:24 1.178
--- function.c 2000/03/20 14:51:24
*************** aggregate_value_p (exp)
*** 4013,4023 ****
{
int i, regno, nregs;
rtx reg;
! tree type;
! if (TREE_CODE_CLASS (TREE_CODE (exp)) == 't')
! type = exp;
! else
! type = TREE_TYPE (exp);
if (RETURN_IN_MEMORY (type))
return 1;
--- 4013,4020 ----
{
int i, regno, nregs;
rtx reg;
!
! tree type = (TYPE_P (exp)) ? exp : TREE_TYPE (exp);
if (RETURN_IN_MEMORY (type))
return 1;
Index: gcc/stmt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/stmt.c,v
retrieving revision 1.130
diff -c -3 -p -r1.130 stmt.c
*** stmt.c 2000/03/19 05:26:48 1.130
--- stmt.c 2000/03/20 14:51:27
*************** expand_asm_operands (string, outputs, in
*** 1514,1520 ****
real_output_rtx[i] = NULL_RTX;
if ((TREE_CODE (val) == INDIRECT_REF
&& allows_mem)
! || (TREE_CODE_CLASS (TREE_CODE (val)) == 'd'
&& (allows_mem || GET_CODE (DECL_RTL (val)) == REG)
&& ! (GET_CODE (DECL_RTL (val)) == REG
&& GET_MODE (DECL_RTL (val)) != TYPE_MODE (type)))
--- 1514,1520 ----
real_output_rtx[i] = NULL_RTX;
if ((TREE_CODE (val) == INDIRECT_REF
&& allows_mem)
! || (DECL_P (val)
&& (allows_mem || GET_CODE (DECL_RTL (val)) == REG)
&& ! (GET_CODE (DECL_RTL (val)) == REG
&& GET_MODE (DECL_RTL (val)) != TYPE_MODE (type)))
*************** warn_if_unused_value (exp)
*** 1990,1996 ****
default:
/* Referencing a volatile value is a side effect, so don't warn. */
! if ((TREE_CODE_CLASS (TREE_CODE (exp)) == 'd'
|| TREE_CODE_CLASS (TREE_CODE (exp)) == 'r')
&& TREE_THIS_VOLATILE (exp))
return 0;
--- 1990,1996 ----
default:
/* Referencing a volatile value is a side effect, so don't warn. */
! if ((DECL_P (exp)
|| TREE_CODE_CLASS (TREE_CODE (exp)) == 'r')
&& TREE_THIS_VOLATILE (exp))
return 0;
Index: gcc/varasm.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.108
diff -c -3 -p -r1.108 varasm.c
*** varasm.c 2000/03/17 17:31:54 1.108
--- varasm.c 2000/03/20 14:51:31
*************** named_section (decl, name, reloc)
*** 301,308 ****
const char *name;
int reloc ATTRIBUTE_UNUSED;
{
! if (decl != NULL_TREE
! && TREE_CODE_CLASS (TREE_CODE (decl)) != 'd')
abort ();
if (name == NULL)
name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
--- 301,307 ----
const char *name;
int reloc ATTRIBUTE_UNUSED;
{
! if (decl != NULL_TREE && !DECL_P (decl))
abort ();
if (name == NULL)
name = TREE_STRING_POINTER (DECL_SECTION_NAME (decl));
*************** assemble_external (decl)
*** 1727,1734 ****
tree decl ATTRIBUTE_UNUSED;
{
#ifdef ASM_OUTPUT_EXTERNAL
! if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd'
! && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
{
rtx rtl = DECL_RTL (decl);
--- 1726,1732 ----
tree decl ATTRIBUTE_UNUSED;
{
#ifdef ASM_OUTPUT_EXTERNAL
! if (DECL_P (decl) && DECL_EXTERNAL (decl) && TREE_PUBLIC (decl))
{
rtx rtl = DECL_RTL (decl);
Index: gcc/cp/call.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/call.c,v
retrieving revision 1.203
diff -c -3 -p -r1.203 call.c
*** call.c 2000/03/10 09:25:44 1.203
--- call.c 2000/03/20 14:51:39
*************** check_dtor_name (basetype, name)
*** 189,195 ****
if (TREE_CODE (name) == TYPE_DECL)
name = TREE_TYPE (name);
! else if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
--- 189,195 ----
if (TREE_CODE (name) == TYPE_DECL)
name = TREE_TYPE (name);
! else if (TYPE_P (name))
/* OK */;
else if (TREE_CODE (name) == IDENTIFIER_NODE)
{
*************** build_new_method_call (instance, name, a
*** 4192,4198 ****
{
explicit_targs = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
! if (TREE_CODE_CLASS (TREE_CODE (name)) == 'd')
name = DECL_NAME (name);
else
{
--- 4192,4198 ----
{
explicit_targs = TREE_OPERAND (name, 1);
name = TREE_OPERAND (name, 0);
! if (DECL_P (name))
name = DECL_NAME (name);
else
{
Index: gcc/cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.571
diff -c -3 -p -r1.571 decl.c
*** decl.c 2000/03/17 17:31:56 1.571
--- decl.c 2000/03/20 14:52:22
*************** push_class_binding (id, decl)
*** 1127,1134 ****
context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
else
{
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd',
! 0);
context = CP_DECL_CONTEXT (decl);
}
--- 1127,1133 ----
context = CP_DECL_CONTEXT (OVL_CURRENT (decl));
else
{
! my_friendly_assert (DECL_P (decl), 0);
context = CP_DECL_CONTEXT (decl);
}
*************** poplevel (keep, reverse, functionbody)
*** 1452,1458 ****
decl = link;
if (TREE_CODE (decl) == TREE_LIST)
decl = TREE_VALUE (decl);
! if (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd')
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl);
--- 1451,1457 ----
decl = link;
if (TREE_CODE (decl) == TREE_LIST)
decl = TREE_VALUE (decl);
! if (DECL_P (decl))
pop_binding (DECL_NAME (decl), decl);
else if (TREE_CODE (decl) == OVERLOAD)
pop_binding (DECL_NAME (OVL_FUNCTION (decl)), decl);
*************** pushtag (name, type, globalize)
*** 2787,2794 ****
if (! globalize)
context = cs;
! else if (cs != NULL_TREE
! && TREE_CODE_CLASS (TREE_CODE (cs)) == 't')
/* When declaring a friend class of a local class, we want
to inject the newly named class into the scope
containing the local class, not the namespace scope. */
--- 2786,2792 ----
if (! globalize)
context = cs;
! else if (cs != NULL_TREE && TYPE_P (cs))
/* When declaring a friend class of a local class, we want
to inject the newly named class into the scope
containing the local class, not the namespace scope. */
*************** lookup_namespace_name (namespace, name)
*** 5228,5234 ****
name = TREE_OPERAND (name, 0);
if (TREE_CODE (name) == OVERLOAD)
name = DECL_NAME (OVL_CURRENT (name));
! else if (TREE_CODE_CLASS (TREE_CODE (name)) == 'd')
name = DECL_NAME (name);
}
--- 5226,5232 ----
name = TREE_OPERAND (name, 0);
if (TREE_CODE (name) == OVERLOAD)
name = DECL_NAME (OVL_CURRENT (name));
! else if (DECL_P (name))
name = DECL_NAME (name);
}
*************** make_typename_type (context, name, compl
*** 5378,5384 ****
{
tree fullname;
! if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
{
if (!(TYPE_LANG_SPECIFIC (name)
&& (CLASSTYPE_IS_TEMPLATE (name)
--- 5376,5382 ----
{
tree fullname;
! if (TYPE_P (name))
{
if (!(TYPE_LANG_SPECIFIC (name)
&& (CLASSTYPE_IS_TEMPLATE (name)
*************** check_initializer (decl, init)
*** 7541,7547 ****
}
else if (DECL_EXTERNAL (decl))
;
! else if (TREE_CODE_CLASS (TREE_CODE (type)) == 't'
&& (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type)))
{
tree core_type = strip_array_types (type);
--- 7539,7545 ----
}
else if (DECL_EXTERNAL (decl))
;
! else if (TYPE_P (type)
&& (IS_AGGR_TYPE (type) || TYPE_NEEDS_CONSTRUCTING (type)))
{
tree core_type = strip_array_types (type);
*************** cp_finish_decl (decl, init, asmspec_tree
*** 8043,8049 ****
{
tree context = CP_DECL_CONTEXT (decl);
if (context
! && TREE_CODE_CLASS (TREE_CODE (context)) == 't'
&& (TREE_CODE (decl) == VAR_DECL
/* We also have a pushclass done that we need to undo here
if we're at top level and declare a method. */
--- 8041,8047 ----
{
tree context = CP_DECL_CONTEXT (decl);
if (context
! && TYPE_P (context)
&& (TREE_CODE (decl) == VAR_DECL
/* We also have a pushclass done that we need to undo here
if we're at top level and declare a method. */
*************** xref_tag (code_type_node, name, globaliz
*** 12369,12375 ****
/* If a cross reference is requested, look up the type
already defined for this tag and return it. */
! if (TREE_CODE_CLASS (TREE_CODE (name)) == 't')
{
t = name;
name = TYPE_IDENTIFIER (t);
--- 12367,12373 ----
/* If a cross reference is requested, look up the type
already defined for this tag and return it. */
! if (TYPE_P (name))
{
t = name;
name = TYPE_IDENTIFIER (t);
Index: gcc/cp/decl2.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl2.c,v
retrieving revision 1.319
diff -c -3 -p -r1.319 decl2.c
*** decl2.c 2000/03/16 10:13:28 1.319
--- decl2.c 2000/03/20 14:52:29
*************** grokfield (declarator, declspecs, init,
*** 1676,1683 ****
static, since references are initialized with the address. */
if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
|| (TREE_STATIC (init) == 0
! && (TREE_CODE_CLASS (TREE_CODE (init)) != 'd'
! || DECL_EXTERNAL (init) == 0)))
{
error ("field initializer is not constant");
init = error_mark_node;
--- 1676,1682 ----
static, since references are initialized with the address. */
if (TREE_CODE (TREE_TYPE (value)) != REFERENCE_TYPE
|| (TREE_STATIC (init) == 0
! && (!DECL_P (init) || DECL_EXTERNAL (init) == 0)))
{
error ("field initializer is not constant");
init = error_mark_node;
*************** build_expr_from_tree (t)
*** 3878,3884 ****
case ALIGNOF_EXPR:
{
tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
! if (TREE_CODE_CLASS (TREE_CODE (r)) != 't')
r = TREE_TYPE (r);
return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
}
--- 3877,3883 ----
case ALIGNOF_EXPR:
{
tree r = build_expr_from_tree (TREE_OPERAND (t, 0));
! if (!TYPE_P (r))
r = TREE_TYPE (r);
return TREE_CODE (t) == SIZEOF_EXPR ? c_sizeof (r) : c_alignof (r);
}
*************** build_expr_from_tree (t)
*** 4046,4052 ****
}
case TYPEID_EXPR:
! if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
return get_typeid (TREE_OPERAND (t, 0));
return build_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
--- 4045,4051 ----
}
case TYPEID_EXPR:
! if (TYPE_P (TREE_OPERAND (t, 0)))
return get_typeid (TREE_OPERAND (t, 0));
return build_typeid (build_expr_from_tree (TREE_OPERAND (t, 0)));
*************** decl_namespace (decl)
*** 4473,4481 ****
decl = DECL_CONTEXT (decl);
if (TREE_CODE (decl) == NAMESPACE_DECL)
return decl;
! if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
decl = TYPE_STUB_DECL (decl);
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 390);
}
return global_namespace;
--- 4472,4480 ----
decl = DECL_CONTEXT (decl);
if (TREE_CODE (decl) == NAMESPACE_DECL)
return decl;
! if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl);
! my_friendly_assert (DECL_P (decl), 390);
}
return global_namespace;
*************** arg_assoc_template_arg (k, arg)
*** 4656,4662 ****
}
/* It's not a template template argument, but it is a type template
argument. */
! else if (TREE_CODE_CLASS (TREE_CODE (arg)) == 't')
return arg_assoc_type (k, arg);
/* It's a non-type template argument. */
else
--- 4655,4661 ----
}
/* It's not a template template argument, but it is a type template
argument. */
! else if (TYPE_P (arg))
return arg_assoc_type (k, arg);
/* It's a non-type template argument. */
else
*************** arg_assoc (k, n)
*** 4794,4800 ****
if (n == error_mark_node)
return 0;
! if (TREE_CODE_CLASS (TREE_CODE (n)) == 't')
return arg_assoc_type (k, n);
if (! type_unknown_p (n))
--- 4793,4799 ----
if (n == error_mark_node)
return 0;
! if (TYPE_P (n))
return arg_assoc_type (k, n);
if (! type_unknown_p (n))
*************** validate_nonmember_using_decl (decl, sco
*** 4959,4965 ****
}
else
my_friendly_abort (382);
! if (TREE_CODE_CLASS (TREE_CODE (*name)) == 'd')
*name = DECL_NAME (*name);
/* Make a USING_DECL. */
return push_using_decl (*scope, *name);
--- 4958,4964 ----
}
else
my_friendly_abort (382);
! if (DECL_P (*name))
*name = DECL_NAME (*name);
/* Make a USING_DECL. */
return push_using_decl (*scope, *name);
*************** do_class_using_decl (decl)
*** 5136,5142 ****
tree name, value;
if (TREE_CODE (decl) != SCOPE_REF
! || TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (decl, 0))) != 't')
{
cp_error ("using-declaration for non-member at class scope");
return NULL_TREE;
--- 5135,5141 ----
tree name, value;
if (TREE_CODE (decl) != SCOPE_REF
! || !TYPE_P (TREE_OPERAND (decl, 0)))
{
cp_error ("using-declaration for non-member at class scope");
return NULL_TREE;
Index: gcc/cp/error.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/error.c,v
retrieving revision 1.107
diff -c -3 -p -r1.107 error.c
*** error.c 2000/03/17 17:31:56 1.107
--- error.c 2000/03/20 14:52:32
*************** dump_template_argument (arg, flags)
*** 221,228 ****
tree arg;
enum tree_string_flags flags;
{
! if (TREE_CODE_CLASS (TREE_CODE (arg)) == 't'
! || TREE_CODE (arg) == TEMPLATE_DECL)
dump_type (arg, flags & ~TS_AGGR_TAGS);
else
dump_expr (arg, (flags | TS_EXPR_PARENS) & ~TS_AGGR_TAGS);
--- 221,227 ----
tree arg;
enum tree_string_flags flags;
{
! if (TYPE_P (arg) || TREE_CODE (arg) == TEMPLATE_DECL)
dump_type (arg, flags & ~TS_AGGR_TAGS);
else
dump_expr (arg, (flags | TS_EXPR_PARENS) & ~TS_AGGR_TAGS);
*************** dump_expr (t, flags)
*** 1965,1971 ****
my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0);
OB_PUTS ("__alignof__ (");
}
! if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t, 0))) == 't')
dump_type (TREE_OPERAND (t, 0), flags);
else
dump_unary_op ("*", t, flags | TS_EXPR_PARENS);
--- 1964,1970 ----
my_friendly_assert (TREE_CODE (t) == ALIGNOF_EXPR, 0);
OB_PUTS ("__alignof__ (");
}
! if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (TREE_OPERAND (t, 0), flags);
else
dump_unary_op ("*", t, flags | TS_EXPR_PARENS);
*************** cp_file_of (t)
*** 2165,2171 ****
{
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
return DECL_SOURCE_FILE (DECL_CONTEXT (t));
! else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
return DECL_SOURCE_FILE (OVL_FUNCTION (t));
--- 2164,2170 ----
{
if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
return DECL_SOURCE_FILE (DECL_CONTEXT (t));
! else if (TYPE_P (t))
return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
return DECL_SOURCE_FILE (OVL_FUNCTION (t));
*************** cp_line_of (t)
*** 2184,2190 ****
&& TYPE_MAIN_DECL (TREE_TYPE (t)))
t = TREE_TYPE (t);
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
line = DECL_SOURCE_LINE (OVL_FUNCTION (t));
--- 2183,2189 ----
&& TYPE_MAIN_DECL (TREE_TYPE (t)))
t = TREE_TYPE (t);
! if (TYPE_P (t))
line = DECL_SOURCE_LINE (TYPE_MAIN_DECL (t));
else if (TREE_CODE (t) == OVERLOAD)
line = DECL_SOURCE_LINE (OVL_FUNCTION (t));
*************** args_to_string (p, verbose)
*** 2365,2371 ****
if (p == NULL_TREE)
return "";
! if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (p))) == 't')
return type_as_string (p, flags);
OB_INIT ();
--- 2364,2370 ----
if (p == NULL_TREE)
return "";
! if (TYPE_P (TREE_VALUE (p)))
return type_as_string (p, flags);
OB_INIT ();
Index: gcc/cp/friend.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/friend.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 friend.c
*** friend.c 2000/02/21 19:51:44 1.54
--- friend.c 2000/03/20 14:52:33
*************** is_friend (type, supplicant)
*** 42,48 ****
if (supplicant == NULL_TREE || type == NULL_TREE)
return 0;
! declp = (TREE_CODE_CLASS (TREE_CODE (supplicant)) == 'd');
if (declp)
/* It's a function decl. */
--- 42,48 ----
if (supplicant == NULL_TREE || type == NULL_TREE)
return 0;
! declp = DECL_P (supplicant);
if (declp)
/* It's a function decl. */
Index: gcc/cp/lex.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/lex.c,v
retrieving revision 1.185
diff -c -3 -p -r1.185 lex.c
*** lex.c 2000/03/12 17:19:20 1.185
--- lex.c 2000/03/20 14:52:43
*************** void
*** 2148,2154 ****
note_got_semicolon (type)
tree type;
{
! if (TREE_CODE_CLASS (TREE_CODE (type)) != 't')
my_friendly_abort (60);
if (CLASS_TYPE_P (type))
CLASSTYPE_GOT_SEMICOLON (type) = 1;
--- 2148,2154 ----
note_got_semicolon (type)
tree type;
{
! if (!TYPE_P (type))
my_friendly_abort (60);
if (CLASS_TYPE_P (type))
CLASSTYPE_GOT_SEMICOLON (type) = 1;
*************** note_list_got_semicolon (declspecs)
*** 2163,2169 ****
for (link = declspecs; link; link = TREE_CHAIN (link))
{
tree type = TREE_VALUE (link);
! if (TREE_CODE_CLASS (TREE_CODE (type)) == 't')
note_got_semicolon (type);
}
clear_anon_tags ();
--- 2163,2169 ----
for (link = declspecs; link; link = TREE_CHAIN (link))
{
tree type = TREE_VALUE (link);
! if (TYPE_P (type))
note_got_semicolon (type);
}
clear_anon_tags ();
*************** is_global (d)
*** 3418,3424 ****
case OVERLOAD: d = OVL_FUNCTION (d); continue;
case TREE_LIST: d = TREE_VALUE (d); continue;
default:
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (d)) == 'd', 980629);
return DECL_NAMESPACE_SCOPE_P (d);
}
--- 3418,3424 ----
case OVERLOAD: d = OVL_FUNCTION (d); continue;
case TREE_LIST: d = TREE_VALUE (d); continue;
default:
! my_friendly_assert (DECL_P (d), 980629);
return DECL_NAMESPACE_SCOPE_P (d);
}
Index: gcc/cp/method.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/method.c,v
retrieving revision 1.141
diff -c -3 -p -r1.141 method.c
*** method.c 2000/03/10 09:25:45 1.141
--- method.c 2000/03/20 14:52:48
*************** build_overload_nested_name (decl)
*** 446,452 ****
build_mangled_name_for_type (context);
else
{
! if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
context = TYPE_NAME (context);
build_overload_nested_name (context);
}
--- 446,452 ----
build_mangled_name_for_type (context);
else
{
! if (TYPE_P (context))
context = TYPE_NAME (context);
build_overload_nested_name (context);
}
*************** build_overload_value (type, value, flags
*** 694,700 ****
tree type, value;
mangling_flags flags;
{
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (type)) == 't', 0);
while (TREE_CODE (value) == NON_LVALUE_EXPR
|| TREE_CODE (value) == NOP_EXPR)
--- 694,700 ----
tree type, value;
mangling_flags flags;
{
! my_friendly_assert (TYPE_P (type), 0);
while (TREE_CODE (value) == NON_LVALUE_EXPR
|| TREE_CODE (value) == NOP_EXPR)
*************** build_qualified_name (decl)
*** 1046,1052 ****
tree context;
int i = 1;
! if (TREE_CODE_CLASS (TREE_CODE (decl)) == 't')
decl = TYPE_NAME (decl);
/* If DECL_ASSEMBLER_NAME has been set properly, use it. */
--- 1046,1052 ----
tree context;
int i = 1;
! if (TYPE_P (decl))
decl = TYPE_NAME (decl);
/* If DECL_ASSEMBLER_NAME has been set properly, use it. */
*************** build_qualified_name (decl)
*** 1074,1080 ****
if (check_ktype (context, FALSE) != -1)
/* Found one! */
break;
! if (TREE_CODE_CLASS (TREE_CODE (context)) == 't')
context = TYPE_NAME (context);
}
}
--- 1074,1080 ----
if (check_ktype (context, FALSE) != -1)
/* Found one! */
break;
! if (TYPE_P (context))
context = TYPE_NAME (context);
}
}
*************** hack_identifier (value, name)
*** 1987,1993 ****
}
}
! if (TREE_CODE_CLASS (TREE_CODE (value)) == 'd' && DECL_NONLOCAL (value))
{
if (DECL_CLASS_SCOPE_P (value)
&& DECL_CONTEXT (value) != current_class_type)
--- 1987,1993 ----
}
}
! if (DECL_P (value) && DECL_NONLOCAL (value))
{
if (DECL_CLASS_SCOPE_P (value)
&& DECL_CONTEXT (value) != current_class_type)
Index: gcc/cp/parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/parse.y,v
retrieving revision 1.169
diff -c -3 -p -r1.169 parse.y
*** parse.y 2000/03/18 18:12:54 1.169
--- parse.y 2000/03/20 14:52:56
*************** typename_sub:
*** 2945,2951 ****
typename_sub0:
typename_sub1 identifier %prec EMPTY
{
! if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
$$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error ("`%T' is not a class or namespace", $2);
--- 2945,2951 ----
typename_sub0:
typename_sub1 identifier %prec EMPTY
{
! if (TYPE_P ($1))
$$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error ("`%T' is not a class or namespace", $2);
*************** typename_sub1:
*** 2972,2978 ****
}
| typename_sub1 typename_sub2
{
! if (TREE_CODE_CLASS (TREE_CODE ($1)) == 't')
$$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error ("`%T' is not a class or namespace", $2);
--- 2972,2978 ----
}
| typename_sub1 typename_sub2
{
! if (TYPE_P ($1))
$$ = make_typename_type ($1, $2, /*complain=*/1);
else if (TREE_CODE ($2) == IDENTIFIER_NODE)
cp_error ("`%T' is not a class or namespace", $2);
Index: gcc/cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.407
diff -c -3 -p -r1.407 pt.c
*** pt.c 2000/03/13 04:54:39 1.407
--- pt.c 2000/03/20 14:53:15
*************** push_inline_template_parms_recursive (pa
*** 321,327 ****
for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
{
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (parm)) == 'd', 0);
switch (TREE_CODE (parm))
{
--- 321,327 ----
for (i = 0; i < TREE_VEC_LENGTH (parms); ++i)
{
tree parm = TREE_VALUE (TREE_VEC_ELT (parms, i));
! my_friendly_assert (DECL_P (parm), 0);
switch (TREE_CODE (parm))
{
*************** check_template_shadow (decl)
*** 1666,1673 ****
that OLDDECL might be an OVERLOAD (or perhaps even an
ERROR_MARK), so we can't just blithely assume it to be a _DECL
node. */
! if (TREE_CODE_CLASS (TREE_CODE (olddecl)) != 'd'
! || !DECL_TEMPLATE_PARM_P (olddecl))
return;
/* We check for decl != olddecl to avoid bogus errors for using a
--- 1666,1672 ----
that OLDDECL might be an OVERLOAD (or perhaps even an
ERROR_MARK), so we can't just blithely assume it to be a _DECL
node. */
! if (!DECL_P (olddecl) || !DECL_TEMPLATE_PARM_P (olddecl))
return;
/* We check for decl != olddecl to avoid bogus errors for using a
*************** process_partial_specialization (decl)
*** 2118,2124 ****
{
tree arg = TREE_VEC_ELT (inner_args, i);
if (/* These first two lines are the `non-type' bit. */
! TREE_CODE_CLASS (TREE_CODE (arg)) != 't'
&& TREE_CODE (arg) != TEMPLATE_DECL
/* This next line is the `argument expression is not just a
simple identifier' condition and also the `specialized
--- 2117,2123 ----
{
tree arg = TREE_VEC_ELT (inner_args, i);
if (/* These first two lines are the `non-type' bit. */
! !TYPE_P (arg)
&& TREE_CODE (arg) != TEMPLATE_DECL
/* This next line is the `argument expression is not just a
simple identifier' condition and also the `specialized
*************** convert_template_argument (parm, arg, ar
*** 3166,3172 ****
else if (is_tmpl_type && TREE_CODE (arg) == RECORD_TYPE)
arg = CLASSTYPE_TI_TEMPLATE (arg);
! is_type = TREE_CODE_CLASS (TREE_CODE (arg)) == 't' || is_tmpl_type;
if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
--- 3165,3171 ----
else if (is_tmpl_type && TREE_CODE (arg) == RECORD_TYPE)
arg = CLASSTYPE_TI_TEMPLATE (arg);
! is_type = TYPE_P (arg) || is_tmpl_type;
if (requires_type && ! is_type && TREE_CODE (arg) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (arg, 0)) == TEMPLATE_TYPE_PARM)
*************** template_args_equal (ot, nt)
*** 3420,3426 ****
if (TREE_CODE (nt) == TREE_VEC)
/* For member templates */
return comp_template_args (ot, nt);
! else if (TREE_CODE_CLASS (TREE_CODE (ot)) == 't')
return same_type_p (ot, nt);
else
return (cp_tree_equal (ot, nt) > 0);
--- 3419,3425 ----
if (TREE_CODE (nt) == TREE_VEC)
/* For member templates */
return comp_template_args (ot, nt);
! else if (TYPE_P (ot))
return same_type_p (ot, nt);
else
return (cp_tree_equal (ot, nt) > 0);
*************** static void
*** 3575,3587 ****
add_pending_template (d)
tree d;
{
! tree ti;
- if (TREE_CODE_CLASS (TREE_CODE (d)) == 't')
- ti = CLASSTYPE_TEMPLATE_INFO (d);
- else
- ti = DECL_TEMPLATE_INFO (d);
-
if (TI_PENDING_TEMPLATE_FLAG (ti))
return;
--- 3574,3581 ----
add_pending_template (d)
tree d;
{
! tree ti = (TYPE_P (d)) ? CLASSTYPE_TEMPLATE_INFO (d) : DECL_TEMPLATE_INFO (d);
if (TI_PENDING_TEMPLATE_FLAG (ti))
return;
*************** lookup_template_class (d1, arglist, in_d
*** 3699,3706 ****
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
! || (TREE_CODE_CLASS (TREE_CODE (d1)) == 't'
! && IS_AGGR_TYPE (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
--- 3693,3699 ----
}
}
else if (TREE_CODE (d1) == ENUMERAL_TYPE
! || (TYPE_P (d1) && IS_AGGR_TYPE (d1)))
{
template = TYPE_TI_TEMPLATE (d1);
d1 = DECL_NAME (template);
*************** lookup_template_class (d1, arglist, in_d
*** 3864,3871 ****
scopes. */
for (ctx = current_class_type;
ctx;
! ctx = (TREE_CODE_CLASS (TREE_CODE (ctx)) == 't')
! ? TYPE_CONTEXT (ctx) : DECL_CONTEXT (ctx))
if (same_type_p (ctx, template_type))
break;
--- 3857,3863 ----
scopes. */
for (ctx = current_class_type;
ctx;
! ctx = (TYPE_P (ctx)) ? TYPE_CONTEXT (ctx) : DECL_CONTEXT (ctx))
if (same_type_p (ctx, template_type))
break;
*************** for_each_template_parm_r (tp, walk_subtr
*** 4065,4071 ****
tree_fn_t fn = pfd->fn;
void *data = pfd->data;
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't'
&& for_each_template_parm (TYPE_CONTEXT (t), fn, data))
return error_mark_node;
--- 4057,4063 ----
tree_fn_t fn = pfd->fn;
void *data = pfd->data;
! if (TYPE_P (t)
&& for_each_template_parm (TYPE_CONTEXT (t), fn, data))
return error_mark_node;
*************** maybe_fold_nontype_arg (arg)
*** 5136,5143 ****
if (! processing_template_decl)
return arg;
! if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't'
! && !uses_template_parms (arg))
{
/* Sometimes, one of the args was an expression involving a
template constant parameter, like N - 1. Now that we've
--- 5128,5134 ----
if (! processing_template_decl)
return arg;
! if (!TYPE_P (arg) && !uses_template_parms (arg))
{
/* Sometimes, one of the args was an expression involving a
template constant parameter, like N - 1. Now that we've
*************** tsubst (t, args, complain, in_decl)
*** 6161,6167 ****
if (type == error_mark_node)
return error_mark_node;
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
return tsubst_decl (t, args, type, in_decl);
switch (TREE_CODE (t))
--- 6152,6158 ----
if (type == error_mark_node)
return error_mark_node;
! if (DECL_P (t))
return tsubst_decl (t, args, type, in_decl);
switch (TREE_CODE (t))
*************** tsubst (t, args, complain, in_decl)
*** 6283,6290 ****
{
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
{
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (arg))
! == 't', 0);
return cp_build_qualified_type_real
(arg, CP_TYPE_QUALS (arg) | CP_TYPE_QUALS (t),
complain);
--- 6274,6280 ----
{
if (TREE_CODE (t) == TEMPLATE_TYPE_PARM)
{
! my_friendly_assert (TYPE_P (arg), 0);
return cp_build_qualified_type_real
(arg, CP_TYPE_QUALS (arg) | CP_TYPE_QUALS (t),
complain);
*************** instantiate_template (tmpl, targ_ptr)
*** 7430,7436 ****
while (i--)
{
tree t = TREE_VEC_ELT (inner_args, i);
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
{
tree nt = target_type (t);
if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
--- 7420,7426 ----
while (i--)
{
tree t = TREE_VEC_ELT (inner_args, i);
! if (TYPE_P (t))
{
tree nt = target_type (t);
if (IS_AGGR_TYPE (nt) && decl_function_context (TYPE_MAIN_DECL (nt)))
*************** type_unification_real (tparms, targs, pa
*** 7750,7756 ****
{
tree type;
! if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
type = TREE_TYPE (arg);
else
{
--- 7740,7746 ----
{
tree type;
! if (!TYPE_P (arg))
type = TREE_TYPE (arg);
else
{
*************** type_unification_real (tparms, targs, pa
*** 7772,7778 ****
return 1;
}
! if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
{
my_friendly_assert (TREE_TYPE (arg) != NULL_TREE, 293);
if (type_unknown_p (arg))
--- 7762,7768 ----
return 1;
}
! if (!TYPE_P (arg))
{
my_friendly_assert (TREE_TYPE (arg) != NULL_TREE, 293);
if (type_unknown_p (arg))
*************** unify (tparms, targs, parm, arg, strict)
*** 8246,8252 ****
/* Immediately reject some pairs that won't unify because of
cv-qualification mismatches. */
if (TREE_CODE (arg) == TREE_CODE (parm)
! && TREE_CODE_CLASS (TREE_CODE (arg)) == 't'
/* We check the cv-qualifiers when unifying with template type
parameters below. We want to allow ARG `const T' to unify with
PARM `T' for example, when computing which of two templates
--- 8236,8242 ----
/* Immediately reject some pairs that won't unify because of
cv-qualification mismatches. */
if (TREE_CODE (arg) == TREE_CODE (parm)
! && TYPE_P (arg)
/* We check the cv-qualifiers when unifying with template type
parameters below. We want to allow ARG `const T' to unify with
PARM `T' for example, when computing which of two templates
*************** instantiate_pending_templates ()
*** 9649,9655 ****
input_filename = SRCLOC_FILE (srcloc);
lineno = SRCLOC_LINE (srcloc);
! if (TREE_CODE_CLASS (TREE_CODE (instantiation)) == 't')
{
tree fn;
--- 9639,9645 ----
input_filename = SRCLOC_FILE (srcloc);
lineno = SRCLOC_LINE (srcloc);
! if (TYPE_P (instantiation))
{
tree fn;
*************** set_mangled_name_for_template_decl (decl
*** 9960,9966 ****
mangled name. Unfortunately, build_decl_overload_real does not
get the decl to mangle, so it relies on the current
namespace. Therefore, we set that here temporarily. */
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd', 980702);
saved_namespace = current_namespace;
current_namespace = CP_DECL_CONTEXT (decl);
--- 9950,9956 ----
mangled name. Unfortunately, build_decl_overload_real does not
get the decl to mangle, so it relies on the current
namespace. Therefore, we set that here temporarily. */
! my_friendly_assert (DECL_P (decl), 980702);
saved_namespace = current_namespace;
current_namespace = CP_DECL_CONTEXT (decl);
Index: gcc/cp/repo.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/repo.c,v
retrieving revision 1.26
diff -c -3 -p -r1.26 repo.c
*** repo.c 2000/02/26 20:15:46 1.26
--- repo.c 2000/03/20 14:53:15
*************** static tree
*** 95,101 ****
repo_get_id (t)
tree t;
{
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
{
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
--- 95,101 ----
repo_get_id (t)
tree t;
{
! if (TYPE_P (t))
{
/* If we're not done setting up the class, we may not have set up
the vtable, so going ahead would give the wrong answer.
*************** repo_template_used (t)
*** 126,137 ****
if (id == NULL_TREE)
return;
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_class_instantiated (t, 0);
}
! else if (TREE_CODE_CLASS (TREE_CODE (t)) == 'd')
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_decl_instantiated (t, 0);
--- 126,137 ----
if (id == NULL_TREE)
return;
! if (TYPE_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_class_instantiated (t, 0);
}
! else if (DECL_P (t))
{
if (IDENTIFIER_REPO_CHOSEN (id))
mark_decl_instantiated (t, 0);
Index: gcc/cp/search.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/search.c,v
retrieving revision 1.163
diff -c -3 -p -r1.163 search.c
*** search.c 2000/03/08 00:22:21 1.163
--- search.c 2000/03/20 14:53:19
*************** lookup_field_1 (type, name)
*** 635,641 ****
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
! my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (field)) == 'd', 0);
if (DECL_NAME (field) == NULL_TREE
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
--- 635,641 ----
#ifdef GATHER_STATISTICS
n_fields_searched++;
#endif /* GATHER_STATISTICS */
! my_friendly_assert (DECL_P (field), 0);
if (DECL_NAME (field) == NULL_TREE
&& ANON_AGGR_TYPE_P (TREE_TYPE (field)))
{
Index: gcc/cp/tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.185
diff -c -3 -p -r1.185 tree.c
*** tree.c 2000/03/03 02:27:15 1.185
--- tree.c 2000/03/20 14:53:21
*************** walk_tree (tp, func, data)
*** 1262,1268 ****
{
if (code == DECL_STMT
&& DECL_STMT_DECL (*tp)
! && TREE_CODE_CLASS (TREE_CODE (DECL_STMT_DECL (*tp))) == 'd')
{
/* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
into declarations that are just mentioned, rather than
--- 1262,1268 ----
{
if (code == DECL_STMT
&& DECL_STMT_DECL (*tp)
! && DECL_P (DECL_STMT_DECL (*tp)))
{
/* Walk the DECL_INITIAL and DECL_SIZE. We don't want to walk
into declarations that are just mentioned, rather than
*************** get_type_decl (t)
*** 1730,1736 ****
{
if (TREE_CODE (t) == TYPE_DECL)
return t;
! if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
return TYPE_STUB_DECL (t);
my_friendly_abort (42);
--- 1730,1736 ----
{
if (TREE_CODE (t) == TYPE_DECL)
return t;
! if (TYPE_P (t))
return TYPE_STUB_DECL (t);
my_friendly_abort (42);
*************** cp_tree_equal (t1, t2)
*** 1915,1921 ****
case ALIGNOF_EXPR:
if (TREE_CODE (TREE_OPERAND (t1, 0)) != TREE_CODE (TREE_OPERAND (t2, 0)))
return 0;
! if (TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (t1, 0))) == 't')
return same_type_p (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
break;
--- 1915,1921 ----
case ALIGNOF_EXPR:
if (TREE_CODE (TREE_OPERAND (t1, 0)) != TREE_CODE (TREE_OPERAND (t2, 0)))
return 0;
! if (TYPE_P (TREE_OPERAND (t1, 0)))
return same_type_p (TREE_OPERAND (t1, 0), TREE_OPERAND (t2, 0));
break;
*************** int
*** 2051,2058 ****
member_p (decl)
tree decl;
{
! tree ctx = DECL_CONTEXT (decl);
! return (ctx && TREE_CODE_CLASS (TREE_CODE (ctx)) == 't');
}
/* Create a placeholder for member access where we don't actually have an
--- 2051,2058 ----
member_p (decl)
tree decl;
{
! const tree ctx = DECL_CONTEXT (decl);
! return (ctx && TYPE_P (ctx));
}
/* Create a placeholder for member access where we don't actually have an
Index: gcc/cp/xref.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/xref.c,v
retrieving revision 1.24
diff -c -3 -p -r1.24 xref.c
*** xref.c 2000/02/26 20:15:46 1.24
--- xref.c 2000/03/20 14:53:21
*************** static const char *
*** 541,549 ****
classname (cls)
tree cls;
{
! if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 't')
cls = TYPE_NAME (cls);
! if (cls && TREE_CODE_CLASS (TREE_CODE (cls)) == 'd')
cls = DECL_NAME (cls);
if (cls && TREE_CODE (cls) == IDENTIFIER_NODE)
return IDENTIFIER_POINTER (cls);
--- 541,549 ----
classname (cls)
tree cls;
{
! if (cls && TYPE_P (cls))
cls = TYPE_NAME (cls);
! if (cls && DECL_P (cls))
cls = DECL_NAME (cls);
if (cls && TREE_CODE (cls) == IDENTIFIER_NODE)
return IDENTIFIER_POINTER (cls);
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------