diff options
author | Eric Christopher <echristo@apple.com> | 2011-09-09 21:53:04 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-09-09 21:53:04 +0000 |
commit | 65c5c9132f700a79619aa2bc339acc8896a8b48b (patch) | |
tree | 945fcdbd1ad1333fdb166f8c24a909c216ef5bc2 | |
parent | 29cfe6c3683f2a80e28e3735bfb3955504d3cdd9 (diff) | |
download | bcm5719-llvm-65c5c9132f700a79619aa2bc339acc8896a8b48b.tar.gz bcm5719-llvm-65c5c9132f700a79619aa2bc339acc8896a8b48b.zip |
Carry the debug information from single exit unified return block
along with the new insert point.
Fixes PR10829
llvm-svn: 139416
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGen/debug-info-line3.c | 16 |
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, |