Commit 60f80e65 by Nathan Sidwell Committed by Nathan Sidwell

call.c (add_candidates): Move decls to initialization.

	* call.c (add_candidates): Move decls to initialization.  Don't
	use !!.

From-SVN: r250434
parent 048f0471
2017-07-21 Nathan Sidwell <nathan@acm.org>
* call.c (add_candidates): Move decls to initialization. Don't
use !!.
2017-07-20 Nathan Sidwell <nathan@acm.org> 2017-07-20 Nathan Sidwell <nathan@acm.org>
Remove TYPE_METHODS. Remove TYPE_METHODS.
......
...@@ -5423,8 +5423,8 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5423,8 +5423,8 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
{ {
tree ctype; tree ctype;
const vec<tree, va_gc> *non_static_args; const vec<tree, va_gc> *non_static_args;
bool check_list_ctor; bool check_list_ctor = false;
bool check_converting; bool check_converting = false;
unification_kind_t strict; unification_kind_t strict;
if (!fns) if (!fns)
...@@ -5435,7 +5435,7 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5435,7 +5435,7 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
if (DECL_CONV_FN_P (fn)) if (DECL_CONV_FN_P (fn))
{ {
check_list_ctor = false; check_list_ctor = false;
check_converting = !!(flags & LOOKUP_ONLYCONVERTING); check_converting = (flags & LOOKUP_ONLYCONVERTING) != 0;
if (flags & LOOKUP_NO_CONVERSION) if (flags & LOOKUP_NO_CONVERSION)
/* We're doing return_type(x). */ /* We're doing return_type(x). */
strict = DEDUCE_CONV; strict = DEDUCE_CONV;
...@@ -5452,18 +5452,13 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5452,18 +5452,13 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
{ {
if (DECL_CONSTRUCTOR_P (fn)) if (DECL_CONSTRUCTOR_P (fn))
{ {
check_list_ctor = !!(flags & LOOKUP_LIST_ONLY); check_list_ctor = (flags & LOOKUP_LIST_ONLY) != 0;
/* For list-initialization we consider explicit constructors /* For list-initialization we consider explicit constructors
and complain if one is chosen. */ and complain if one is chosen. */
check_converting check_converting
= ((flags & (LOOKUP_ONLYCONVERTING|LOOKUP_LIST_INIT_CTOR)) = ((flags & (LOOKUP_ONLYCONVERTING|LOOKUP_LIST_INIT_CTOR))
== LOOKUP_ONLYCONVERTING); == LOOKUP_ONLYCONVERTING);
} }
else
{
check_list_ctor = false;
check_converting = false;
}
strict = DEDUCE_CALL; strict = DEDUCE_CALL;
ctype = conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE; ctype = conversion_path ? BINFO_TYPE (conversion_path) : NULL_TREE;
} }
...@@ -5476,9 +5471,6 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5476,9 +5471,6 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
for (lkp_iterator iter (fns); iter; ++iter) for (lkp_iterator iter (fns); iter; ++iter)
{ {
tree fn_first_arg;
const vec<tree, va_gc> *fn_args;
fn = *iter; fn = *iter;
if (check_converting && DECL_NONCONVERTING_P (fn)) if (check_converting && DECL_NONCONVERTING_P (fn))
...@@ -5486,10 +5478,13 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5486,10 +5478,13 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
if (check_list_ctor && !is_list_ctor (fn)) if (check_list_ctor && !is_list_ctor (fn))
continue; continue;
/* Figure out which set of arguments to use. */ tree fn_first_arg = NULL_TREE;
const vec<tree, va_gc> *fn_args = args;
if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn)) if (DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
{ {
/* If this function is a non-static member and we didn't get an /* Figure out where the object arg comes from. If this
function is a non-static member and we didn't get an
implicit object argument, move it out of args. */ implicit object argument, move it out of args. */
if (first_arg == NULL_TREE) if (first_arg == NULL_TREE)
{ {
...@@ -5506,12 +5501,6 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args, ...@@ -5506,12 +5501,6 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
fn_first_arg = first_arg; fn_first_arg = first_arg;
fn_args = non_static_args; fn_args = non_static_args;
} }
else
{
/* Otherwise, just use the list of arguments provided. */
fn_first_arg = NULL_TREE;
fn_args = args;
}
if (TREE_CODE (fn) == TEMPLATE_DECL) if (TREE_CODE (fn) == TEMPLATE_DECL)
add_template_candidate (candidates, add_template_candidate (candidates,
......
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