[llvm-branch-commits] [clang] [llvm] [Coverage][Single] Enable Branch coverage for SwitchStmt (PR #113112)

NAKAMURA Takumi via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 28 03:05:32 PST 2026


================
@@ -1006,6 +1006,25 @@ struct CounterCoverageMappingBuilder
     return Counters;
   }
 
+  /// Returns {TrueCnt,FalseCnt} for "implicit default".
+  /// FalseCnt is considered as the False count on SwitchStmt.
+  std::pair<Counter, Counter>
+  getSwitchImplicitDefaultCounterPair(const Stmt *Cond, Counter ParentCount,
+                                      Counter CaseCountSum) {
+    if (llvm::EnableSingleByteCoverage)
+      // Allocate the new Counter since `subtract(Parent - Sum)` is unavailable.
+      return {Counter::getZero(), // Folded
+              Counter::getCounter(CounterMap[Cond].Skipped = NextCounterNum++)};
----------------
chapuni wrote:

Done. I supposed it was the topic of `clang-format`.

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


More information about the llvm-branch-commits mailing list