[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
Wed Feb 5 11:14:41 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG428583dd22fd: [DebugInfo] Fix debug-info generation for block invocations so that we set theā€¦ (authored by shafik).
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

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


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
@@ -3665,8 +3665,11 @@
     Name = getDynamicInitializerName(cast<VarDecl>(D), GD.getDynamicInitKind(),
                                      Fn);
   } else {
-    // Use llvm function name.
     Name = Fn->getName();
+
+    if (const auto *BD = dyn_cast<BlockDecl>(D))
+      LinkageName = Name;
+
     Flags |= llvm::DINode::FlagPrototyped;
   }
   if (Name.startswith("\01"))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73282.242707.patch
Type: text/x-patch
Size: 1204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200205/1b7eb64d/attachment-0001.bin>


More information about the cfe-commits mailing list