llvm.org GIT mirror llvm / ba51299
[StreamArray] Pipe the Offset through the constructor. When randomly accessing an element by offset, we weren't passing the offset through so if you called .offset() it would return a value of 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302292 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 3 years ago
1 changed file(s) with 3 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
6363 public:
6464 VarStreamArrayIterator() = default;
6565 VarStreamArrayIterator(const ArrayType &Array, const WrappedCtx &Ctx,
66 BinaryStreamRef Stream, bool *HadError = nullptr)
67 : IterRef(Stream), Ctx(&Ctx), Array(&Array), HadError(HadError) {
66 BinaryStreamRef Stream, bool *HadError = nullptr, uint32_t Offset = 0)
67 : IterRef(Stream), Ctx(&Ctx), Array(&Array), HadError(HadError), AbsOffset(Offset) {
6868 if (IterRef.getLength() == 0)
6969 moveToEnd();
7070 else {
237237 /// since the behavior is undefined if \p Offset does not refer to the
238238 /// beginning of a valid record.
239239 Iterator at(uint32_t Offset) const {
240 return Iterator(*this, Ctx, Stream.drop_front(Offset), nullptr);
240 return Iterator(*this, Ctx, Stream.drop_front(Offset), nullptr, Offset);
241241 }
242242
243243 BinaryStreamRef getUnderlyingStream() const { return Stream; }