DebugInfo: Omit debug info for dynamic classes in TUs that do not have the vtable for that class

This reduces Clang's .dwo (fission debug info) size by 23% over
Clang+LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188576 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/debug-info-class.cpp b/test/CodeGenCXX/debug-info-class.cpp
index df24926..76cc1e3 100644
--- a/test/CodeGenCXX/debug-info-class.cpp
+++ b/test/CodeGenCXX/debug-info-class.cpp
@@ -12,6 +12,32 @@
 public:
   virtual ~B();
 };
+
+B::~B() {
+}
+
+struct C {
+  static int s;
+  virtual ~C();
+};
+
+C::~C() {
+}
+
+struct D {
+  D();
+  virtual ~D();
+  void func() {
+  }
+};
+
+struct E {
+  E();
+  virtual ~E();
+  virtual void func() {
+  }
+};
+
 struct A {
   int one;
   static const int HdrSize = 52;
@@ -21,6 +47,11 @@
   }
 };
 
+void f1() {
+  D x;
+  x.func();
+  E y;
+}
 
 int main(int argc, char **argv) {
   B b;
@@ -40,9 +71,20 @@
 // CHECK: DW_TAG_structure_type ] [foo]
 // CHECK: DW_TAG_class_type ] [bar]
 // CHECK: DW_TAG_union_type ] [baz]
-// CHECK: DW_TAG_structure_type ] [A]
-// CHECK: HdrSize
 // CHECK: DW_TAG_class_type ] [B]
 // CHECK: metadata !"_vptr$B", {{.*}}, i32 64, metadata !{{.*}}} ; [ DW_TAG_member ]
-// CHECK: ![[EXCEPTLOC]] = metadata !{i32 31,
-// CHECK: ![[RETLOC]] = metadata !{i32 30,
+
+// CHECK: [[C:![0-9]*]] = {{.*}} metadata [[C_MEM:![0-9]*]], i32 0, metadata [[C]], null} ; [ DW_TAG_structure_type ] [C] {{.*}} [def]
+// CHECK: [[C_MEM]] = metadata !{metadata [[C_VPTR:![0-9]*]], metadata [[C_S:![0-9]*]], metadata [[C_DTOR:![0-9]*]]}
+// CHECK: [[C_VPTR]] = {{.*}} ; [ DW_TAG_member ] [_vptr$C] {{.*}} [artificial]
+// CHECK: [[C_S]] = {{.*}} ; [ DW_TAG_member ] [s] {{.*}} [static] [from int]
+// CHECK: [[C_DTOR]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [~C]
+
+// CHECK: ; [ DW_TAG_structure_type ] [A]
+// CHECK: HdrSize
+// CHECK: metadata [[D_MEM:![0-9]*]], i32 0, null} ; [ DW_TAG_structure_type ] [D] {{.*}} [decl]
+// CHECK: [[D_MEM]] = metadata !{metadata [[D_FUNC:![0-9]*]]}
+// CHECK: [[D_FUNC]] = {{.*}} ; [ DW_TAG_subprogram ] {{.*}} [func]
+// CHECK: null, i32 0, null} ; [ DW_TAG_structure_type ] [E] {{.*}} [decl]
+// CHECK: ![[EXCEPTLOC]] = metadata !{i32 62,
+// CHECK: ![[RETLOC]] = metadata !{i32 61,