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
This commit is contained in:
Rafael Espindola
2013-07-29 21:26:49 +00:00
parent 096880b590
commit 3ed45fe2be
5 changed files with 38 additions and 37 deletions
+14 -3
View File
@@ -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.