[PATCH] D51159: [FileManager] Do not call 'real_path' in getFile().
Eric Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 23 06:23:32 PDT 2018
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51159.162166.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180823/9025edd2/attachment-0001.bin>
More information about the cfe-commits
mailing list