summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-26 04:52:52 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-01-26 04:52:52 +0000
commitac08b26611860e16d95c6cd49b444cd5d84cc1de (patch)
treef2f40f6280166f6886e72db55d8537dad299b664 /clang/tools/libclang/CIndex.cpp
parent6350e07ecddc2457915ed73938117b2c8a710b44 (diff)
downloadbcm5719-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/libclang/CIndex.cpp')
-rw-r--r--clang/tools/libclang/CIndex.cpp15
1 files changed, 15 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"
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud