summaryrefslogtreecommitdiff
path: root/gcc/cp/pt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/pt.c')
-rw-r--r--gcc/cp/pt.c85
1 files changed, 58 insertions, 27 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 481306f5f7f..b56ab1f1abd 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -6682,13 +6682,9 @@ maybe_get_template_decl_from_type_decl (tree decl)
that we want to avoid. It also causes some problems with argument
coercion (see convert_nontype_argument for more information on this). */
-tree
-lookup_template_class (tree d1,
- tree arglist,
- tree in_decl,
- tree context,
- int entering_scope,
- tsubst_flags_t complain)
+static tree
+lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
+ int entering_scope, tsubst_flags_t complain)
{
tree templ = NULL_TREE, parmlist;
tree t;
@@ -6697,8 +6693,6 @@ lookup_template_class (tree d1,
spec_entry elt;
hashval_t hash;
- timevar_push (TV_NAME_LOOKUP);
-
if (TREE_CODE (d1) == IDENTIFIER_NODE)
{
tree value = innermost_non_namespace_value (d1);
@@ -6751,7 +6745,7 @@ lookup_template_class (tree d1,
{
if (complain & tf_error)
error ("%qT is not a template", d1);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
if (TREE_CODE (templ) != TEMPLATE_DECL
@@ -6766,7 +6760,7 @@ lookup_template_class (tree d1,
if (in_decl)
error ("for template declaration %q+D", in_decl);
}
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
complain &= ~tf_user;
@@ -6816,10 +6810,10 @@ lookup_template_class (tree d1,
if (arglist2 == error_mark_node
|| (!uses_template_parms (arglist2)
&& check_instantiated_args (templ, arglist2, complain)))
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
parm = bind_template_template_parm (TREE_TYPE (templ), arglist2);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, parm);
+ return parm;
}
else
{
@@ -6895,7 +6889,7 @@ lookup_template_class (tree d1,
{
/* Restore the ARGLIST to its full size. */
TREE_VEC_LENGTH (arglist) = saved_depth;
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
}
SET_TMPL_ARGS_LEVEL (bound_args, i, a);
@@ -6923,7 +6917,7 @@ lookup_template_class (tree d1,
if (arglist == error_mark_node)
/* We were unable to bind the arguments. */
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
/* In the scope of a template class, explicit references to the
template class refer to the type of the template, not any
@@ -6939,7 +6933,7 @@ lookup_template_class (tree d1,
/* comp_template_args is expensive, check it last. */
&& comp_template_args (TYPE_TI_ARGS (template_type),
arglist))
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, template_type);
+ return template_type;
/* If we already have this specialization, return it. */
elt.tmpl = gen_tmpl;
@@ -6949,7 +6943,7 @@ lookup_template_class (tree d1,
&elt, hash);
if (entry)
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, entry->spec);
+ return entry->spec;
is_dependent_type = uses_template_parms (arglist);
@@ -6959,7 +6953,7 @@ lookup_template_class (tree d1,
&& check_instantiated_args (gen_tmpl,
INNERMOST_TEMPLATE_ARGS (arglist),
complain))
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
+ return error_mark_node;
if (!is_dependent_type
&& !PRIMARY_TEMPLATE_P (gen_tmpl)
@@ -6969,7 +6963,7 @@ lookup_template_class (tree d1,
found = xref_tag_from_type (TREE_TYPE (gen_tmpl),
DECL_NAME (gen_tmpl),
/*tag_scope=*/ts_global);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
+ return found;
}
context = tsubst (DECL_CONTEXT (gen_tmpl), arglist,
@@ -7162,9 +7156,22 @@ lookup_template_class (tree d1,
TREE_PUBLIC (type_decl) = 1;
determine_visibility (type_decl);
- POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
+ return t;
}
- timevar_pop (TV_NAME_LOOKUP);
+}
+
+/* Wrapper for lookup_template_class_1. */
+
+tree
+lookup_template_class (tree d1, tree arglist, tree in_decl, tree context,
+ int entering_scope, tsubst_flags_t complain)
+{
+ tree ret;
+ timevar_push (TV_TEMPLATE_INST);
+ ret = lookup_template_class_1 (d1, arglist, in_decl, context,
+ entering_scope, complain);
+ timevar_pop (TV_TEMPLATE_INST);
+ return ret;
}
struct pair_fn_data
@@ -8102,8 +8109,8 @@ perform_typedefs_access_check (tree tmpl, tree targs)
input_location = saved_location;
}
-tree
-instantiate_class_template (tree type)
+static tree
+instantiate_class_template_1 (tree type)
{
tree templ, args, pattern, t, member;
tree typedecl;
@@ -8597,6 +8604,18 @@ instantiate_class_template (tree type)
return type;
}
+/* Wrapper for instantiate_class_template_1. */
+
+tree
+instantiate_class_template (tree type)
+{
+ tree ret;
+ timevar_push (TV_TEMPLATE_INST);
+ ret = instantiate_class_template_1 (type);
+ timevar_pop (TV_TEMPLATE_INST);
+ return ret;
+}
+
static tree
tsubst_template_arg (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
@@ -13505,8 +13524,8 @@ check_instantiated_args (tree tmpl, tree args, tsubst_flags_t complain)
/* Instantiate the indicated variable or function template TMPL with
the template arguments in TARG_PTR. */
-tree
-instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain)
+static tree
+instantiate_template_1 (tree tmpl, tree orig_args, tsubst_flags_t complain)
{
tree targ_ptr = orig_args;
tree fndecl;
@@ -13615,6 +13634,18 @@ instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain)
return fndecl;
}
+/* Wrapper for instantiate_template_1. */
+
+tree
+instantiate_template (tree tmpl, tree orig_args, tsubst_flags_t complain)
+{
+ tree ret;
+ timevar_push (TV_TEMPLATE_INST);
+ ret = instantiate_template_1 (tmpl, orig_args, complain);
+ timevar_pop (TV_TEMPLATE_INST);
+ return ret;
+}
+
/* The FN is a TEMPLATE_DECL for a function. ARGS is an array with
NARGS elements of the arguments that are being used when calling
it. TARGS is a vector into which the deduced template arguments
@@ -17204,7 +17235,7 @@ instantiate_decl (tree d, int defer_ok,
if (! push_tinst_level (d))
return d;
- timevar_push (TV_PARSE);
+ timevar_push (TV_TEMPLATE_INST);
/* Set TD to the template whose DECL_TEMPLATE_RESULT is the pattern
for the instantiation. */
@@ -17497,7 +17528,7 @@ out:
pop_deferring_access_checks ();
pop_tinst_level ();
- timevar_pop (TV_PARSE);
+ timevar_pop (TV_TEMPLATE_INST);
return d;
}