Update prebuilt Clang to match Android kernel.
Bug: 132428451
Change-Id: I8f6e2cb23f381fc0c02ddea99b867e58e925e5be
diff --git a/linux-x64/clang/include/llvm/Support/BinaryStreamArray.h b/linux-x64/clang/include/llvm/Support/BinaryStreamArray.h
index d1571cb..96d09db 100644
--- a/linux-x64/clang/include/llvm/Support/BinaryStreamArray.h
+++ b/linux-x64/clang/include/llvm/Support/BinaryStreamArray.h
@@ -1,9 +1,8 @@
//===- BinaryStreamArray.h - Array backed by an arbitrary stream *- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -96,21 +95,32 @@
explicit VarStreamArray(const Extractor &E) : E(E) {}
- explicit VarStreamArray(BinaryStreamRef Stream) : Stream(Stream) {}
+ explicit VarStreamArray(BinaryStreamRef Stream, uint32_t Skew = 0)
+ : Stream(Stream), Skew(Skew) {}
- VarStreamArray(BinaryStreamRef Stream, const Extractor &E)
- : Stream(Stream), E(E) {}
+ VarStreamArray(BinaryStreamRef Stream, const Extractor &E, uint32_t Skew = 0)
+ : Stream(Stream), E(E), Skew(Skew) {}
Iterator begin(bool *HadError = nullptr) const {
- return Iterator(*this, E, HadError);
+ return Iterator(*this, E, Skew, nullptr);
}
bool valid() const { return Stream.valid(); }
+ uint32_t skew() const { return Skew; }
Iterator end() const { return Iterator(E); }
bool empty() const { return Stream.getLength() == 0; }
+ VarStreamArray<ValueType, Extractor> substream(uint32_t Begin,
+ uint32_t End) const {
+ assert(Begin >= Skew);
+ // We should never cut off the beginning of the stream since it might be
+ // skewed, meaning the initial bytes are important.
+ BinaryStreamRef NewStream = Stream.slice(0, End);
+ return {NewStream, E, Begin};
+ }
+
/// given an offset into the array's underlying stream, return an
/// iterator to the record at that offset. This is considered unsafe
/// since the behavior is undefined if \p Offset does not refer to the
@@ -123,11 +133,17 @@
Extractor &getExtractor() { return E; }
BinaryStreamRef getUnderlyingStream() const { return Stream; }
- void setUnderlyingStream(BinaryStreamRef S) { Stream = S; }
+ void setUnderlyingStream(BinaryStreamRef S, uint32_t Skew = 0) {
+ Stream = S;
+ this->Skew = Skew;
+ }
+
+ void drop_front() { Skew += begin()->length(); }
private:
BinaryStreamRef Stream;
Extractor E;
+ uint32_t Skew;
};
template <typename ValueType, typename Extractor>
@@ -139,10 +155,6 @@
public:
VarStreamArrayIterator(const ArrayType &Array, const Extractor &E,
- bool *HadError)
- : VarStreamArrayIterator(Array, E, 0, HadError) {}
-
- VarStreamArrayIterator(const ArrayType &Array, const Extractor &E,
uint32_t Offset, bool *HadError)
: IterRef(Array.Stream.drop_front(Offset)), Extract(E),
Array(&Array), AbsOffset(Offset), HadError(HadError) {