Commit 5ffe581d by Jason Merrill Committed by Jason Merrill

cp-tree.def: Add WRAPPER.

	* cp-tree.def: Add WRAPPER.  USER_CONV now only has two ops.
	* cp-tree.h: Add WRAPPER support.
	* call.c (add_candidate): Split out from add_*_candidate fns.
	(build_over_call): Take the candidate instead of function and args.
	Enforce access control here.  Emit overload warnings here.
	(add_warning): New fn.
	(joust): Add WARN parm.  If not set, call add_warning instead of
	printing a warning.  Reenable some warnings.
	(tourney): Pass it.
	(convert_like): Adjust.
	(build_new_op): Adjust.
	(build_new_function_call): Adjust.
	(build_user_type_conversion_1): Adjust.
	(USER_CONV_FN): Adjust.
	* tree.c (build_expr_wrapper, build_expr_ptr_wrapper,
	build_int_wrapper): New fns.

From-SVN: r19393
parent 62441128
Thu Apr 23 21:19:06 1998 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.def: Add WRAPPER. USER_CONV now only has two ops.
* cp-tree.h: Add WRAPPER support.
* call.c (add_candidate): Split out from add_*_candidate fns.
(build_over_call): Take the candidate instead of function and args.
Enforce access control here. Emit overload warnings here.
(add_warning): New fn.
(joust): Add WARN parm. If not set, call add_warning instead of
printing a warning. Reenable some warnings.
(tourney): Pass it.
(convert_like): Adjust.
(build_new_op): Adjust.
(build_new_function_call): Adjust.
(build_user_type_conversion_1): Adjust.
(USER_CONV_FN): Adjust.
* tree.c (build_expr_wrapper, build_expr_ptr_wrapper,
build_int_wrapper): New fns.
Thu Apr 23 18:27:53 1998 Mark P. Mitchell <mmitchell@usa.net>
* pt.c (unify): Fix typo in previous change.
......
......@@ -173,6 +173,10 @@ DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", 'e', 2)
/* XXX: could recycle some of the common fields */
DEFTREECODE (CPLUS_BINDING, "binding", 'x', 2)
/* A generic wrapper for something not tree that we want to include in
tree structure. */
DEFTREECODE (WRAPPER, "wrapper", 'x', 1)
/* A whole bunch of tree codes for the initial, superficial parsing of
templates. */
DEFTREECODE (LOOKUP_EXPR, "lookup_expr", 'e', 2)
......@@ -208,6 +212,10 @@ DEFTREECODE (RETURN_INIT, "return_init", 'e', 2)
DEFTREECODE (TRY_BLOCK, "try_stmt", 'e', 2)
DEFTREECODE (HANDLER, "catch_stmt", 'e', 2)
DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
/* And some codes for expressing conversions for overload resolution. */
DEFTREECODE (IDENTITY_CONV, "identity_conv", 'e', 1)
DEFTREECODE (LVALUE_CONV, "lvalue_conv", 'e', 1)
DEFTREECODE (QUAL_CONV, "qual_conv", 'e', 1)
......@@ -216,12 +224,10 @@ DEFTREECODE (PTR_CONV, "ptr_conv", 'e', 1)
DEFTREECODE (PMEM_CONV, "pmem_conv", 'e', 1)
DEFTREECODE (BASE_CONV, "base_conv", 'e', 1)
DEFTREECODE (REF_BIND, "ref_bind", 'e', 1)
DEFTREECODE (USER_CONV, "user_conv", 'e', 4)
DEFTREECODE (USER_CONV, "user_conv", 'e', 2)
DEFTREECODE (AMBIG_CONV, "ambig_conv", 'e', 1)
DEFTREECODE (RVALUE_CONV, "rvalue_conv", 'e', 1)
DEFTREECODE (TAG_DEFN, "tag_defn", 'e', 0)
/*
Local variables:
mode:c
......
......@@ -73,6 +73,18 @@ struct tree_binding
tree value;
};
#define WRAPPER_PTR(NODE) (((struct tree_wrapper*)NODE)->u.ptr)
#define WRAPPER_INT(NODE) (((struct tree_wrapper*)NODE)->u.i)
struct tree_wrapper
{
char common[sizeof (struct tree_common)];
union {
void *ptr;
int i;
} u;
};
/* To identify to the debug emitters if it should pay attention to the
flag `-Wtemplate-debugging'. */
#define HAVE_TEMPLATES 1
......@@ -2624,6 +2636,9 @@ extern tree hack_decl_function_context PROTO((tree));
extern tree lvalue_type PROTO((tree));
extern tree error_type PROTO((tree));
extern tree make_temp_vec PROTO((int));
extern tree build_ptr_wrapper PROTO((void *));
extern tree build_expr_ptr_wrapper PROTO((void *));
extern tree build_int_wrapper PROTO((int));
extern int varargs_function_p PROTO((tree));
extern int really_overloaded_fn PROTO((tree));
extern int cp_tree_equal PROTO((tree, tree));
......
......@@ -5594,7 +5594,7 @@ template_decl_level (decl)
default:
my_friendly_abort (0);
break;
return 0;
}
}
......
......@@ -2141,6 +2141,41 @@ make_temp_vec (len)
return node;
}
/* Build a wrapper around some pointer PTR so we can use it as a tree. */
tree
build_ptr_wrapper (ptr)
void *ptr;
{
tree t = make_node (WRAPPER);
WRAPPER_PTR (t) = ptr;
return t;
}
/* Same, but on the expression_obstack. */
tree
build_expr_ptr_wrapper (ptr)
void *ptr;
{
tree t;
push_expression_obstack ();
t = build_ptr_wrapper (ptr);
pop_obstacks ();
return t;
}
/* Build a wrapper around some integer I so we can use it as a tree. */
tree
build_int_wrapper (i)
int i;
{
tree t = make_node (WRAPPER);
WRAPPER_INT (t) = i;
return t;
}
void
push_expression_obstack ()
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment