From 7f822a9306f2818f9cbb020e96f97ce9b97dbc9a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 29 Jul 2013 21:26:49 +0000 Subject: Include st_dev to make the result of getUniqueID actually unique. This will let us use getUniqueID instead of st_dev directly on clang. llvm-svn: 187378 --- llvm/lib/Support/Unix/Path.inc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'llvm/lib/Support/Unix/Path.inc') diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index 5386366b542..0c4518c7493 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/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 &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) { -- cgit v1.2.3