]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: drop push_tinst_level in mangling
authorJason Merrill <jason@redhat.com>
Thu, 22 May 2025 21:11:10 +0000 (17:11 -0400)
committerJason Merrill <jason@redhat.com>
Fri, 23 May 2025 20:42:37 +0000 (16:42 -0400)
I wondered why we needed to push/pop_tinst_level in mangle_decl_string.  And
apparently we don't need to anymore.

gcc/cp/ChangeLog:

* mangle.cc (mangle_decl_string): Don't push_tinst_level.

gcc/cp/mangle.cc

index 3d5e96b2c944951ae5d7a6649d516aed69d64a80..13d5dedebd293e90477acab51173a90797c9b7f9 100644 (file)
@@ -4452,23 +4452,12 @@ static tree
 mangle_decl_string (const tree decl)
 {
   tree result;
-  tree saved_fn = NULL_TREE;
-  bool template_p = false;
+  tree saved_fn = current_function_decl;
 
   /* We shouldn't be trying to mangle an uninstantiated template.  */
   gcc_assert (!type_dependent_expression_p (decl));
 
-  if (DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl))
-    {
-      struct tinst_level *tl = current_instantiation ();
-      if ((!tl || tl->maybe_get_node () != decl)
-         && push_tinst_level (decl))
-       {
-         template_p = true;
-         saved_fn = current_function_decl;
-         current_function_decl = NULL_TREE;
-       }
-    }
+  current_function_decl = NULL_TREE;
   iloc_sentinel ils (DECL_SOURCE_LOCATION (decl));
 
   start_mangling (decl);
@@ -4483,12 +4472,7 @@ mangle_decl_string (const tree decl)
     fprintf (stderr, "mangle_decl_string = '%s'\n\n",
             IDENTIFIER_POINTER (result));
 
-  if (template_p)
-    {
-      pop_tinst_level ();
-      current_function_decl = saved_fn;
-    }
-
+  current_function_decl = saved_fn;
   return result;
 }