diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-08-01 21:36:02 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-08-01 21:36:02 +0000 |
commit | 8cb1d81250ab0957f956146af7bfe62cdd0a9f3e (patch) | |
tree | c6d2b989605ac93c280cd2294c7409813dd1519d | |
parent | 44c8e346c79cc2affa31385df254b85aa0f5c869 (diff) | |
download | external_llvm-8cb1d81250ab0957f956146af7bfe62cdd0a9f3e.zip external_llvm-8cb1d81250ab0957f956146af7bfe62cdd0a9f3e.tar.gz external_llvm-8cb1d81250ab0957f956146af7bfe62cdd0a9f3e.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187616 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/Support/FileSystem.h | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index 60455a4..c130b47 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -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 |