]> granicus.if.org Git - llvm/commitdiff
[CachePruning] Simplify comparator
authorFangrui Song <maskray@google.com>
Sun, 21 Apr 2019 06:17:40 +0000 (06:17 +0000)
committerFangrui Song <maskray@google.com>
Sun, 21 Apr 2019 06:17:40 +0000 (06:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358843 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/CachePruning.cpp

index 7f97d1afbd3a4cf757d0951ce1fc9feb2578b88b..9813eec0e4330794b9da289a62ff893be9071d27 100644 (file)
@@ -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