summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp3
-rw-r--r--clang/test/CodeGen/debug-info-line3.c16
2 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 7e8415bb268..a16f10e6541 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -116,7 +116,8 @@ void CodeGenFunction::EmitReturnBlock() {
dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->use_begin());
if (BI && BI->isUnconditional() &&
BI->getSuccessor(0) == ReturnBlock.getBlock()) {
- // Reset insertion point and delete the branch.
+ // Reset insertion point, including debug location, and delete the branch.
+ Builder.SetCurrentDebugLocation(BI->getDebugLoc());
Builder.SetInsertPoint(BI->getParent());
BI->eraseFromParent();
delete ReturnBlock.getBlock();
diff --git a/clang/test/CodeGen/debug-info-line3.c b/clang/test/CodeGen/debug-info-line3.c
new file mode 100644
index 00000000000..645ffb9e748
--- /dev/null
+++ b/clang/test/CodeGen/debug-info-line3.c
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -g -S -emit-llvm %s -o - | FileCheck %s
+
+void func(char c, char* d)
+{
+ *d = c + 1;
+ return;
+
+
+
+
+
+
+}
+
+// CHECK: ret void, !dbg !19
+// CHECK: !19 = metadata !{i32 6,
OpenPOWER on IntegriCloud