[llvm] r187616 - Expose that the unique file ID has a device and a file component.

Rafael Espindola rafael.espindola at gmail.com
Thu Aug 1 14:36:02 PDT 2013


Author: rafael
Date: Thu Aug  1 16:36:02 2013
New Revision: 187616

URL: http://llvm.org/viewvc/llvm-project?rev=187616&view=rev
Log:
Expose that the unique file ID has a device and a file component.

The use of sd_dev and st_ino has reached libclang, so expose the two components
in UniqueID so that we can use it in clang.

Modified:
    llvm/trunk/include/llvm/Support/FileSystem.h

Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=187616&r1=187615&r2=187616&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Thu Aug  1 16:36:02 2013
@@ -126,16 +126,22 @@ inline perms operator~(perms x) {
 }
 
 class UniqueID {
-  uint64_t A;
-  uint64_t B;
+  uint64_t Device;
+  uint64_t File;
 
 public:
   UniqueID() {}
-  UniqueID(uint64_t A, uint64_t B) : A(A), B(B) {}
+  UniqueID(uint64_t Device, uint64_t File) : Device(Device), File(File) {}
   bool operator==(const UniqueID &Other) const {
-    return A == Other.A && B == Other.B;
+    return Device == Other.Device && File == Other.File;
   }
   bool operator!=(const UniqueID &Other) const { return !(*this == Other); }
+  bool operator<(const UniqueID &Other) const {
+    return Device < Other.Device ||
+           (Device == Other.Device && File < Other.File);
+  }
+  uint64_t getDevice() const { return Device; }
+  uint64_t getFile() const { return File; }
 };
 
 /// file_status - Represents the result of a call to stat and friends. It has





More information about the llvm-commits mailing list