Skip to content

Commit 5a5838f

Browse files
committed
Introduce CounterMappingRegion::isBranch(). NFC.
1 parent 7384d8b commit 5a5838f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2370,8 +2370,7 @@ static void dump(llvm::raw_ostream &OS, StringRef FunctionName,
23702370
} else {
23712371
Ctx.dump(R.Count, OS);
23722372

2373-
if (R.Kind == CounterMappingRegion::BranchRegion ||
2374-
R.Kind == CounterMappingRegion::MCDCBranchRegion) {
2373+
if (R.isBranch()) {
23752374
OS << ", ";
23762375
Ctx.dump(R.FalseCount, OS);
23772376
}

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ struct CounterMappingRegion {
272272

273273
RegionKind Kind;
274274

275+
bool isBranch() const {
276+
return (Kind == BranchRegion || Kind == MCDCBranchRegion);
277+
}
278+
275279
CounterMappingRegion(Counter Count, unsigned FileID, unsigned ExpandedFileID,
276280
unsigned LineStart, unsigned ColumnStart,
277281
unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
@@ -716,8 +720,7 @@ struct FunctionRecord {
716720

717721
void pushRegion(CounterMappingRegion Region, uint64_t Count,
718722
uint64_t FalseCount, bool HasSingleByteCoverage) {
719-
if (Region.Kind == CounterMappingRegion::BranchRegion ||
720-
Region.Kind == CounterMappingRegion::MCDCBranchRegion) {
723+
if (Region.isBranch()) {
721724
CountedBranchRegions.emplace_back(Region, Count, FalseCount,
722725
HasSingleByteCoverage);
723726
// If either counter is hard-coded to zero, then this region represents a

0 commit comments

Comments
 (0)