14#ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPING_H
15#define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPING_H
43#include <system_error>
49class IndexedInstrProfReader;
84 : Err(Err), Msg(ErrStr.str()) {
85 assert(Err != coveragemap_error::success &&
"Not an error");
88 std::string message()
const override;
145 return std::tie(
LHS.Kind,
LHS.ID) < std::tie(
RHS.Kind,
RHS.ID);
178 std::vector<CounterExpression> Expressions;
195 Term(
unsigned CounterID,
int Factor)
196 : CounterID(CounterID), Factor(Factor) {}
273 return mcdc::getParams<const mcdc::DecisionParameters>(
MCDCParams);
277 return mcdc::getParams<const mcdc::BranchParameters>(
MCDCParams);
443 const auto &
A = *
this;
462 std::optional<TVPairMap> IndependencePairs;
481 return Region.getDecisionParams().NumConditions;
485 return Folded[
false][Condition] || Folded[
true][Condition];
495 return TV[TestVectorIndex].first[PosToID[Condition]];
501 const unsigned TrueDecisions =
504 return {TrueDecisions, TV.
size() - TrueDecisions};
510 return TV[TestVectorIndex].second;
519 assert(IndependencePairs);
520 auto It = PosToID.
find(Condition);
521 assert(It != PosToID.
end() &&
"Condition ID without an Ordinal mapping");
522 return IndependencePairs->contains(It->second);
532 assert(IndependencePairs);
533 return (*IndependencePairs)[PosToID[Condition]];
538 unsigned Covered = 0;
549 return (
static_cast<double>(Covered) /
static_cast<double>(
Total)) * 100.0;
553 std::ostringstream
OS;
554 const auto &[Line, Col] = CondLoc[Condition];
555 OS <<
"Condition C" << Condition + 1 <<
" --> (" << Line <<
":" << Col
561 std::ostringstream
OS;
567 for (
unsigned I = 0;
I < NumConditions;
I++) {
569 if (
I != NumConditions - 1)
578 "TestVector index out of bounds!");
579 std::ostringstream
OS;
582 OS <<
" " << TestVectorIndex + 1 <<
" { ";
583 for (
unsigned Condition = 0; Condition < NumConditions; Condition++) {
599 if (Condition != NumConditions - 1)
616 "Condition index is out of bounds!");
617 std::ostringstream
OS;
619 OS <<
" C" << Condition + 1 <<
"-Pair: ";
621 OS <<
"constant folded\n";
624 OS <<
"covered: (" << rows.first <<
",";
625 OS << rows.second <<
")\n";
627 OS <<
"not covered\n";
693 : Expressions(Expressions), CounterValues(CounterValues) {}
767 std::forward_iterator_tag, FunctionRecord> {
781 : Records(Records_), RecordIndices(RecordIndices_),
782 CurrentIndex(RecordIndices.
begin()),
785 Current(CurrentIndex == RecordIndices.
end() ? Records.begin()
786 : &Records[*CurrentIndex]),
788 assert(Filename.empty() == RecordIndices_.empty() &&
789 "If `Filename` is specified, `RecordIndices` must also be provided");
796 return Current ==
RHS.Current && Filename ==
RHS.Filename;
809 if (RecordIndices.
empty()) {
811 assert(Current != Records.end() &&
"incremented past end");
816 assert(CurrentIndex != RecordIndices.
end() &&
"incremented past end");
818 if (CurrentIndex == RecordIndices.
end()) {
819 Current = Records.end();
821 Current = &Records[*CurrentIndex];
869 bool IsBranchRegion =
false)
874 return std::tie(L.Line, L.Col, L.Count, L.HasCount, L.IsRegionEntry,
875 L.IsGapRegion) == std::tie(R.Line, R.Col, R.Count,
876 R.HasCount, R.IsRegionEntry,
891 std::vector<const FunctionRecord *> Instantiations;
894 std::vector<const FunctionRecord *> Instantiations)
895 : Line(Line), Col(Col), Instantiations(
std::
move(Instantiations)) {}
902 size_t size()
const {
return Instantiations.size(); }
912 for (
unsigned I = 1,
E = Instantiations.size();
I <
E; ++
I)
913 if (Instantiations[
I]->
Name != Instantiations[0]->
Name)
920 assert(
hasName() &&
"Instantiations don't have a shared name");
921 return Instantiations[0]->Name;
928 Count +=
F->ExecutionCount;
934 return Instantiations;
946 std::string Filename;
947 std::vector<CoverageSegment> Segments;
948 std::vector<ExpansionRecord> Expansions;
949 std::vector<CountedRegion> BranchRegions;
950 std::vector<MCDCRecord> MCDCRecords;
952 bool SingleByteCoverage =
false;
967 std::vector<CoverageSegment>::const_iterator
begin()
const {
968 return Segments.begin();
971 std::vector<CoverageSegment>::const_iterator
end()
const {
972 return Segments.end();
975 bool empty()
const {
return Segments.empty(); }
993 std::vector<FunctionRecord> Functions;
995 std::vector<std::pair<std::string, uint64_t>> FuncHashMismatches;
997 std::optional<bool> SingleByteCoverage;
1002 static Error loadFromReaders(
1003 ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
1004 std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1011 std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1017 Error loadFunctionRecord(
1019 const std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1027 getImpreciseRecordIndicesForFilename(
StringRef Filename)
const;
1035 load(
ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
1036 std::optional<std::reference_wrapper<IndexedInstrProfReader>>
1047 bool CheckBinaryIDs =
false);
1060 return FuncHashMismatches;
1093 getImpreciseRecordIndicesForFilename(Filename)),
1101 LLVM_ABI std::vector<InstantiationGroup>
1108 bool HasMultipleRegions;
1131 return LineSegments;
1141 std::forward_iterator_tag,
1142 const LineCoverageStats> {
1148 : CD(CD), WrappedSegment(nullptr), Next(CD.begin()), Ended(
false),
1154 return &CD == &R.CD && Next == R.Next && Ended == R.Ended;
1163 EndIt.Next = CD.
end();
1171 std::vector<CoverageSegment>::const_iterator Next;
1182 auto End = Begin.getEnd();
1213namespace accessors {
1216template <
class FuncRecordTy, llvm::endianness Endian>
1218 return support::endian::byte_swap<uint64_t, Endian>(
Record->FuncHash);
1222template <
class FuncRecordTy, llvm::endianness Endian>
1224 return support::endian::byte_swap<uint32_t, Endian>(
Record->DataSize);
1228template <
class FuncRecordTy, llvm::endianness Endian>
1230 return support::endian::byte_swap<uint64_t, Endian>(
Record->NameRef);
1235template <
class FuncRecordTy, llvm::endianness Endian>
1246template <
class FuncRecordTy, llvm::endianness Endian>
1248 const char *MappingBuf) {
1249 return {MappingBuf, size_t(getDataSize<FuncRecordTy, Endian>(
Record))};
1254template <
class FuncRecordTy, llvm::endianness Endian>
1255std::pair<const char *, const FuncRecordTy *>
1257 return {MappingBuf + getDataSize<FuncRecordTy, Endian>(
Record),
Record + 1};
1263template <
class IntPtrT>
1268#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
1274 return accessors::getFuncHash<ThisT, Endian>(
this);
1278 return accessors::getDataSize<ThisT, Endian>(
this);
1283 return support::endian::byte_swap<IntPtrT, Endian>(NamePtr);
1287 template <llvm::endianness Endian>
1289 IntPtrT NameRef = getFuncNameRef<Endian>();
1291 FuncName = ProfileNames.
getFuncName(NameRef, NameS);
1292 if (NameS && FuncName.
empty())
1294 "function name is empty");
1298 template <llvm::endianness Endian>
1299 std::pair<const char *, const ThisT *>
1301 return accessors::advanceByOneOutOfLine<ThisT, Endian>(
this, MappingBuf);
1308 template <llvm::endianness Endian>
1310 return accessors::getCoverageMappingOutOfLine<ThisT, Endian>(
this,
1319#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
1325 return accessors::getFuncHash<ThisT, Endian>(
this);
1329 return accessors::getDataSize<ThisT, Endian>(
this);
1333 return accessors::getFuncNameRef<ThisT, Endian>(
this);
1336 template <llvm::endianness Endian>
1338 return accessors::getFuncNameViaRef<ThisT, Endian>(
this, ProfileNames,
1342 template <llvm::endianness Endian>
1343 std::pair<const char *, const ThisT *>
1345 return accessors::advanceByOneOutOfLine<ThisT, Endian>(
this, MappingBuf);
1352 template <llvm::endianness Endian>
1354 return accessors::getCoverageMappingOutOfLine<ThisT, Endian>(
this,
1363#define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
1369 return accessors::getFuncHash<ThisT, Endian>(
this);
1373 return accessors::getDataSize<ThisT, Endian>(
this);
1377 return accessors::getFuncNameRef<ThisT, Endian>(
this);
1380 template <llvm::endianness Endian>
1382 return accessors::getFuncNameViaRef<ThisT, Endian>(
this, ProfileNames,
1388 return support::endian::byte_swap<uint64_t, Endian>(FilenamesRef);
1393 template <llvm::endianness Endian>
1400 template <llvm::endianness Endian>
1401 std::pair<const char *, const CovMapFunctionRecordV3 *>
1405 sizeof(
char) + getDataSize<Endian>();
1416#define COVMAP_HEADER(Type, LLVMType, Name, Init) Type Name;
1419 return support::endian::byte_swap<uint32_t, Endian>(NRecords);
1423 return support::endian::byte_swap<uint32_t, Endian>(FilenamesSize);
1427 return support::endian::byte_swap<uint32_t, Endian>(CoverageSize);
1431 return support::endian::byte_swap<uint32_t, Endian>(
Version);
1498 using namespace coverage;
1500 return CounterExpression(CounterExpression::ExprKind::Subtract,
1501 Counter::getCounter(~0U),
1502 Counter::getCounter(~0U));
1506 using namespace coverage;
1508 return CounterExpression(CounterExpression::ExprKind::Add,
1509 Counter::getCounter(~0U),
1510 Counter::getCounter(~0U));
1514 return static_cast<unsigned>(
1515 hash_combine(V.Kind, V.LHS.getKind(), V.LHS.getCounterID(),
1516 V.RHS.getKind(), V.RHS.getCounterID()));
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
AMDGPU Mark last scratch load
This file implements the BitVector class.
This file declares a library for handling Build IDs and using them to find debug info.
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
#define LLVM_PACKED_START
This file defines the DenseMap class.
This file defines the DenseSet and SmallDenseSet classes.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
ArrayRef< BitWord > getData() const
size_type size() const
size - Returns the number of bits in this bitvector.
iterator find(const_arg_type_t< KeyT > Val)
Base class for user error types.
Lightweight error class with error context and mandatory checking.
static ErrorSuccess success()
Create a success value.
Tagged union holding either a T or a Error.
Class representing an expression and its matching format.
A symbol table used for function [IR]PGO name look-up with keys (such as pointers,...
StringRef getFuncOrVarName(uint64_t ValMD5Hash) const
Return name of functions or global variables from the name's md5 hash value.
LLVM_ABI StringRef getFuncName(uint64_t FuncNameAddress, size_t NameSize) const
Return function's PGO name from the function name's symbol address in the object file.
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.
constexpr bool empty() const
empty - Check if the string is empty.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
A Counter expression builder is used to construct the counter expressions.
ArrayRef< CounterExpression > getExpressions() const
LLVM_ABI Counter subtract(Counter LHS, Counter RHS, bool Simplify=true)
Return a counter that represents the expression that subtracts RHS from LHS.
LLVM_ABI Counter add(Counter LHS, Counter RHS, bool Simplify=true)
Return a counter that represents the expression that adds LHS and RHS.
LLVM_ABI Counter subst(Counter C, const SubstMap &Map)
std::map< Counter, Counter > SubstMap
K to V map.
A Counter mapping context is used to connect the counters, expressions and the obtained counter value...
LLVM_ABI Expected< MCDCRecord > evaluateMCDCRegion(const CounterMappingRegion &Region, ArrayRef< const CounterMappingRegion * > Branches, bool IsVersion11)
Return an MCDC record that indicates executed test vectors and condition pairs.
void setCounts(ArrayRef< uint64_t > Counts)
void dump(const Counter &C) const
LLVM_ABI Expected< int64_t > evaluate(const Counter &C) const
Return the number of times that a region of code associated with this counter was executed.
void setBitmap(BitVector &&Bitmap_)
LLVM_ABI unsigned getMaxCounterID(const Counter &C) const
CounterMappingContext(ArrayRef< CounterExpression > Expressions, ArrayRef< uint64_t > CounterValues={})
LLVM_ABI void dump(const Counter &C, raw_ostream &OS) const
Coverage information to be processed or displayed.
bool getSingleByteCoverage() const
ArrayRef< ExpansionRecord > getExpansions() const
Expansions that can be further processed.
ArrayRef< CountedRegion > getBranches() const
Branches that can be further processed.
std::vector< CoverageSegment >::const_iterator begin() const
Get an iterator over the coverage segments for this object.
std::vector< CoverageSegment >::const_iterator end() const
StringRef getFilename() const
Get the name of the file this data covers.
ArrayRef< MCDCRecord > getMCDCRecords() const
MCDC Records that can be further processed.
CoverageData(bool Single, StringRef Filename)
CoverageMapError(coveragemap_error Err, const Twine &ErrStr=Twine())
void log(raw_ostream &OS) const override
Print an error message to an output stream.
coveragemap_error get() const
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
const std::string & getMessage() const
The mapping of profile information to coverage data.
unsigned getMismatchedCount() const
The number of functions that couldn't have their profiles mapped.
LLVM_ABI std::vector< StringRef > getUniqueSourceFiles() const
Returns a lexicographically sorted, unique list of files that are covered.
LLVM_ABI CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const
Get the coverage for an expansion within a coverage set.
ArrayRef< std::pair< std::string, uint64_t > > getHashMismatches() const
A hash mismatch occurs when a profile record for a symbol does not have the same hash as a coverage m...
iterator_range< FunctionRecordIterator > getCoveredFunctions(StringRef Filename) const
Gets all of the functions in a particular file.
iterator_range< FunctionRecordIterator > getCoveredFunctions() const
Gets all of the functions covered by this profile.
LLVM_ABI CoverageData getCoverageForFunction(const FunctionRecord &Function) const
Get the coverage for a particular function.
CoverageMapping(const CoverageMapping &)=delete
LLVM_ABI std::vector< InstantiationGroup > getInstantiationGroups(StringRef Filename) const
Get the list of function instantiation groups in a particular file.
LLVM_ABI CoverageData getCoverageForFile(StringRef Filename) const
Get the coverage for a particular file.
CoverageMapping & operator=(const CoverageMapping &)=delete
Iterator over Functions, optionally filtered to a single file.
FunctionRecordIterator(ArrayRef< FunctionRecord > Records_, StringRef Filename="", ArrayRef< unsigned > RecordIndices_={})
FunctionRecordIterator & operator++()
bool operator==(const FunctionRecordIterator &RHS) const
const FunctionRecord & operator*() const
An instantiation group contains a FunctionRecord list, such that each record corresponds to a distinc...
InstantiationGroup(const InstantiationGroup &)=delete
unsigned getLine() const
Get the line where the common function was defined.
unsigned getColumn() const
Get the column where the common function was defined.
bool hasName() const
Check if the instantiations in this group have a common mangled name.
size_t size() const
Get the number of instantiations in this group.
ArrayRef< const FunctionRecord * > getInstantiations() const
Get the instantiations in this group.
uint64_t getTotalExecutionCount() const
Get the total execution count of all instantiations in this group.
InstantiationGroup(InstantiationGroup &&)=default
StringRef getName() const
Get the common mangled name for instantiations in this group.
An iterator over the LineCoverageStats objects for lines described by a CoverageData instance.
LineCoverageIterator(const CoverageData &CD)
const LineCoverageStats & operator*() const
bool operator==(const LineCoverageIterator &R) const
LineCoverageIterator getEnd() const
LLVM_ABI LineCoverageIterator & operator++()
LineCoverageIterator(const CoverageData &CD, unsigned Line)
Coverage statistics for a single line.
bool hasMultipleRegions() const
const CoverageSegment * getWrappedSegment() const
uint64_t getExecutionCount() const
ArrayRef< const CoverageSegment * > getLineSegments() const
Emulate SmallVector<CondState> with a pair of BitVector.
auto getIndex() const
Equivalent to buildTestVector's Index.
CondState operator[](int I) const
Emulate RHS SmallVector::operator[].
TestVector(unsigned N)
~DontCare
void set(int I, CondState Val)
Set the condition Val at position I.
auto getDifferences(const TestVector &B) const
For each element:
void push_back(CondState Val)
Emulate SmallVector::push_back.
Compute TestVector Indices "TVIdx" from the Conds graph.
static constexpr auto HardMaxTVs
Hard limit of test vectors.
SmallVector< std::array< int, 2 > > Indices
Output: Index for TestVectors bitmap (These are not CondIDs)
int NumTestVectors
Output: The number of test vectors.
SmallVector< MCDCNode > SavedNodes
This is no longer needed after the assignment.
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
A range adaptor for a pair of iterators.
BuildIDFetcher searches local cache directories for debug info.
This class implements an extremely fast bulk output stream that can only output to a stream.
The virtual file system interface.
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
constexpr size_t NameSize
uint64_t getFuncNameRef(const FuncRecordTy *Record)
Return the function lookup key. The value is considered opaque.
StringRef getCoverageMappingOutOfLine(const FuncRecordTy *Record, const char *MappingBuf)
Read coverage mapping out-of-line, from MappingBuf.
uint64_t getDataSize(const FuncRecordTy *Record)
Return the coverage map data size for the function.
Error getFuncNameViaRef(const FuncRecordTy *Record, InstrProfSymtab &ProfileNames, StringRef &FuncName)
Return the PGO name of the function.
std::pair< const char *, const FuncRecordTy * > advanceByOneOutOfLine(const FuncRecordTy *Record, const char *MappingBuf)
Advance to the next out-of-line coverage mapping and its associated function record.
uint64_t getFuncHash(const FuncRecordTy *Record)
Return the structural hash associated with the function.
std::variant< std::monostate, DecisionParameters, BranchParameters > Parameters
The type of MC/DC-specific parameters.
std::array< ConditionID, 2 > ConditionIDs
LLVM_ABI const std::error_category & coveragemap_category()
std::error_code make_error_code(coveragemap_error E)
static iterator_range< LineCoverageIterator > getLineCoverageStats(const coverage::CoverageData &CD)
Get a LineCoverageIterator range for the lines described by CD.
@ invalid_or_missing_arch_specifier
constexpr uint64_t TestingFormatMagic
std::pair< unsigned, unsigned > LineColPair
This is an optimization pass for GlobalISel generic memory operations.
GCNRegPressure max(const GCNRegPressure &P1, const GCNRegPressure &P2)
std::error_code make_error_code(BitcodeError E)
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
uint64_t offsetToAlignedAddr(const void *Addr, Align Alignment)
Returns the necessary adjustment for aligning Addr to Alignment bytes, rounding up.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
auto make_second_range(ContainerTy &&c)
Given a container of pairs, return a range over the second elements.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
bool isAddrAligned(Align Lhs, const void *Addr)
Checks that Addr is a multiple of the alignment.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
static coverage::CounterExpression getTombstoneKey()
static bool isEqual(const coverage::CounterExpression &LHS, const coverage::CounterExpression &RHS)
static unsigned getHashValue(const coverage::CounterExpression &V)
static coverage::CounterExpression getEmptyKey()
An information struct used to provide DenseMap with the various necessary components for a given valu...
Associates a source range with an execution count.
CountedRegion(const CounterMappingRegion &R, uint64_t ExecutionCount, uint64_t FalseExecutionCount)
CountedRegion(const CounterMappingRegion &R, uint64_t ExecutionCount)
uint64_t FalseExecutionCount
A Counter expression is a value that represents an arithmetic operation with two counters.
CounterExpression(ExprKind Kind, Counter LHS, Counter RHS)
A Counter mapping region associates a source range with a specific counter.
LineColPair endLoc() const
const auto & getDecisionParams() const
CounterMappingRegion(const mcdc::DecisionParameters &MCDCParams, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
static CounterMappingRegion makeExpansion(unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
static CounterMappingRegion makeGapRegion(Counter Count, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
CounterMappingRegion(Counter Count, unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
CounterMappingRegion(Counter Count, Counter FalseCount, unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind, const mcdc::Parameters &MCDCParams=std::monostate())
static CounterMappingRegion makeRegion(Counter Count, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
static CounterMappingRegion makeDecisionRegion(const mcdc::DecisionParameters &MCDCParams, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Counter FalseCount
Secondary Counter used for Branch Regions (FalseCount).
static CounterMappingRegion makeSkipped(unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Counter Count
Primary Counter that is also used for Branch Regions (TrueCount).
LineColPair startLoc() const
const auto & getBranchParams() const
static CounterMappingRegion makeBranchRegion(Counter Count, Counter FalseCount, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, const mcdc::Parameters &MCDCParams=std::monostate())
mcdc::Parameters MCDCParams
Parameters used for Modified Condition/Decision Coverage.
@ ExpansionRegion
An ExpansionRegion represents a file expansion region that associates a source range with the expansi...
@ MCDCDecisionRegion
A DecisionRegion represents a top-level boolean expression and is associated with a variable length b...
@ MCDCBranchRegion
A Branch Region can be extended to include IDs to facilitate MC/DC.
@ SkippedRegion
A SkippedRegion represents a source range with code that was skipped by a preprocessor or similar mea...
@ GapRegion
A GapRegion is like a CodeRegion, but its count is only set as the line execution count when its the ...
@ BranchRegion
A BranchRegion represents leaf-level boolean expressions and is associated with two counters,...
@ CodeRegion
A CodeRegion associates some code with a counter.
A Counter is an abstract value that describes how to compute the execution count for a region of code...
static const unsigned EncodingTagBits
static Counter getZero()
Return the counter that represents the number zero.
static Counter getCounter(unsigned CounterId)
Return the counter that corresponds to a specific profile counter.
friend bool operator==(const Counter &LHS, const Counter &RHS)
unsigned getCounterID() const
CounterKind
The CounterExpression kind (Add or Subtract) is encoded in bit 0 next to the CounterKind.
unsigned getExpressionID() const
static const unsigned EncodingCounterTagAndExpansionRegionTagBits
CounterKind getKind() const
bool isExpression() const
friend bool operator!=(const Counter &LHS, const Counter &RHS)
friend bool operator<(const Counter &LHS, const Counter &RHS)
static const unsigned EncodingTagMask
static Counter getExpression(unsigned ExpressionId)
Return the counter that corresponds to a specific addition counter expression.
CovMapFunctionRecordV1()=delete
std::pair< const char *, const ThisT * > advanceByOne(const char *MappingBuf) const
StringRef getCoverageMapping(const char *MappingBuf) const
uint64_t getFuncHash() const
uint64_t getFilenamesRef() const
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
Return the PGO name of the function.
IntPtrT getFuncNameRef() const
Return function lookup key. The value is consider opaque.
uint64_t getDataSize() const
uint64_t getFilenamesRef() const
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
CovMapFunctionRecordV2()=delete
uint64_t getDataSize() const
std::pair< const char *, const ThisT * > advanceByOne(const char *MappingBuf) const
StringRef getCoverageMapping(const char *MappingBuf) const
uint64_t getFuncHash() const
uint64_t getFuncNameRef() const
uint64_t getFuncHash() const
std::pair< const char *, const CovMapFunctionRecordV3 * > advanceByOne(const char *) const
uint64_t getFuncNameRef() const
StringRef getCoverageMapping(const char *) const
Read the inline coverage mapping.
uint64_t getFilenamesRef() const
Get the filename set reference.
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
uint64_t getDataSize() const
CovMapFunctionRecordV3()=delete
Coverage mapping information for a single function.
The execution count information starting at a point in a file.
CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry)
bool HasCount
When false, the segment was uninstrumented or skipped.
unsigned Col
The column where this segment begins.
friend bool operator==(const CoverageSegment &L, const CoverageSegment &R)
bool IsRegionEntry
Whether this enters a new region or returns to a previous count.
uint64_t Count
The execution count, or zero if no count was recorded.
unsigned Line
The line where this segment begins.
CoverageSegment(unsigned Line, unsigned Col, uint64_t Count, bool IsRegionEntry, bool IsGapRegion=false, bool IsBranchRegion=false)
bool IsGapRegion
Whether this enters a gap region.
Coverage information for a macro expansion or #included file.
const CountedRegion & Region
The region that expands to this record.
unsigned FileID
The abstract file this expansion covers.
ExpansionRecord(const CountedRegion &Region, const FunctionRecord &Function)
const FunctionRecord & Function
Coverage for the expansion.
Code coverage information for a single function.
std::vector< CountedRegion > CountedBranchRegions
Branch Regions in the function along with their counts.
std::string Name
Raw function name.
std::vector< CountedRegion > CountedRegions
Regions in the function along with their counts.
FunctionRecord & operator=(FunctionRecord &&)=default
void pushMCDCRecord(MCDCRecord &&Record)
std::vector< MCDCRecord > MCDCRecords
MCDC Records record a DecisionRegion and associated BranchRegions.
std::vector< std::string > Filenames
Mapping from FileID (i.e.
FunctionRecord(FunctionRecord &&FR)=default
FunctionRecord(StringRef Name, ArrayRef< StringRef > Filenames)
uint64_t ExecutionCount
The number of times this function was executed.
void pushRegion(CounterMappingRegion Region, uint64_t Count, uint64_t FalseCount)
MCDC Record grouping all information together.
std::pair< unsigned, unsigned > TVRowPair
MCDCRecord(const CounterMappingRegion &Region, TestVectors &&TV, BoolVector &&Folded, CondIDMap &&PosToID, LineColPairMap &&CondLoc)
float getPercentCovered() const
std::string getConditionCoverageString(unsigned Condition)
std::pair< unsigned, unsigned > getDecisions() const
Return the number of True and False decisions for all executed test vectors.
std::string getConditionHeaderString(unsigned Condition)
unsigned getNumTestVectors() const
LLVM_ABI void findIndependencePairs()
std::string getTestVectorString(unsigned TestVectorIndex)
TVRowPair getConditionIndependencePair(unsigned Condition)
Return the Independence Pair that covers the given condition.
bool isConditionIndependencePairCovered(unsigned Condition) const
Determine whether a given condition (indicated by Condition) is covered by an Independence Pair.
CondState
CondState represents the evaluation of a condition in an executed test vector, which can be True or F...
std::string getTestVectorHeaderString() const
CondState getTVCondition(unsigned TestVectorIndex, unsigned Condition)
Return the evaluation of a condition (indicated by Condition) in an executed test vector (indicated b...
unsigned getNumConditions() const
std::array< BitVector, 2 > BoolVector
const CounterMappingRegion & getDecisionRegion() const
CondState getTVResult(unsigned TestVectorIndex)
Return the Result evaluation for an executed test vector.
bool isCondFolded(unsigned Condition) const
ConditionIDs NextIDs
Number of accumulated paths (>= 1)
int Width
Reference count; temporary use.