Skip to content

Commit

Permalink
Fix in r128471 is very broad. Some of the unconditional branches need…
Browse files Browse the repository at this point in the history
… line number information for better user experience.

Restrict the fix. This fixes break.exp failures from gdb testsuite.

llvm-svn: 128513
  • Loading branch information
Devang Patel committed Mar 30, 2011
1 parent 84d7907 commit 4d76127
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions clang/lib/CodeGen/CGExprScalar.cpp
Expand Up @@ -2317,6 +2317,9 @@ Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {

// Emit an unconditional branch from this block to ContBlock. Insert an entry
// into the phi node for the edge with the value of RHSCond.
if (CGF.getDebugInfo())
// There is no need to emit line number for unconditional branch.
Builder.SetCurrentDebugLocation(llvm::DebugLoc());
CGF.EmitBlock(ContBlock);
PN->addIncoming(RHSCond, RHSBlock);

Expand Down
9 changes: 6 additions & 3 deletions clang/lib/CodeGen/CGStmt.cpp
Expand Up @@ -270,9 +270,6 @@ 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);
}

Expand Down Expand Up @@ -400,11 +397,17 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {

// Emit the 'else' code if present.
if (const Stmt *Else = S.getElse()) {
// There is no need to emit line number for unconditional branch.
if (getDebugInfo())
Builder.SetCurrentDebugLocation(llvm::DebugLoc());
EmitBlock(ElseBlock);
{
RunCleanupsScope ElseScope(*this);
EmitStmt(Else);
}
// There is no need to emit line number for unconditional branch.
if (getDebugInfo())
Builder.SetCurrentDebugLocation(llvm::DebugLoc());
EmitBranch(ContBlock);
}

Expand Down

0 comments on commit 4d76127

Please sign in to comment.