diff --git a/llvm/include/llvm/Support/BinaryStreamArray.h b/llvm/include/llvm/Support/BinaryStreamArray.h index 67ba2e4189be4..e490389c8ec43 100644 --- a/llvm/include/llvm/Support/BinaryStreamArray.h +++ b/llvm/include/llvm/Support/BinaryStreamArray.h @@ -133,9 +133,9 @@ class VarStreamArray { Extractor &getExtractor() { return E; } BinaryStreamRef getUnderlyingStream() const { return Stream; } - void setUnderlyingStream(BinaryStreamRef S, uint32_t Skew = 0) { - Stream = S; - this->Skew = Skew; + void setUnderlyingStream(BinaryStreamRef NewStream, uint32_t NewSkew = 0) { + Stream = NewStream; + Skew = NewSkew; } void drop_front() { Skew += begin()->length(); } @@ -143,7 +143,7 @@ class VarStreamArray { private: BinaryStreamRef Stream; Extractor E; - uint32_t Skew; + uint32_t Skew = 0; }; template diff --git a/llvm/include/llvm/Support/BinaryStreamReader.h b/llvm/include/llvm/Support/BinaryStreamReader.h index 9e16ce227ff86..b7d61c02667b3 100644 --- a/llvm/include/llvm/Support/BinaryStreamReader.h +++ b/llvm/include/llvm/Support/BinaryStreamReader.h @@ -148,14 +148,14 @@ class BinaryStreamReader { /// returns an appropriate error code. Error readStreamRef(BinaryStreamRef &Ref, uint32_t Length); - /// Read \p Length bytes from the underlying stream into \p Stream. This is + /// Read \p Length bytes from the underlying stream into \p Ref. This is /// equivalent to calling getUnderlyingStream().slice(Offset, Length). /// Updates the stream's offset to point after the newly read object. Never /// causes a copy. /// /// \returns a success error code if the data was successfully read, otherwise /// returns an appropriate error code. - Error readSubstream(BinarySubstreamRef &Stream, uint32_t Size); + Error readSubstream(BinarySubstreamRef &Ref, uint32_t Length); /// Get a pointer to an object of type T from the underlying stream, as if by /// memcpy, and store the result into \p Dest. It is up to the caller to diff --git a/llvm/include/llvm/Support/BinaryStreamRef.h b/llvm/include/llvm/Support/BinaryStreamRef.h index 7427b8da5b435..5375d6a3a7615 100644 --- a/llvm/include/llvm/Support/BinaryStreamRef.h +++ b/llvm/include/llvm/Support/BinaryStreamRef.h @@ -198,7 +198,7 @@ class BinaryStreamRef }; struct BinarySubstreamRef { - uint32_t Offset; // Offset in the parent stream + uint32_t Offset = 0; // Offset in the parent stream BinaryStreamRef StreamData; // Stream Data BinarySubstreamRef slice(uint32_t Off, uint32_t Size) const { @@ -211,8 +211,8 @@ struct BinarySubstreamRef { BinarySubstreamRef keep_front(uint32_t N) const { return slice(0, N); } std::pair - split(uint32_t Offset) const { - return std::make_pair(keep_front(Offset), drop_front(Offset)); + split(uint32_t Off) const { + return std::make_pair(keep_front(Off), drop_front(Off)); } uint32_t size() const { return StreamData.getLength(); } diff --git a/llvm/lib/Support/BinaryStreamReader.cpp b/llvm/lib/Support/BinaryStreamReader.cpp index b17786593bded..a0434bdc61156 100644 --- a/llvm/lib/Support/BinaryStreamReader.cpp +++ b/llvm/lib/Support/BinaryStreamReader.cpp @@ -139,10 +139,10 @@ Error BinaryStreamReader::readStreamRef(BinaryStreamRef &Ref, uint32_t Length) { return Error::success(); } -Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Stream, - uint32_t Size) { - Stream.Offset = getOffset(); - return readStreamRef(Stream.StreamData, Size); +Error BinaryStreamReader::readSubstream(BinarySubstreamRef &Ref, + uint32_t Length) { + Ref.Offset = getOffset(); + return readStreamRef(Ref.StreamData, Length); } Error BinaryStreamReader::skip(uint32_t Amount) {