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 /lib/Support/Unix | |
parent | 096880b59008a44860edd0fcab1f55aa1363bdf5 (diff) | |
download | llvm-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 'lib/Support/Unix')
-rw-r--r-- | lib/Support/Unix/Path.inc | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/Support/Unix/Path.inc b/lib/Support/Unix/Path.inc index 5386366b54..0c4518c749 100644 --- a/lib/Support/Unix/Path.inc +++ b/lib/Support/Unix/Path.inc @@ -293,6 +293,10 @@ TimeValue file_status::getLastModificationTime() const { return Ret; } +UniqueID file_status::getUniqueID() { + return UniqueID(fs_st_dev, fs_st_ino); +} + error_code current_path(SmallVectorImpl<char> &result) { #ifdef MAXPATHLEN result.reserve(MAXPATHLEN); @@ -457,18 +461,6 @@ error_code equivalent(const Twine &A, const Twine &B, bool &result) { return error_code::success(); } -error_code getUniqueID(const Twine Path, uint64_t &Result) { - SmallString<128> Storage; - StringRef P = Path.toNullTerminatedStringRef(Storage); - - struct stat Status; - if (::stat(P.begin(), &Status) != 0) - return error_code(errno, system_category()); - - Result = Status.st_ino; - return error_code::success(); -} - static error_code fillStatus(int StatRet, const struct stat &Status, file_status &Result) { if (StatRet != 0) { |