ioeric updated this revision to Diff 162166. ioeric added a comment. - Add comment
Repository: rC Clang https://reviews.llvm.org/D51159 Files: lib/Basic/FileManager.cpp Index: lib/Basic/FileManager.cpp =================================================================== --- lib/Basic/FileManager.cpp +++ lib/Basic/FileManager.cpp @@ -316,9 +316,16 @@ UFE.File = std::move(F); UFE.IsValid = true; - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) - UFE.RealPathName = RealPathName.str(); + if (UFE.File) { + if (auto Path = UFE.File->getName()) { + llvm::SmallString<128> AbsPath(*Path); + // This is not the same as `real_path()` system call, which also resolves + // symlinks. + makeAbsolutePath(AbsPath); + llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true); + UFE.RealPathName = AbsPath.str(); + } + } return &UFE; }
Index: lib/Basic/FileManager.cpp =================================================================== --- lib/Basic/FileManager.cpp +++ lib/Basic/FileManager.cpp @@ -316,9 +316,16 @@ UFE.File = std::move(F); UFE.IsValid = true; - SmallString<128> RealPathName; - if (!FS->getRealPath(InterndFileName, RealPathName)) - UFE.RealPathName = RealPathName.str(); + if (UFE.File) { + if (auto Path = UFE.File->getName()) { + llvm::SmallString<128> AbsPath(*Path); + // This is not the same as `real_path()` system call, which also resolves + // symlinks. + makeAbsolutePath(AbsPath); + llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true); + UFE.RealPathName = AbsPath.str(); + } + } return &UFE; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits