10 #ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
11 #define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
39 T &Item)
const =
delete;
91 : Stream(Stream), E(E) {}
94 : Stream(Other.Stream),
E(Other.
E) {}
111 template <
typename ValueType,
typename Extractor>
112 class VarStreamArrayIterator
114 std::forward_iterator_tag, ValueType> {
115 typedef VarStreamArrayIterator<ValueType, Extractor> IterType;
116 typedef VarStreamArray<ValueType, Extractor>
ArrayType;
120 bool *HadError =
nullptr)
121 : IterRef(Array.Stream), Array(&Array), HadError(HadError), Extract(E) {
125 auto EC = Extract(IterRef, ThisLen, ThisValue);
137 if (Array && R.Array) {
140 return IterRef == R.IterRef;
144 if (!Array && !R.Array)
152 assert(Array && !HasError);
166 auto EC = Extract(IterRef, ThisLen, ThisValue);
170 }
else if (ThisLen == 0) {
186 if (HadError !=
nullptr)
191 ReadableStreamRef IterRef;
192 const ArrayType *Array{
nullptr};
194 bool HasError{
false};
195 bool *HadError{
nullptr};
211 return Stream == Other.Stream;
215 return !(*
this ==
Other);
224 if (
auto EC = Stream.
readBytes(Off,
sizeof(
T), Data)) {
225 assert(
false &&
"Unexpected failure reading from stream");
230 return *
reinterpret_cast<const T *
>(Data.data());
251 template <
typename T>
252 class FixedStreamArrayIterator
254 std::random_access_iterator_tag, T> {
258 : Array(Array), Index(Index) {}
271 return (Index == R.Index) && (Array == R.Array);
288 return Index - R.Index;
291 bool operator<(const FixedStreamArrayIterator<T> &RHS)
const {
292 assert(Array == RHS.Array);
293 return Index < RHS.Index;
304 #endif // LLVM_DEBUGINFO_MSF_STREAMARRAY_H
bool operator==(const IterType &R) const
VarStreamArray(const Extractor &E)
VarStreamArray represents an array of variable length records backed by a stream. ...
bool operator==(const FixedStreamArray< T > &Other) const
FixedStreamArray()=default
FixedStreamArrayIterator< T > & operator=(const FixedStreamArrayIterator< T > &Other)
FixedStreamArrayIterator< T > end() const
FixedStreamArrayIterator< T > & operator+=(std::ptrdiff_t N)
const T & operator[](uint32_t Index) const
Iterator begin(bool *HadError=nullptr) const
bool operator!=(const FixedStreamArray< T > &Other) const
FixedStreamArrayIterator(const FixedStreamArray< T > &Array, uint32_t Index)
FixedStreamArray(ReadableStreamRef Stream)
Class to represent array types.
FixedStreamArrayIterator< T > & operator-=(std::ptrdiff_t N)
Error readBytes(uint32_t Offset, uint32_t Size, ArrayRef< uint8_t > &Buffer) const
bool operator==(const FixedStreamArrayIterator< T > &R) const
ReadableStreamRef getUnderlyingStream() const
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
static GCRegistry::Add< CoreCLRGC > E("coreclr","CoreCLR-compatible GC")
VarStreamArrayIterator()=default
VarStreamArrayIterator(const ArrayType &Array, const Extractor &E, bool *HadError=nullptr)
RefType drop_front(uint32_t N) const
ReadableStreamRef getUnderlyingStream() const
uint32_t getLength() const
VarStreamArray(ReadableStreamRef Stream, const Extractor &E)
const T & operator*() const
std::ptrdiff_t operator-(const FixedStreamArrayIterator< T > &R) const
VarStreamArray(ReadableStreamRef Stream)
void consumeError(Error Err)
Consume a Error without doing anything.
const Extractor & getExtractor() const
FixedStreamArrayIterator< T > begin() const
~VarStreamArrayIterator()=default
const ValueType & operator*() const
VarStreamArray(const VarStreamArray< ValueType, Extractor > &Other)
VarStreamArrayIterator(const Extractor &E)
VarStreamArrayIterator< ValueType, Extractor > Iterator
FixedStreamArray & operator=(const FixedStreamArray &)=default
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
PointerUnion< const Value *, const PseudoSourceValue * > ValueType