summaryrefslogtreecommitdiff
path: root/include/llvm/Support/FileSystem.h
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-07-29 21:26:49 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-07-29 21:26:49 +0000
commit3ed45fe2be4356351942a2cfe9bd92e996d4fcad (patch)
treedb0f4e0ca1ab5bea02dd42f312770d37b539a1e7 /include/llvm/Support/FileSystem.h
parent096880b59008a44860edd0fcab1f55aa1363bdf5 (diff)
downloadllvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.tar.gz
llvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.tar.bz2
llvm-3ed45fe2be4356351942a2cfe9bd92e996d4fcad.tar.xz
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/llvm/Support/FileSystem.h')
-rw-r--r--include/llvm/Support/FileSystem.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h
index d4ca8397a5..908878f1b6 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.