[cfe-commits] r139416 - in /cfe/trunk: lib/CodeGen/CodeGenFunction.cpp test/CodeGen/debug-info-line3.c

Eric Christopher echristo at apple.com
Fri Sep 9 14:53:04 PDT 2011


Author: echristo
Date: Fri Sep  9 16:53:04 2011
New Revision: 139416

URL: http://llvm.org/viewvc/llvm-project?rev=139416&view=rev
Log:
Carry the debug information from single exit unified return block
along with the new insert point.

Fixes PR10829

Added:
    cfe/trunk/test/CodeGen/debug-info-line3.c
Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=139416&r1=139415&r2=139416&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Sep  9 16:53:04 2011
@@ -116,7 +116,8 @@
       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();

Added: cfe/trunk/test/CodeGen/debug-info-line3.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-line3.c?rev=139416&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-line3.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-line3.c Fri Sep  9 16:53:04 2011
@@ -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,





More information about the cfe-commits mailing list