[PATCH] D47097: [WIP][DebugInfo] Preserve scope in auto generated StoreInst
Anastasis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 21 12:41:00 PDT 2018
gramanas updated this revision to Diff 147838.
gramanas added a comment.
- Apply debug location
Repository:
rC Clang
https://reviews.llvm.org/D47097
Files:
lib/CodeGen/CGDecl.cpp
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]+]]
+
Index: lib/CodeGen/CGDecl.cpp
===================================================================
--- lib/CodeGen/CGDecl.cpp
+++ lib/CodeGen/CGDecl.cpp
@@ -2057,8 +2057,10 @@
}
// Store the initial value into the alloca.
- if (DoStore)
+ if (DoStore) {
EmitStoreOfScalar(ArgVal, lv, /* isInitialization */ true);
+ ApplyDebugLocation::CreateArtificial(*this);
+ }
setAddrOfLocalVar(&D, DeclPtr);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47097.147838.patch
Type: text/x-patch
Size: 862 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180521/a1011217/attachment.bin>
More information about the cfe-commits
mailing list