[PR c++/90613] Fix using-decl debug bloat
authorNathan Sidwell <nathan@gcc.gnu.org>
Wed, 28 Aug 2019 13:36:54 +0000 (13:36 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 28 Aug 2019 13:36:54 +0000 (13:36 +0000)
https://gcc.gnu.org/ml/gcc-patches/2019-08/msg01888.html
cp/
PR c++/90613
* name-lookup.c (cp_emit_debug_info): Check for builtins during
overload iteration.

testsuite/
PR c++/90613
* g++.dg/lookup/using61.C: New.

From-SVN: r274991

gcc/cp/ChangeLog
gcc/cp/name-lookup.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/lookup/using61.C [new file with mode: 0644]

index b735dab6a517290471e3c0fde37bab7328ef9f10..08a44b6c6067f4a273f0c69943f63edbb35cfd21 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-28  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/90613
+       * name-lookup.c (cp_emit_debug_info): Check for builtins during
+       overload iteration.
+
 2019-08-27  Marek Polacek  <polacek@redhat.com>
 
        PR c++/81676 - bogus -Wunused warnings in constexpr if.
index a8ab4db4d0d91612e557026bacc5600b0b12644b..8bbb92ddc9faa4e0343a7329b6554d3ee883acdf 100644 (file)
@@ -7455,13 +7455,6 @@ cp_emit_debug_info_for_using (tree t, tree context)
   if (seen_error ())
     return;
 
-  /* Ignore this FUNCTION_DECL if it refers to a builtin declaration
-     of a builtin function.  */
-  if (TREE_CODE (t) == FUNCTION_DECL
-      && DECL_EXTERNAL (t)
-      && fndecl_built_in_p (t))
-    return;
-
   /* Do not supply context to imported_module_or_decl, if
      it is a global namespace.  */
   if (context == global_namespace)
@@ -7469,18 +7462,26 @@ cp_emit_debug_info_for_using (tree t, tree context)
 
   t = MAYBE_BASELINK_FUNCTIONS (t);
 
-  /* FIXME: Handle TEMPLATE_DECLs.  */
   for (lkp_iterator iter (t); iter; ++iter)
     {
       tree fn = *iter;
-      if (TREE_CODE (fn) != TEMPLATE_DECL)
-       {
-         if (building_stmt_list_p ())
-           add_stmt (build_stmt (input_location, USING_STMT, fn));
-         else
-           debug_hooks->imported_module_or_decl (fn, NULL_TREE, context,
-                                                 false, false);
-       }
+
+      if (TREE_CODE (fn) == TEMPLATE_DECL)
+       /* FIXME: Handle TEMPLATE_DECLs.  */
+       continue;
+      
+      /* Ignore this FUNCTION_DECL if it refers to a builtin declaration
+        of a builtin function.  */
+      if (TREE_CODE (fn) == FUNCTION_DECL
+         && DECL_EXTERNAL (fn)
+         && fndecl_built_in_p (fn))
+       continue;
+
+      if (building_stmt_list_p ())
+       add_stmt (build_stmt (input_location, USING_STMT, fn));
+      else
+       debug_hooks->imported_module_or_decl (fn, NULL_TREE, context,
+                                             false, false);
     }
 }
 
index 333fe3cdea2e04833d3e9209ca1aa94c24da4137..480362e9d8af6bdc23081a13ba3de7aab950b6d6 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-16  Martin Liska  <mliska@suse.cz>
+
+       PR c++/90613
+       * g++.dg/lookup/using61.C: New.
+
 2019-08-28  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR middle-end/89544
diff --git a/gcc/testsuite/g++.dg/lookup/using61.C b/gcc/testsuite/g++.dg/lookup/using61.C
new file mode 100644 (file)
index 0000000..33d6df0
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-options "-gdwarf-2" }
+/* { dg-skip-if "No Dwarf" { { *-*-aix* hppa*-*-hpux* } && { ! hppa*64*-*-* } } } */
+
+extern "C" long double nanl(const char *);
+using ::nanl;
+
+// We should elide the using for this extern C builtin
+// { dg-final { scan-assembler-not ".debug_info" } }