[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst

Anastasis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 18 17:31:12 PDT 2018


gramanas created this revision.
gramanas added a reviewer: vsk.
Herald added subscribers: JDevlieghere, aprantl.

In this test there is a store instruction generated by clang
for the function argument `int b` where the debug info is missing.

The goal of this patch is to instruct clang to add an artificial
location to auto generated store instructions using
ApplyDebugLocation::CreateArtificial() so that we can
preserve the scope information of the dbg metadata.


Repository:
  rC Clang

https://reviews.llvm.org/D47097

Files:
  test/CodeGen/debug-info-preserve-scope.c


Index: test/CodeGen/debug-info-preserve-scope.c
===================================================================
--- /dev/null
+++ test/CodeGen/debug-info-preserve-scope.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -O0 -debug-info-kind=limited -emit-llvm -o - %s | FileCheck %s
+
+static int a;
+
+// CHECK-LABEL: define void @f
+void f(int b) {
+  a = b;
+}
+
+// CHECK: store i32 %b, i32* %b.addr, align 4, !dbg ![[dbgLocForStore:[0-9]+]]
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47097.147625.patch
Type: text/x-patch
Size: 440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180519/72cd7cfb/attachment.bin>


More information about the cfe-commits mailing list