[Coverage] Fix the start/end locations of switch statements
While pushing switch statements onto the region stack we neglected to
specify their start/end locations. This results in a crash (PR26825) if
we end up in nested macro expansions without enough information to
handle the relevant file exits.
I added a test in switchmacro.c and fixed up a bunch of incorrect CHECK
lines that specify strange end locations for switches.
llvm-svn: 262697
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 9279d1a..adafee4 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/lib/CodeGen/CoverageMappingGen.cpp
@@ -776,7 +776,7 @@
BreakContinueStack.back().ContinueCount, BC.ContinueCount);
Counter ExitCount = getRegionCounter(S);
- pushRegion(ExitCount);
+ pushRegion(ExitCount, getStart(S), getEnd(S));
}
void VisitSwitchCase(const SwitchCase *S) {