zequanwu added a comment. Thanks for reviewing.
================ 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: > zequanwu wrote: > > 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? > I see, you're right. We use a gap region with zero count to cover the area > after break. That's actually documented here: > https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#switch-statements. > One interesting point is that there's only one gap region that covers the > whole body; in this example, that would be `Gap,File 0, [[@LINE]]:13 -> > [[@LINE+8]]:10 = 0`. So, perhaps the new gaps emitted in switches are > redundant, but getting rid of them is just a performance optimization. Yes, they are redundant. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D97101/new/ https://reviews.llvm.org/D97101 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits