Add a GetUniqueID that will replace the uniqueID of PathV1.h.
llvm-svn: 184217
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc
index c98c21d..9ea4f9e 100644
--- a/llvm/lib/Support/Unix/PathV2.inc
+++ b/llvm/lib/Support/Unix/PathV2.inc
@@ -350,6 +350,18 @@
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);