summaryrefslogtreecommitdiff
path: root/include/clang-c
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-04-07 20:50:35 +0000
committerFangrui Song <maskray@google.com>2018-04-07 20:50:35 +0000
commit639427d5d327e33d797db8a39eedf466d1159e97 (patch)
tree81e4a1d5a137dc45d8b5fc8c8d9f666409414704 /include/clang-c
parent06e7df12ca91bef4b1680a0a4d20bac50f1719e8 (diff)
downloadclang-639427d5d327e33d797db8a39eedf466d1159e97.tar.gz
[libclang] Add clang_File_tryGetRealPathName
Summary: clang_getFileName() may return a path relative to WorkingDir. On Arch Linux, during clang_indexTranslationUnit(), clang_getFileName() on CXIdxIncludedIncludedFileInfo::file may return "/../lib64/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../include/c++/7.3.0/string", for `#include <string>`. I presume WorkingDir is somehow changed to /usr/lib or /usr/include and clang_getFileName() returns a path relative to WorkingDir. clang_File_tryGetRealPathName() returns "/usr/include/c++/7.3.0/string" which is more useful for the indexer in this case. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r--include/clang-c/Index.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index cc43b6a535..e8dcfdf035 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -425,6 +425,13 @@ CINDEX_LINKAGE const char *clang_getFileContents(CXTranslationUnit tu,
CINDEX_LINKAGE int clang_File_isEqual(CXFile file1, CXFile file2);
/**
+ * \brief Returns the real path name of \c file.
+ *
+ * An empty string may be returned. Use \c clang_getFileName() in that case.
+ */
+CINDEX_LINKAGE CXString clang_File_tryGetRealPathName(CXFile file);
+
+/**
* @}
*/