[PATCH] D70571: [Coverage] Emit a gap region to cover switch bodies

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 17:50:23 PST 2019


vsk planned changes to this revision.
vsk marked an inline comment as done.
vsk added a comment.

I'll write something up in the coverage mapping docs. Briefly, though, with this change there should be a gap region that covers the entire switch body (starting from the '{' in 'switch {', and terminating where the last case ends).



================
Comment at: clang/test/CoverageMapping/switch.cpp:32
   switch (i) {      // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+6]]:2 = #4
-    nop();          // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE+2]]:10 = 0
+    nop();          // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:14 -> [[@LINE+2]]:10 = 0
   case 1:           // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE+1]]:10 = #7
----------------
efriedma wrote:
> I'm not sure I understand the effect here.  Will we show that nop() never executes, or will we not show any coverage information for it?
The report will show an execution count of 0 for that call to nop(). In general a gap region's count is selected as the line count when it's the only region present in a line.


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

https://reviews.llvm.org/D70571





More information about the cfe-commits mailing list