From 5ec91b4438212d96fb482a2a9a37d67d20b2a64a Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Thu, 13 Dec 2018 18:11:33 +0000 Subject: [PATCH] Correctly handle skewed streams in drop_front() method. When calling BinaryStreamArray::drop_front(), if the stream is skewed it means we must never drop the first bytes of the stream since offsets which occur in records assume the existence of those bytes. So if we want to skip the first record in a stream, then what we really want to do is just set the begin pointer to the next record. But we shouldn't actually remove those bytes from the underlying view of the data. llvm-svn: 349066 --- include/llvm/Support/BinaryStreamArray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/llvm/Support/BinaryStreamArray.h b/include/llvm/Support/BinaryStreamArray.h index 049cf56f4f3..7c110fcb6a4 100644 --- a/include/llvm/Support/BinaryStreamArray.h +++ b/include/llvm/Support/BinaryStreamArray.h @@ -139,7 +139,7 @@ public: this->Skew = Skew; } - void drop_front() { Stream = Stream.drop_front(begin()->length()); } + void drop_front() { Skew += begin()->length(); } private: BinaryStreamRef Stream;