DebugInfo: Emit "LocalToUnit" flag on local member function decls.
authorJames Y Knight <jyknight@google.com>
Mon, 22 Feb 2021 23:35:53 +0000 (18:35 -0500)
committerJames Y Knight <jyknight@google.com>
Mon, 22 Feb 2021 23:47:15 +0000 (18:47 -0500)
Follow-up to fe2dcd89acfd9301a230e38e9030734553baa8dc.

Update test per review comments, restoring the "D" type to its
original state, and adding new "L" type. (Sorry, this was intended to
be included in the prior commit)

Differential Revision: https://reviews.llvm.org/D96044

clang/test/CodeGenCXX/debug-info-class.cpp

index 1e271be94a9db18348ef6f295067dbd33a2bf6b8..a1ef0962dd9df4f11472ca886fb95535fe780a92 100644 (file)
@@ -24,14 +24,12 @@ struct C {
 C::~C() {
 }
 
-namespace {
 struct D {
-  D() {}
-  virtual ~D() {}
+  D();
+  virtual ~D();
   void func() {
   }
 };
-} // namespace
 
 struct E {
   E();
@@ -73,6 +71,13 @@ struct A {
   }
 };
 
+namespace {
+struct L {
+  void func() {
+  }
+};
+}
+
 void f1() {
   D x;
   x.func();
@@ -81,6 +86,8 @@ void f1() {
   F::inner z;
   K k;
   k.func();
+  L l;
+  l.func();
 }
 
 int main(int argc, char **argv) {
@@ -137,12 +144,11 @@ int main(int argc, char **argv) {
 // CHECK-SAME:                     DIFlagStaticMember
 // CHECK: [[C_DTOR]] = !DISubprogram(name: "~C"
 
-// CHECK: [[D:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D"
+// CHECK: [[D:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "D"
 // CHECK-SAME:             size:
+// CHECK-SAME:             DIFlagFwdDecl
 // CHECK-NOT:              identifier:
 // CHECK-SAME:             ){{$}}
-// CHECK: [[D_FUNC_DECL:![0-9]*]] = !DISubprogram(name: "func",{{.*}} scope: [[D]]
-// CHECK-SAME:             DISPFlagLocalToUnit
 
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "E"
 // CHECK-SAME:             DIFlagFwdDecl
@@ -153,11 +159,21 @@ int main(int argc, char **argv) {
 // CHECK-SAME:             identifier: "_ZTS1K"
 // CHECK-SAME:             ){{$}}
 
+// CHECK: [[L:![0-9]+]] = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "L"
+// CHECK-SAME:             ){{$}}
+// CHECK: [[L_FUNC_DECL:![0-9]*]] = !DISubprogram(name: "func",{{.*}} scope: [[L]]
+// CHECK-SAME:             DISPFlagLocalToUnit
+
 // CHECK: !DISubprogram(name: "func",{{.*}} scope: [[D]]
+// CHECK-SAME:          DISPFlagDefinition
+// CHECK-SAME:          declaration: [[D_FUNC_DECL:![0-9]*]]
+// CHECK: [[D_FUNC_DECL]] = !DISubprogram(name: "func",{{.*}} scope: [[D]]
+
+// CHECK: !DISubprogram(name: "func",{{.*}} scope: [[L]]
 // CHECK-SAME:          DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK-SAME:          declaration: [[D_FUNC_DECL]]
+// CHECK-SAME:          declaration: [[L_FUNC_DECL]]
 
-// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 52
+// CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "inner",{{.*}} line: 50
 // CHECK-NOT: DIFlagFwdDecl
 // CHECK-SAME: elements: [[G_INNER_MEM:![0-9]*]]
 // CHECK-SAME: identifier: "_ZTSN1G5innerE"
@@ -173,5 +189,5 @@ int main(int argc, char **argv) {
 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "A"
 // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "HdrSize"
 //
-// CHECK: ![[EXCEPTLOC]] = !DILocation(line: 93,
-// CHECK: ![[RETLOC]] = !DILocation(line: 92,
+// CHECK: ![[EXCEPTLOC]] = !DILocation(line: 100,
+// CHECK: ![[RETLOC]] = !DILocation(line: 99,