aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-20 14:16:56 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-20 14:16:56 +0000
commit2cab237b5dbfe1b3e9c7aa7a3c02d2b98fcf7462 (patch)
tree524fe828571f81358bba62fdb6d04c6e5e96a2a4 /contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
parent6c7828a2807ea5e50c79ca42dbedf2b589ce63b2 (diff)
parent044eb2f6afba375a914ac9d8024f8f5142bb912e (diff)
Notes
Diffstat (limited to 'contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp')
-rw-r--r--contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp b/contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
index 6fe93530da21..49e82e481059 100644
--- a/contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
+++ b/contrib/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
@@ -116,6 +116,13 @@ static void writeCounter(ArrayRef<CounterExpression> Expressions, Counter C,
}
void CoverageMappingWriter::write(raw_ostream &OS) {
+ // Check that we don't have any bogus regions.
+ assert(all_of(MappingRegions,
+ [](const CounterMappingRegion &CMR) {
+ return CMR.startLoc() <= CMR.endLoc();
+ }) &&
+ "Source region does not begin before it ends");
+
// Sort the regions in an ascending order by the file id and the starting
// location. Sort by region kinds to ensure stable order for tests.
std::stable_sort(
@@ -164,6 +171,7 @@ void CoverageMappingWriter::write(raw_ostream &OS) {
Counter Count = Minimizer.adjust(I->Count);
switch (I->Kind) {
case CounterMappingRegion::CodeRegion:
+ case CounterMappingRegion::GapRegion:
writeCounter(MinExpressions, Count, OS);
break;
case CounterMappingRegion::ExpansionRegion: {