Some random cleanups. Mainly fixing stale comments and awkward
whitespacing. Rename some name-lookup internal workers to the do_FOO form.
natan
--
Nathan Sidwell
2017-05-30 Nathan Sidwell
* 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.
Index: cp-tree.def
===
--- cp-tree.def (revision 248689)
+++ cp-tree.def (working copy)
@@ -228,8 +228,7 @@ DEFTREECODE (DEFERRED_NOEXCEPT, "deferre
member template, the template may be an IDENTIFIER_NODE. */
DEFTREECODE (TEMPLATE_ID_EXPR, "template_id_expr", tcc_expression, 2)
-/* A list-like node for chaining overloading candidates. TREE_TYPE is
- the original name, and the parameter is the FUNCTION_DECL. */
+/* One of a set of overloaded functions. */
DEFTREECODE (OVERLOAD, "overload", tcc_exceptional, 0)
/* A pseudo-destructor, of the form "OBJECT.~DESTRUCTOR" or
Index: cp-tree.h
===
--- cp-tree.h (revision 248689)
+++ cp-tree.h (working copy)
@@ -692,7 +692,8 @@ struct GTY(()) tree_overload {
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
{
@@ -970,7 +971,7 @@ enum GTY(()) abstract_class_use {
(LANG_IDENTIFIER_CAST (NODE)->class_template_info)
/* 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,
name lookup consists simply of pulling off the node at the front
of the list (modulo oddities for looking up the names of types,
@@ -1454,6 +1455,7 @@ union GTY((desc ("cp_tree_node_structure
userdef_literal;
};
+
/* Global state. */
struct GTY(()) saved_scope {
@@ -2496,9 +2498,9 @@ struct GTY(()) lang_decl_fn {
unsigned static_function : 1;
unsigned pure_virtual : 1;
unsigned defaulted_p : 1;
-
unsigned has_in_charge_parm_p : 1;
unsigned has_vtt_parm_p : 1;
+
unsigned pending_inline_p : 1;
unsigned nonconverting : 1;
unsigned thunk_p : 1;
Index: error.c
===
--- error.c (revision 248689)
+++ error.c (working copy)
@@ -1146,7 +1146,7 @@ dump_decl (cxx_pretty_printer *pp, tree
case SCOPE_REF:
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);
break;
@@ -1193,8 +1193,7 @@ dump_decl (cxx_pretty_printer *pp, tree
case OVERLOAD:
if (!OVL_SINGLE_P (t))
{
- t = OVL_FIRST (t);
- tree ctx = CP_DECL_CONTEXT (t);
+ tree ctx = ovl_scope (t);
if (ctx != global_namespace)
{
if (TYPE_P (ctx))
@@ -1203,7 +1202,7 @@ dump_decl (cxx_pretty_printer *pp, tree
dump_decl (pp, ctx, flags);
pp_cxx_colon_colon (pp);
}
- dump_decl (pp, DECL_NAME (t), flags);
+ dump_decl (pp, OVL_NAME (t), flags);
break;
}
Index: name-lookup.c
===
--- name-lookup.c (revision 248689)
+++ name-lookup.c (working copy)
@@ -120,13 +120,12 @@ find_namespace_value (tree ns, tree name
static void
add_decl_to_level (cp_binding_level *b, tree decl)
{
- /* We used to record virtual tables as if they were ordinary
- variables, but no longer do so. */
- gcc_assert (!(VAR_P (decl) && DECL_VIRTUAL_P (decl)));
+ gcc_assert (b->kind != sk_class);
- if (TREE_CODE (decl) == NAMESPACE_DECL
- && !DECL_NAMESPACE_ALIAS (decl))
+ if (TREE_CODE (decl) == NAMESPACE_DECL && !DECL_NAMESPACE_ALIAS (decl))
{
+ /* Inner namespaces get their own chain, to make walking
+ simpler. */
DECL_CHAIN (decl) = b->namespaces;
b->namespaces = decl;
}
@@ -2132,8 +2131,7 @@ check_local_shadow (tree decl)
/* Warn if a variable shadows a non-function, or the variable
is a function or a pointer-to-function. */
- if ((TREE_CODE (member) != FUNCTION_DECL
- && TREE_CODE (member) != OVERLOAD)