summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-03-29 17:00:31 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-03-29 17:00:31 +0000
commitd394617a55809ecd30dcd0f67589484907a1a5e2 (patch)
treed978554a847a089ebaa7749fd8f5dbeb78ad0e51 /llvm/lib/System
parent858045e396fc16f89b0cb383cdd46d91cef0950e (diff)
downloadbcm5719-llvm-d394617a55809ecd30dcd0f67589484907a1a5e2.tar.gz
bcm5719-llvm-d394617a55809ecd30dcd0f67589484907a1a5e2.zip
Add a uniqueID field to the FileStatus structure for Paths. This will map
to the inode number on Unix and something far less unique on Windows. The windows case needs to be improved. llvm-svn: 35461
Diffstat (limited to 'llvm/lib/System')
-rw-r--r--llvm/lib/System/Unix/Path.inc1
-rw-r--r--llvm/lib/System/Win32/Path.inc7
2 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index b155213ec62..5557282964e 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -375,6 +375,7 @@ Path::getFileStatus(FileStatus &info, bool update, std::string *ErrStr) const {
status->mode = buf.st_mode;
status->user = buf.st_uid;
status->group = buf.st_gid;
+ status->uniqueID = uint64_t(buf.st_ino);
status->isDir = S_ISDIR(buf.st_mode);
status->isFile = S_ISREG(buf.st_mode);
}
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc
index 1f809ecfa56..f5edaa07edb 100644
--- a/llvm/lib/System/Win32/Path.inc
+++ b/llvm/lib/System/Win32/Path.inc
@@ -319,6 +319,13 @@ Path::getFileStatus(FileStatus &info, bool update, std::string *ErrStr) const {
status->user = 9999; // Not applicable to Windows, so...
status->group = 9999; // Not applicable to Windows, so...
+ // FIXME: this is only unique if the file is accessed by the same file path.
+ // How do we do this for C:\dir\file and ..\dir\file ? Unix has inode
+ // numbers, but the concept doesn't exist in Windows.
+ status->uniqueID = 0;
+ for (unsigned i = 0; i < path.length(); ++i)
+ status->uniqueID += path[i];
+
__int64 ft = *reinterpret_cast<__int64*>(&fi.ftLastWriteTime);
status->modTime.fromWin32Time(ft);
OpenPOWER on IntegriCloud