summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit45e6c2406dcb8c368805707d4f84f15d8fd09967 (patch)
tree26685a9b54275ec2898a05e7fde6508f7962b032 /llvm/lib/Support/Unix
parent5eeaf7402bc7826667a881c7fd0c5a95826e4296 (diff)
downloadbcm5719-llvm-45e6c2406dcb8c368805707d4f84f15d8fd09967.tar.gz
bcm5719-llvm-45e6c2406dcb8c368805707d4f84f15d8fd09967.zip
Add a GetUniqueID that will replace the uniqueID of PathV1.h.
llvm-svn: 184217
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/PathV2.inc12
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc
index c98c21d07cc..9ea4f9ed51a 100644
--- a/llvm/lib/Support/Unix/PathV2.inc
+++ b/llvm/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);
OpenPOWER on IntegriCloud