#include "llvm/ProfileData/Coverage/CoverageMapping.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Object/BuildID.h"
#include "llvm/ProfileData/Coverage/CoverageMappingReader.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <map>
#include <memory>
#include <optional>
#include <stack>
#include <string>
#include <system_error>
#include <utility>
#include <vector>
usingnamespacellvm;
usingnamespacecoverage;
#define DEBUG_TYPE …
Counter CounterExpressionBuilder::get(const CounterExpression &E) { … }
void CounterExpressionBuilder::extractTerms(Counter C, int Factor,
SmallVectorImpl<Term> &Terms) { … }
Counter CounterExpressionBuilder::simplify(Counter ExpressionTree) { … }
Counter CounterExpressionBuilder::add(Counter LHS, Counter RHS, bool Simplify) { … }
Counter CounterExpressionBuilder::subtract(Counter LHS, Counter RHS,
bool Simplify) { … }
void CounterMappingContext::dump(const Counter &C, raw_ostream &OS) const { … }
Expected<int64_t> CounterMappingContext::evaluate(const Counter &C) const { … }
mcdc::TVIdxBuilder::TVIdxBuilder(const SmallVectorImpl<ConditionIDs> &NextIDs,
int Offset)
: … { … }
namespace {
class NextIDsBuilder { … };
class MCDCRecordProcessor : NextIDsBuilder, mcdc::TVIdxBuilder { … };
}
Expected<MCDCRecord> CounterMappingContext::evaluateMCDCRegion(
const CounterMappingRegion &Region,
ArrayRef<const CounterMappingRegion *> Branches, bool IsVersion11) { … }
unsigned CounterMappingContext::getMaxCounterID(const Counter &C) const { … }
void FunctionRecordIterator::skipOtherFiles() { … }
ArrayRef<unsigned> CoverageMapping::getImpreciseRecordIndicesForFilename(
StringRef Filename) const { … }
static unsigned getMaxCounterID(const CounterMappingContext &Ctx,
const CoverageMappingRecord &Record) { … }
static unsigned getMaxBitmapSize(const CoverageMappingRecord &Record,
bool IsVersion11) { … }
namespace {
class MCDCDecisionRecorder { … };
}
Error CoverageMapping::loadFunctionRecord(
const CoverageMappingRecord &Record,
IndexedInstrProfReader &ProfileReader) { … }
Error CoverageMapping::loadFromReaders(
ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
IndexedInstrProfReader &ProfileReader, CoverageMapping &Coverage) { … }
Expected<std::unique_ptr<CoverageMapping>> CoverageMapping::load(
ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
IndexedInstrProfReader &ProfileReader) { … }
static Error handleMaybeNoDataFoundError(Error E) { … }
Error CoverageMapping::loadFromFile(
StringRef Filename, StringRef Arch, StringRef CompilationDir,
IndexedInstrProfReader &ProfileReader, CoverageMapping &Coverage,
bool &DataFound, SmallVectorImpl<object::BuildID> *FoundBinaryIDs) { … }
Expected<std::unique_ptr<CoverageMapping>> CoverageMapping::load(
ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename,
vfs::FileSystem &FS, ArrayRef<StringRef> Arches, StringRef CompilationDir,
const object::BuildIDFetcher *BIDFetcher, bool CheckBinaryIDs) { … }
namespace {
class FunctionInstantiationSetCollector { … };
class SegmentBuilder { … };
}
std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const { … }
static SmallBitVector gatherFileIDs(StringRef SourceFile,
const FunctionRecord &Function) { … }
static std::optional<unsigned>
findMainViewFileID(const FunctionRecord &Function) { … }
static std::optional<unsigned>
findMainViewFileID(StringRef SourceFile, const FunctionRecord &Function) { … }
static bool isExpansion(const CountedRegion &R, unsigned FileID) { … }
CoverageData CoverageMapping::getCoverageForFile(StringRef Filename) const { … }
std::vector<InstantiationGroup>
CoverageMapping::getInstantiationGroups(StringRef Filename) const { … }
CoverageData
CoverageMapping::getCoverageForFunction(const FunctionRecord &Function) const { … }
CoverageData CoverageMapping::getCoverageForExpansion(
const ExpansionRecord &Expansion) const { … }
LineCoverageStats::LineCoverageStats(
ArrayRef<const CoverageSegment *> LineSegments,
const CoverageSegment *WrappedSegment, unsigned Line)
: … { … }
LineCoverageIterator &LineCoverageIterator::operator++() { … }
static std::string getCoverageMapErrString(coveragemap_error Err,
const std::string &ErrMsg = "") { … }
namespace {
class CoverageMappingErrorCategoryType : public std::error_category { … };
}
std::string CoverageMapError::message() const { … }
const std::error_category &llvm::coverage::coveragemap_category() { … }
char CoverageMapError::ID = …;