Index: include/clang-c/Index.h =================================================================== --- include/clang-c/Index.h +++ include/clang-c/Index.h @@ -32,7 +32,7 @@ * compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable. */ #define CINDEX_VERSION_MAJOR 0 -#define CINDEX_VERSION_MINOR 47 +#define CINDEX_VERSION_MINOR 48 #define CINDEX_VERSION_ENCODE(major, minor) ( \ ((major) * 10000) \ @@ -424,6 +424,13 @@ */ 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); + /** * @} */ Index: tools/libclang/CIndex.cpp =================================================================== --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -4249,6 +4249,14 @@ return FEnt1->getUniqueID() == FEnt2->getUniqueID(); } +CXString clang_File_tryGetRealPathName(CXFile SFile) { + if (!SFile) + return cxstring::createNull(); + + FileEntry *FEnt = static_cast(SFile); + return cxstring::createRef(FEnt->tryGetRealPathName()); +} + //===----------------------------------------------------------------------===// // CXCursor Operations. //===----------------------------------------------------------------------===// Index: tools/libclang/libclang.exports =================================================================== --- tools/libclang/libclang.exports +++ tools/libclang/libclang.exports @@ -46,6 +46,7 @@ clang_Cursor_getModule clang_Cursor_getStorageClass clang_File_isEqual +clang_File_tryGetRealPathName clang_Module_getASTFile clang_Module_getParent clang_Module_getName