diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-26 04:52:52 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2013-01-26 04:52:52 +0000 |
commit | db84e7a44dce24c3a8e4e0fc84434c00fc2da168 (patch) | |
tree | 9aad4b86e73fd27506c97453370300d62e977566 /tools/libclang/CIndex.cpp | |
parent | 4e4d7cedb84e6c5476e9cee5128e977b240331a6 (diff) |
[libclang] Introduce clang_getFileUniqueID which returns a struct
for a CXFile containing device/inode/modification time.
Intended to be useful as a key associated with a unique file across
an indexing session.
rdar://13091837
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173559 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r-- | tools/libclang/CIndex.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 5d492417ba..a8517091ac 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -2960,6 +2960,21 @@ unsigned clang_isFileMultipleIncludeGuarded(CXTranslationUnit tu, CXFile file) { .isFileMultipleIncludeGuarded(FEnt); } +int clang_getFileUniqueID(CXFile file, CXFileUniqueID *outID) { + 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(); + outID->data[2] = FEnt->getModificationTime(); + return 0; +#endif +} + } // end: extern "C" //===----------------------------------------------------------------------===// |