aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Basic/FileManager.cpp
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-08-24 09:53:44 +0000
committerEric Liu <ioeric@google.com>2018-08-24 09:53:44 +0000
commit8e44a8e7a0b1d4fd520be3f105cc27c013e1547d (patch)
tree69482021501e2e1d340abb6d8d11e3d0316791b2 /clang/lib/Basic/FileManager.cpp
parentfc89001cec9833b0058d57d17045b61aeb958b38 (diff)
downloadllvm-8e44a8e7a0b1d4fd520be3f105cc27c013e1547d.zip
llvm-8e44a8e7a0b1d4fd520be3f105cc27c013e1547d.tar.gz
llvm-8e44a8e7a0b1d4fd520be3f105cc27c013e1547d.tar.bz2
Fix build bot after r340598.
Revert to the original behavior: only calculate real file path when file is opened and avoid using InterndPath for real path calculation. llvm-svn: 340602
Diffstat (limited to 'clang/lib/Basic/FileManager.cpp')
-rw-r--r--clang/lib/Basic/FileManager.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 060d3a6..a45a8f2 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -316,14 +316,18 @@ const FileEntry *FileManager::getFile(StringRef Filename, bool openFile,
UFE.File = std::move(F);
UFE.IsValid = true;
- llvm::SmallString<128> AbsPath(InterndFileName);
- // This is not the same as `VFS::getRealPath()`, which resolves symlinks but
- // can be very expensive on real file systems.
- // FIXME: the semantic of RealPathName is unclear, and the name might be
- // misleading. We need to clean up the interface here.
- makeAbsolutePath(AbsPath);
- llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true);
- UFE.RealPathName = AbsPath.str();
+ if (UFE.File) {
+ if (auto PathName = UFE.File->getName()) {
+ llvm::SmallString<128> AbsPath(*PathName);
+ // This is not the same as `VFS::getRealPath()`, which resolves symlinks
+ // but can be very expensive on real file systems.
+ // FIXME: the semantic of RealPathName is unclear, and the name might be
+ // misleading. We need to clean up the interface here.
+ makeAbsolutePath(AbsPath);
+ llvm::sys::path::remove_dots(AbsPath, /*remove_dot_dot=*/true);
+ UFE.RealPathName = AbsPath.str();
+ }
+ }
return &UFE;
}