LLVM 22.0.0git
llvm::coverage::CoverageMapping Class Reference

The mapping of profile information to coverage data. More...

#include "llvm/ProfileData/Coverage/CoverageMapping.h"

Public Member Functions

 CoverageMapping (const CoverageMapping &)=delete
CoverageMappingoperator= (const CoverageMapping &)=delete
unsigned getMismatchedCount () const
 The number of functions that couldn't have their profiles mapped.
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 mapping record for the same symbol.
LLVM_ABI std::vector< StringRefgetUniqueSourceFiles () const
 Returns a lexicographically sorted, unique list of files that are covered.
LLVM_ABI CoverageData getCoverageForFile (StringRef Filename) const
 Get the coverage for a particular file.
LLVM_ABI CoverageData getCoverageForFunction (const FunctionRecord &Function) const
 Get the coverage for a particular function.
LLVM_ABI CoverageData getCoverageForExpansion (const ExpansionRecord &Expansion) const
 Get the coverage for an expansion within a coverage set.
iterator_range< FunctionRecordIteratorgetCoveredFunctions () const
 Gets all of the functions covered by this profile.
iterator_range< FunctionRecordIteratorgetCoveredFunctions (StringRef Filename) const
 Gets all of the functions in a particular file.
LLVM_ABI std::vector< InstantiationGroupgetInstantiationGroups (StringRef Filename) const
 Get the list of function instantiation groups in a particular file.

Static Public Member Functions

static LLVM_ABI Expected< std::unique_ptr< CoverageMapping > > load (ArrayRef< std::unique_ptr< CoverageMappingReader > > CoverageReaders, std::optional< std::reference_wrapper< IndexedInstrProfReader > > &ProfileReader)
 Load the coverage mapping using the given readers.
static LLVM_ABI Expected< std::unique_ptr< CoverageMapping > > load (ArrayRef< StringRef > ObjectFilenames, std::optional< StringRef > ProfileFilename, vfs::FileSystem &FS, ArrayRef< StringRef > Arches={}, StringRef CompilationDir="", const object::BuildIDFetcher *BIDFetcher=nullptr, bool CheckBinaryIDs=false)
 Load the coverage mapping from the given object files and profile.

Detailed Description

The mapping of profile information to coverage data.

This is the main interface to get coverage information, using a profile to fill out execution counts.

Definition at line 991 of file CoverageMapping.h.

Constructor & Destructor Documentation

◆ CoverageMapping()

llvm::coverage::CoverageMapping::CoverageMapping ( const CoverageMapping & )
delete

Member Function Documentation

◆ getCoverageForExpansion()

CoverageData CoverageMapping::getCoverageForExpansion ( const ExpansionRecord & Expansion) const

Get the coverage for an expansion within a coverage set.

Definition at line 1539 of file CoverageMapping.cpp.

References assert(), llvm::dbgs(), Expansion, isExpansion(), and LLVM_DEBUG.

◆ getCoverageForFile()

CoverageData CoverageMapping::getCoverageForFile ( StringRef Filename) const

Get the coverage for a particular file.

The given filename must be the name as recorded in the coverage information. That is, only names returned from getUniqueSourceFiles will yield a result.

Definition at line 1446 of file CoverageMapping.cpp.

References assert(), llvm::dbgs(), findMainViewFileID(), gatherFileIDs(), isExpansion(), and LLVM_DEBUG.

◆ getCoverageForFunction()

CoverageData CoverageMapping::getCoverageForFunction ( const FunctionRecord & Function) const

Get the coverage for a particular function.

Definition at line 1507 of file CoverageMapping.cpp.

References assert(), llvm::dbgs(), findMainViewFileID(), isExpansion(), and LLVM_DEBUG.

◆ getCoveredFunctions() [1/2]

iterator_range< FunctionRecordIterator > llvm::coverage::CoverageMapping::getCoveredFunctions ( ) const
inline

Gets all of the functions covered by this profile.

Definition at line 1083 of file CoverageMapping.h.

References llvm::make_range().

Referenced by getUniqueSourceFiles().

◆ getCoveredFunctions() [2/2]

iterator_range< FunctionRecordIterator > llvm::coverage::CoverageMapping::getCoveredFunctions ( StringRef Filename) const
inline

Gets all of the functions in a particular file.

Definition at line 1090 of file CoverageMapping.h.

References llvm::make_range().

◆ getHashMismatches()

ArrayRef< std::pair< std::string, uint64_t > > llvm::coverage::CoverageMapping::getHashMismatches ( ) const
inline

A hash mismatch occurs when a profile record for a symbol does not have the same hash as a coverage mapping record for the same symbol.

This returns a list of hash mismatches, where each mismatch is a pair of the symbol name and its coverage mapping hash.

Definition at line 1059 of file CoverageMapping.h.

◆ getInstantiationGroups()

std::vector< InstantiationGroup > CoverageMapping::getInstantiationGroups ( StringRef Filename) const

Get the list of function instantiation groups in a particular file.

Every instantiation group in a program is attributed to exactly one file: the file in which the definition for the common function begins.

Definition at line 1482 of file CoverageMapping.cpp.

References findMainViewFileID().

◆ getMismatchedCount()

unsigned llvm::coverage::CoverageMapping::getMismatchedCount ( ) const
inline

The number of functions that couldn't have their profiles mapped.

This is a count of functions whose profile is out of date or otherwise can't be associated with any coverage information.

Definition at line 1053 of file CoverageMapping.h.

◆ getUniqueSourceFiles()

std::vector< StringRef > CoverageMapping::getUniqueSourceFiles ( ) const

Returns a lexicographically sorted, unique list of files that are covered.

Definition at line 1399 of file CoverageMapping.cpp.

References llvm::append_range(), getCoveredFunctions(), llvm::Last, llvm::sort(), and llvm::unique().

◆ load() [1/2]

Expected< std::unique_ptr< CoverageMapping > > CoverageMapping::load ( ArrayRef< std::unique_ptr< CoverageMappingReader > > CoverageReaders,
std::optional< std::reference_wrapper< IndexedInstrProfReader > > & ProfileReader )
static

Load the coverage mapping using the given readers.

Definition at line 992 of file CoverageMapping.cpp.

◆ load() [2/2]

Expected< std::unique_ptr< CoverageMapping > > CoverageMapping::load ( ArrayRef< StringRef > ObjectFilenames,
std::optional< StringRef > ProfileFilename,
vfs::FileSystem & FS,
ArrayRef< StringRef > Arches = {},
StringRef CompilationDir = "",
const object::BuildIDFetcher * BIDFetcher = nullptr,
bool CheckBinaryIDs = false )
static

◆ operator=()

CoverageMapping & llvm::coverage::CoverageMapping::operator= ( const CoverageMapping & )
delete

The documentation for this class was generated from the following files: