From 4dabb3791dfe9db2483914aaff3ee79f9cc74bbf Mon Sep 17 00:00:00 2001 From: Mike Stump Date: Wed, 8 May 1996 18:18:35 +0000 Subject: [PATCH] 86th Cygnus<->FSF quick merge From-SVN: r11956 --- gcc/cp/ChangeLog | 9 +++++ gcc/cp/call.c | 40 ++++++++------------ gcc/cp/class.c | 2 +- gcc/cp/cp-tree.h | 5 +-- gcc/cp/cvt.c | 2 +- gcc/cp/expr.c | 2 +- gcc/cp/gxxint.texi | 9 +++++ gcc/cp/init.c | 24 ++++++------ gcc/cp/method.c | 6 +-- gcc/cp/parse.y | 4 +- gcc/cp/pt.c | 2 +- gcc/cp/rtti.c | 18 ++++----- gcc/cp/search.c | 4 +- gcc/cp/sig.c | 2 +- gcc/cp/tree.c | 2 +- gcc/cp/typeck.c | 92 ++++++++++++++++++++++++---------------------- gcc/cp/typeck2.c | 8 ++-- 17 files changed, 123 insertions(+), 108 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f64da638a03..431c8b59c95 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +Tue May 7 20:39:57 1996 Mike Stump + + * cp-tree.h (build_overload_call_maybe): Removed. + * call.c (build_overload_call_real): Invert meaning of last arg to + be require_complete. + (build_overload_call): Ditto. + * typeck.c (build_x_function_call): Use build_overload_call_real + instead of build_overload_call_maybe. + Mon May 6 01:23:32 1996 Jason Merrill * decl2.c (finish_file): Don't try to emit functions that haven't diff --git a/gcc/cp/call.c b/gcc/cp/call.c index c55d904fcd4..a50c5888b1e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -228,10 +228,10 @@ convert_harshness (type, parmtype, parm) tree ttl = TYPE_METHOD_BASETYPE (type); tree ttr = TYPE_METHOD_BASETYPE (parmtype); - int b_or_d = get_base_distance (ttr, ttl, 0, 0); + int b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0); if (b_or_d < 0) { - b_or_d = get_base_distance (ttl, ttr, 0, 0); + b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0); if (b_or_d < 0) return EVIL_RETURN (h); h.distance = -b_or_d; @@ -361,10 +361,10 @@ convert_harshness (type, parmtype, parm) h.code = 0; else { - int b_or_d = get_base_distance (ttr, ttl, 0, 0); + int b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0); if (b_or_d < 0) { - b_or_d = get_base_distance (ttl, ttr, 0, 0); + b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0); if (b_or_d < 0) return EVIL_RETURN (h); h.distance = -b_or_d; @@ -551,10 +551,10 @@ convert_harshness (type, parmtype, parm) if (TREE_CODE (ttl) == RECORD_TYPE && TREE_CODE (ttr) == RECORD_TYPE) { - int b_or_d = get_base_distance (ttl, ttr, 0, 0); + int b_or_d = get_base_distance (ttl, ttr, 0, (tree*)0); if (b_or_d < 0) { - b_or_d = get_base_distance (ttr, ttl, 0, 0); + b_or_d = get_base_distance (ttr, ttl, 0, (tree*)0); if (b_or_d < 0) return EVIL_RETURN (h); h.distance = -b_or_d; @@ -611,10 +611,10 @@ convert_harshness (type, parmtype, parm) if (codel == RECORD_TYPE && coder == RECORD_TYPE) { - int b_or_d = get_base_distance (type, parmtype, 0, 0); + int b_or_d = get_base_distance (type, parmtype, 0, (tree*)0); if (b_or_d < 0) { - b_or_d = get_base_distance (parmtype, type, 0, 0); + b_or_d = get_base_distance (parmtype, type, 0, (tree*)0); if (b_or_d < 0) return EVIL_RETURN (h); h.distance = -b_or_d; @@ -1178,7 +1178,7 @@ build_vfield_ref (datum, type) rval = build (COMPONENT_REF, TREE_TYPE (CLASSTYPE_VFIELD (type)), datum, CLASSTYPE_VFIELD (type)); else - rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), 0, 0); + rval = build_component_ref (datum, DECL_NAME (CLASSTYPE_VFIELD (type)), NULL_TREE, 0); flag_assume_nonnull_objects = old_assume_nonnull_objects; return rval; @@ -1431,7 +1431,7 @@ build_scoped_method_call (exp, basetype, name, parms) name = build_min_nt (BIT_NOT_EXPR, type); } name = build_min_nt (SCOPE_REF, basetype, name); - return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, 0); + return build_min_nt (METHOD_CALL_EXPR, name, exp, parms, NULL_TREE); } if (TREE_CODE (type) == REFERENCE_TYPE) @@ -1604,7 +1604,7 @@ build_method_call (instance, name, parms, basetype_path, flags) name = build_min_nt (BIT_NOT_EXPR, type); } - return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, 0); + return build_min_nt (METHOD_CALL_EXPR, name, instance, parms, NULL_TREE); } /* This is the logic that magically deletes the second argument to @@ -2089,6 +2089,7 @@ build_method_call (instance, name, parms, basetype_path, flags) alloca ((len + 1) * sizeof (struct harshness_code)); result = build_overload_call (name, friend_parms, 0, cp); + /* If it turns out to be the one we were actually looking for (it was probably a friend function), the return the good result. */ @@ -2577,11 +2578,11 @@ build_method_call (instance, name, parms, basetype_path, flags) function's new name. */ tree -build_overload_call_real (fnname, parms, flags, final_cp, buildxxx) +build_overload_call_real (fnname, parms, flags, final_cp, require_complete) tree fnname, parms; int flags; struct candidate *final_cp; - int buildxxx; + int require_complete; { /* must check for overloading here */ tree functions, function, parm; @@ -2829,8 +2830,7 @@ build_overload_call_real (fnname, parms, flags, final_cp, buildxxx) if (final_cp) return rval; - return buildxxx ? build_function_call_real (rval, parms, 0, flags) - : build_function_call_real (rval, parms, 1, flags); + return build_function_call_real (rval, parms, require_complete, flags); } if (flags & LOOKUP_SPECULATIVELY) @@ -2843,20 +2843,12 @@ build_overload_call_real (fnname, parms, flags, final_cp, buildxxx) return error_mark_node; } +/* This requires a complete type on the result of the call. */ tree build_overload_call (fnname, parms, flags, final_cp) tree fnname, parms; int flags; struct candidate *final_cp; -{ - return build_overload_call_real (fnname, parms, flags, final_cp, 0); -} - -tree -build_overload_call_maybe (fnname, parms, flags, final_cp) - tree fnname, parms; - int flags; - struct candidate *final_cp; { return build_overload_call_real (fnname, parms, flags, final_cp, 1); } diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 01ea19c367e..4f1f23a624a 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -126,7 +126,7 @@ build_vbase_pointer (exp, type) name = (char *) alloca (TYPE_NAME_LENGTH (type) + sizeof (VBASE_NAME) + 1); sprintf (name, VBASE_NAME_FORMAT, TYPE_NAME_STRING (type)); - return build_component_ref (exp, get_identifier (name), 0, 0); + return build_component_ref (exp, get_identifier (name), NULL_TREE, 0); } /* Is the type of the EXPR, the complete type of the object? diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e3a9297a3d6..d6db7a0103d 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -1282,8 +1282,8 @@ extern int flag_new_for_scope; #define TYPE_GET_PTRMEMFUNC_TYPE(NODE) ((tree)TYPE_LANG_SPECIFIC(NODE)) #define TYPE_SET_PTRMEMFUNC_TYPE(NODE, VALUE) (TYPE_LANG_SPECIFIC(NODE) = ((struct lang_type *)(void*)(VALUE))) /* These are to get the delta2 and pfn fields from a TYPE_PTRMEMFUNC_P. */ -#define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, 0, 0), delta2_identifier, 0, 0)) -#define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, 0, 0), pfn_identifier, 0, 0)) +#define DELTA2_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), delta2_identifier, NULL_TREE, 0)) +#define PFN_FROM_PTRMEMFUNC(NODE) (build_component_ref (build_component_ref ((NODE), pfn_or_delta2_identifier, NULL_TREE, 0), pfn_identifier, NULL_TREE, 0)) /* Nonzero for VAR_DECL and FUNCTION_DECL node means that `extern' was specified in its declaration. */ @@ -1945,7 +1945,6 @@ extern tree build_scoped_method_call PROTO((tree, tree, tree, tree)); extern tree build_method_call PROTO((tree, tree, tree, tree, int)); extern tree build_overload_call_real PROTO((tree, tree, int, struct candidate *, int)); extern tree build_overload_call PROTO((tree, tree, int, struct candidate *)); -extern tree build_overload_call_maybe PROTO((tree, tree, int, struct candidate *)); /* in class.c */ extern tree build_vbase_pointer PROTO((tree, tree)); diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 80f16e29cc0..5c09175e872 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -609,7 +609,7 @@ build_up_reference (type, arg, flags, checkconst) use INDIRECT_BIND. */ tree slot = build (VAR_DECL, argtype); layout_decl (slot, 0); - rval = build (TARGET_EXPR, argtype, slot, arg, 0); + rval = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE); rval = build1 (ADDR_EXPR, type, rval); goto done; } diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index bda84000141..7411a4eaa0d 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -139,7 +139,7 @@ cplus_expand_expr (exp, target, tmode, modifier) call_target = validize_mem (call_target); } - call_exp = build (CALL_EXPR, type, func, args, 0); + call_exp = build (CALL_EXPR, type, func, args, NULL_TREE); TREE_SIDE_EFFECTS (call_exp) = 1; return_target = expand_call (call_exp, call_target, ignore); if (call_target == 0) diff --git a/gcc/cp/gxxint.texi b/gcc/cp/gxxint.texi index 69161f9b5a3..ccdc8aef4c1 100644 --- a/gcc/cp/gxxint.texi +++ b/gcc/cp/gxxint.texi @@ -682,6 +682,15 @@ appear in cp-decl.c and cp-decl2.c, so the are a good candidate for proper fixing, and removal. +@item TREE_HAS_CONSTRUCTOR +A flag to indicate when a CALL_EXPR represents a call to a constructor. +If set, we know that the type of the object, is the complete type of the +object, and that the value returned is nonnull. When used in this +fashion, it is an optimization. Can also be used on SAVE_EXPRs to +indicate when they are of fixed type and nonnull. Can also be used on +INDIRECT_EXPRs on CALL_EXPRs that represent a call to a constructor. + + @item TREE_PRIVATE Set for FIELD_DECLs by finish_struct. But not uniformly set. diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 7486a5430b1..45dc9c280eb 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -174,7 +174,7 @@ perform_member_init (member, name, init, explicit, protect_list) if (init != NULL_TREE && TREE_CODE (init) != TREE_LIST) init = build_tree_list (NULL_TREE, init); - decl = build_component_ref (C_C_D, name, 0, explicit); + decl = build_component_ref (C_C_D, name, NULL_TREE, explicit); if (explicit && TREE_CODE (type) == ARRAY_TYPE @@ -220,7 +220,7 @@ perform_member_init (member, name, init, explicit, protect_list) current_member_init_list. */ if (init || explicit) { - decl = build_component_ref (C_C_D, name, 0, explicit); + decl = build_component_ref (C_C_D, name, NULL_TREE, explicit); expand_expr_stmt (build_modify_expr (decl, INIT_EXPR, init)); } } @@ -237,7 +237,7 @@ perform_member_init (member, name, init, explicit, protect_list) if (TYPE_NEEDS_DESTRUCTOR (type)) { - tree expr = build_component_ref (C_C_D, name, 0, explicit); + tree expr = build_component_ref (C_C_D, name, NULL_TREE, explicit); expr = build_delete (type, expr, integer_zero_node, LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR, 0); @@ -1071,7 +1071,7 @@ expand_member_init (exp, name, init) TREE_USED (exp) = 1; } type = TYPE_MAIN_VARIANT (TREE_TYPE (field)); - parm = build_component_ref (exp, name, 0, 0); + parm = build_component_ref (exp, name, NULL_TREE, 0); /* Now get to the constructors. */ fndecl = TREE_VEC_ELT (CLASSTYPE_METHOD_VEC (type), 0); @@ -1114,7 +1114,7 @@ expand_member_init (exp, name, init) } else if (TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (field))) { - parm = build_component_ref (exp, name, 0, 0); + parm = build_component_ref (exp, name, NULL_TREE, 0); expand_aggr_init (parm, NULL_TREE, 0, 0); rval = error_mark_node; } @@ -1457,7 +1457,7 @@ expand_aggr_init_1 (binfo, true_exp, exp, init, alias_this, flags) tree arg = build_unary_op (ADDR_EXPR, exp, 0); init = TREE_OPERAND (init, 1); init = build (CALL_EXPR, build_pointer_type (TREE_TYPE (init)), - TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), 0); + TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), NULL_TREE); TREE_SIDE_EFFECTS (init) = 1; TREE_VALUE (TREE_OPERAND (init, 1)) = convert_pointer_to (TREE_TYPE (TREE_TYPE (TREE_VALUE (tmp))), arg); @@ -2529,7 +2529,7 @@ build_builtin_call (type, node, arglist) tree node; tree arglist; { - tree rval = build (CALL_EXPR, type, node, arglist, 0); + tree rval = build (CALL_EXPR, type, node, arglist, NULL_TREE); TREE_SIDE_EFFECTS (rval) = 1; assemble_external (TREE_OPERAND (node, 0)); TREE_USED (TREE_OPERAND (node, 0)) = 1; @@ -2842,7 +2842,7 @@ build_new (placement, decl, init, use_global_new) cookie = build_indirect_ref (build (MINUS_EXPR, build_pointer_type (BI_header_type), rval, extra), NULL_PTR); exp1 = build (MODIFY_EXPR, void_type_node, - build_component_ref (cookie, nc_nelts_field_id, 0, 0), + build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0), nelts); TREE_SIDE_EFFECTS (exp1) = 1; rval = convert (build_pointer_type (true_type), rval); @@ -3080,9 +3080,9 @@ build_vec_delete_1 (base, maxindex, type, auto_delete_vec, auto_delete, base, virtual_size))); DECL_REGISTER (tbase) = 1; - controller = build (BIND_EXPR, void_type_node, tbase, 0, 0); + controller = build (BIND_EXPR, void_type_node, tbase, NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (controller) = 1; - block = build_block (tbase, 0, 0, 0, 0); + block = build_block (tbase, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE); add_block_current_level (block); if (auto_delete != integer_zero_node @@ -3802,7 +3802,7 @@ build_delete (type, addr, auto_delete, flags, use_global_delete) continue; if (TYPE_NEEDS_DESTRUCTOR (TREE_TYPE (member))) { - tree this_member = build_component_ref (ref, DECL_NAME (member), 0, 0); + tree this_member = build_component_ref (ref, DECL_NAME (member), NULL_TREE, 0); tree this_type = TREE_TYPE (member); expr = build_delete (this_type, this_member, integer_two_node, flags, 0); exprstmt = tree_cons (NULL_TREE, expr, exprstmt); @@ -3884,7 +3884,7 @@ build_vec_delete (base, maxindex, auto_delete_vec, auto_delete, tree cookie_addr = build (MINUS_EXPR, build_pointer_type (BI_header_type), base, BI_header_size); tree cookie = build_indirect_ref (cookie_addr, NULL_PTR); - maxindex = build_component_ref (cookie, nc_nelts_field_id, 0, 0); + maxindex = build_component_ref (cookie, nc_nelts_field_id, NULL_TREE, 0); do type = TREE_TYPE (type); while (TREE_CODE (type) == ARRAY_TYPE); diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 5e1793bcc05..5d16db6d8bc 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -1462,7 +1462,7 @@ build_opfncall (code, flags, xarg1, xarg2, arg3) } else if (code == COND_EXPR) { - parms = tree_cons (0, xarg2, build_tree_list (NULL_TREE, arg3)); + parms = tree_cons (NULL_TREE, xarg2, build_tree_list (NULL_TREE, arg3)); rval = build_method_call (xarg1, fnname, parms, NULL_TREE, flags); } else if (code == METHOD_CALL_EXPR) @@ -1561,7 +1561,7 @@ hack_identifier (value, name) this field was initialized by a base initializer, we can emit an error message. */ TREE_USED (value) = 1; - value = build_component_ref (C_C_D, name, 0, 1); + value = build_component_ref (C_C_D, name, NULL_TREE, 1); } else if (really_overloaded_fn (value)) { @@ -1775,7 +1775,7 @@ build_component_type_expr (of, component, basetype_path, protect) } this_this = convert_pointer_to (TREE_TYPE (of), current_class_decl); - return build_component_ref (this_this, name, 0, protect); + return build_component_ref (this_this, name, NULL_TREE, protect); } else if (cname) return build_offset_ref (cname, name); diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 1b79dec6795..bd44fd445e9 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -1494,13 +1494,13 @@ primary: { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); } | overqualified_id '(' nonnull_exprlist ')' { if (current_template_parms) - $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, 0); + $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), $3, NULL_TREE); else $$ = build_member_call (OP0 ($$), OP1 ($$), $3); } | overqualified_id LEFT_RIGHT { if (current_template_parms) $$ = build_min_nt (CALL_EXPR, copy_to_permanent ($1), - NULL_TREE, 0); + NULL_TREE, NULL_TREE); else $$ = build_member_call (OP0 ($$), OP1 ($$), NULL_TREE); } | object unqualified_id %prec UNARY diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5d1dfcef980..47a37c85a16 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1799,7 +1799,7 @@ tsubst (t, args, nargs, in_decl) case CALL_EXPR: return build_parse_node (CALL_EXPR, tsubst (TREE_OPERAND (t, 0), args, nargs, in_decl), - tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl), 0); + tsubst (TREE_OPERAND (t, 1), args, nargs, in_decl), NULL_TREE); case SCOPE_REF: return build_parse_node diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 37e6698b17d..be982754349 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -165,7 +165,7 @@ build_typeid (exp) t = build_vfn_ref ((tree *) 0, exp, integer_zero_node); TREE_TYPE (t) = build_pointer_type (tinfo_fn_type); - t = build (CALL_EXPR, TREE_TYPE (tinfo_fn_type), t, NULL_TREE, 0); + t = build (CALL_EXPR, TREE_TYPE (tinfo_fn_type), t, NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (t) = 1; return convert_from_reference (t); } @@ -263,7 +263,7 @@ get_typeid_1 (type) tree type; { tree t = build (CALL_EXPR, TREE_TYPE (tinfo_fn_type), - default_conversion (get_tinfo_fn (type)), NULL_TREE, 0); + default_conversion (get_tinfo_fn (type)), NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (t) = 1; return convert_from_reference (t); } @@ -317,7 +317,7 @@ throw_bad_cast () pop_obstacks (); - d = build (CALL_EXPR, void_type_node, default_conversion (d), NULL_TREE, 0); + d = build (CALL_EXPR, void_type_node, default_conversion (d), NULL_TREE, NULL_TREE); TREE_SIDE_EFFECTS (d) = 1; return d; } @@ -526,7 +526,7 @@ build_dynamic_cast (type, expr) } result = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (dcast_fn)), - decay_conversion (dcast_fn), elems, 0); + decay_conversion (dcast_fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (result) = 1; if (tc == REFERENCE_TYPE) @@ -611,7 +611,7 @@ expand_si_desc (tdecl, type) } fn = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - decay_conversion (fn), elems, 0); + decay_conversion (fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (fn) = 1; expand_expr_stmt (fn); } @@ -791,7 +791,7 @@ expand_class_desc (tdecl, type) } fn = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - decay_conversion (fn), elems, 0); + decay_conversion (fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (fn) = 1; expand_expr_stmt (fn); } @@ -839,7 +839,7 @@ expand_ptr_desc (tdecl, type) } fn = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - decay_conversion (fn), elems, 0); + decay_conversion (fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (fn) = 1; expand_expr_stmt (fn); } @@ -890,7 +890,7 @@ expand_attr_desc (tdecl, type) } fn = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - decay_conversion (fn), elems, 0); + decay_conversion (fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (fn) = 1; expand_expr_stmt (fn); } @@ -932,7 +932,7 @@ expand_generic_desc (tdecl, type, fnname) } fn = build (CALL_EXPR, TREE_TYPE (TREE_TYPE (fn)), - decay_conversion (fn), elems, 0); + decay_conversion (fn), elems, NULL_TREE); TREE_SIDE_EFFECTS (fn) = 1; expand_expr_stmt (fn); } diff --git a/gcc/cp/search.c b/gcc/cp/search.c index ed97fc34617..d7db46bec35 100644 --- a/gcc/cp/search.c +++ b/gcc/cp/search.c @@ -2785,8 +2785,8 @@ expand_upcast_fixups (binfo, addr, orig_addr, vbase, vbase_addr, t, assemble_external (vtbl); aref = build_array_ref (vtbl, idx); naref = build_array_ref (nvtbl, idx); - old_delta = build_component_ref (aref, delta_identifier, 0, 0); - new_delta = build_component_ref (naref, delta_identifier, 0, 0); + old_delta = build_component_ref (aref, delta_identifier, NULL_TREE, 0); + new_delta = build_component_ref (naref, delta_identifier, NULL_TREE, 0); /* This is a upcast, so we have to add the offset for the virtual base. */ diff --git a/gcc/cp/sig.c b/gcc/cp/sig.c index a16321a598c..00f257efbd8 100644 --- a/gcc/cp/sig.c +++ b/gcc/cp/sig.c @@ -981,7 +981,7 @@ build_signature_method_call (basetype, instance, function, parms) if (flag_vtable_thunks) vfn = aref; else - vfn = build_component_ref (aref, pfn_identifier, 0, 0); + vfn = build_component_ref (aref, pfn_identifier, NULL_TREE, 0); TREE_TYPE (vfn) = build_pointer_type (TREE_TYPE (function)); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 11cc90da6fc..7a8ef461b1a 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -220,7 +220,7 @@ build_cplus_new (type, init) TREE_OPERAND (init, 0), TREE_OPERAND (init, 1), slot); TREE_SIDE_EFFECTS (rval) = 1; TREE_ADDRESSABLE (rval) = 1; - rval = build (TARGET_EXPR, type, slot, rval, 0); + rval = build (TARGET_EXPR, type, slot, rval, NULL_TREE); TREE_SIDE_EFFECTS (rval) = 1; TREE_ADDRESSABLE (rval) = 1; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 4b9b11eff70..88ce4dbe11a 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2242,12 +2242,11 @@ build_array_ref (array, idx) In the second case, TREE_PURPOSE (function) is the function's name directly. - DECL is the class instance variable, usually CURRENT_CLASS_DECL. */ + DECL is the class instance variable, usually CURRENT_CLASS_DECL. + + When calling a TEMPLATE_DECL, we don't require a complete return + type. */ -/* - * [eichin:19911015.1726EST] actually return a possibly incomplete - * type - */ tree build_x_function_call (function, params, decl) tree function, params, decl; @@ -2259,7 +2258,7 @@ build_x_function_call (function, params, decl) return error_mark_node; if (current_template_parms) - return build_min_nt (CALL_EXPR, function, params, 0); + return build_min_nt (CALL_EXPR, function, params, NULL_TREE); type = TREE_TYPE (function); @@ -2373,8 +2372,8 @@ build_x_function_call (function, params, decl) tree val = TREE_VALUE (function); if (TREE_CODE (val) == TEMPLATE_DECL) - return build_overload_call_maybe - (function, params, LOOKUP_COMPLAIN, (struct candidate *)0); + return build_overload_call_real + (function, params, LOOKUP_COMPLAIN, (struct candidate *)0, 0); else if (DECL_CHAIN (val) != NULL_TREE) return build_overload_call (function, params, LOOKUP_COMPLAIN, (struct candidate *)0); @@ -2484,11 +2483,11 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) fntype = TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (function)); index = save_expr (build_component_ref (function, index_identifier, - 0, 0)); + NULL_TREE, 0)); e1 = build (GT_EXPR, boolean_type_node, index, convert (delta_type_node, integer_zero_node)); delta = convert (ptrdiff_type_node, - build_component_ref (function, delta_identifier, 0, 0)); + build_component_ref (function, delta_identifier, NULL_TREE, 0)); delta2 = DELTA2_FROM_PTRMEMFUNC (function); /* convert down to the right base, before using the instance. */ @@ -2512,7 +2511,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) aref = save_expr (aref); delta = build_binary_op (PLUS_EXPR, - build_conditional_expr (e1, build_component_ref (aref, delta_identifier, 0, 0), integer_zero_node), + build_conditional_expr (e1, build_component_ref (aref, delta_identifier, NULL_TREE, 0), integer_zero_node), delta, 1); } @@ -2521,7 +2520,7 @@ get_member_function_from_ptrfunc (instance_ptrptr, function) if (flag_vtable_thunks) e2 = aref; else - e2 = build_component_ref (aref, pfn_identifier, 0, 0); + e2 = build_component_ref (aref, pfn_identifier, NULL_TREE, 0); e3 = PFN_FROM_PTRMEMFUNC (function); TREE_TYPE (e2) = TREE_TYPE (e3); @@ -3365,14 +3364,14 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) else if (TYPE_PTRMEMFUNC_P (type0) && TREE_CODE (op1) == INTEGER_CST && integer_zerop (op1)) { - op0 = build_component_ref (op0, index_identifier, 0, 0); + op0 = build_component_ref (op0, index_identifier, NULL_TREE, 0); op1 = integer_zero_node; result_type = TREE_TYPE (op0); } else if (TYPE_PTRMEMFUNC_P (type1) && TREE_CODE (op0) == INTEGER_CST && integer_zerop (op0)) { - op0 = build_component_ref (op1, index_identifier, 0, 0); + op0 = build_component_ref (op1, index_identifier, NULL_TREE, 0); op1 = integer_zero_node; result_type = TREE_TYPE (op0); } @@ -3386,8 +3385,8 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) && ((op1.index != -1 && op0.delta2 == op1.delta2) || op0.pfn == op1.pfn)) */ - tree index0 = build_component_ref (op0, index_identifier, 0, 0); - tree index1 = save_expr (build_component_ref (op1, index_identifier, 0, 0)); + tree index0 = build_component_ref (op0, index_identifier, NULL_TREE, 0); + tree index1 = save_expr (build_component_ref (op1, index_identifier, NULL_TREE, 0)); tree pfn0 = PFN_FROM_PTRMEMFUNC (op0); tree pfn1 = PFN_FROM_PTRMEMFUNC (op1); tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0); @@ -3408,7 +3407,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code) else if (TYPE_PTRMEMFUNC_P (type0) && TYPE_PTRMEMFUNC_FN_TYPE (type0) == type1) { - tree index0 = build_component_ref (op0, index_identifier, 0, 0); + tree index0 = build_component_ref (op0, index_identifier, NULL_TREE, 0); tree index1; tree pfn0 = PFN_FROM_PTRMEMFUNC (op0); tree delta20 = DELTA2_FROM_PTRMEMFUNC (op0); @@ -5909,7 +5908,7 @@ build_x_modify_expr (lhs, modifycode, rhs) { if (current_template_parms) return build_min_nt (MODOP_EXPR, lhs, - build_min_nt (modifycode, 0, 0), rhs); + build_min_nt (modifycode, NULL_TREE, NULL_TREE), rhs); if (modifycode != NOP_EXPR) { @@ -6024,9 +6023,9 @@ build_ptrmemfunc (type, pfn, force) if (TREE_CODE (pfn) != CONSTRUCTOR) { tree e1, e2, e3; - ndelta = convert (ptrdiff_type_node, build_component_ref (pfn, delta_identifier, 0, 0)); + ndelta = convert (ptrdiff_type_node, build_component_ref (pfn, delta_identifier, NULL_TREE, 0)); ndelta2 = convert (ptrdiff_type_node, DELTA2_FROM_PTRMEMFUNC (pfn)); - index = build_component_ref (pfn, index_identifier, 0, 0); + index = build_component_ref (pfn, index_identifier, NULL_TREE, 0); delta = get_delta_difference (TYPE_METHOD_BASETYPE (TREE_TYPE (TYPE_PTRMEMFUNC_FN_TYPE (TREE_TYPE (pfn)))), TYPE_METHOD_BASETYPE (TREE_TYPE (type)), force); @@ -6034,20 +6033,20 @@ build_ptrmemfunc (type, pfn, force) delta2 = build_binary_op (PLUS_EXPR, ndelta2, delta2, 1); e1 = fold (build (GT_EXPR, boolean_type_node, index, integer_zero_node)); - u = build_nt (CONSTRUCTOR, 0, tree_cons (delta2_identifier, delta2, NULL_TREE)); - u = build_nt (CONSTRUCTOR, 0, tree_cons (NULL_TREE, delta, - tree_cons (NULL_TREE, index, - tree_cons (NULL_TREE, u, NULL_TREE)))); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (delta2_identifier, delta2, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta, + tree_cons (NULL_TREE, index, + tree_cons (NULL_TREE, u, NULL_TREE)))); e2 = digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0); pfn = PFN_FROM_PTRMEMFUNC (pfn); npfn = build1 (NOP_EXPR, type, pfn); TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn); - u = build_nt (CONSTRUCTOR, 0, tree_cons (pfn_identifier, npfn, NULL_TREE)); - u = build_nt (CONSTRUCTOR, 0, tree_cons (NULL_TREE, delta, - tree_cons (NULL_TREE, index, - tree_cons (NULL_TREE, u, NULL_TREE)))); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (pfn_identifier, npfn, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta, + tree_cons (NULL_TREE, index, + tree_cons (NULL_TREE, u, NULL_TREE)))); e3 = digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0); return build_conditional_expr (e1, e2, e3); } @@ -6068,10 +6067,10 @@ build_ptrmemfunc (type, pfn, force) pfn = build1 (NOP_EXPR, type, npfn); TREE_CONSTANT (pfn) = TREE_CONSTANT (npfn); - u = build_nt (CONSTRUCTOR, 0, tree_cons (pfn_identifier, pfn, NULL_TREE)); - u = build_nt (CONSTRUCTOR, 0, tree_cons (NULL_TREE, delta, - tree_cons (NULL_TREE, nindex, - tree_cons (NULL_TREE, u, NULL_TREE)))); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (pfn_identifier, pfn, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta, + tree_cons (NULL_TREE, nindex, + tree_cons (NULL_TREE, u, NULL_TREE)))); e3 = digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0); return e3; } @@ -6086,10 +6085,10 @@ build_ptrmemfunc (type, pfn, force) if (integer_zerop (pfn)) { pfn = build_c_cast (type, integer_zero_node, 0); - u = build_nt (CONSTRUCTOR, 0, tree_cons (pfn_identifier, pfn, NULL_TREE)); - u = build_nt (CONSTRUCTOR, 0, tree_cons (NULL_TREE, integer_zero_node, - tree_cons (NULL_TREE, integer_zero_node, - tree_cons (NULL_TREE, u, NULL_TREE)))); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (pfn_identifier, pfn, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, integer_zero_node, + tree_cons (NULL_TREE, integer_zero_node, + tree_cons (NULL_TREE, u, NULL_TREE)))); return digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0); } @@ -6127,21 +6126,28 @@ build_ptrmemfunc (type, pfn, force) index = size_binop (PLUS_EXPR, DECL_VINDEX (TREE_OPERAND (pfn, 0)), integer_one_node); - u = build_nt (CONSTRUCTOR, 0, tree_cons (delta2_identifier, delta2, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (delta2_identifier, delta2, NULL_TREE)); } else { index = size_binop (MINUS_EXPR, integer_zero_node, integer_one_node); - npfn = build1 (NOP_EXPR, type, pfn); - TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn); + if (type == TREE_TYPE (pfn)) + { + npfn = pfn; + } + else + { + npfn = build1 (NOP_EXPR, type, pfn); + TREE_CONSTANT (npfn) = TREE_CONSTANT (pfn); + } - u = build_nt (CONSTRUCTOR, 0, tree_cons (pfn_identifier, npfn, NULL_TREE)); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (pfn_identifier, npfn, NULL_TREE)); } - u = build_nt (CONSTRUCTOR, 0, tree_cons (NULL_TREE, delta, - tree_cons (NULL_TREE, index, - tree_cons (NULL_TREE, u, NULL_TREE)))); + u = build_nt (CONSTRUCTOR, NULL_TREE, tree_cons (NULL_TREE, delta, + tree_cons (NULL_TREE, index, + tree_cons (NULL_TREE, u, NULL_TREE)))); return digest_init (TYPE_GET_PTRMEMFUNC_TYPE (type), u, (tree*)0); } diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index b0ea21cc117..602a092e0ae 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -873,11 +873,11 @@ digest_init (type, init, tail) else if (flag_traditional) /* Traditionally one can say `char x[100] = 0;'. */ return process_init_constructor (type, - build_nt (CONSTRUCTOR, 0, - tree_cons (0, init, 0)), - 0); + build_nt (CONSTRUCTOR, NULL_TREE, + tree_cons (NULL_TREE, init, NULL_TREE)), + (tree*)0); if (code != ARRAY_TYPE) - return convert_for_initialization (0, type, init, LOOKUP_NORMAL, + return convert_for_initialization (NULL_TREE, type, init, LOOKUP_NORMAL, "initialization", NULL_TREE, 0); }