Remove a redundant null-check in DIExpression::prepend, NFC

Code outside of an `if (Expr)` block dereferenced `Expr`, so the null
check was redundant.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@336465 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Vedant Kumar
2018-07-06 21:06:20 +00:00
parent c779b36d25
commit 21926ea0e1
+14 -13
View File
@@ -819,24 +819,25 @@ DIExpression *DIExpression::prepend(const DIExpression *Expr, bool DerefBefore,
DIExpression *DIExpression::prependOpcodes(const DIExpression *Expr,
SmallVectorImpl<uint64_t> &Ops,
bool StackValue) {
assert(Expr && "Can't prepend ops to this expression");
// If there are no ops to prepend, do not even add the DW_OP_stack_value.
if (Ops.empty())
StackValue = false;
if (Expr)
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
if (StackValue) {
if (Op.getOp() == dwarf::DW_OP_stack_value)
StackValue = false;
else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
Ops.push_back(dwarf::DW_OP_stack_value);
StackValue = false;
}
for (auto Op : Expr->expr_ops()) {
// A DW_OP_stack_value comes at the end, but before a DW_OP_LLVM_fragment.
if (StackValue) {
if (Op.getOp() == dwarf::DW_OP_stack_value)
StackValue = false;
else if (Op.getOp() == dwarf::DW_OP_LLVM_fragment) {
Ops.push_back(dwarf::DW_OP_stack_value);
StackValue = false;
}
Ops.push_back(Op.getOp());
for (unsigned I = 0; I < Op.getNumArgs(); ++I)
Ops.push_back(Op.getArg(I));
}
Ops.push_back(Op.getOp());
for (unsigned I = 0; I < Op.getNumArgs(); ++I)
Ops.push_back(Op.getArg(I));
}
if (StackValue)
Ops.push_back(dwarf::DW_OP_stack_value);
return DIExpression::get(Expr->getContext(), Ops);