[clang] [Coverage] Introduce `getBranchCounterPair()`. NFC. (PR #112702)

NAKAMURA Takumi via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 7 23:27:01 PST 2025


================
@@ -939,8 +939,17 @@ struct CounterCoverageMappingBuilder
     Counter Skipped;
   };
 
-  BranchCounterPair getBranchCounterPair(const Stmt *S, Counter ParentCnt) {
+  BranchCounterPair
+  getBranchCounterPair(const Stmt *S, Counter ParentCnt,
+                       std::optional<Counter> SkipCntForOld = std::nullopt) {
     Counter ExecCnt = getRegionCounter(S);
+
+    // The old behavior of SingleByte shouldn't emit Branches.
+    if (llvm::EnableSingleByteCoverage) {
+      assert(SkipCntForOld);
----------------
chapuni wrote:

I wish its end of life would come soon. The assertion will disappear when implementation begins. e.g. https://github.com/llvm/llvm-project/pull/113111/commits/3c6252260ee11e3a453076b4d96ffffe20d49998

I really want to label it `&& "UNDER CONSTRUCTION"`, or eliminate this assertions now.

https://github.com/llvm/llvm-project/pull/112702


More information about the cfe-commits mailing list