26 : Modules(&Modules), Modi(Modi), Filei(Filei) {
37 if (isEnd() && R.isEnd())
41 if (isEnd() != R.isEnd())
50 assert(Modules == R.Modules);
55 return (Filei == R.Filei);
68 return Filei < R.Filei;
77 if (isEnd() && R.isEnd())
93 return Thisi - R.Filei;
101 assert(Filei <= Modules->getSourceFileCount(Modi));
110 assert(!isUniversalEnd());
118 void DbiModuleSourceFilesIterator::setValue() {
124 uint32_t Off = Modules->ModuleInitialFileIndex[Modi] + Filei;
126 if (!ExpectedValue) {
130 ThisValue = *ExpectedValue;
133 bool DbiModuleSourceFilesIterator::isEnd()
const {
134 if (isUniversalEnd())
138 assert(Modi <= Modules->getModuleCount());
139 assert(Filei <= Modules->getSourceFileCount(Modi));
148 bool DbiModuleSourceFilesIterator::isUniversalEnd()
const {
return !Modules; }
150 bool DbiModuleSourceFilesIterator::isCompatible(
153 if (isUniversalEnd() || R.isUniversalEnd())
160 return Modi == R.Modi;
165 if (
auto EC = initializeModInfo(ModInfo))
167 if (
auto EC = initializeFileInfo(FileInfo))
174 ModInfoSubstream = ModInfo;
188 FileInfoSubstream = FileInfo;
194 if (
auto EC = FISR.
readObject(FileInfoHeader))
200 if (
auto EC = FISR.
readArray(ModuleIndices, FileInfoHeader->NumModules))
202 if (
auto EC = FISR.
readArray(ModFileCountArray, FileInfoHeader->NumModules))
210 for (
auto Count : ModFileCountArray)
211 NumSourceFiles += Count;
217 if (
auto EC = FISR.
readArray(FileNameOffsets, NumSourceFiles))
223 auto DescriptorIter = Descriptors.begin();
225 ModuleInitialFileIndex.resize(FileInfoHeader->NumModules);
226 ModuleDescriptorOffsets.resize(FileInfoHeader->NumModules);
227 for (
size_t I = 0;
I < FileInfoHeader->NumModules; ++
I) {
228 assert(DescriptorIter != Descriptors.end());
229 ModuleInitialFileIndex[
I] = NextFileIndex;
230 ModuleDescriptorOffsets[
I] = DescriptorIter.offset();
232 NextFileIndex += ModFileCountArray[
I];
236 assert(DescriptorIter == Descriptors.end());
237 assert(NextFileIndex == NumSourceFiles);
243 return FileInfoHeader->NumModules;
247 return FileNameOffsets.size();
251 return ModFileCountArray[Modi];
255 assert(Modi < getModuleCount());
257 auto Iter = Descriptors.at(Offset);
258 assert(Iter != Descriptors.end());
264 return make_range<DbiModuleSourceFilesIterator>(
271 if (Index >= getSourceFileCount())
278 return std::move(EC);
DbiModuleSourceFilesIterator & operator-=(std::ptrdiff_t N)
This class represents lattice values for constants.
Expected< StringRef > getFileName(uint32_t Index) const
DbiModuleSourceFilesIterator & operator+=(std::ptrdiff_t N)
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
Error readObject(const T *&Dest)
Get a pointer to an object of type T from the underlying stream, as if by memcpy, and store the resul...
DbiModuleDescriptor getModuleDescriptor(uint32_t Modi) const
FixedStreamArray is similar to VarStreamArray, except with each record having a fixed-length.
iterator_range< DbiModuleSourceFilesIterator > source_files(uint32_t Modi) const
amdgpu Simplify well known AMD library false Value Value const Twine & Name
uint32_t getSourceFileCount() const
uint32_t getModuleCount() const
Tagged union holding either a T or a Error.
Error readCString(StringRef &Dest)
Read a null terminated string from Dest.
DbiModuleSourceFilesIterator()=default
Error initialize(BinaryStreamRef ModInfo, BinaryStreamRef FileInfo)
bool operator==(const DbiModuleSourceFilesIterator &R) const
std::ptrdiff_t operator-(const DbiModuleSourceFilesIterator &R) const
void consumeError(Error Err)
Consume a Error without doing anything.
void setOffset(uint32_t Off)
uint32_t getLength() const
static ErrorSuccess success()
Create a success value.
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
A range adaptor for a pair of iterators.
Error readStreamRef(BinaryStreamRef &Ref)
Read the entire remainder of the underlying stream into Ref.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
Lightweight error class with error context and mandatory checking.
Provides read only access to a subclass of BinaryStream.
StringRef - Represent a constant reference to a string, i.e.
Error readArray(ArrayRef< T > &Array, uint32_t NumElements)
Get a reference to a NumElements element array of objects of type T from the underlying stream as if ...
bool operator<(const DbiModuleSourceFilesIterator &RHS) const