[clang] [clang][coverage] Add opt-in call continuation counters for coverage (PR #201079)

Alan Phipps via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 14:51:24 PDT 2026


================
@@ -36,6 +36,8 @@ class CodeGenPGO {
   unsigned NumRegionCounters;
   uint64_t FunctionHash;
   std::unique_ptr<llvm::DenseMap<const Stmt *, CounterPair>> RegionCounterMap;
+  std::unique_ptr<llvm::DenseMap<const Stmt *, unsigned>>
+      CallContinuationCounterMap;
----------------
evodius96 wrote:

Thanks -- I think that's what I'm trying to wrap my head around.  Strictly speaking, a continuation counter is still a counter, and therefore `Executed` has meaning for it.  However, I think your dilemma is finding an optimal way to designate the counter appropriately. The baked-in way Clang does this is to use regions to identify how counters are interpreted, and so the counters would still be in `RegionCounterMap` and be referenced by the region, and then you could visualize it and process it appropriately, and you therefore wouldn't need to redefine `CounterPair`.

However, adding a special region for this may be overkill, so I need to think about this a bit.

@chapuni implemented `CounterPair` to make verification easier. `Executed` would be used, but `Skipped` can just be `None`.


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


More information about the cfe-commits mailing list