debug/94273 - avoid creating type DIEs for DINFO_LEVEL_TERSE
authorRichard Biener <rguenther@suse.de>
Fri, 27 Mar 2020 12:57:42 +0000 (13:57 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 27 Mar 2020 13:00:43 +0000 (14:00 +0100)
This avoids completing types for DINFO_LEVEL_TERSE by using
the should_emit_struct_debug machinery.

2020-03-27  Richard Biener  <rguenther@suse.de>

PR debug/94273
* dwarf2out.c (should_emit_struct_debug): Return false for
DINFO_LEVEL_TERSE.

* g++.dg/debug/pr94273.C: New testcase.

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr94273.C [new file with mode: 0644]

index 97cad024271f7731795a5d879f4c712891d139ae..ef8dffbbf1ef4c466f61a3453debe6816408eac6 100644 (file)
@@ -1,3 +1,9 @@
+2020-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR debug/94273
+       * dwarf2out.c (should_emit_struct_debug): Return false for
+       DINFO_LEVEL_TERSE.
+
 2020-03-27  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/94352
index b1fa6f5ff7c1b4df422f74620b73cc7a178d2fa5..378a27394e8bf9be9733cb15b9cc0dd9c49ac205 100644 (file)
@@ -399,6 +399,9 @@ get_full_len (const wide_int &op)
 static bool
 should_emit_struct_debug (tree type, enum debug_info_usage usage)
 {
+  if (debug_info_level <= DINFO_LEVEL_TERSE)
+    return false;
+
   enum debug_struct_file criterion;
   tree type_decl;
   bool generic = lang_hooks.types.generic_p (type);
index d5a1c8e1a8e7addd3e613710190e2c09c3829b21..156eee12cddab8bc3a23db8689d0a273e7712106 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-27  Richard Biener  <rguenther@suse.de>
+
+       PR debug/94273
+       * g++.dg/debug/pr94273.C: New testcase.
+
 2020-03-27  Tobias Burnus  <tobias@codesourcery.com>
 
        PR fortran/93957
diff --git a/gcc/testsuite/g++.dg/debug/pr94273.C b/gcc/testsuite/g++.dg/debug/pr94273.C
new file mode 100644 (file)
index 0000000..4e5c66d
--- /dev/null
@@ -0,0 +1,4 @@
+class a {
+    virtual void c() {}
+} extern b;
+a b;