[llvm] r358843 - [CachePruning] Simplify comparator

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 20 23:17:40 PDT 2019


Author: maskray
Date: Sat Apr 20 23:17:40 2019
New Revision: 358843

URL: http://llvm.org/viewvc/llvm-project?rev=358843&view=rev
Log:
[CachePruning] Simplify comparator

Modified:
    llvm/trunk/lib/Support/CachePruning.cpp

Modified: llvm/trunk/lib/Support/CachePruning.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CachePruning.cpp?rev=358843&r1=358842&r2=358843&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CachePruning.cpp (original)
+++ llvm/trunk/lib/Support/CachePruning.cpp Sat Apr 20 23:17:40 2019
@@ -35,15 +35,8 @@ struct FileInfo {
   /// Used to determine which files to prune first. Also used to determine
   /// set membership, so must take into account all fields.
   bool operator<(const FileInfo &Other) const {
-    if (Time < Other.Time)
-      return true;
-    else if (Other.Time < Time)
-      return false;
-    if (Other.Size < Size)
-      return true;
-    else if (Size < Other.Size)
-      return false;
-    return Path < Other.Path;
+    return std::tie(Time, Other.Size, Path) <
+           std::tie(Other.Time, Size, Other.Path);
   }
 };
 } // anonymous namespace




More information about the llvm-commits mailing list