[cfe-commits] r128471 - in /cfe/trunk: lib/CodeGen/CGStmt.cpp test/CodeGen/debug-info-line2.c test/CodeGenObjC/debug-info-foreach.m
Devang Patel
dpatel at apple.com
Tue Mar 29 11:35:54 PDT 2011
Author: dpatel
Date: Tue Mar 29 13:35:54 2011
New Revision: 128471
URL: http://llvm.org/viewvc/llvm-project?rev=128471&view=rev
Log:
Do not line number entry for unconditional branches. Usually, users do not want to stop at closing '}'.
Added:
cfe/trunk/test/CodeGen/debug-info-line2.c
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/test/CodeGenObjC/debug-info-foreach.m
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=128471&r1=128470&r2=128471&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Mar 29 13:35:54 2011
@@ -270,6 +270,9 @@
// terminated, don't touch it.
} else {
// Otherwise, create a fall-through branch.
+ // There is no need to emit line number for unconditional branch.
+ if (getDebugInfo())
+ Builder.SetCurrentDebugLocation(llvm::DebugLoc());
Builder.CreateBr(Target);
}
Added: cfe/trunk/test/CodeGen/debug-info-line2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-line2.c?rev=128471&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/debug-info-line2.c (added)
+++ cfe/trunk/test/CodeGen/debug-info-line2.c Tue Mar 29 13:35:54 2011
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -g -emit-llvm -o - %s | FileCheck %s
+// Radar 9199234
+
+int bar();
+int foo(int i) {
+ int j = 0;
+ if (i) {
+ j = bar();
+//CHECK: store i32 %call, i32* %j, align 4, !dbg
+//CHECK-NOT: br label %if.end, !dbg
+ }
+ else
+ {
+ j = bar() + 2;
+ }
+ return j;
+}
Modified: cfe/trunk/test/CodeGenObjC/debug-info-foreach.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-foreach.m?rev=128471&r1=128470&r2=128471&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-foreach.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-foreach.m Tue Mar 29 13:35:54 2011
@@ -4,10 +4,17 @@
@class NSArray;
+int i;
void f(NSArray *a) {
id keys;
for (id thisKey in keys) {
+ int j = i;
+ ++j;
+ i = j;
}
for (id thisKey in keys) {
+ int k = i;
+ ++k;
+ i = k;
}
}
More information about the cfe-commits
mailing list