aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CoverageMappingGen.cpp
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2016-09-27 23:30:36 +0000
committerAlex Lorenz <arphaman@gmail.com>2016-09-27 23:30:36 +0000
commit08780529b3d6deadbf1e1a1a19ea9689241eb4c1 (patch)
tree9e659b0aaf1c853e43c3e42cbf1f6669f78e4645 /clang/lib/CodeGen/CoverageMappingGen.cpp
parent3e490ef94efbf87d52aea11eee8bc25739ca95d1 (diff)
downloadllvm-08780529b3d6deadbf1e1a1a19ea9689241eb4c1.zip
llvm-08780529b3d6deadbf1e1a1a19ea9689241eb4c1.tar.gz
llvm-08780529b3d6deadbf1e1a1a19ea9689241eb4c1.tar.bz2
[Coverage] The coverage region for switch covers the code after the switch.
This patch fixes a regression introduced in r262697 that changed the way the coverage regions for switches are constructed. The PGO instrumentation counter for a switch statement refers to the counter at the exit of the switch. Therefore, the coverage region for the switch statement should cover the code that comes after the switch, and not the switch statement itself. rdar://28480997 Differential Revision: https://reviews.llvm.org/D24981 llvm-svn: 282554
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index e008f44..0e51658 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -842,7 +842,11 @@ struct CounterCoverageMappingBuilder
Counter ExitCount = getRegionCounter(S);
SourceLocation ExitLoc = getEnd(S);
- pushRegion(ExitCount, getStart(S), ExitLoc);
+ pushRegion(ExitCount);
+
+ // Ensure that handleFileExit recognizes when the end location is located
+ // in a different file.
+ MostRecentLocation = getStart(S);
handleFileExit(ExitLoc);
}