[llvm] r336466 - Fix DIExpression::ExprOperand::appendToVector
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 6 14:06:21 PDT 2018
Author: vedantk
Date: Fri Jul 6 14:06:21 2018
New Revision: 336466
URL: http://llvm.org/viewvc/llvm-project?rev=336466&view=rev
Log:
Fix DIExpression::ExprOperand::appendToVector
appendToVector used the wrong overload of SmallVector::append, resulting
in it appending the same element to a vector `getSize()` times. This did
not cause a problem when initially committed because appendToVector was
only used to append 1-element operands.
This changes appendToVector to use the correct overload of append().
Testing: ./unittests/IR/IRTests --gtest_filter='*DIExpressionTest*'
Modified:
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
llvm/trunk/lib/IR/DebugInfoMetadata.cpp
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=336466&r1=336465&r2=336466&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Fri Jul 6 14:06:21 2018
@@ -2329,7 +2329,7 @@ public:
/// Append the elements of this operand to \p V.
void appendToVector(SmallVectorImpl<uint64_t> &V) const {
- V.append(getSize(), *get());
+ V.append(get(), get() + getSize());
}
};
Modified: llvm/trunk/lib/IR/DebugInfoMetadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfoMetadata.cpp?rev=336466&r1=336465&r2=336466&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfoMetadata.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfoMetadata.cpp Fri Jul 6 14:06:21 2018
@@ -834,9 +834,7 @@ DIExpression *DIExpression::prependOpcod
StackValue = false;
}
}
- Ops.push_back(Op.getOp());
- for (unsigned I = 0; I < Op.getNumArgs(); ++I)
- Ops.push_back(Op.getArg(I));
+ Op.appendToVector(Ops);
}
if (StackValue)
Ops.push_back(dwarf::DW_OP_stack_value);
@@ -906,9 +904,7 @@ Optional<DIExpression *> DIExpression::c
continue;
}
}
- Ops.push_back(Op.getOp());
- for (unsigned I = 0; I < Op.getNumArgs(); ++I)
- Ops.push_back(Op.getArg(I));
+ Op.appendToVector(Ops);
}
}
Ops.push_back(dwarf::DW_OP_LLVM_fragment);
More information about the llvm-commits
mailing list