[DebugInfo] Fix debug-info generation for block invocations so that we set the LinkageName
Currently when generating debug-info for a BlockDecl we are setting the Name to the mangled name and not setting the LinkageName.
This means we see the mangled name for block invcations ends up in DW_AT_Name and not in DW_AT_linkage_name.
This patch fixes this case so that we also set the LinkageName as well.
Differential Revision: https://reviews.llvm.org/D73282
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 99af4e2..0e54e94 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/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"))