diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-29 21:26:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-07-29 21:26:49 +0000 |
commit | 3ed45fe2be4356351942a2cfe9bd92e996d4fcad (patch) | |
tree | db0f4e0ca1ab5bea02dd42f312770d37b539a1e7 /include | |
parent | 096880b59008a44860edd0fcab1f55aa1363bdf5 (diff) | |
download | external_llvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.zip external_llvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.tar.gz external_llvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.tar.bz2 |
Include st_dev to make the result of getUniqueID actually unique.
This will let us use getUniqueID instead of st_dev directly on clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Support/FileSystem.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index d4ca839..908878f 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -125,8 +125,19 @@ inline perms operator~(perms x) { return static_cast<perms>(~static_cast<unsigned short>(x)); } +class UniqueID { + uint64_t A; + uint64_t B; + +public: + UniqueID() {} + UniqueID(uint64_t A, uint64_t B) : A(A), B(B) {} + bool operator==(const UniqueID &Other) const { + return A == Other.A && B == Other.B; + } + bool operator!=(const UniqueID &Other) const { return !(*this == Other); } +}; - /// file_status - Represents the result of a call to stat and friends. It has /// a platform specific member to store the result. class file_status @@ -148,7 +159,6 @@ class file_status uint32_t FileIndexLow; #endif friend bool equivalent(file_status A, file_status B); - friend error_code getUniqueID(const Twine Path, uint64_t &Result); file_type Type; perms Perms; public: @@ -176,6 +186,7 @@ public: file_type type() const { return Type; } perms permissions() const { return Perms; } TimeValue getLastModificationTime() const; + UniqueID getUniqueID(); #if defined(LLVM_ON_UNIX) uint32_t getUser() const { return fs_st_uid; } @@ -664,7 +675,7 @@ file_magic identify_magic(StringRef magic); /// platform specific error_code. error_code identify_magic(const Twine &path, file_magic &result); -error_code getUniqueID(const Twine Path, uint64_t &Result); +error_code getUniqueID(const Twine Path, UniqueID &Result); /// This class represents a memory mapped file. It is based on /// boost::iostreams::mapped_file. |