14#ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
15#define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPINGREADER_H
33class CoverageMappingReader;
77 return Reader ==
RHS.Reader;
80 return Reader !=
RHS.Reader;
84 auto E = make_error<CoverageMapError>(ReadErr);
92 auto E = make_error<CoverageMapError>(ReadErr);
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);
177 size_t FilenamesBegin,
size_t FilenamesSize)
178 : Version(Version), FunctionName(FunctionName),
180 FilenamesBegin(FilenamesBegin), FilenamesSize(FilenamesSize) {}
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;
208 : ProfileNames(
std::
move(Symtab)), FuncRecords(
std::
move(FuncRecords)),
209 CoverageMapCopy(
std::
move(CoverageMapCopy)) {}
222 createCoverageReaderFromBuffer(
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.
Reader for the coverage mapping data that is emitted by the frontend and stored in an object file.
std::unique_ptr< MemoryBuffer > CoverageMapCopyStorage
BinaryCoverageReader & operator=(const BinaryCoverageReader &)=delete
std::unique_ptr< MemoryBuffer > FuncRecordsStorage
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="")
LLVM_ABI 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.
LLVM_ABI 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.
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.
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