Commit r329515 recently added new test LibclangReparseTest.FileName. This test fails in an environment which has TMPDIR set to a symbolic link that points to an actual directory.
build$ ln -s /tmp mytmp build$ TMPDIR=$PWD/mytmp ./tools/clang/unittests/libclang/libclangTests [...] [----------] 5 tests from LibclangReparseTest [ RUN ] LibclangReparseTest.FileName .../tools/clang/unittests/libclang/LibclangTest.cpp:497: Failure Value of: strstr(clang_getCString(cxname), CppName.c_str()) Actual: false Expected: true [ FAILED ] LibclangReparseTest.FileName (10 ms) [...]
CppName is the original path in form $tmpdir/libclang-test-xxxxxx/main.cpp. Value cxname is obtained through clang_File_tryGetRealPathName() which gives the real path with the symlink resolved. The test fails because these two paths do not match.
The proposed patch addresses the problem by checking only that the value returned by clang_File_tryGetRealPathName() ends with "main.cpp".
Additionally, the patch makes the previous assertion in the test that checks result of clang_getFileName() stricter. It newly verifies that the name returned by the function is exactly same as what was given to clang_parseTranslationUnit()/clang_getFile().