[PATCH] D24034: [Coverage] Make sorting criteria for CounterMappingRegions local.
Igor Kudrin via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 31 00:09:43 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL280198: [Coverage] Make sorting criteria for CounterMappingRegions local. (authored by ikudrin).
Changed prior to commit:
https://reviews.llvm.org/D24034?vs=69703&id=69798#toc
Repository:
rL LLVM
https://reviews.llvm.org/D24034
Files:
llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMapping.h
llvm/trunk/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
Index: llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMapping.h
===================================================================
--- llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMapping.h
+++ llvm/trunk/include/llvm/ProfileData/Coverage/CoverageMapping.h
@@ -245,12 +245,6 @@
return std::pair<unsigned, unsigned>(LineEnd, ColumnEnd);
}
- bool operator<(const CounterMappingRegion &Other) const {
- if (FileID != Other.FileID)
- return FileID < Other.FileID;
- return startLoc() < Other.startLoc();
- }
-
bool contains(const CounterMappingRegion &Other) const {
if (FileID != Other.FileID)
return false;
Index: llvm/trunk/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
===================================================================
--- llvm/trunk/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
+++ llvm/trunk/lib/ProfileData/Coverage/CoverageMappingWriter.cpp
@@ -108,8 +108,16 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24034.69798.patch
Type: text/x-patch
Size: 1714 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160831/ac8217a6/attachment.bin>
More information about the llvm-commits
mailing list