Do not line number entry for unconditional branches. Usually, users do not want to stop at closing '}'.

llvm-svn: 128471
This commit is contained in:
Devang Patel 2011-03-29 18:35:54 +00:00
parent f71173043f
commit 6f2e41e0d4
3 changed files with 27 additions and 0 deletions

View File

@ -270,6 +270,9 @@ void CodeGenFunction::EmitBranch(llvm::BasicBlock *Target) {
// 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);
}

View File

@ -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;
}

View File

@ -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;
}
}