Skip to content

Commit f2ba219

Browse files
committed
Update comments
1 parent c8edf58 commit f2ba219

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -935,16 +935,32 @@ struct CounterCoverageMappingBuilder
935935
}
936936

937937
struct BranchCounterPair {
938-
Counter Executed;
939-
Counter Skipped;
938+
Counter Executed; ///< The Counter previously assigned.
939+
Counter Skipped; ///< An expression (Parent-Executed), or equivalent to it.
940940
};
941941

942+
/// Retrieve or assign the pair of Counter(s).
943+
///
944+
/// This returns BranchCounterPair {Executed, Skipped}.
945+
/// Executed is the Counter associated with S assigned by an earlier
946+
/// CounterMapping pass.
947+
/// Skipped may be an expression (Executed - ParentCnt) or newly
948+
/// assigned Counter in EnableSingleByteCoverage, as subtract
949+
/// expressions are not available in this mode.
950+
///
951+
/// \param S Key to the CounterMap
952+
/// \param ParentCnt The Counter representing how many times S is evaluated.
953+
/// \param SkipCntForOld (To be removed later) Optional fake Counter
954+
/// to override Skipped for adjustment of
955+
/// expressions in the old behavior of
956+
/// EnableSingleByteCoverage that is unaware of
957+
/// Branch coverage.
942958
BranchCounterPair
943959
getBranchCounterPair(const Stmt *S, Counter ParentCnt,
944960
std::optional<Counter> SkipCntForOld = std::nullopt) {
945961
Counter ExecCnt = getRegionCounter(S);
946962

947-
// The old behavior of SingleByte shouldn't emit Branches.
963+
// The old behavior of SingleByte is unaware of Branches.
948964
if (llvm::EnableSingleByteCoverage) {
949965
assert(SkipCntForOld);
950966
return {ExecCnt, *SkipCntForOld};

0 commit comments

Comments
 (0)