30 ModuleDebugStreamRef::ModuleDebugStreamRef(
32 std::unique_ptr<MappedBlockStream> Stream)
33 :
Mod(Module), Stream(
std::move(Stream)) {}
40 uint32_t SymbolSize =
Mod.getSymbolDebugInfoByteSize();
44 if (C11Size > 0 && C13Size > 0)
46 "Module has both C11 and C13 line info");
66 if (
auto EC = SubsectionsReader.
readArray(Subsections,
73 if (
auto EC = Reader.
readSubstream(GlobalRefsSubstream, GlobalRefsSize))
76 return make_error<RawError>(raw_error_code::corrupt_file,
77 "Unexpected bytes in module stream.");
88 return SymbolsSubstream;
92 return C11LinesSubstream;
96 return C13LinesSubstream;
100 return GlobalRefsSubstream;
105 return make_range(SymbolArray.begin(HadError), SymbolArray.end());
109 auto Iter = SymbolArray.at(Offset);
110 assert(Iter != SymbolArray.end());
116 return make_range(Subsections.begin(), Subsections.end());
120 return !C13LinesSubstream.empty();
128 for (
const auto &SS : subsections()) {
129 if (SS.kind() != DebugSubsectionKind::FileChecksums)
133 return std::move(
EC);
const codeview::CVSymbolArray getSymbolArrayForScope(uint32_t ScopeBegin) const
Error readSubstream(BinarySubstreamRef &Stream, uint32_t Size)
Read Length bytes from the underlying stream into Stream.
This class represents lattice values for constants.
Error readInteger(T &Dest)
Read an integer of the specified endianness into Dest and update the stream's offset.
A Module instance is used to store all the information related to an LLVM module. ...
Expected< codeview::DebugChecksumsSubsectionRef > findChecksumsSubsection() const
This provides a very simple, boring adaptor for a begin and end iterator into a range type...
BinarySubstreamRef getC13LinesSubstream() const
iterator_range< DebugSubsectionIterator > subsections() const
codeview::CVSymbol readSymbolAtOffset(uint32_t Offset) const
Tagged union holding either a T or a Error.
Error initialize(BinaryStreamReader Reader)
iterator_range< codeview::CVSymbolArray::Iterator > symbols(bool *HadError) const
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
void setOffset(uint32_t Off)
static ErrorSuccess success()
Create a success value.
bool hasDebugSubsections() const
BinaryStreamRef is to BinaryStream what ArrayRef is to an Array.
BinarySubstreamRef getC11LinesSubstream() const
BinarySubstreamRef getSymbolsSubstream() const
The access may modify the value stored in memory.
A range adaptor for a pair of iterators.
CVSymbolArray limitSymbolArrayToScope(const CVSymbolArray &Symbols, uint32_t ScopeBegin)
BinarySubstreamRef getGlobalRefsSubstream() const
uint32_t bytesRemaining() const
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.
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 ...