40#include <system_error>
45using namespace coverage;
47#define DEBUG_TYPE "coverage-mapping"
50 auto It = ExpressionIndices.find(
E);
51 if (It != ExpressionIndices.end())
53 unsigned I = Expressions.size();
54 Expressions.push_back(
E);
55 ExpressionIndices[
E] =
I;
59void CounterExpressionBuilder::extractTerms(
Counter C,
int Factor,
61 switch (
C.getKind()) {
68 const auto &
E = Expressions[
C.getExpressionID()];
69 extractTerms(
E.LHS, Factor, Terms);
76Counter CounterExpressionBuilder::simplify(
Counter ExpressionTree) {
79 extractTerms(ExpressionTree, +1, Terms);
83 if (Terms.
size() == 0)
87 llvm::sort(Terms, [](
const Term &LHS,
const Term &RHS) {
88 return LHS.CounterID <
RHS.CounterID;
92 auto Prev = Terms.
begin();
93 for (
auto I = Prev + 1,
E = Terms.
end();
I !=
E; ++
I) {
94 if (
I->CounterID == Prev->CounterID) {
95 Prev->Factor +=
I->Factor;
106 for (
auto T : Terms) {
109 for (
int I = 0;
I <
T.Factor; ++
I)
118 for (
auto T : Terms) {
121 for (
int I = 0;
I < -
T.Factor; ++
I)
130 return Simplify ?
simplify(Cnt) : Cnt;
136 return Simplify ?
simplify(Cnt) : Cnt;
140 switch (
C.getKind()) {
145 OS <<
'#' <<
C.getCounterID();
148 if (
C.getExpressionID() >= Expressions.size())
150 const auto &
E = Expressions[
C.getExpressionID()];
159 if (CounterValues.
empty())
162 if (
auto E =
Value.takeError()) {
177 } VisitCount = KNeverVisited;
180 std::stack<StackElem> CounterStack;
181 CounterStack.push({
C});
183 int64_t LastPoppedValue;
185 while (!CounterStack.empty()) {
186 StackElem &Current = CounterStack.top();
188 switch (Current.ICounter.getKind()) {
194 if (Current.ICounter.getCounterID() >= CounterValues.
size())
196 LastPoppedValue = CounterValues[Current.ICounter.getCounterID()];
200 if (Current.ICounter.getExpressionID() >= Expressions.size())
202 const auto &
E = Expressions[Current.ICounter.getExpressionID()];
203 if (Current.VisitCount == StackElem::KNeverVisited) {
204 CounterStack.push(StackElem{
E.LHS});
205 Current.VisitCount = StackElem::KVisitedOnce;
206 }
else if (Current.VisitCount == StackElem::KVisitedOnce) {
207 Current.LHS = LastPoppedValue;
208 CounterStack.push(StackElem{
E.RHS});
209 Current.VisitCount = StackElem::KVisitedTwice;
211 int64_t
LHS = Current.LHS;
212 int64_t
RHS = LastPoppedValue;
222 return LastPoppedValue;
226 switch (
C.getKind()) {
230 return C.getCounterID();
232 if (
C.getExpressionID() >= Expressions.size())
234 const auto &
E = Expressions[
C.getExpressionID()];
241void FunctionRecordIterator::skipOtherFiles() {
242 while (Current != Records.end() && !Filename.
empty() &&
243 Filename != Current->Filenames[0])
245 if (Current == Records.end())
252 auto RecordIt = FilenameHash2RecordIndices.find(FilenameHash);
253 if (RecordIt == FilenameHash2RecordIndices.end())
255 return RecordIt->second;
260 unsigned MaxCounterID = 0;
267Error CoverageMapping::loadFunctionRecord(
271 if (OrigFuncName.
empty())
273 "record function name is empty");
275 if (
Record.Filenames.empty())
282 std::vector<uint64_t> Counts;
284 Record.FunctionHash, Counts)) {
287 FuncHashMismatches.emplace_back(std::string(
Record.FunctionName),
291 return make_error<InstrProfError>(IPE);
294 Ctx.setCounts(Counts);
296 assert(!
Record.MappingRegions.empty() &&
"Function has no regions");
303 if (
Record.MappingRegions.size() == 1 &&
304 Record.MappingRegions[0].Count.isZero() && Counts[0] > 0)
325 if (!RecordProvenance[FilenamesHash].insert(
hash_value(OrigFuncName)).second)
328 Functions.push_back(std::move(
Function));
333 unsigned RecordIndex = Functions.size() - 1;
335 auto &RecordIndices = FilenameHash2RecordIndices[
hash_value(Filename)];
339 if (RecordIndices.empty() || RecordIndices.back() != RecordIndex)
340 RecordIndices.push_back(RecordIndex);
348Error CoverageMapping::loadFromReaders(
349 ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
351 for (
const auto &CoverageReader : CoverageReaders) {
352 for (
auto RecordOrErr : *CoverageReader) {
353 if (
Error E = RecordOrErr.takeError())
355 const auto &
Record = *RecordOrErr;
364 ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
366 auto Coverage = std::unique_ptr<CoverageMapping>(
new CoverageMapping());
367 if (
Error E = loadFromReaders(CoverageReaders, ProfileReader, *Coverage))
369 return std::move(Coverage);
378 return make_error<CoverageMapError>(CME.
get(), CME.
getMessage());
382Error CoverageMapping::loadFromFile(
387 Filename,
false,
false);
388 if (std::error_code EC = CovMappingBufOrErr.getError())
391 CovMappingBufOrErr.get()->getMemBufferRef();
396 CovMappingBufRef, Arch, Buffers, CompilationDir,
397 FoundBinaryIDs ? &BinaryIDs :
nullptr);
398 if (
Error E = CoverageReadersOrErr.takeError()) {
406 for (
auto &Reader : CoverageReadersOrErr.get())
408 if (FoundBinaryIDs && !Readers.
empty()) {
414 DataFound |= !Readers.
empty();
415 if (
Error E = loadFromReaders(Readers, ProfileReader, Coverage))
425 if (
Error E = ProfileReaderOrErr.takeError())
427 auto ProfileReader = std::move(ProfileReaderOrErr.get());
428 auto Coverage = std::unique_ptr<CoverageMapping>(
new CoverageMapping());
429 bool DataFound =
false;
431 auto GetArch = [&](
size_t Idx) {
434 if (Arches.
size() == 1)
435 return Arches.
front();
442 loadFromFile(File.value(), GetArch(File.index()), CompilationDir,
443 *ProfileReader, *Coverage, DataFound, &FoundBinaryIDs))
448 std::vector<object::BuildID> ProfileBinaryIDs;
453 if (!ProfileBinaryIDs.empty()) {
455 return std::lexicographical_compare(
A.begin(),
A.end(),
B.begin(),
460 ProfileBinaryIDs.begin(), ProfileBinaryIDs.end(),
461 FoundBinaryIDs.
begin(), FoundBinaryIDs.
end(),
462 std::inserter(BinaryIDsToFetch, BinaryIDsToFetch.
end()), Compare);
466 std::optional<std::string> PathOpt = BIDFetcher->
fetch(BinaryID);
468 std::string Path = std::move(*PathOpt);
470 if (
Error E = loadFromFile(Path, Arch, CompilationDir, *ProfileReader,
471 *Coverage, DataFound))
473 }
else if (CheckBinaryIDs) {
477 "Missing binary ID: " +
478 llvm::toHex(BinaryID,
true)));
485 join(ObjectFilenames.
begin(), ObjectFilenames.
end(),
", "),
487 return std::move(Coverage);
496class FunctionInstantiationSetCollector {
497 using MapT = std::map<LineColPair, std::vector<const FunctionRecord *>>;
498 MapT InstantiatedFunctions;
503 while (
I !=
E &&
I->FileID != FileID)
505 assert(
I !=
E &&
"function does not cover the given file");
506 auto &Functions = InstantiatedFunctions[
I->startLoc()];
510 MapT::iterator begin() {
return InstantiatedFunctions.begin(); }
511 MapT::iterator end() {
return InstantiatedFunctions.end(); }
514class SegmentBuilder {
515 std::vector<CoverageSegment> &
Segments;
518 SegmentBuilder(std::vector<CoverageSegment> &Segments) :
Segments(
Segments) {}
525 bool IsRegionEntry,
bool EmitSkippedRegion =
false) {
526 bool HasCount = !EmitSkippedRegion &&
530 if (!
Segments.empty() && !IsRegionEntry && !EmitSkippedRegion) {
532 if (
Last.HasCount == HasCount &&
Last.Count ==
Region.ExecutionCount &&
538 Segments.emplace_back(StartLoc.first, StartLoc.second,
539 Region.ExecutionCount, IsRegionEntry,
542 Segments.emplace_back(StartLoc.first, StartLoc.second, IsRegionEntry);
547 <<
" (count = " <<
Last.Count <<
")"
548 << (
Last.IsRegionEntry ?
", RegionEntry" :
"")
549 << (!
Last.HasCount ?
", Skipped" :
"")
550 << (
Last.IsGapRegion ?
", Gap" :
"") <<
"\n";
559 void completeRegionsUntil(std::optional<LineColPair> Loc,
560 unsigned FirstCompletedRegion) {
563 auto CompletedRegionsIt = ActiveRegions.
begin() + FirstCompletedRegion;
564 std::stable_sort(CompletedRegionsIt, ActiveRegions.
end(),
566 return L->endLoc() < R->endLoc();
570 for (
unsigned I = FirstCompletedRegion + 1,
E = ActiveRegions.
size();
I <
E;
572 const auto *CompletedRegion = ActiveRegions[
I];
573 assert((!Loc || CompletedRegion->endLoc() <= *Loc) &&
574 "Completed region ends after start of new region");
576 const auto *PrevCompletedRegion = ActiveRegions[
I - 1];
577 auto CompletedSegmentLoc = PrevCompletedRegion->endLoc();
580 if (Loc && CompletedSegmentLoc == *Loc)
585 if (CompletedSegmentLoc == CompletedRegion->endLoc())
589 for (
unsigned J =
I + 1; J <
E; ++J)
590 if (CompletedRegion->endLoc() == ActiveRegions[J]->endLoc())
591 CompletedRegion = ActiveRegions[J];
593 startSegment(*CompletedRegion, CompletedSegmentLoc,
false);
597 if (FirstCompletedRegion &&
Last->endLoc() != *Loc) {
600 startSegment(*ActiveRegions[FirstCompletedRegion - 1],
Last->endLoc(),
602 }
else if (!FirstCompletedRegion && (!Loc || *Loc !=
Last->endLoc())) {
605 startSegment(*
Last,
Last->endLoc(),
false,
true);
609 ActiveRegions.
erase(CompletedRegionsIt, ActiveRegions.
end());
613 for (
const auto &CR :
enumerate(Regions)) {
614 auto CurStartLoc = CR.value().startLoc();
617 auto CompletedRegions =
618 std::stable_partition(ActiveRegions.
begin(), ActiveRegions.
end(),
620 return !(Region->endLoc() <= CurStartLoc);
622 if (CompletedRegions != ActiveRegions.
end()) {
623 unsigned FirstCompletedRegion =
624 std::distance(ActiveRegions.
begin(), CompletedRegions);
625 completeRegionsUntil(CurStartLoc, FirstCompletedRegion);
631 if (CurStartLoc == CR.value().endLoc()) {
635 (CR.index() + 1) == Regions.
size() ||
637 startSegment(ActiveRegions.
empty() ? CR.value() : *ActiveRegions.
back(),
638 CurStartLoc, !GapRegion, Skipped);
641 if (Skipped && !ActiveRegions.
empty())
642 startSegment(*ActiveRegions.
back(), CurStartLoc,
false);
645 if (CR.index() + 1 == Regions.
size() ||
646 CurStartLoc != Regions[CR.index() + 1].startLoc()) {
649 startSegment(CR.value(), CurStartLoc, !GapRegion);
657 if (!ActiveRegions.
empty())
658 completeRegionsUntil(std::nullopt, 0);
664 if (
LHS.startLoc() !=
RHS.startLoc())
665 return LHS.startLoc() <
RHS.startLoc();
668 return RHS.endLoc() <
LHS.endLoc();
678 "Unexpected order of region kind values");
679 return LHS.Kind <
RHS.Kind;
688 auto Active = Regions.
begin();
690 for (
auto I = Regions.
begin() + 1;
I !=
End; ++
I) {
691 if (Active->startLoc() !=
I->startLoc() ||
692 Active->endLoc() !=
I->endLoc()) {
711 if (
I->Kind == Active->Kind)
712 Active->ExecutionCount +=
I->ExecutionCount;
719 static std::vector<CoverageSegment>
721 std::vector<CoverageSegment>
Segments;
722 SegmentBuilder
Builder(Segments);
724 sortNestedRegions(Regions);
728 dbgs() <<
"Combined regions:\n";
729 for (
const auto &CR : CombinedRegions)
730 dbgs() <<
" " << CR.LineStart <<
":" << CR.ColumnStart <<
" -> "
731 << CR.LineEnd <<
":" << CR.ColumnEnd
732 <<
" (count=" << CR.ExecutionCount <<
")\n";
735 Builder.buildSegmentsImpl(CombinedRegions);
741 if (!(
L.Line <
R.Line) && !(
L.Line ==
R.Line &&
L.Col <
R.Col)) {
742 if (
L.Line ==
R.Line &&
L.Col ==
R.Col && !
L.HasCount)
745 <<
" followed by " <<
R.Line <<
":" <<
R.Col <<
"\n");
746 assert(
false &&
"Coverage segments not unique or sorted");
758 std::vector<StringRef> Filenames;
762 auto Last = std::unique(Filenames.begin(), Filenames.end());
763 Filenames.erase(
Last, Filenames.end());
772 FilenameEquivalence[
I] =
true;
773 return FilenameEquivalence;
777static std::optional<unsigned>
780 for (
const auto &CR :
Function.CountedRegions)
782 IsNotExpandedFile[CR.ExpandedFileID] =
false;
792static std::optional<unsigned>
795 if (
I && SourceFile ==
Function.Filenames[*
I])
806 std::vector<CountedRegion> Regions;
811 getImpreciseRecordIndicesForFilename(Filename);
812 for (
unsigned RecordIndex : RecordIndices) {
816 for (
const auto &CR :
Function.CountedRegions)
817 if (FileIDs.test(CR.FileID)) {
818 Regions.push_back(CR);
820 FileCoverage.Expansions.emplace_back(CR,
Function);
823 for (
const auto &CR :
Function.CountedBranchRegions)
824 if (FileIDs.test(CR.FileID) && (CR.FileID == CR.ExpandedFileID))
825 FileCoverage.BranchRegions.push_back(CR);
828 LLVM_DEBUG(
dbgs() <<
"Emitting segments for file: " << Filename <<
"\n");
829 FileCoverage.Segments = SegmentBuilder::buildSegments(Regions);
834std::vector<InstantiationGroup>
836 FunctionInstantiationSetCollector InstantiationSetCollector;
840 getImpreciseRecordIndicesForFilename(Filename);
841 for (
unsigned RecordIndex : RecordIndices) {
846 InstantiationSetCollector.insert(
Function, *MainFileID);
849 std::vector<InstantiationGroup> Result;
850 for (
auto &InstantiationSet : InstantiationSetCollector) {
852 InstantiationSet.first.second,
853 std::move(InstantiationSet.second)};
854 Result.emplace_back(std::move(IG));
866 std::vector<CountedRegion> Regions;
867 for (
const auto &CR :
Function.CountedRegions)
868 if (CR.FileID == *MainFileID) {
869 Regions.push_back(CR);
871 FunctionCoverage.Expansions.emplace_back(CR,
Function);
874 for (
const auto &CR :
Function.CountedBranchRegions)
875 if (CR.FileID == *MainFileID)
876 FunctionCoverage.BranchRegions.push_back(CR);
880 FunctionCoverage.Segments = SegmentBuilder::buildSegments(Regions);
882 return FunctionCoverage;
889 std::vector<CountedRegion> Regions;
891 if (CR.FileID == Expansion.
FileID) {
892 Regions.push_back(CR);
894 ExpansionCoverage.Expansions.emplace_back(CR, Expansion.
Function);
898 if (CR.FileID == Expansion.
FileID)
899 ExpansionCoverage.BranchRegions.push_back(CR);
902 << Expansion.
FileID <<
"\n");
903 ExpansionCoverage.Segments = SegmentBuilder::buildSegments(Regions);
905 return ExpansionCoverage;
908LineCoverageStats::LineCoverageStats(
911 : ExecutionCount(0), HasMultipleRegions(
false), Mapped(
false), Line(Line),
912 LineSegments(LineSegments), WrappedSegment(WrappedSegment) {
914 unsigned MinRegionCount = 0;
916 return !S->
IsGapRegion && S->HasCount && S->IsRegionEntry;
918 for (
unsigned I = 0;
I < LineSegments.
size() && MinRegionCount < 2; ++
I)
919 if (isStartOfRegion(LineSegments[
I]))
922 bool StartOfSkippedRegion = !LineSegments.
empty() &&
923 !LineSegments.
front()->HasCount &&
924 LineSegments.
front()->IsRegionEntry;
926 HasMultipleRegions = MinRegionCount > 1;
928 !StartOfSkippedRegion &&
929 ((WrappedSegment && WrappedSegment->
HasCount) || (MinRegionCount > 0));
937 ExecutionCount = WrappedSegment->
Count;
940 for (
const auto *LS : LineSegments)
941 if (isStartOfRegion(LS))
942 ExecutionCount = std::max(ExecutionCount, LS->Count);
946 if (Next == CD.
end()) {
952 WrappedSegment = Segments.back();
954 while (Next != CD.
end() && Next->Line == Line)
955 Segments.push_back(&*Next++);
962 const std::string &ErrMsg =
"") {
974 OS <<
"no coverage data found";
977 OS <<
"unsupported coverage format version";
980 OS <<
"truncated coverage data";
983 OS <<
"malformed coverage data";
986 OS <<
"failed to decompress coverage data (zlib)";
989 OS <<
"`-arch` specifier is invalid or missing for universal binary";
995 OS <<
": " << ErrMsg;
1005class CoverageMappingErrorCategoryType :
public std::error_category {
1006 const char *
name()
const noexcept
override {
return "llvm.coveragemap"; }
1007 std::string message(
int IE)
const override {
1019 static CoverageMappingErrorCategoryType ErrorCategory;
1020 return ErrorCategory;
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")
static SmallBitVector gatherFileIDs(StringRef SourceFile, const FunctionRecord &Function)
static std::optional< unsigned > findMainViewFileID(const FunctionRecord &Function)
Return the ID of the file where the definition of the function is located.
static bool isExpansion(const CountedRegion &R, unsigned FileID)
static Error handleMaybeNoDataFoundError(Error E)
static std::string getCoverageMapErrString(coveragemap_error Err, const std::string &ErrMsg="")
static unsigned getMaxCounterID(const CounterMappingContext &Ctx, const CoverageMappingRecord &Record)
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines the DenseMap class.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the SmallBitVector class.
This file defines the SmallString class.
This file defines the SmallVector class.
Defines the virtual file system interface vfs::FileSystem.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & front() const
front - Get the first element.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
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.
Error takeError()
Take ownership of the stored error.
Reader for the indexed binary instrprof format.
static Expected< std::unique_ptr< IndexedInstrProfReader > > create(const Twine &Path, vfs::FileSystem &FS, const Twine &RemappingPath="")
Factory method to create an indexed reader.
Error getFunctionCounts(StringRef FuncName, uint64_t FuncHash, std::vector< uint64_t > &Counts)
Fill Counts with the profile data for the given function name.
Error readBinaryIds(std::vector< llvm::object::BuildID > &BinaryIds) override
Read a list of binary ids.
static std::pair< instrprof_error, std::string > take(Error E)
Consume an Error and return the raw enum value contained within it, and the optional error message.
static ErrorOr< std::unique_ptr< MemoryBuffer > > getFileOrSTDIN(const Twine &Filename, bool IsText=false, bool RequiresNullTerminator=true, std::optional< Align > Alignment=std::nullopt)
Open the specified file as a MemoryBuffer, or open stdin if the Filename is "-".
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
MutableArrayRef< T > drop_back(size_t N=1) const
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
int find_first() const
Returns the index of the first set bit, -1 if none of the bits are set.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
iterator erase(const_iterator CI)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StringRef - Represent a constant reference to a string, i.e.
constexpr bool empty() const
empty - Check if the string is empty.
LLVM Value Representation.
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)
Counter subtract(Counter LHS, Counter RHS, bool Simplify=true)
Return a counter that represents the expression that subtracts RHS from LHS.
Counter add(Counter LHS, Counter RHS, bool Simplify=true)
Return a counter that represents the expression that adds LHS and RHS.
A Counter mapping context is used to connect the counters, expressions and the obtained counter value...
Expected< int64_t > evaluate(const Counter &C) const
Return the number of times that a region of code associated with this counter was executed.
unsigned getMaxCounterID(const Counter &C) const
void dump(const Counter &C, raw_ostream &OS) const
Coverage information to be processed or displayed.
std::vector< CoverageSegment >::const_iterator end() const
std::string message() const override
Return the error message as a string.
coveragemap_error get() const
const std::string & getMessage() const
The mapping of profile information to coverage data.
std::vector< StringRef > getUniqueSourceFiles() const
Returns a lexicographically sorted, unique list of files that are covered.
CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const
Get the coverage for an expansion within a coverage set.
iterator_range< FunctionRecordIterator > getCoveredFunctions() const
Gets all of the functions covered by this profile.
CoverageData getCoverageForFunction(const FunctionRecord &Function) const
Get the coverage for a particular function.
std::vector< InstantiationGroup > getInstantiationGroups(StringRef Filename) const
Get the list of function instantiation groups in a particular file.
CoverageData getCoverageForFile(StringRef Filename) const
Get the coverage for a particular file.
static Expected< std::unique_ptr< CoverageMapping > > load(ArrayRef< std::unique_ptr< CoverageMappingReader > > CoverageReaders, IndexedInstrProfReader &ProfileReader)
Load the coverage mapping using the given readers.
An instantiation group contains a FunctionRecord list, such that each record corresponds to a distinc...
An iterator over the LineCoverageStats objects for lines described by a CoverageData instance.
LineCoverageIterator & operator++()
Coverage statistics for a single line.
BuildIDFetcher searches local cache directories for debug info.
virtual std::optional< std::string > fetch(BuildIDRef BuildID) const
Returns the path to the debug file with the given build ID.
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
The virtual file system interface.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
const std::error_category & coveragemap_category()
@ invalid_or_missing_arch_specifier
std::pair< unsigned, unsigned > LineColPair
SmallVector< uint8_t, 10 > BuildID
A build ID in binary form.
This is an optimization pass for GlobalISel generic memory operations.
hash_code hash_value(const FixedPointSemantics &Val)
Error createFileError(const Twine &F, Error E)
Concatenate a source file path and/or name with an Error.
auto enumerate(FirstRange &&First, RestRanges &&...Rest)
Given two or more input ranges, returns a new range whose values are are tuples (A,...
StringRef getFuncNameWithoutPrefix(StringRef PGOFuncName, StringRef FileName="<unknown>")
Given a PGO function name, remove the filename prefix and return the original (static) function name.
Error handleErrors(Error E, HandlerTs &&... Hs)
Pass the ErrorInfo(s) contained in E to their respective handlers.
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
auto map_range(ContainerTy &&C, FuncTy F)
@ no_such_file_or_directory
void sort(IteratorTy Start, IteratorTy End)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Error errorCodeToError(std::error_code EC)
Helper for converting an std::error_code to a Error.
void consumeError(Error Err)
Consume a Error without doing anything.
hash_code hash_combine_range(InputIteratorT first, InputIteratorT last)
Compute a hash_code for a sequence of values.
Associates a source range with an execution count.
A Counter expression is a value that represents an arithmetic operation with two counters.
@ ExpansionRegion
An ExpansionRegion represents a file expansion region that associates a source range with the expansi...
@ 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 ...
@ 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 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.
static Counter getExpression(unsigned ExpressionId)
Return the counter that corresponds to a specific addition counter expression.
Coverage mapping information for a single function.
The execution count information starting at a point in a file.
bool HasCount
When false, the segment was uninstrumented or skipped.
uint64_t Count
The execution count, or zero if no count was recorded.
bool IsGapRegion
Whether this enters a gap region.
Coverage information for a macro expansion or #included file.
unsigned FileID
The abstract file this expansion covers.
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::vector< CountedRegion > CountedRegions
Regions in the function along with their counts.
std::vector< std::string > Filenames
Mapping from FileID (i.e.