Coverage: add HasCodeBefore flag to a mapping region.
This flag will be used by the coverage tool to help
compute the execution counts for each line in a source file.
Differential Revision: http://reviews.llvm.org/D4746
llvm-svn: 214740
diff --git a/llvm/lib/ProfileData/CoverageMappingWriter.cpp b/llvm/lib/ProfileData/CoverageMappingWriter.cpp
index f9bbe61..f5e6ab4 100644
--- a/llvm/lib/ProfileData/CoverageMappingWriter.cpp
+++ b/llvm/lib/ProfileData/CoverageMappingWriter.cpp
@@ -181,7 +181,11 @@
}
assert(I.LineStart >= PrevLineStart);
encodeULEB128(I.LineStart - PrevLineStart, OS);
- encodeULEB128(I.ColumnStart, OS);
+ uint64_t CodeBeforeColumnStart =
+ uint64_t(I.HasCodeBefore) |
+ (uint64_t(I.ColumnStart)
+ << CounterMappingRegion::EncodingHasCodeBeforeBits);
+ encodeULEB128(CodeBeforeColumnStart, OS);
assert(I.LineEnd >= I.LineStart);
encodeULEB128(I.LineEnd - I.LineStart, OS);
encodeULEB128(I.ColumnEnd, OS);