diff options
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/debug-info-line2.c | 17 | ||||
-rw-r--r-- | test/CodeGenObjC/debug-info-foreach.m | 7 |
3 files changed, 27 insertions, 0 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 24acf65739..add85a2a06 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -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); } diff --git a/test/CodeGen/debug-info-line2.c b/test/CodeGen/debug-info-line2.c new file mode 100644 index 0000000000..bf3250d424 --- /dev/null +++ b/test/CodeGen/debug-info-line2.c @@ -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; +} diff --git a/test/CodeGenObjC/debug-info-foreach.m b/test/CodeGenObjC/debug-info-foreach.m index c056e0e249..89b409c716 100644 --- a/test/CodeGenObjC/debug-info-foreach.m +++ b/test/CodeGenObjC/debug-info-foreach.m @@ -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; } } |