[PATCH] D97101: [Coverage] Emit zero count gap region between statements if first statements contains return, throw, goto, co_return

Zequan Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 2 20:39:44 PST 2021


zequanwu added inline comments.


================
Comment at: clang/test/CoverageMapping/deferred-region.cpp:43
   if (true)
-    return; // CHECK: Gap,File 0, [[@LINE]]:11
+    return;
   else
----------------
vsk wrote:
> I'm confused by this change. Do we lose the gap here? I assumed it was needed to prevent the condition count from `if (true)` from kicking in after the `return`?
Fixed.


================
Comment at: clang/test/CoverageMapping/switch.cpp:62
   default:          // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #4
     break;          // CHECK-NEXT: Branch,File 0, [[@LINE-1]]:3 -> [[@LINE-1]]:10 = #4, (#0 - #4)
+  }
----------------
vsk wrote:
> The blank space after `default: break;` and before the closing '}' should have the same count as the switch condition, I thought (this goes for all of the unreachable code within a switch body)? The idea is to prevent 'not-executed' regions from appearing after the `break` stmt.
Yes, they are unreachable. So, shouldn't they always have zero count instead of same count as switch condition?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97101/new/

https://reviews.llvm.org/D97101



More information about the cfe-commits mailing list