[clang] [Coverage] Introduce `getBranchCounterPair()`. NFC. (PR #112702)
NAKAMURA Takumi via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 7 23:13:47 PST 2025
================
@@ -938,6 +938,37 @@ struct CounterCoverageMappingBuilder
return Counter::getCounter(CounterMap[S]);
}
+ struct BranchCounterPair {
+ Counter Executed;
+ Counter Skipped;
+ };
+
+ BranchCounterPair getBranchCounterPair(const Stmt *S, Counter ParentCnt) {
+ Counter ExecCnt = getRegionCounter(S);
+ return {ExecCnt, Builder.subtract(ParentCnt, ExecCnt)};
+ }
+
+ /// Returns {TrueCnt,FalseCnt} for "implicit default".
+ /// FalseCnt is considered as the False count on SwitchStmt.
----------------
chapuni wrote:
`getSwitchImplicitDefaultCounterPair` has been migrated to #113112. I suppose this explained what it did.
Note, I didn't migrate this using `BranchCounterPair` since I thought this was semantically different from others.
https://github.com/llvm/llvm-project/pull/112702
More information about the cfe-commits
mailing list