[clang] e8617f2 - DebugInfo: Emit "LocalToUnit" flag on local member function decls.

James Y Knight via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 22 15:47:24 PST 2021


Author: James Y Knight
Date: 2021-02-22T18:47:15-05:00
New Revision: e8617f2f1870022b7dd076bf43c7aaee30831197

URL: https://github.com/llvm/llvm-project/commit/e8617f2f1870022b7dd076bf43c7aaee30831197
DIFF: https://github.com/llvm/llvm-project/commit/e8617f2f1870022b7dd076bf43c7aaee30831197.diff

LOG: DebugInfo: Emit "LocalToUnit" flag on local member function decls.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenCXX/debug-info-class.cpp b/clang/test/CodeGenCXX/debug-info-class.cpp
index 1e271be94a9d..a1ef0962dd9d 100644
--- a/clang/test/CodeGenCXX/debug-info-class.cpp
+++ b/clang/test/CodeGenCXX/debug-info-class.cpp
@@ -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,


        


More information about the cfe-commits mailing list