name-lookup.c (pushdecl_outermost_localscope): Always conditionally stop timer.
authorNathan Sidwell <nathan@acm.org>
Thu, 11 May 2017 14:51:07 +0000 (14:51 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 11 May 2017 14:51:07 +0000 (14:51 +0000)
* name-lookup.c (pushdecl_outermost_localscope): Always
conditionally stop timer.

From-SVN: r247910

gcc/cp/ChangeLog
gcc/cp/name-lookup.c

index 6db47ed56bf47212318ae4707fad3b3676c5ea04..78269de072f3d6c2e9ff6d197027b9a1a11ae1c6 100644 (file)
@@ -1,5 +1,8 @@
 2017-05-11  Nathan Sidwell  <nathan@acm.org>
 
+       * name-lookup.c (pushdecl_outermost_localscope): Always
+       conditionally stop timer.
+
        * decl.c (xref_tag_1): Don't frob ts_lambda scope here.
        * name-lookup.c (pushtag_1): Deal with ts_lambda scope.
 
index 552a75f4875413422718f11d44dfc2b04d981b90..b5a60e34005904d3ebdc882a0775de7981ca16e7 100644 (file)
@@ -2874,19 +2874,17 @@ pushdecl_with_scope_1 (tree x, cp_binding_level *level, bool is_friend)
 tree
 pushdecl_outermost_localscope (tree x)
 {
+  cp_binding_level *b = NULL;
   bool subtime = timevar_cond_start (TV_NAME_LOOKUP);
-  cp_binding_level *b  = NULL, *n = current_binding_level;
 
-  if (n->kind == sk_function_parms)
-    return error_mark_node;
-  do
-    {
-      b = n;
-      n = b->level_chain;
-    }
-  while (n->kind != sk_function_parms);
-  tree ret = pushdecl_with_scope_1 (x, b, false);
+  /* Find the scope just inside the function parms.  */
+  for (cp_binding_level *n = current_binding_level;
+       n->kind != sk_function_parms; n = b->level_chain)
+    b = n;
+
+  tree ret = b ? pushdecl_with_scope_1 (x, b, false) : error_mark_node;
   timevar_cond_stop (TV_NAME_LOOKUP, subtime);
+
   return ret;
 }