]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/cp/decl2.c
decl2.c: Include "timevar.h".
[gcc.git] / gcc / cp / decl2.c
index 63240dd7f587a3d3c1b464fa50bd268381c4a3d7..0ee4dd36f0f202af1d4fb9db79ceb1d8de9d0b53 100644 (file)
@@ -3364,9 +3364,11 @@ is_namespace_ancestor (tree root, tree child)
 tree
 namespace_ancestor (tree ns1, tree ns2)
 {
+  timevar_push (TV_NAME_LOOKUP);
   if (is_namespace_ancestor (ns1, ns2))
-    return ns1;
-  return namespace_ancestor (CP_DECL_CONTEXT (ns1), ns2);
+    POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, ns1);
+  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
@@ -3376,9 +3378,10 @@ static void
 add_using_namespace (tree user, tree used, bool indirect)
 {
   tree t;
+  timevar_push (TV_NAME_LOOKUP);
   /* Using oneself is a no-op.  */
   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 (used) == NAMESPACE_DECL, 380);
   /* Check if we already have this.  */
@@ -3388,7 +3391,7 @@ add_using_namespace (tree user, tree used, bool indirect)
       if (!indirect)
        /* Promote to direct usage.  */
        TREE_INDIRECT_USING (t) = 0;
-      return;
+      POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, (void)0);
     }
 
   /* Add used to the user's using list.  */
@@ -3410,6 +3413,7 @@ add_using_namespace (tree user, tree used, bool indirect)
   /* Tell everyone using us about the new used namespaces.  */
   for (t = DECL_NAMESPACE_USERS (user); t; t = TREE_CHAIN (t))
     add_using_namespace (TREE_PURPOSE (t), used, 1);
+  timevar_pop (TV_NAME_LOOKUP);
 }
 
 /* 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,
 {
   tree iter;
   tree val1;
+  timevar_push (TV_NAME_LOOKUP);
   /* Iterate over all used namespaces in current, searching for using
      directives of scope.  */
   for (iter = usings; iter; iter = TREE_CHAIN (iter))
@@ -3563,7 +3568,8 @@ lookup_using_namespace (tree name, tree val, tree usings, tree scope,
        /* Resolve ambiguities.  */
        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]
@@ -3580,6 +3586,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
   /* ... and a list of namespace yet to see.  */
   tree todo = NULL_TREE;
   tree usings;
+  timevar_push (TV_NAME_LOOKUP);
   /* Look through namespace aliases.  */
   scope = ORIGINAL_NAMESPACE (scope);
   while (scope && (result != error_mark_node))
@@ -3603,7 +3610,7 @@ qualified_lookup_using_namespace (tree name, tree scope, tree result,
       else
        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 */
@@ -3670,19 +3677,20 @@ set_decl_namespace (tree decl, tree scope, bool friendp)
 static tree
 decl_namespace (tree decl)
 {
+  timevar_push (TV_NAME_LOOKUP);
   if (TYPE_P (decl))
     decl = TYPE_STUB_DECL (decl);
   while (DECL_CONTEXT (decl))
     {
       decl = DECL_CONTEXT (decl);
       if (TREE_CODE (decl) == NAMESPACE_DECL)
-       return decl;
+       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, decl);
       if (TYPE_P (decl))
        decl = TYPE_STUB_DECL (decl);
       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.  */
@@ -4064,6 +4072,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
   struct arg_lookup k;
   tree fn = NULL_TREE;
 
+  timevar_push (TV_NAME_LOOKUP);
   k.name = name;
   k.functions = fns;
   k.classes = NULL_TREE;
@@ -4078,7 +4087,7 @@ lookup_arg_dependent (tree name, tree fns, tree args)
     unqualified_namespace_lookup (name, 0, &k.namespaces);
 
   arg_assoc_args (&k, args);
-  return k.functions;
+  POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, k.functions);
 }
 
 /* Process a namespace-alias declaration.  */
This page took 0.030252 seconds and 5 git commands to generate.