14#ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
15#define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
77 return Reader ==
RHS.Reader;
80 return Reader !=
RHS.Reader;
135 std::vector<StringRef> &Filenames;
136 std::vector<CounterExpression> &Expressions;
137 std::vector<CounterMappingRegion> &MappingRegions;
142 std::vector<StringRef> &Filenames,
143 std::vector<CounterExpression> &Expressions,
144 std::vector<CounterMappingRegion> &MappingRegions)
146 TranslationUnitFilenames(TranslationUnitFilenames),
147 Filenames(Filenames), Expressions(Expressions),
148 MappingRegions(MappingRegions) {}
159 readMappingRegionsSubArray(std::vector<CounterMappingRegion> &MappingRegions,
160 unsigned InferredFileID,
size_t NumFileIDs);
187 std::vector<std::string> Filenames;
188 std::vector<ProfileMappingRecord> MappingRecords;
189 std::unique_ptr<InstrProfSymtab> ProfileNames;
190 size_t CurrentRecord = 0;
191 std::vector<StringRef> FunctionsFilenames;
192 std::vector<CounterExpression> Expressions;
193 std::vector<CounterMappingRegion> MappingRegions;
205 BinaryCoverageReader(std::unique_ptr<InstrProfSymtab> Symtab,
208 : ProfileNames(
std::
move(Symtab)), FuncRecords(
std::
move(FuncRecords)),
209 CoverageMapCopy(
std::
move(CoverageMapCopy)) {}
213 BinaryCoverageReader &
operator=(
const BinaryCoverageReader &) =
delete;
225 std::unique_ptr<InstrProfSymtab> ProfileNamesPtr,
uint8_t BytesInAddress,
233 std::vector<std::string> &Filenames;
241 std::vector<std::string> &Filenames,
244 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.
static Expected< std::unique_ptr< BinaryCoverageReader > > createCoverageReaderFromBuffer(StringRef Coverage, FuncRecordsStorage &&FuncRecords, CoverageMapCopyStorage &&CoverageMap, std::unique_ptr< InstrProfSymtab > ProfileNamesPtr, uint8_t BytesInAddress, llvm::endianness Endian, StringRef CompilationDir="")
std::unique_ptr< MemoryBuffer > CoverageMapCopyStorage
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*()
CoverageMappingRecord value_type
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()
RawCoverageFilenamesReader(StringRef Data, std::vector< std::string > &Filenames, StringRef CompilationDir="")
LLVM_ABI Error read(CovMapVersion Version)
RawCoverageFilenamesReader(const RawCoverageFilenamesReader &)=delete
RawCoverageFilenamesReader & operator=(const RawCoverageFilenamesReader &)=delete
LLVM_ABI Expected< bool > isDummy()
RawCoverageMappingDummyChecker(StringRef MappingData)
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)
LLVM_ABI Error readSize(uint64_t &Result)
LLVM_ABI Error readIntMax(uint64_t &Result, uint64_t MaxPlus1)
LLVM_ABI Error readULEB128(uint64_t &Result)
LLVM_ABI 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.
FunctionAddr VTableAddr uintptr_t uintptr_t Version
Error make_error(ArgTs &&... Args)
Make a Error instance representing failure using the given error info type.
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