summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-01-28 19:50:09 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-01-28 19:50:09 +0000
commit298720d324fc8ad041b3b9d9bb9a80982ee53ced (patch)
tree1ed2f46e4bc859a7598273f45c4962224e2836d4 /clang/lib/CodeGen/CodeGenFunction.cpp
parent4058dd9f3f17bb91e96bda91ed5ecad183a30cb2 (diff)
downloadbcm5719-llvm-298720d324fc8ad041b3b9d9bb9a80982ee53ced.tar.gz
bcm5719-llvm-298720d324fc8ad041b3b9d9bb9a80982ee53ced.zip
DebugInfo: Attribute implicit boolean tests to the expression being tested, not to the outer use of that expression.
This is half a fix for a GDB test suite failure that expects to start at 'a' in the following code: void func(int a) if (a && b) ... But instead, without this change, the comparison was assigned to '&&' (well, worse actually - because there was a chained 'a && b && c' and it was assigned to the second '&&' because of a recursive application of this bug) and then the load folded into the comparison so breaking on the function started at '&&' instead of 'a'. The other part of this needs to be fixed in LLVM where it's ignoring the location of the icmp and instead using the location of the branch instruction. The fix to the conditional operator is actually a no-op currently, because the conditional operator's location coincides with 'a' (the start of the conditional expression) but should probably be '?' instead. See the FIXME in the test case that mentions the ARCMigration tool failures when I tried to make that change. llvm-svn: 227356
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index d08e011ea3c..ae78aa00e3a 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -1058,8 +1058,11 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
uint64_t RHSCount = Cnt.getCount();
ConditionalEvaluation eval(*this);
- EmitBranchOnBoolExpr(CondBOp->getLHS(), LHSTrue, FalseBlock, RHSCount);
- EmitBlock(LHSTrue);
+ {
+ ApplyDebugLocation DL(*this, Cond);
+ EmitBranchOnBoolExpr(CondBOp->getLHS(), LHSTrue, FalseBlock, RHSCount);
+ EmitBlock(LHSTrue);
+ }
// Any temporaries created here are conditional.
Cnt.beginRegion(Builder);
@@ -1103,8 +1106,11 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
uint64_t RHSCount = TrueCount - LHSCount;
ConditionalEvaluation eval(*this);
- EmitBranchOnBoolExpr(CondBOp->getLHS(), TrueBlock, LHSFalse, LHSCount);
- EmitBlock(LHSFalse);
+ {
+ ApplyDebugLocation DL(*this, Cond);
+ EmitBranchOnBoolExpr(CondBOp->getLHS(), TrueBlock, LHSFalse, LHSCount);
+ EmitBlock(LHSFalse);
+ }
// Any temporaries created here are conditional.
Cnt.beginRegion(Builder);
@@ -1151,8 +1157,11 @@ void CodeGenFunction::EmitBranchOnBoolExpr(const Expr *Cond,
cond.begin(*this);
EmitBlock(LHSBlock);
Cnt.beginRegion(Builder);
- EmitBranchOnBoolExpr(CondOp->getLHS(), TrueBlock, FalseBlock,
- LHSScaledTrueCount);
+ {
+ ApplyDebugLocation DL(*this, Cond);
+ EmitBranchOnBoolExpr(CondOp->getLHS(), TrueBlock, FalseBlock,
+ LHSScaledTrueCount);
+ }
cond.end(*this);
cond.begin(*this);
OpenPOWER on IntegriCloud