diff options
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 21 |
2 files changed, 17 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index 962ae8b2f34..e16dbc37f96 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -443,6 +443,8 @@ private: } }; +/// A scoped helper to set the current debug location to the specified location +/// or preferred location of the specified Expr. class ApplyDebugLocation { private: void init(SourceLocation TemporaryLocation); 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); |