[llvm] r349066 - Correctly handle skewed streams in drop_front() method.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 13 10:11:33 PST 2018


Author: zturner
Date: Thu Dec 13 10:11:33 2018
New Revision: 349066

URL: http://llvm.org/viewvc/llvm-project?rev=349066&view=rev
Log:
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.

Modified:
    llvm/trunk/include/llvm/Support/BinaryStreamArray.h

Modified: llvm/trunk/include/llvm/Support/BinaryStreamArray.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/BinaryStreamArray.h?rev=349066&r1=349065&r2=349066&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/BinaryStreamArray.h (original)
+++ llvm/trunk/include/llvm/Support/BinaryStreamArray.h Thu Dec 13 10:11:33 2018
@@ -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;




More information about the llvm-commits mailing list