Commit fd295cb2 by Gabriel Dos Reis Committed by Gabriel Dos Reis

decl2.c: Include "timevar.h".

	* decl2.c: Include "timevar.h".
	(namespace_ancestor): Time name lookup.
	(add_using_namespace): Likewise.
	(lookup_using_namespace): Likewise.
	(qualified_lookup_using_namespace): Likewise.
	(decl_namespace): Likewise.
	(lookup_arg_dependent): Likewise.
	* lex.c (do_identifier): Likewise.
	(do_scoped_id): Likewise.
	* pt.c (lookup_template_class): Likewise.

From-SVN: r62892
parent ddb0ae00
2003-02-13 Gabriel Dos Reis <gdr@integrable-solutions.net>
* decl2.c: Include "timevar.h".
(namespace_ancestor): Time name lookup.
(add_using_namespace): Likewise.
(lookup_using_namespace): Likewise.
(qualified_lookup_using_namespace): Likewise.
(decl_namespace): Likewise.
(lookup_arg_dependent): Likewise.
* lex.c (do_identifier): Likewise.
(do_scoped_id): Likewise.
* pt.c (lookup_template_class): Likewise.
2003-02-14 Andrew Pinski <pinskia@physics.uc.edu> 2003-02-14 Andrew Pinski <pinskia@physics.uc.edu>
* decl.c: (define_label): Fix warning for return 0 instead of NULL. * decl.c: (define_label): Fix warning for return 0 instead of NULL.
......
...@@ -3364,9 +3364,11 @@ is_namespace_ancestor (tree root, tree child) ...@@ -3364,9 +3364,11 @@ is_namespace_ancestor (tree root, tree child)
tree tree
namespace_ancestor (tree ns1, tree ns2) namespace_ancestor (tree ns1, tree ns2)
{ {
timevar_push (TV_NAME_LOOKUP);
if (is_namespace_ancestor (ns1, ns2)) if (is_namespace_ancestor (ns1, ns2))
return ns1; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
return namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2));
} }
/* Insert USED into the using list of USER. Set INDIRECT_flag if this /* Insert USED into the using list of USER. Set INDIRECT_flag if this
...@@ -3376,9 +3378,10 @@ static void ...@@ -3376,9 +3378,10 @@ static void
add_using_namespace (tree user, tree used, bool indirect) add_using_namespace (tree user, tree used, bool indirect)
{ {
tree t; tree t;
timevar_push (TV_NAME_LOOKUP);
/* Using oneself is a no-op. */ /* Using oneself is a no-op. */
if (user == used) if (user == used)
return; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380); my_friendly_assert (TREE_CODE (user) == NAMESPACE_DECL, 380);
my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380); my_friendly_assert (TREE_CODE (used) == NAMESPACE_DECL, 380);
/* Check if we already have this. */ /* Check if we already have this. */
...@@ -3388,7 +3391,7 @@ add_using_namespace (tree user, tree used, bool indirect) ...@@ -3388,7 +3391,7 @@ add_using_namespace (tree user, tree used, bool indirect)
if (!indirect) if (!indirect)
/* Promote to direct usage. */ /* Promote to direct usage. */
TREE_INDIRECT_USING (t) = 0; TREE_INDIRECT_USING (t) = 0;
return; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
} }
/* Add used to the user's using list. */ /* Add used to the user's using list. */
...@@ -3410,6 +3413,7 @@ add_using_namespace (tree user, tree used, bool indirect) ...@@ -3410,6 +3413,7 @@ add_using_namespace (tree user, tree used, bool indirect)
/* Tell everyone using us about the new used namespaces. */ /* Tell everyone using us about the new used namespaces. */
for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t)) for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
add_using_namespace (TREE_PURPOSE (t), used, 1); add_using_namespace (TREE_PURPOSE (t), used, 1);
timevar_pop (TV_NAME_LOOKUP);
} }
/* Combines two sets of overloaded functions into an OVERLOAD chain, removing /* Combines two sets of overloaded functions into an OVERLOAD chain, removing
...@@ -3551,6 +3555,7 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope, ...@@ -3551,6 +3555,7 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope,
{ {
tree iter; tree iter;
tree val1; tree val1;
timevar_push (TV_NAME_LOOKUP);
/* Iterate over all used namespaces in current, searching for using /* Iterate over all used namespaces in current, searching for using
directives of scope. */ directives of scope. */
for (iter = usings; iter; iter = TREE_CHAIN (iter)) for (iter = usings; iter; iter = TREE_CHAIN (iter))
...@@ -3563,7 +3568,8 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope, ...@@ -3563,7 +3568,8 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope,
/* Resolve ambiguities. */ /* Resolve ambiguities. */
val = ambiguous_decl (name, val, val1, flags); val = ambiguous_decl (name, val, val1, flags);
} }
return BINDING_VALUE (val) != error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
BINDING_VALUE (val) != error_mark_node);
} }
/* [namespace.qual] /* [namespace.qual]
...@@ -3580,6 +3586,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result, ...@@ -3580,6 +3586,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
/* ... and a list of namespace yet to see. */ /* ... and a list of namespace yet to see. */
tree todo = NULL_TREE; tree todo = NULL_TREE;
tree usings; tree usings;
timevar_push (TV_NAME_LOOKUP);
/* Look through namespace aliases. */ /* Look through namespace aliases. */
scope = ORIGINAL_NAMESPACE (scope); scope = ORIGINAL_NAMESPACE (scope);
while (scope && (result != error_mark_node)) while (scope && (result != error_mark_node))
...@@ -3603,7 +3610,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result, ...@@ -3603,7 +3610,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
else else
scope = NULL_TREE; /* If there never was a todo list. */ scope = NULL_TREE; /* If there never was a todo list. */
} }
return result != error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, result != error_mark_node);
} }
/* [namespace.memdef]/2 */ /* [namespace.memdef]/2 */
...@@ -3670,19 +3677,20 @@ set_decl_namespace (tree decl, tree scope, bool friendp) ...@@ -3670,19 +3677,20 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
static tree static tree
decl_namespace (tree decl) decl_namespace (tree decl)
{ {
timevar_push (TV_NAME_LOOKUP);
if (TYPE_P (decl)) if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl); decl = TYPE_STUB_DECL (decl);
while (DECL_CONTEXT (decl)) while (DECL_CONTEXT (decl))
{ {
decl = DECL_CONTEXT (decl); decl = DECL_CONTEXT (decl);
if (TREE_CODE (decl) == NAMESPACE_DECL) if (TREE_CODE (decl) == NAMESPACE_DECL)
return decl; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
if (TYPE_P (decl)) if (TYPE_P (decl))
decl = TYPE_STUB_DECL (decl); decl = TYPE_STUB_DECL (decl);
my_friendly_assert (DECL_P (decl), 390); my_friendly_assert (DECL_P (decl), 390);
} }
return global_namespace; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, global_namespace);
} }
/* Return the namespace where the current declaration is declared. */ /* Return the namespace where the current declaration is declared. */
...@@ -4064,6 +4072,7 @@ lookup_arg_dependent (tree name, tree fns, tree args) ...@@ -4064,6 +4072,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
struct arg_lookup k; struct arg_lookup k;
tree fn = NULL_TREE; tree fn = NULL_TREE;
timevar_push (TV_NAME_LOOKUP);
k.name = name; k.name = name;
k.functions = fns; k.functions = fns;
k.classes = NULL_TREE; k.classes = NULL_TREE;
...@@ -4078,7 +4087,7 @@ lookup_arg_dependent (tree name, tree fns, tree args) ...@@ -4078,7 +4087,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
unqualified_namespace_lookup (name, 0, &k.namespaces); unqualified_namespace_lookup (name, 0, &k.namespaces);
arg_assoc_args (&k, args); arg_assoc_args (&k, args);
return k.functions; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, k.functions);
} }
/* Process a namespace-alias declaration. */ /* Process a namespace-alias declaration. */
......
...@@ -746,6 +746,7 @@ do_identifier (token, args) ...@@ -746,6 +746,7 @@ do_identifier (token, args)
{ {
register tree id; register tree id;
timevar_push (TV_NAME_LOOKUP);
id = lookup_name (token, 0); id = lookup_name (token, 0);
/* Do Koenig lookup if appropriate (inside templates we build lookup /* Do Koenig lookup if appropriate (inside templates we build lookup
...@@ -765,21 +766,22 @@ do_identifier (token, args) ...@@ -765,21 +766,22 @@ do_identifier (token, args)
being used as a declarator. So we call it again to get the error being used as a declarator. So we call it again to get the error
message. */ message. */
id = lookup_name (token, 0); id = lookup_name (token, 0);
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
if (!id || (TREE_CODE (id) == FUNCTION_DECL if (!id || (TREE_CODE (id) == FUNCTION_DECL
&& DECL_ANTICIPATED (id))) && DECL_ANTICIPATED (id)))
{ {
if (current_template_parms) if (current_template_parms)
return build_min_nt (LOOKUP_EXPR, token); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP,
build_min_nt (LOOKUP_EXPR, token));
else if (IDENTIFIER_TYPENAME_P (token)) else if (IDENTIFIER_TYPENAME_P (token))
/* A templated conversion operator might exist. */ /* A templated conversion operator might exist. */
return token; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, token);
else else
{ {
unqualified_name_lookup_error (token); unqualified_name_lookup_error (token);
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
} }
...@@ -815,7 +817,7 @@ do_identifier (token, args) ...@@ -815,7 +817,7 @@ do_identifier (token, args)
|| TREE_CODE (id) == USING_DECL)) || TREE_CODE (id) == USING_DECL))
id = build_min_nt (LOOKUP_EXPR, token); id = build_min_nt (LOOKUP_EXPR, token);
return id; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
} }
tree tree
...@@ -823,6 +825,7 @@ do_scoped_id (token, id) ...@@ -823,6 +825,7 @@ do_scoped_id (token, id)
tree token; tree token;
tree id; tree id;
{ {
timevar_push (TV_NAME_LOOKUP);
if (!id || (TREE_CODE (id) == FUNCTION_DECL if (!id || (TREE_CODE (id) == FUNCTION_DECL
&& DECL_ANTICIPATED (id))) && DECL_ANTICIPATED (id)))
{ {
...@@ -830,7 +833,7 @@ do_scoped_id (token, id) ...@@ -830,7 +833,7 @@ do_scoped_id (token, id)
{ {
id = build_min_nt (LOOKUP_EXPR, token); id = build_min_nt (LOOKUP_EXPR, token);
LOOKUP_EXPR_GLOBAL (id) = 1; LOOKUP_EXPR_GLOBAL (id) = 1;
return id; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
} }
if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node) if (IDENTIFIER_NAMESPACE_VALUE (token) != error_mark_node)
error ("`::%D' undeclared (first use here)", token); error ("`::%D' undeclared (first use here)", token);
...@@ -861,11 +864,11 @@ do_scoped_id (token, id) ...@@ -861,11 +864,11 @@ do_scoped_id (token, id)
{ {
id = build_min_nt (LOOKUP_EXPR, token); id = build_min_nt (LOOKUP_EXPR, token);
LOOKUP_EXPR_GLOBAL (id) = 1; LOOKUP_EXPR_GLOBAL (id) = 1;
return id; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, id);
} }
/* else just use the decl */ /* else just use the decl */
} }
return convert_from_reference (id); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, convert_from_reference (id));
} }
tree tree
......
...@@ -4031,6 +4031,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4031,6 +4031,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
tree template = NULL_TREE, parmlist; tree template = NULL_TREE, parmlist;
tree t; tree t;
timevar_push (TV_NAME_LOOKUP);
if (TREE_CODE (d1) == IDENTIFIER_NODE) if (TREE_CODE (d1) == IDENTIFIER_NODE)
{ {
if (IDENTIFIER_VALUE (d1) if (IDENTIFIER_VALUE (d1)
...@@ -4086,7 +4087,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4086,7 +4087,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
{ {
if (complain & tf_error) if (complain & tf_error)
error ("`%T' is not a template", d1); error ("`%T' is not a template", d1);
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
if (TREE_CODE (template) != TEMPLATE_DECL if (TREE_CODE (template) != TEMPLATE_DECL
...@@ -4102,7 +4103,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4102,7 +4103,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
if (in_decl) if (in_decl)
cp_error_at ("for template declaration `%D'", in_decl); cp_error_at ("for template declaration `%D'", in_decl);
} }
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
} }
if (DECL_TEMPLATE_TEMPLATE_PARM_P (template)) if (DECL_TEMPLATE_TEMPLATE_PARM_P (template))
...@@ -4137,10 +4138,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4137,10 +4138,10 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
arglist2 = coerce_template_parms (parmlist, arglist, template, arglist2 = coerce_template_parms (parmlist, arglist, template,
complain, /*require_all_args=*/1); complain, /*require_all_args=*/1);
if (arglist2 == error_mark_node) if (arglist2 == error_mark_node)
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
parm = bind_template_template_parm (TREE_TYPE (template), arglist2); parm = bind_template_template_parm (TREE_TYPE (template), arglist2);
return parm; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, parm);
} }
else else
{ {
...@@ -4227,7 +4228,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4227,7 +4228,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
if (arglist == error_mark_node) if (arglist == error_mark_node)
/* We were unable to bind the arguments. */ /* We were unable to bind the arguments. */
return error_mark_node; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, error_mark_node);
/* In the scope of a template class, explicit references to the /* In the scope of a template class, explicit references to the
template class refer to the type of the template, not any template class refer to the type of the template, not any
...@@ -4264,7 +4265,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4264,7 +4265,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
} }
} }
if (found) if (found)
return found; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
for (tp = &DECL_TEMPLATE_INSTANTIATIONS (template); for (tp = &DECL_TEMPLATE_INSTANTIATIONS (template);
*tp; *tp;
...@@ -4280,7 +4281,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4280,7 +4281,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
= DECL_TEMPLATE_INSTANTIATIONS (template); = DECL_TEMPLATE_INSTANTIATIONS (template);
DECL_TEMPLATE_INSTANTIATIONS (template) = found; DECL_TEMPLATE_INSTANTIATIONS (template) = found;
return TREE_VALUE (found); POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, TREE_VALUE (found));
} }
/* This type is a "partial instantiation" if any of the template /* This type is a "partial instantiation" if any of the template
...@@ -4296,7 +4297,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4296,7 +4297,7 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
found = xref_tag_from_type (TREE_TYPE (template), found = xref_tag_from_type (TREE_TYPE (template),
DECL_NAME (template), DECL_NAME (template),
/*globalize=*/1); /*globalize=*/1);
return found; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
} }
context = tsubst (DECL_CONTEXT (template), arglist, context = tsubst (DECL_CONTEXT (template), arglist,
...@@ -4452,8 +4453,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) ...@@ -4452,8 +4453,9 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain)
code that generates debugging information will crash. */ code that generates debugging information will crash. */
DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1; DECL_IGNORED_P (TYPE_STUB_DECL (t)) = 1;
return t; POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, t);
} }
timevar_pop (TV_NAME_LOOKUP);
} }
struct pair_fn_data struct pair_fn_data
......
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