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
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 @@
   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;
 }