PR16214, PR14467: DebugInfo: use "RequireCompleteType" to decide when to emit the full definition of a type in -flimit-debug-info
This simplifies the core benefit of -flimit-debug-info by taking a more
systematic approach to avoid emitting debug info definitions for types
that only require declarations. The previous ad-hoc approach (3 cases
removed in this patch) had many holes.
The general approach (adding a bit to TagDecl and callback through
ASTConsumer) has been discussed with Richard Smith - though always open
to revision.
llvm-svn: 186262
diff --git a/clang/test/CodeGenCXX/debug-info-class-limited.cpp b/clang/test/CodeGenCXX/debug-info-class-limited.cpp
index 26ee19f..a4b9f46 100644
--- a/clang/test/CodeGenCXX/debug-info-class-limited.cpp
+++ b/clang/test/CodeGenCXX/debug-info-class-limited.cpp
@@ -1,8 +1,7 @@
// RUN: %clang -emit-llvm -g -S %s -o - | FileCheck %s
namespace PR16214_1 {
-// CHECK: [[PR16214_1:![0-9]*]] = {{.*}} [ DW_TAG_namespace ] [PR16214_1]
-// CHECK: = metadata !{i32 {{[0-9]*}}, metadata !{{[0-9]*}}, metadata [[PR16214_1]], {{.*}} ; [ DW_TAG_structure_type ] [foo] {{.*}} [def]
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
struct foo {
int i;
};
@@ -13,9 +12,9 @@
bar b;
}
-namespace test1 {
+namespace PR14467 {
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
struct foo {
- int i;
};
foo *bar(foo *a) {
@@ -24,9 +23,9 @@
}
}
-namespace test2 {
+namespace test1 {
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [decl]
struct foo {
- int i;
};
extern int bar(foo *a);
@@ -34,3 +33,20 @@
return bar(a);
}
}
+
+namespace test2 {
+// FIXME: if we were a bit fancier, we could realize that the 'foo' type is only
+// required because of the 'bar' type which is not required at all (or might
+// only be required to be declared)
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
+struct foo {
+};
+
+struct bar {
+ foo f;
+};
+
+void func() {
+ foo *f;
+}
+}