14#ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
15#define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
32class CoverageMappingReader;
76 return Reader ==
RHS.Reader;
79 return Reader !=
RHS.Reader;
83 auto E = make_error<CoverageMapError>(ReadErr);
91 auto E = make_error<CoverageMapError>(ReadErr);
134 std::vector<StringRef> &Filenames;
135 std::vector<CounterExpression> &Expressions;
136 std::vector<CounterMappingRegion> &MappingRegions;
141 std::vector<StringRef> &Filenames,
142 std::vector<CounterExpression> &Expressions,
143 std::vector<CounterMappingRegion> &MappingRegions)
145 TranslationUnitFilenames(TranslationUnitFilenames),
146 Filenames(Filenames), Expressions(Expressions),
147 MappingRegions(MappingRegions) {}
158 readMappingRegionsSubArray(std::vector<CounterMappingRegion> &MappingRegions,
159 unsigned InferredFileID,
size_t NumFileIDs);
185 std::vector<std::string> Filenames;
186 std::vector<ProfileMappingRecord> MappingRecords;
187 std::unique_ptr<InstrProfSymtab> ProfileNames;
188 size_t CurrentRecord = 0;
189 std::vector<StringRef> FunctionsFilenames;
190 std::vector<CounterExpression> Expressions;
191 std::vector<CounterMappingRegion> MappingRegions;
200 : ProfileNames(
std::
move(Symtab)), FuncRecords(
std::
move(FuncRecords)) {}
215 std::unique_ptr<InstrProfSymtab> ProfileNamesPtr, uint8_t BytesInAddress,
223 std::vector<std::string> &Filenames;
231 std::vector<std::string> &Filenames,
234 CompilationDir(CompilationDir) {}
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Lightweight error class with error context and mandatory checking.
Tagged union holding either a T or a Error.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
Reader for the coverage mapping data that is emitted by the frontend and stored in an object file.
static Expected< std::unique_ptr< BinaryCoverageReader > > createCoverageReaderFromBuffer(StringRef Coverage, FuncRecordsStorage &&FuncRecords, std::unique_ptr< InstrProfSymtab > ProfileNamesPtr, uint8_t BytesInAddress, llvm::endianness Endian, StringRef CompilationDir="")
static Expected< std::vector< std::unique_ptr< BinaryCoverageReader > > > create(MemoryBufferRef ObjectBuffer, StringRef Arch, SmallVectorImpl< std::unique_ptr< MemoryBuffer > > &ObjectFileBuffers, StringRef CompilationDir="", SmallVectorImpl< object::BuildIDRef > *BinaryIDs=nullptr)
BinaryCoverageReader & operator=(const BinaryCoverageReader &)=delete
std::unique_ptr< MemoryBuffer > FuncRecordsStorage
Error readNextRecord(CoverageMappingRecord &Record) override
BinaryCoverageReader(const BinaryCoverageReader &)=delete
A file format agnostic iterator over coverage mapping data.
Expected< CoverageMappingRecord & > operator*()
bool operator==(const CoverageMappingIterator &RHS) const
std::ptrdiff_t difference_type
CoverageMappingIterator()
~CoverageMappingIterator()
std::input_iterator_tag iterator_category
Expected< CoverageMappingRecord * > operator->()
CoverageMappingIterator(CoverageMappingReader *Reader)
CoverageMappingIterator & operator++()
bool operator!=(const CoverageMappingIterator &RHS) const
CoverageMappingIterator begin()
virtual Error readNextRecord(CoverageMappingRecord &Record)=0
virtual ~CoverageMappingReader()=default
CoverageMappingIterator end()
The mapping of profile information to coverage data.
Reader for the raw coverage filenames.
RawCoverageFilenamesReader(StringRef Data, std::vector< std::string > &Filenames, StringRef CompilationDir="")
Error read(CovMapVersion Version)
RawCoverageFilenamesReader(const RawCoverageFilenamesReader &)=delete
RawCoverageFilenamesReader & operator=(const RawCoverageFilenamesReader &)=delete
Checks if the given coverage mapping data is exported for an unused function.
Expected< bool > isDummy()
RawCoverageMappingDummyChecker(StringRef MappingData)
Reader for the raw coverage mapping data.
RawCoverageMappingReader(const RawCoverageMappingReader &)=delete
RawCoverageMappingReader & operator=(const RawCoverageMappingReader &)=delete
RawCoverageMappingReader(StringRef MappingData, ArrayRef< std::string > &TranslationUnitFilenames, std::vector< StringRef > &Filenames, std::vector< CounterExpression > &Expressions, std::vector< CounterMappingRegion > &MappingRegions)
Base class for the raw coverage mapping and filenames data readers.
Error readSize(uint64_t &Result)
Error readIntMax(uint64_t &Result, uint64_t MaxPlus1)
Error readULEB128(uint64_t &Result)
Error readString(StringRef &Result)
RawCoverageReader(StringRef Data)
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
This is an optimization pass for GlobalISel generic memory operations.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Implement std::hash so that hash_code can be used in STL containers.
StringRef CoverageMapping
ProfileMappingRecord(CovMapVersion Version, StringRef FunctionName, uint64_t FunctionHash, StringRef CoverageMapping, size_t FilenamesBegin, size_t FilenamesSize)
A Counter is an abstract value that describes how to compute the execution count for a region of code...
Coverage mapping information for a single function.
ArrayRef< CounterExpression > Expressions
ArrayRef< CounterMappingRegion > MappingRegions
ArrayRef< StringRef > Filenames