summaryrefslogtreecommitdiff
path: root/lib/Support/Unix
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-18 19:34:49 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-18 19:34:49 +0000
commit605510d16ead87dc48a363addb8a99eca6e3f17c (patch)
treea208a08b79913daef0b721791882cadd75967cec /lib/Support/Unix
parent13769fa725b03a937335cf04d2b9cc1ca426060f (diff)
downloadllvm-605510d16ead87dc48a363addb8a99eca6e3f17c.tar.gz
llvm-605510d16ead87dc48a363addb8a99eca6e3f17c.tar.bz2
llvm-605510d16ead87dc48a363addb8a99eca6e3f17c.tar.xz
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
Diffstat (limited to 'lib/Support/Unix')
-rw-r--r--lib/Support/Unix/PathV2.inc12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Support/Unix/PathV2.inc b/lib/Support/Unix/PathV2.inc
index c98c21d07c..9ea4f9ed51 100644
--- a/lib/Support/Unix/PathV2.inc
+++ b/lib/Support/Unix/PathV2.inc
@@ -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);