diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp')
| -rw-r--r-- | gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp b/gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp index 8ff90d62cfd..82356333b93 100644 --- a/gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp +++ b/gnu/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp @@ -108,8 +108,16 @@ static void writeCounter(ArrayRef<CounterExpression> Expressions, Counter C, void CoverageMappingWriter::write(raw_ostream &OS) { // Sort the regions in an ascending order by the file id and the starting - // location. - std::stable_sort(MappingRegions.begin(), MappingRegions.end()); + // location. Sort by region kinds to ensure stable order for tests. + std::stable_sort( + MappingRegions.begin(), MappingRegions.end(), + [](const CounterMappingRegion &LHS, const CounterMappingRegion &RHS) { + if (LHS.FileID != RHS.FileID) + return LHS.FileID < RHS.FileID; + if (LHS.startLoc() != RHS.startLoc()) + return LHS.startLoc() < RHS.startLoc(); + return LHS.Kind < RHS.Kind; + }); // Write out the fileid -> filename mapping. encodeULEB128(VirtualFileMapping.size(), OS); |
