aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c89
1 files changed, 62 insertions, 27 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index f9dd6de..e489cae 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -552,7 +552,7 @@ poplevel (int keep, int reverse, int functionbody)
unsigned ix;
cp_label_binding *label_bind;
- timevar_push (TV_NAME_LOOKUP);
+ timevar_start (TV_NAME_LOOKUP);
restart:
block = NULL_TREE;
@@ -815,7 +815,8 @@ poplevel (int keep, int reverse, int functionbody)
if (kind == sk_cleanup)
goto restart;
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, block);
+ timevar_stop (TV_NAME_LOOKUP);
+ return block;
}
/* Walk all the namespaces contained NAMESPACE, including NAMESPACE
@@ -899,7 +900,7 @@ push_local_name (tree decl)
size_t i, nelts;
tree t, name;
- timevar_push (TV_NAME_LOOKUP);
+ timevar_start (TV_NAME_LOOKUP);
name = DECL_NAME (decl);
@@ -918,13 +919,13 @@ push_local_name (tree decl)
DECL_DISCRIMINATOR (decl) = 1;
VEC_replace (tree, local_names, i, decl);
- timevar_pop (TV_NAME_LOOKUP);
+ timevar_stop (TV_NAME_LOOKUP);
return;
}
}
VEC_safe_push (tree, gc, local_names, decl);
- timevar_pop (TV_NAME_LOOKUP);
+ timevar_stop (TV_NAME_LOOKUP);
}
/* Subroutine of duplicate_decls: return truthvalue of whether
@@ -2535,26 +2536,37 @@ make_label_decl (tree id, int local_p)
be found, create one. (We keep track of used, but undefined,
labels, and complain about them at the end of a function.) */
-tree
-lookup_label (tree id)
+static tree
+lookup_label_1 (tree id)
{
tree decl;
- timevar_push (TV_NAME_LOOKUP);
/* You can't use labels at global scope. */
if (current_function_decl == NULL_TREE)
{
error ("label %qE referenced outside of any function", id);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, NULL_TREE);
+ return NULL_TREE;
}
/* See if we've already got this label. */
decl = IDENTIFIER_LABEL_VALUE (id);
if (decl != NULL_TREE && DECL_CONTEXT (decl) == current_function_decl)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ return decl;
decl = make_label_decl (id, /*local_p=*/0);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ return decl;
+}
+
+/* Wrapper for lookup_label_1. */
+
+tree
+lookup_label (tree id)
+{
+ tree ret;
+ bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
+ ret = lookup_label_1 (id);
+ timevar_cond_stop (TV_NAME_LOOKUP, subtime);
+ return ret;
}
/* Declare a local label named ID. */
@@ -2827,15 +2839,13 @@ check_omp_return (void)
/* Define a label, specifying the location in the source file.
Return the LABEL_DECL node for the label. */
-tree
-define_label (location_t location, tree name)
+static tree
+define_label_1 (location_t location, tree name)
{
struct named_label_entry *ent, dummy;
struct cp_binding_level *p;
tree decl;
- timevar_push (TV_NAME_LOOKUP);
-
decl = lookup_label (name);
dummy.label_decl = decl;
@@ -2855,7 +2865,7 @@ define_label (location_t location, tree name)
if (DECL_INITIAL (decl) != NULL_TREE)
{
error ("duplicate label %qD", decl);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
else
{
@@ -2874,9 +2884,22 @@ define_label (location_t location, tree name)
ent->uses = NULL;
}
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
+ return decl;
}
+/* Wrapper for define_label_1. */
+
+tree
+define_label (location_t location, tree name)
+{
+ tree ret;
+ timevar_start (TV_NAME_LOOKUP);
+ ret = define_label_1 (location, name);
+ timevar_stop (TV_NAME_LOOKUP);
+ return ret;
+}
+
+
struct cp_switch
{
struct cp_binding_level *level;
@@ -11262,16 +11285,14 @@ lookup_and_check_tag (enum tag_types tag_code, tree name,
TEMPLATE_HEADER_P is true when this declaration is preceded by
a set of template parameters. */
-tree
-xref_tag (enum tag_types tag_code, tree name,
- tag_scope scope, bool template_header_p)
+static tree
+xref_tag_1 (enum tag_types tag_code, tree name,
+ tag_scope scope, bool template_header_p)
{
enum tree_code code;
tree t;
tree context = NULL_TREE;
- timevar_push (TV_NAME_LOOKUP);
-
gcc_assert (TREE_CODE (name) == IDENTIFIER_NODE);
switch (tag_code)
@@ -11299,7 +11320,7 @@ xref_tag (enum tag_types tag_code, tree name,
scope, template_header_p);
if (t == error_mark_node)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
if (scope != ts_current && t && current_class_type
&& template_class_depth (current_class_type)
@@ -11354,7 +11375,7 @@ xref_tag (enum tag_types tag_code, tree name,
if (code == ENUMERAL_TYPE)
{
error ("use of enum %q#D without previous declaration", name);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
else
{
@@ -11368,7 +11389,7 @@ xref_tag (enum tag_types tag_code, tree name,
if (template_header_p && MAYBE_CLASS_TYPE_P (t))
{
if (!redeclare_class_template (t, current_template_parms))
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
else if (!processing_template_decl
&& CLASS_TYPE_P (t)
@@ -11376,7 +11397,7 @@ xref_tag (enum tag_types tag_code, tree name,
{
error ("redeclaration of %qT as a non-template", t);
error ("previous declaration %q+D", t);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
/* Make injected friend class visible. */
@@ -11394,9 +11415,23 @@ xref_tag (enum tag_types tag_code, tree name,
}
}
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ return t;
+}
+
+/* Wrapper for xref_tag_1. */
+
+tree
+xref_tag (enum tag_types tag_code, tree name,
+ tag_scope scope, bool template_header_p)
+{
+ tree ret;
+ timevar_start (TV_NAME_LOOKUP);
+ ret = xref_tag_1 (tag_code, name, scope, template_header_p);
+ timevar_stop (TV_NAME_LOOKUP);
+ return ret;
}
+
tree
xref_tag_from_type (tree old, tree id, tag_scope scope)
{