[clang] [llvm] [Coverage] Introduce "partial fold" on BranchRegion (PR #112694)

Jessica Paquette via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 17 23:59:06 PDT 2024


================
@@ -19,18 +19,18 @@ using namespace coverage;
 static void sumBranches(size_t &NumBranches, size_t &CoveredBranches,
                         const ArrayRef<CountedRegion> &Branches) {
   for (const auto &BR : Branches) {
-    // Skip folded branches.
-    if (BR.Folded)
-      continue;
-
-    // "True" Condition Branches.
-    ++NumBranches;
-    if (BR.ExecutionCount > 0)
-      ++CoveredBranches;
-    // "False" Condition Branches.
-    ++NumBranches;
-    if (BR.FalseExecutionCount > 0)
-      ++CoveredBranches;
+    if (!BR.TrueFolded) {
+      // "True" Condition Branches.
+      ++NumBranches;
+      if (BR.ExecutionCount > 0)
+        ++CoveredBranches;
+    }
+    if (!BR.FalseFolded) {
----------------
ornata wrote:

Can this be a lambda or static helper function?

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


More information about the cfe-commits mailing list