Add a GetUniqueID that will replace the uniqueID of PathV1.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184217 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2013-06-18 19:34:49 +00:00
parent 13769fa725
commit 605510d16e
3 changed files with 28 additions and 0 deletions

View File

@ -350,6 +350,18 @@ error_code file_size(const Twine &path, uint64_t &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();
}
error_code status(const Twine &path, file_status &result) {
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);