[PATCH] D45140: [Support] Change std::sort to llvm::sort in response to r327219

Mandeep Singh Grang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 31 19:27:26 PDT 2018


mgrang created this revision.
mgrang added reviewers: chandlerc, jordan_rose, bkramer.

r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort.
Refer the comments section in https://reviews.llvm.org/D44363 for a list of all the required patches.


Repository:
  rL LLVM

https://reviews.llvm.org/D45140

Files:
  lib/Support/SourceMgr.cpp
  lib/Support/Timer.cpp


Index: lib/Support/Timer.cpp
===================================================================
--- lib/Support/Timer.cpp
+++ lib/Support/Timer.cpp
@@ -284,7 +284,7 @@
 
 void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
   // Sort the timers in descending order by amount of time taken.
-  std::sort(TimersToPrint.begin(), TimersToPrint.end());
+  llvm::sort(TimersToPrint.begin(), TimersToPrint.end());
 
   TimeRecord Total;
   for (const PrintRecord &Record : TimersToPrint)
Index: lib/Support/SourceMgr.cpp
===================================================================
--- lib/Support/SourceMgr.cpp
+++ lib/Support/SourceMgr.cpp
@@ -247,7 +247,7 @@
   : SM(&sm), Loc(L), Filename(FN), LineNo(Line), ColumnNo(Col), Kind(Kind),
     Message(Msg), LineContents(LineStr), Ranges(Ranges.vec()),
     FixIts(Hints.begin(), Hints.end()) {
-  std::sort(FixIts.begin(), FixIts.end());
+  llvm::sort(FixIts.begin(), FixIts.end());
 }
 
 static void buildFixItLine(std::string &CaretLine, std::string &FixItLine,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45140.140568.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180401/7b65a551/attachment.bin>


More information about the llvm-commits mailing list