mirror of git://gcc.gnu.org/git/gcc.git
cp-tree.def (OVERLOAD): Fix comment.
* cp-tree.def (OVERLOAD): Fix comment. * cp-tree.h: Fix comments and whitespace. * error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope. * name-lookup.c (add_decl_to_level): Assert not class. (check_local_shadow): Use OVL_P. (pushdecl_with_scope_1): Rename to ... (do_pushdecl_with_Scope): ... here. (do_nonmember_using_decl): Use qualified_namespace_lookup return value. (push_class_level_binding_1): Use OVL_P. (pushdecl_namespace_level): Use do_pushdecl_with_scope. (pushtag_1): Rename to ... (do_pushtag): ... here. Adjust do_pushdecl_with_scope call. (pushtag): Adjust. (store_class_bindings): Do not time here. * name-lookup.h (pushdecl_outermost_localscope): Reorder. * pt.c (listify): Declare argvec at point of initialization. From-SVN: r248693
This commit is contained in:
parent
77d1dbdb4c
commit
5256a7f596
|
|
@ -1,5 +1,23 @@
|
||||||
2017-05-30 Nathan Sidwell <nathan@acm.org>
|
2017-05-30 Nathan Sidwell <nathan@acm.org>
|
||||||
|
|
||||||
|
* cp-tree.def (OVERLOAD): Fix comment.
|
||||||
|
* cp-tree.h: Fix comments and whitespace.
|
||||||
|
* error.c (dump_decl): Use pp_cxx_colon_colon, ovl_scope.
|
||||||
|
* name-lookup.c (add_decl_to_level): Assert not class.
|
||||||
|
(check_local_shadow): Use OVL_P.
|
||||||
|
(pushdecl_with_scope_1): Rename to ...
|
||||||
|
(do_pushdecl_with_Scope): ... here.
|
||||||
|
(do_nonmember_using_decl): Use qualified_namespace_lookup return
|
||||||
|
value.
|
||||||
|
(push_class_level_binding_1): Use OVL_P.
|
||||||
|
(pushdecl_namespace_level): Use do_pushdecl_with_scope.
|
||||||
|
(pushtag_1): Rename to ...
|
||||||
|
(do_pushtag): ... here. Adjust do_pushdecl_with_scope call.
|
||||||
|
(pushtag): Adjust.
|
||||||
|
(store_class_bindings): Do not time here.
|
||||||
|
* name-lookup.h (pushdecl_outermost_localscope): Reorder.
|
||||||
|
* pt.c (listify): Declare argvec at point of initialization.
|
||||||
|
|
||||||
PR c++/80913
|
PR c++/80913
|
||||||
* name-lookup.c (add_decl_to_level): Assert not making a circular
|
* name-lookup.c (add_decl_to_level): Assert not making a circular
|
||||||
chain.
|
chain.
|
||||||
|
|
|
||||||
|
|
@ -228,8 +228,7 @@ DEFTREECODE (DEFERRED_NOEXCEPT, "deferred_noexcept", tcc_exceptional, 0)
|
||||||
member template, the template may be an IDENTIFIER_NODE. */
|
member template, the template may be an IDENTIFIER_NODE. */
|
||||||
DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", tcc_expression, 2)
|
DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", tcc_expression, 2)
|
||||||
|
|
||||||
/* A list-like node for chaining overloading candidates. TREE_TYPE is
|
/* One of a set of overloaded functions. */
|
||||||
the original name, and the parameter is the FUNCTION_DECL. */
|
|
||||||
DEFTREECODE (OVERLOAD, "overload", tcc_exceptional, 0)
|
DEFTREECODE (OVERLOAD, "overload", tcc_exceptional, 0)
|
||||||
|
|
||||||
/* A pseudo-destructor, of the form "OBJECT.~DESTRUCTOR" or
|
/* A pseudo-destructor, of the form "OBJECT.~DESTRUCTOR" or
|
||||||
|
|
|
||||||
|
|
@ -692,7 +692,8 @@ struct GTY(()) tree_overload {
|
||||||
tree function;
|
tree function;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Iterator for a 1 dimensional overload. */
|
/* Iterator for a 1 dimensional overload. Permits iterating over the
|
||||||
|
outer level of a 2-d overload when explicitly enabled. */
|
||||||
|
|
||||||
class ovl_iterator
|
class ovl_iterator
|
||||||
{
|
{
|
||||||
|
|
@ -970,7 +971,7 @@ enum GTY(()) abstract_class_use {
|
||||||
(LANG_IDENTIFIER_CAST (NODE)->class_template_info)
|
(LANG_IDENTIFIER_CAST (NODE)->class_template_info)
|
||||||
|
|
||||||
/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
|
/* The IDENTIFIER_BINDING is the innermost cxx_binding for the
|
||||||
identifier. It's PREVIOUS is the next outermost binding. Each
|
identifier. Its PREVIOUS is the next outermost binding. Each
|
||||||
VALUE field is a DECL for the associated declaration. Thus,
|
VALUE field is a DECL for the associated declaration. Thus,
|
||||||
name lookup consists simply of pulling off the node at the front
|
name lookup consists simply of pulling off the node at the front
|
||||||
of the list (modulo oddities for looking up the names of types,
|
of the list (modulo oddities for looking up the names of types,
|
||||||
|
|
@ -1454,6 +1455,7 @@ union GTY((desc ("cp_tree_node_structure (&%h)"),
|
||||||
userdef_literal;
|
userdef_literal;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Global state. */
|
/* Global state. */
|
||||||
|
|
||||||
struct GTY(()) saved_scope {
|
struct GTY(()) saved_scope {
|
||||||
|
|
@ -2496,9 +2498,9 @@ struct GTY(()) lang_decl_fn {
|
||||||
unsigned static_function : 1;
|
unsigned static_function : 1;
|
||||||
unsigned pure_virtual : 1;
|
unsigned pure_virtual : 1;
|
||||||
unsigned defaulted_p : 1;
|
unsigned defaulted_p : 1;
|
||||||
|
|
||||||
unsigned has_in_charge_parm_p : 1;
|
unsigned has_in_charge_parm_p : 1;
|
||||||
unsigned has_vtt_parm_p : 1;
|
unsigned has_vtt_parm_p : 1;
|
||||||
|
|
||||||
unsigned pending_inline_p : 1;
|
unsigned pending_inline_p : 1;
|
||||||
unsigned nonconverting : 1;
|
unsigned nonconverting : 1;
|
||||||
unsigned thunk_p : 1;
|
unsigned thunk_p : 1;
|
||||||
|
|
|
||||||
|
|
@ -1146,7 +1146,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
|
||||||
|
|
||||||
case SCOPE_REF:
|
case SCOPE_REF:
|
||||||
dump_type (pp, TREE_OPERAND (t, 0), flags);
|
dump_type (pp, TREE_OPERAND (t, 0), flags);
|
||||||
pp_colon_colon (pp);
|
pp_cxx_colon_colon (pp);
|
||||||
dump_decl (pp, TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME);
|
dump_decl (pp, TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1193,8 +1193,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
|
||||||
case OVERLOAD:
|
case OVERLOAD:
|
||||||
if (!OVL_SINGLE_P (t))
|
if (!OVL_SINGLE_P (t))
|
||||||
{
|
{
|
||||||
t = OVL_FIRST (t);
|
tree ctx = ovl_scope (t);
|
||||||
tree ctx = CP_DECL_CONTEXT (t);
|
|
||||||
if (ctx != global_namespace)
|
if (ctx != global_namespace)
|
||||||
{
|
{
|
||||||
if (TYPE_P (ctx))
|
if (TYPE_P (ctx))
|
||||||
|
|
@ -1203,7 +1202,7 @@ dump_decl (cxx_pretty_printer *pp, tree t, int flags)
|
||||||
dump_decl (pp, ctx, flags);
|
dump_decl (pp, ctx, flags);
|
||||||
pp_cxx_colon_colon (pp);
|
pp_cxx_colon_colon (pp);
|
||||||
}
|
}
|
||||||
dump_decl (pp, DECL_NAME (t), flags);
|
dump_decl (pp, OVL_NAME (t), flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,13 +120,12 @@ find_namespace_value (tree ns, tree name)
|
||||||
static void
|
static void
|
||||||
add_decl_to_level (cp_binding_level *b, tree decl)
|
add_decl_to_level (cp_binding_level *b, tree decl)
|
||||||
{
|
{
|
||||||
/* We used to record virtual tables as if they were ordinary
|
gcc_assert (b->kind != sk_class);
|
||||||
variables, but no longer do so. */
|
|
||||||
gcc_assert (!(VAR_P (decl) && DECL_VIRTUAL_P (decl)));
|
|
||||||
|
|
||||||
if (TREE_CODE (decl) == NAMESPACE_DECL
|
if (TREE_CODE (decl) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (decl))
|
||||||
&& !DECL_NAMESPACE_ALIAS (decl))
|
|
||||||
{
|
{
|
||||||
|
/* Inner namespaces get their own chain, to make walking
|
||||||
|
simpler. */
|
||||||
DECL_CHAIN (decl) = b->namespaces;
|
DECL_CHAIN (decl) = b->namespaces;
|
||||||
b->namespaces = decl;
|
b->namespaces = decl;
|
||||||
}
|
}
|
||||||
|
|
@ -2132,8 +2131,7 @@ check_local_shadow (tree decl)
|
||||||
|
|
||||||
/* Warn if a variable shadows a non-function, or the variable
|
/* Warn if a variable shadows a non-function, or the variable
|
||||||
is a function or a pointer-to-function. */
|
is a function or a pointer-to-function. */
|
||||||
if ((TREE_CODE (member) != FUNCTION_DECL
|
if (!OVL_P (member)
|
||||||
&& TREE_CODE (member) != OVERLOAD)
|
|
||||||
|| TREE_CODE (decl) == FUNCTION_DECL
|
|| TREE_CODE (decl) == FUNCTION_DECL
|
||||||
|| TYPE_PTRFN_P (TREE_TYPE (decl))
|
|| TYPE_PTRFN_P (TREE_TYPE (decl))
|
||||||
|| TYPE_PTRMEMFUNC_P (TREE_TYPE (decl)))
|
|| TYPE_PTRMEMFUNC_P (TREE_TYPE (decl)))
|
||||||
|
|
@ -3328,7 +3326,7 @@ push_using_decl (tree scope, tree name)
|
||||||
closer binding level than LEVEL. */
|
closer binding level than LEVEL. */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
pushdecl_with_scope_1 (tree x, cp_binding_level *level, bool is_friend)
|
do_pushdecl_with_scope (tree x, cp_binding_level *level, bool is_friend)
|
||||||
{
|
{
|
||||||
cp_binding_level *b;
|
cp_binding_level *b;
|
||||||
tree function_decl = current_function_decl;
|
tree function_decl = current_function_decl;
|
||||||
|
|
@ -3365,7 +3363,7 @@ pushdecl_outermost_localscope (tree x)
|
||||||
n->kind != sk_function_parms; n = b->level_chain)
|
n->kind != sk_function_parms; n = b->level_chain)
|
||||||
b = n;
|
b = n;
|
||||||
|
|
||||||
tree ret = b ? pushdecl_with_scope_1 (x, b, false) : error_mark_node;
|
tree ret = b ? do_pushdecl_with_scope (x, b, false) : error_mark_node;
|
||||||
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -3436,10 +3434,6 @@ do_nonmember_using_decl (tree scope, tree name, tree *value_p, tree *type_p)
|
||||||
name_lookup lookup (name, 0);
|
name_lookup lookup (name, 0);
|
||||||
|
|
||||||
if (!qualified_namespace_lookup (scope, &lookup))
|
if (!qualified_namespace_lookup (scope, &lookup))
|
||||||
/* Lookup error */
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!lookup.value)
|
|
||||||
{
|
{
|
||||||
error ("%qD not declared", name);
|
error ("%qD not declared", name);
|
||||||
return;
|
return;
|
||||||
|
|
@ -4062,7 +4056,7 @@ push_class_level_binding_1 (tree name, tree x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (TREE_CODE (target_decl) == OVERLOAD
|
else if (TREE_CODE (target_decl) == OVERLOAD
|
||||||
&& is_overloaded_fn (target_bval))
|
&& OVL_P (target_bval))
|
||||||
old_decl = bval;
|
old_decl = bval;
|
||||||
else if (TREE_CODE (decl) == USING_DECL
|
else if (TREE_CODE (decl) == USING_DECL
|
||||||
&& TREE_CODE (bval) == USING_DECL
|
&& TREE_CODE (bval) == USING_DECL
|
||||||
|
|
@ -4077,10 +4071,10 @@ push_class_level_binding_1 (tree name, tree x)
|
||||||
&& DECL_DEPENDENT_P (bval))
|
&& DECL_DEPENDENT_P (bval))
|
||||||
return true;
|
return true;
|
||||||
else if (TREE_CODE (decl) == USING_DECL
|
else if (TREE_CODE (decl) == USING_DECL
|
||||||
&& is_overloaded_fn (target_bval))
|
&& OVL_P (target_bval))
|
||||||
old_decl = bval;
|
old_decl = bval;
|
||||||
else if (TREE_CODE (bval) == USING_DECL
|
else if (TREE_CODE (bval) == USING_DECL
|
||||||
&& is_overloaded_fn (target_decl))
|
&& OVL_P (target_decl))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (old_decl && binding->scope == class_binding_level)
|
if (old_decl && binding->scope == class_binding_level)
|
||||||
|
|
@ -4544,7 +4538,7 @@ pushdecl_namespace_level (tree x, bool is_friend)
|
||||||
tree t;
|
tree t;
|
||||||
|
|
||||||
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
||||||
t = pushdecl_with_scope_1
|
t = do_pushdecl_with_scope
|
||||||
(x, NAMESPACE_LEVEL (current_namespace), is_friend);
|
(x, NAMESPACE_LEVEL (current_namespace), is_friend);
|
||||||
|
|
||||||
/* Now, the type_shadowed stack may screw us. Munge it so it does
|
/* Now, the type_shadowed stack may screw us. Munge it so it does
|
||||||
|
|
@ -5627,12 +5621,11 @@ maybe_process_template_type_declaration (tree type, int is_friend,
|
||||||
Returns TYPE upon success and ERROR_MARK_NODE otherwise. */
|
Returns TYPE upon success and ERROR_MARK_NODE otherwise. */
|
||||||
|
|
||||||
static tree
|
static tree
|
||||||
pushtag_1 (tree name, tree type, tag_scope scope)
|
do_pushtag (tree name, tree type, tag_scope scope)
|
||||||
{
|
{
|
||||||
cp_binding_level *b;
|
|
||||||
tree decl;
|
tree decl;
|
||||||
|
|
||||||
b = current_binding_level;
|
cp_binding_level *b = current_binding_level;
|
||||||
while (/* Cleanup scopes are not scopes from the point of view of
|
while (/* Cleanup scopes are not scopes from the point of view of
|
||||||
the language. */
|
the language. */
|
||||||
b->kind == sk_cleanup
|
b->kind == sk_cleanup
|
||||||
|
|
@ -5721,7 +5714,7 @@ pushtag_1 (tree name, tree type, tag_scope scope)
|
||||||
}
|
}
|
||||||
else if (b->kind != sk_template_parms)
|
else if (b->kind != sk_template_parms)
|
||||||
{
|
{
|
||||||
decl = pushdecl_with_scope_1 (decl, b, /*is_friend=*/false);
|
decl = do_pushdecl_with_scope (decl, b, /*is_friend=*/false);
|
||||||
if (decl == error_mark_node)
|
if (decl == error_mark_node)
|
||||||
return decl;
|
return decl;
|
||||||
|
|
||||||
|
|
@ -5783,14 +5776,14 @@ pushtag_1 (tree name, tree type, tag_scope scope)
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wrapper for pushtag_1. */
|
/* Wrapper for do_pushtag. */
|
||||||
|
|
||||||
tree
|
tree
|
||||||
pushtag (tree name, tree type, tag_scope scope)
|
pushtag (tree name, tree type, tag_scope scope)
|
||||||
{
|
{
|
||||||
tree ret;
|
tree ret;
|
||||||
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
||||||
ret = pushtag_1 (name, type, scope);
|
ret = do_pushtag (name, type, scope);
|
||||||
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -5879,7 +5872,6 @@ store_class_bindings (vec<cp_class_binding, va_gc> *names,
|
||||||
size_t i;
|
size_t i;
|
||||||
cp_class_binding *cb;
|
cp_class_binding *cb;
|
||||||
|
|
||||||
bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
|
|
||||||
for (i = 0; vec_safe_iterate (names, i, &cb); ++i)
|
for (i = 0; vec_safe_iterate (names, i, &cb); ++i)
|
||||||
if (store_binding_p (cb->identifier))
|
if (store_binding_p (cb->identifier))
|
||||||
bindings_need_stored.safe_push (cb->identifier);
|
bindings_need_stored.safe_push (cb->identifier);
|
||||||
|
|
@ -5891,7 +5883,6 @@ store_class_bindings (vec<cp_class_binding, va_gc> *names,
|
||||||
store_binding (id, old_bindings);
|
store_binding (id, old_bindings);
|
||||||
bindings_need_stored.truncate (0);
|
bindings_need_stored.truncate (0);
|
||||||
}
|
}
|
||||||
timevar_cond_stop (TV_NAME_LOOKUP, subtime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A chain of saved_scope structures awaiting reuse. */
|
/* A chain of saved_scope structures awaiting reuse. */
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ struct GTY(()) cp_binding_level {
|
||||||
/* A list of USING_DECL nodes. */
|
/* A list of USING_DECL nodes. */
|
||||||
tree usings;
|
tree usings;
|
||||||
|
|
||||||
|
|
||||||
/* Using directives. */
|
/* Using directives. */
|
||||||
vec<tree, va_gc> *using_directives;
|
vec<tree, va_gc> *using_directives;
|
||||||
|
|
||||||
|
|
@ -331,8 +330,8 @@ extern void finish_namespace_using_decl (tree, tree, tree);
|
||||||
extern void finish_local_using_decl (tree, tree, tree);
|
extern void finish_local_using_decl (tree, tree, tree);
|
||||||
extern void finish_namespace_using_directive (tree, tree);
|
extern void finish_namespace_using_directive (tree, tree);
|
||||||
extern void finish_local_using_directive (tree, tree);
|
extern void finish_local_using_directive (tree, tree);
|
||||||
extern tree pushdecl_outermost_localscope (tree);
|
|
||||||
extern tree pushdecl (tree, bool is_friend = false);
|
extern tree pushdecl (tree, bool is_friend = false);
|
||||||
|
extern tree pushdecl_outermost_localscope (tree);
|
||||||
extern tree pushdecl_top_level (tree, bool is_friend = false);
|
extern tree pushdecl_top_level (tree, bool is_friend = false);
|
||||||
extern tree pushdecl_top_level_and_finish (tree, tree);
|
extern tree pushdecl_top_level_and_finish (tree, tree);
|
||||||
extern tree pushtag (tree, tree, tag_scope);
|
extern tree pushtag (tree, tree, tag_scope);
|
||||||
|
|
|
||||||
|
|
@ -24788,15 +24788,16 @@ static tree
|
||||||
listify (tree arg)
|
listify (tree arg)
|
||||||
{
|
{
|
||||||
tree std_init_list = get_namespace_binding (std_node, init_list_identifier);
|
tree std_init_list = get_namespace_binding (std_node, init_list_identifier);
|
||||||
tree argvec;
|
|
||||||
if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list))
|
if (!std_init_list || !DECL_CLASS_TEMPLATE_P (std_init_list))
|
||||||
{
|
{
|
||||||
error ("deducing from brace-enclosed initializer list requires "
|
error ("deducing from brace-enclosed initializer list requires "
|
||||||
"#include <initializer_list>");
|
"#include <initializer_list>");
|
||||||
return error_mark_node;
|
return error_mark_node;
|
||||||
}
|
}
|
||||||
argvec = make_tree_vec (1);
|
tree argvec = make_tree_vec (1);
|
||||||
TREE_VEC_ELT (argvec, 0) = arg;
|
TREE_VEC_ELT (argvec, 0) = arg;
|
||||||
|
|
||||||
return lookup_template_class (std_init_list, argvec, NULL_TREE,
|
return lookup_template_class (std_init_list, argvec, NULL_TREE,
|
||||||
NULL_TREE, 0, tf_warning_or_error);
|
NULL_TREE, 0, tf_warning_or_error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue