Use llvm::sys::fs::UniqueID for windows and unix.
This unifies the unix and windows versions of FileManager::UniqueDirContainer
and FileManager::UniqueFileContainer by using UniqueID.
We cannot just replace "struct stat" with llvm::sys::fs::file_status, since we
want to be able to construct fake ones, and file_status has different members
on unix and windows.
What the patch does is:
* Record only the information that clang is actually using.
* Use llvm::sys::fs::status instead of stat and fstat.
* Use llvm::sys::fs::UniqueID
* Delete the old windows versions of UniqueDirContainer and
UniqueFileContainer since the "unix" one now works on windows too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187619 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 9f6300a..2007951 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -3057,15 +3057,12 @@
if (!file || !outID)
return 1;
-#ifdef LLVM_ON_WIN32
- return 1; // inodes not supported on windows.
-#else
FileEntry *FEnt = static_cast<FileEntry *>(file);
- outID->data[0] = FEnt->getDevice();
- outID->data[1] = FEnt->getInode();
+ const llvm::sys::fs::UniqueID &ID = FEnt->getUniqueID();
+ outID->data[0] = ID.getDevice();
+ outID->data[1] = ID.getFile();
outID->data[2] = FEnt->getModificationTime();
return 0;
-#endif
}
} // end: extern "C"