diff mbox series

debug/94273 - avoid creating type DIEs for DINFO_LEVEL_TERSE

Message ID nycvar.YFH.7.76.2003271359360.830@zhemvz.fhfr.qr
State New
Headers show
Series debug/94273 - avoid creating type DIEs for DINFO_LEVEL_TERSE | expand

Commit Message

Richard Biener March 27, 2020, 12:59 p.m. UTC
This avoids completing types for DINFO_LEVEL_TERSE by using
the should_emit_struct_debug machinery.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

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/dwarf2out.c                      | 3 +++
 gcc/testsuite/g++.dg/debug/pr94273.C | 4 ++++
 2 files changed, 7 insertions(+)
 create mode 100644 gcc/testsuite/g++.dg/debug/pr94273.C
diff mbox series

Patch

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index b1fa6f5ff7c..378a27394e8 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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);
diff --git a/gcc/testsuite/g++.dg/debug/pr94273.C b/gcc/testsuite/g++.dg/debug/pr94273.C
new file mode 100644
index 00000000000..4e5c66d8e26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/pr94273.C
@@ -0,0 +1,4 @@ 
+class a {
+    virtual void c() {}
+} extern b;
+a b;