aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/ProfileData/Coverage
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/lib/ProfileData/Coverage
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/ProfileData/Coverage')
-rw-r--r--contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMapping.cpp60
-rw-r--r--contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingReader.cpp94
-rw-r--r--contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingWriter.cpp28
-rw-r--r--contrib/libs/llvm12/lib/ProfileData/Coverage/ya.make10
4 files changed, 96 insertions, 96 deletions
diff --git a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMapping.cpp b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMapping.cpp
index cdbcde50d3..3307b782e2 100644
--- a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -249,12 +249,12 @@ Error CoverageMapping::loadFunctionRecord(
consumeError(std::move(E));
return Error::success();
}
- Expected<int64_t> AltExecutionCount = Ctx.evaluate(Region.FalseCount);
- if (auto E = AltExecutionCount.takeError()) {
- consumeError(std::move(E));
- return Error::success();
- }
- Function.pushRegion(Region, *ExecutionCount, *AltExecutionCount);
+ Expected<int64_t> AltExecutionCount = Ctx.evaluate(Region.FalseCount);
+ if (auto E = AltExecutionCount.takeError()) {
+ consumeError(std::move(E));
+ return Error::success();
+ }
+ Function.pushRegion(Region, *ExecutionCount, *AltExecutionCount);
}
// Don't create records for (filenames, function) pairs we've already seen.
@@ -490,15 +490,15 @@ class SegmentBuilder {
if (CurStartLoc == CR.value().endLoc()) {
// Avoid making zero-length regions active. If it's the last region,
// emit a skipped segment. Otherwise use its predecessor's count.
- const bool Skipped =
- (CR.index() + 1) == Regions.size() ||
- CR.value().Kind == CounterMappingRegion::SkippedRegion;
+ const bool Skipped =
+ (CR.index() + 1) == Regions.size() ||
+ CR.value().Kind == CounterMappingRegion::SkippedRegion;
startSegment(ActiveRegions.empty() ? CR.value() : *ActiveRegions.back(),
CurStartLoc, !GapRegion, Skipped);
- // If it is skipped segment, create a segment with last pushed
- // regions's count at CurStartLoc.
- if (Skipped && !ActiveRegions.empty())
- startSegment(*ActiveRegions.back(), CurStartLoc, false);
+ // If it is skipped segment, create a segment with last pushed
+ // regions's count at CurStartLoc.
+ if (Skipped && !ActiveRegions.empty())
+ startSegment(*ActiveRegions.back(), CurStartLoc, false);
continue;
}
if (CR.index() + 1 == Regions.size() ||
@@ -598,8 +598,8 @@ public:
const auto &L = Segments[I - 1];
const auto &R = Segments[I];
if (!(L.Line < R.Line) && !(L.Line == R.Line && L.Col < R.Col)) {
- if (L.Line == R.Line && L.Col == R.Col && !L.HasCount)
- continue;
+ if (L.Line == R.Line && L.Col == R.Col && !L.HasCount)
+ continue;
LLVM_DEBUG(dbgs() << " ! Segment " << L.Line << ":" << L.Col
<< " followed by " << R.Line << ":" << R.Col << "\n");
assert(false && "Coverage segments not unique or sorted");
@@ -616,7 +616,7 @@ public:
std::vector<StringRef> CoverageMapping::getUniqueSourceFiles() const {
std::vector<StringRef> Filenames;
for (const auto &Function : getCoveredFunctions())
- llvm::append_range(Filenames, Function.Filenames);
+ llvm::append_range(Filenames, Function.Filenames);
llvm::sort(Filenames);
auto Last = std::unique(Filenames.begin(), Filenames.end());
Filenames.erase(Last, Filenames.end());
@@ -676,10 +676,10 @@ CoverageData CoverageMapping::getCoverageForFile(StringRef Filename) const {
if (MainFileID && isExpansion(CR, *MainFileID))
FileCoverage.Expansions.emplace_back(CR, Function);
}
- // Capture branch regions specific to the function (excluding expansions).
- for (const auto &CR : Function.CountedBranchRegions)
- if (FileIDs.test(CR.FileID) && (CR.FileID == CR.ExpandedFileID))
- FileCoverage.BranchRegions.push_back(CR);
+ // Capture branch regions specific to the function (excluding expansions).
+ for (const auto &CR : Function.CountedBranchRegions)
+ if (FileIDs.test(CR.FileID) && (CR.FileID == CR.ExpandedFileID))
+ FileCoverage.BranchRegions.push_back(CR);
}
LLVM_DEBUG(dbgs() << "Emitting segments for file: " << Filename << "\n");
@@ -727,10 +727,10 @@ CoverageMapping::getCoverageForFunction(const FunctionRecord &Function) const {
if (isExpansion(CR, *MainFileID))
FunctionCoverage.Expansions.emplace_back(CR, Function);
}
- // Capture branch regions specific to the function (excluding expansions).
- for (const auto &CR : Function.CountedBranchRegions)
- if (CR.FileID == *MainFileID)
- FunctionCoverage.BranchRegions.push_back(CR);
+ // Capture branch regions specific to the function (excluding expansions).
+ for (const auto &CR : Function.CountedBranchRegions)
+ if (CR.FileID == *MainFileID)
+ FunctionCoverage.BranchRegions.push_back(CR);
LLVM_DEBUG(dbgs() << "Emitting segments for function: " << Function.Name
<< "\n");
@@ -750,10 +750,10 @@ CoverageData CoverageMapping::getCoverageForExpansion(
if (isExpansion(CR, Expansion.FileID))
ExpansionCoverage.Expansions.emplace_back(CR, Expansion.Function);
}
- for (const auto &CR : Expansion.Function.CountedBranchRegions)
- // Capture branch regions that only pertain to the corresponding expansion.
- if (CR.FileID == Expansion.FileID)
- ExpansionCoverage.BranchRegions.push_back(CR);
+ for (const auto &CR : Expansion.Function.CountedBranchRegions)
+ // Capture branch regions that only pertain to the corresponding expansion.
+ if (CR.FileID == Expansion.FileID)
+ ExpansionCoverage.BranchRegions.push_back(CR);
LLVM_DEBUG(dbgs() << "Emitting segments for expansion of file "
<< Expansion.FileID << "\n");
@@ -831,8 +831,8 @@ static std::string getCoverageMapErrString(coveragemap_error Err) {
return "Malformed coverage data";
case coveragemap_error::decompression_failed:
return "Failed to decompress coverage data (zlib)";
- case coveragemap_error::invalid_or_missing_arch_specifier:
- return "`-arch` specifier is invalid or missing for universal binary";
+ case coveragemap_error::invalid_or_missing_arch_specifier:
+ return "`-arch` specifier is invalid or missing for universal binary";
}
llvm_unreachable("A value of coveragemap_error has no message.");
}
diff --git a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingReader.cpp b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingReader.cpp
index 1acdcb4beb..54b63a2af0 100644
--- a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingReader.cpp
+++ b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingReader.cpp
@@ -213,7 +213,7 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray(
return Err;
unsigned LineStart = 0;
for (size_t I = 0; I < NumRegions; ++I) {
- Counter C, C2;
+ Counter C, C2;
CounterMappingRegion::RegionKind Kind = CounterMappingRegion::CodeRegion;
// Read the combined counter + region kind.
@@ -223,18 +223,18 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray(
return Err;
unsigned Tag = EncodedCounterAndRegion & Counter::EncodingTagMask;
uint64_t ExpandedFileID = 0;
-
- // If Tag does not represent a ZeroCounter, then it is understood to refer
- // to a counter or counter expression with region kind assumed to be
- // "CodeRegion". In that case, EncodedCounterAndRegion actually encodes the
- // referenced counter or counter expression (and nothing else).
- //
- // If Tag represents a ZeroCounter and EncodingExpansionRegionBit is set,
- // then EncodedCounterAndRegion is interpreted to represent an
- // ExpansionRegion. In all other cases, EncodedCounterAndRegion is
- // interpreted to refer to a specific region kind, after which additional
- // fields may be read (e.g. BranchRegions have two encoded counters that
- // follow an encoded region kind value).
+
+ // If Tag does not represent a ZeroCounter, then it is understood to refer
+ // to a counter or counter expression with region kind assumed to be
+ // "CodeRegion". In that case, EncodedCounterAndRegion actually encodes the
+ // referenced counter or counter expression (and nothing else).
+ //
+ // If Tag represents a ZeroCounter and EncodingExpansionRegionBit is set,
+ // then EncodedCounterAndRegion is interpreted to represent an
+ // ExpansionRegion. In all other cases, EncodedCounterAndRegion is
+ // interpreted to refer to a specific region kind, after which additional
+ // fields may be read (e.g. BranchRegions have two encoded counters that
+ // follow an encoded region kind value).
if (Tag != Counter::Zero) {
if (auto Err = decodeCounter(EncodedCounterAndRegion, C))
return Err;
@@ -255,14 +255,14 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray(
case CounterMappingRegion::SkippedRegion:
Kind = CounterMappingRegion::SkippedRegion;
break;
- case CounterMappingRegion::BranchRegion:
- // For a Branch Region, read two successive counters.
- Kind = CounterMappingRegion::BranchRegion;
- if (auto Err = readCounter(C))
- return Err;
- if (auto Err = readCounter(C2))
- return Err;
- break;
+ case CounterMappingRegion::BranchRegion:
+ // For a Branch Region, read two successive counters.
+ Kind = CounterMappingRegion::BranchRegion;
+ if (auto Err = readCounter(C))
+ return Err;
+ if (auto Err = readCounter(C2))
+ return Err;
+ break;
default:
return make_error<CoverageMapError>(coveragemap_error::malformed);
}
@@ -314,7 +314,7 @@ Error RawCoverageMappingReader::readMappingRegionsSubArray(
dbgs() << "\n";
});
- auto CMR = CounterMappingRegion(C, C2, InferredFileID, ExpandedFileID,
+ auto CMR = CounterMappingRegion(C, C2, InferredFileID, ExpandedFileID,
LineStart, ColumnStart,
LineStart + NumLines, ColumnEnd, Kind);
if (CMR.startLoc() > CMR.endLoc())
@@ -620,7 +620,7 @@ public:
CovBuf += FilenamesSize;
FilenameRange FileRange(FilenamesBegin, Filenames.size() - FilenamesBegin);
- if (Version >= CovMapVersion::Version4) {
+ if (Version >= CovMapVersion::Version4) {
// Map a hash of the filenames region to the filename range associated
// with this coverage header.
int64_t FilenamesRef =
@@ -648,7 +648,7 @@ public:
// This is a no-op in Version4 (coverage mappings are not affixed to the
// coverage header).
const char *MappingBuf = CovBuf;
- if (Version >= CovMapVersion::Version4 && CoverageSize != 0)
+ if (Version >= CovMapVersion::Version4 && CoverageSize != 0)
return make_error<CoverageMapError>(coveragemap_error::malformed);
CovBuf += CoverageSize;
const char *MappingEnd = CovBuf;
@@ -702,7 +702,7 @@ public:
if (FileRange && !FileRange->isInvalid()) {
StringRef Mapping =
CFR->template getCoverageMapping<Endian>(OutOfLineMappingBuf);
- if (Version >= CovMapVersion::Version4 &&
+ if (Version >= CovMapVersion::Version4 &&
Mapping.data() + Mapping.size() > FuncRecBufEnd)
return make_error<CoverageMapError>(coveragemap_error::malformed);
if (Error Err = insertFunctionRecordIfNeeded(CFR, Mapping, *FileRange))
@@ -731,7 +731,7 @@ Expected<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
case CovMapVersion::Version2:
case CovMapVersion::Version3:
case CovMapVersion::Version4:
- case CovMapVersion::Version5:
+ case CovMapVersion::Version5:
// Decompress the name data.
if (Error E = P.create(P.getNameData()))
return std::move(E);
@@ -744,9 +744,9 @@ Expected<std::unique_ptr<CovMapFuncRecordReader>> CovMapFuncRecordReader::get(
else if (Version == CovMapVersion::Version4)
return std::make_unique<VersionedCovMapFuncRecordReader<
CovMapVersion::Version4, IntPtrT, Endian>>(P, R, F);
- else if (Version == CovMapVersion::Version5)
- return std::make_unique<VersionedCovMapFuncRecordReader<
- CovMapVersion::Version5, IntPtrT, Endian>>(P, R, F);
+ else if (Version == CovMapVersion::Version5)
+ return std::make_unique<VersionedCovMapFuncRecordReader<
+ CovMapVersion::Version5, IntPtrT, Endian>>(P, R, F);
}
llvm_unreachable("Unsupported version");
}
@@ -790,7 +790,7 @@ static Error readCoverageMappingData(
}
// In Version4, function records are not affixed to coverage headers. Read
// the records from their dedicated section.
- if (Version >= CovMapVersion::Version4)
+ if (Version >= CovMapVersion::Version4)
return Reader->readFunctionRecords(FuncRecBuf, FuncRecBufEnd, None, nullptr,
nullptr);
return Error::success();
@@ -974,19 +974,19 @@ loadBinaryFormat(std::unique_ptr<Binary> Bin, StringRef Arch) {
BytesInAddress, Endian);
}
-/// Determine whether \p Arch is invalid or empty, given \p Bin.
-static bool isArchSpecifierInvalidOrMissing(Binary *Bin, StringRef Arch) {
- // If we have a universal binary and Arch doesn't identify any of its slices,
- // it's user error.
- if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin)) {
- for (auto &ObjForArch : Universal->objects())
- if (Arch == ObjForArch.getArchFlagName())
- return false;
- return true;
- }
- return false;
-}
-
+/// Determine whether \p Arch is invalid or empty, given \p Bin.
+static bool isArchSpecifierInvalidOrMissing(Binary *Bin, StringRef Arch) {
+ // If we have a universal binary and Arch doesn't identify any of its slices,
+ // it's user error.
+ if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin)) {
+ for (auto &ObjForArch : Universal->objects())
+ if (Arch == ObjForArch.getArchFlagName())
+ return false;
+ return true;
+ }
+ return false;
+}
+
Expected<std::vector<std::unique_ptr<BinaryCoverageReader>>>
BinaryCoverageReader::create(
MemoryBufferRef ObjectBuffer, StringRef Arch,
@@ -1007,10 +1007,10 @@ BinaryCoverageReader::create(
return BinOrErr.takeError();
std::unique_ptr<Binary> Bin = std::move(BinOrErr.get());
- if (isArchSpecifierInvalidOrMissing(Bin.get(), Arch))
- return make_error<CoverageMapError>(
- coveragemap_error::invalid_or_missing_arch_specifier);
-
+ if (isArchSpecifierInvalidOrMissing(Bin.get(), Arch))
+ return make_error<CoverageMapError>(
+ coveragemap_error::invalid_or_missing_arch_specifier);
+
// MachO universal binaries which contain archives need to be treated as
// archives, not as regular binaries.
if (auto *Universal = dyn_cast<MachOUniversalBinary>(Bin.get())) {
diff --git a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingWriter.cpp b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
index 65b83d1f41..a9ad67f63b 100644
--- a/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
+++ b/contrib/libs/llvm12/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
@@ -80,14 +80,14 @@ public:
ArrayRef<CounterMappingRegion> MappingRegions)
: Expressions(Expressions) {
AdjustedExpressionIDs.resize(Expressions.size(), 0);
- for (const auto &I : MappingRegions) {
+ for (const auto &I : MappingRegions) {
mark(I.Count);
- mark(I.FalseCount);
- }
- for (const auto &I : MappingRegions) {
+ mark(I.FalseCount);
+ }
+ for (const auto &I : MappingRegions) {
gatherUsed(I.Count);
- gatherUsed(I.FalseCount);
- }
+ gatherUsed(I.FalseCount);
+ }
}
void mark(Counter C) {
@@ -205,7 +205,7 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
PrevLineStart = 0;
}
Counter Count = Minimizer.adjust(I->Count);
- Counter FalseCount = Minimizer.adjust(I->FalseCount);
+ Counter FalseCount = Minimizer.adjust(I->FalseCount);
switch (I->Kind) {
case CounterMappingRegion::CodeRegion:
case CounterMappingRegion::GapRegion:
@@ -231,13 +231,13 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
<< Counter::EncodingCounterTagAndExpansionRegionTagBits,
OS);
break;
- case CounterMappingRegion::BranchRegion:
- encodeULEB128(unsigned(I->Kind)
- << Counter::EncodingCounterTagAndExpansionRegionTagBits,
- OS);
- writeCounter(MinExpressions, Count, OS);
- writeCounter(MinExpressions, FalseCount, OS);
- break;
+ case CounterMappingRegion::BranchRegion:
+ encodeULEB128(unsigned(I->Kind)
+ << Counter::EncodingCounterTagAndExpansionRegionTagBits,
+ OS);
+ writeCounter(MinExpressions, Count, OS);
+ writeCounter(MinExpressions, FalseCount, OS);
+ break;
}
assert(I->LineStart >= PrevLineStart);
encodeULEB128(I->LineStart - PrevLineStart, OS);
diff --git a/contrib/libs/llvm12/lib/ProfileData/Coverage/ya.make b/contrib/libs/llvm12/lib/ProfileData/Coverage/ya.make
index 7485f519d1..efd850fcac 100644
--- a/contrib/libs/llvm12/lib/ProfileData/Coverage/ya.make
+++ b/contrib/libs/llvm12/lib/ProfileData/Coverage/ya.make
@@ -12,11 +12,11 @@ LICENSE(Apache-2.0 WITH LLVM-exception)
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
PEERDIR(
- contrib/libs/llvm12
- contrib/libs/llvm12/lib/IR
- contrib/libs/llvm12/lib/Object
- contrib/libs/llvm12/lib/ProfileData
- contrib/libs/llvm12/lib/Support
+ contrib/libs/llvm12
+ contrib/libs/llvm12/lib/IR
+ contrib/libs/llvm12/lib/Object
+ contrib/libs/llvm12/lib/ProfileData
+ contrib/libs/llvm12/lib/Support
)
ADDINCL(