[PATCH] D73282: Fix debug-info generation for block invocations so that we set the LinkageName instead of the Name
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 30 10:41:08 PST 2020
shafik updated this revision to Diff 241508.
shafik marked 4 inline comments as done.
shafik added a comment.
Address comments by not special casing the `___Z` case, this requires setting both the Name and Linkage name because DWARF requires subroutines to have a `DW_AT_name`. We discovered this when altering the code to just set the `LinkageName` and it broke several LLDB tests.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73282/new/
https://reviews.llvm.org/D73282
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-block-invocation-linkage-name.cpp
clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
clang/test/OpenMP/target_parallel_debug_codegen.cpp
clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
Index: clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
===================================================================
--- clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
+++ clang/test/OpenMP/target_parallel_for_debug_codegen.cpp
@@ -111,5 +111,5 @@
// CHECK: addrspacecast [10 x [10 x i32]]* %{{.+}} to [10 x [10 x i32]] addrspace(1)*
// CHECK: call void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 addrspace(1)* {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
-// CHECK-DAG: distinct !DISubprogram(name: "[[NONDEBUG_WRAPPER]]",
-// CHECK-DAG: distinct !DISubprogram(name: "[[DEBUG_PARALLEL]]",
+// CHECK-DAG: distinct !DISubprogram(name: "[[NONDEBUG_WRAPPER]]", linkageName: "[[NONDEBUG_WRAPPER]]",
+// CHECK-DAG: distinct !DISubprogram(name: "[[DEBUG_PARALLEL]]", linkageName: "[[DEBUG_PARALLEL]]",
Index: clang/test/OpenMP/target_parallel_debug_codegen.cpp
===================================================================
--- clang/test/OpenMP/target_parallel_debug_codegen.cpp
+++ clang/test/OpenMP/target_parallel_debug_codegen.cpp
@@ -133,5 +133,5 @@
// CHECK: !DILocalVariable(name: "b",
// CHECK-SAME: line: 21
-// CHECK-DAG: distinct !DISubprogram(name: "[[NONDEBUG_WRAPPER]]",
-// CHECK-DAG: distinct !DISubprogram(name: "[[DEBUG_PARALLEL]]",
+// CHECK-DAG: distinct !DISubprogram(name: "[[NONDEBUG_WRAPPER]]", linkageName: "[[NONDEBUG_WRAPPER]]",
+// CHECK-DAG: distinct !DISubprogram(name: "[[DEBUG_PARALLEL]]", linkageName: "[[DEBUG_PARALLEL]]",
Index: clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
===================================================================
--- clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
+++ clang/test/CodeGenCXX/debug-info-global-ctor-dtor.cpp
@@ -32,7 +32,7 @@
// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init",{{.*}} line: 15,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-NOKEXT: !DISubprogram(name: "__dtor_glob",{{.*}} line: 15,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_var_init.1",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
+// CHECK-NOKEXT: !DISubprogram(name: "__cxx_global_array_dtor", linkageName: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-NOKEXT: !DISubprogram(name: "__dtor_array",{{.*}} line: 16,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-NOKEXT: !DISubprogram(name: "__dtor__ZZ3foovE4stat",{{.*}} line: 19,{{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-NOKEXT: !DISubprogram({{.*}} DISPFlagLocalToUnit | DISPFlagDefinition
@@ -42,7 +42,7 @@
// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'glob'",{{.*}} line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'glob'",{{.*}} line: 15,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-MSVC: !DISubprogram(name: "`dynamic initializer for 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
-// CHECK-MSVC: !DISubprogram(name: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
+// CHECK-MSVC: !DISubprogram(name: "__cxx_global_array_dtor", linkageName: "__cxx_global_array_dtor",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'array'",{{.*}} line: 16,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
// CHECK-MSVC: !DISubprogram(name: "`dynamic atexit destructor for 'stat'",{{.*}} line: 19,{{.*}}: DISPFlagLocalToUnit | DISPFlagDefinition
Index: clang/test/CodeGenCXX/debug-info-block-invocation-linkage-name.cpp
===================================================================
--- /dev/null
+++ clang/test/CodeGenCXX/debug-info-block-invocation-linkage-name.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=standalone -fblocks -triple %itanium_abi_triple %s -o - | FileCheck %s
+
+// CHECK: !DISubprogram(name: "___Z1fU13block_pointerFviE_block_invoke", linkageName: "___Z1fU13block_pointerFviE_block_invoke"
+void g(void (^call)(int));
+
+void f(void (^callback)(int)) {
+ g(^(int x) {
+ callback(x);
+ });
+}
+
+void h() {
+ f(^(int x){
+ });
+}
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3655,8 +3655,9 @@
Name = getDynamicInitializerName(cast<VarDecl>(D), GD.getDynamicInitKind(),
Fn);
} else {
- // Use llvm function name.
- Name = Fn->getName();
+ LinkageName = Fn->getName();
+ Name = LinkageName;
+
Flags |= llvm::DINode::FlagPrototyped;
}
if (Name.startswith("\01"))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73282.241508.patch
Type: text/x-patch
Size: 5008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200130/47ce93f1/attachment-0001.bin>
More information about the cfe-commits
mailing list