From ac08b26611860e16d95c6cd49b444cd5d84cc1de Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Sat, 26 Jan 2013 04:52:52 +0000 Subject: [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 --- clang/tools/libclang/CIndex.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'clang/tools/libclang/CIndex.cpp') 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(file); + outID->data[0] = FEnt->getDevice(); + outID->data[1] = FEnt->getInode(); + outID->data[2] = FEnt->getModificationTime(); + return 0; +#endif +} + } // end: extern "C" //===----------------------------------------------------------------------===// -- cgit v1.2.3