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 | ac08b26611860e16d95c6cd49b444cd5d84cc1de (patch) | |
| tree | f2f40f6280166f6886e72db55d8537dad299b664 /clang/tools | |
| parent | 6350e07ecddc2457915ed73938117b2c8a710b44 (diff) | |
| download | bcm5719-llvm-ac08b26611860e16d95c6cd49b444cd5d84cc1de.tar.gz bcm5719-llvm-ac08b26611860e16d95c6cd49b444cd5d84cc1de.zip | |
[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
llvm-svn: 173559
Diffstat (limited to 'clang/tools')
| -rw-r--r-- | clang/tools/libclang/CIndex.cpp | 15 | ||||
| -rw-r--r-- | clang/tools/libclang/libclang.exports | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index 5d492417bae..a8517091acb 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/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" //===----------------------------------------------------------------------===// diff --git a/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports index 8f3c86318c7..616be4c635e 100644 --- a/clang/tools/libclang/libclang.exports +++ b/clang/tools/libclang/libclang.exports @@ -166,6 +166,7 @@ clang_getFile clang_getFileLocation clang_getFileName clang_getFileTime +clang_getFileUniqueID clang_getFunctionTypeCallingConv clang_getIBOutletCollectionType clang_getIncludedFile |

