summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2019-11-21 14:17:04 -0800
committerVedant Kumar <vsk@apple.com>2019-12-03 12:35:54 -0800
commit859bf4d2bea2404bd2eac92451f2db4371ec6eb4 (patch)
treeb27618c806fb6fbbac6b44269e26ff7cd207de66 /clang/lib/CodeGen
parentbf830b01a21e6ff2f44c17be4ad4ee897465a677 (diff)
downloadbcm5719-llvm-859bf4d2bea2404bd2eac92451f2db4371ec6eb4.tar.gz
bcm5719-llvm-859bf4d2bea2404bd2eac92451f2db4371ec6eb4.zip
[Coverage] Emit a gap region to cover switch bodies
Emit a gap region beginning where the switch body begins. This sets line execution counts in the areas between non-overlapping cases to 0. This also removes some special handling of the first case in a switch: these are now treated like any other case. This does not resolve an outstanding issue with case statement regions that do not end when a region is terminated. But it should address llvm.org/PR44011. Differential Revision: https://reviews.llvm.org/D70571
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 0a7a4fe33ac..bdecff39c88 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -1114,8 +1114,8 @@ struct CounterCoverageMappingBuilder
// Make a region for the body of the switch. If the body starts with
// a case, that case will reuse this region; otherwise, this covers
// the unreachable code at the beginning of the switch body.
- size_t Index =
- pushRegion(Counter::getZero(), getStart(CS->body_front()));
+ size_t Index = pushRegion(Counter::getZero(), getStart(CS));
+ getRegion().setGap(true);
for (const auto *Child : CS->children())
Visit(Child);
OpenPOWER on IntegriCloud