[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 22:43:33 PST 2020


shafik updated this revision to Diff 241638.
shafik added a comment.

Using a more targeted approach.


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
@@ -3655,8 +3655,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.241638.patch
Type: text/x-patch
Size: 1204 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200131/43eec8c0/attachment-0001.bin>


More information about the cfe-commits mailing list