r340602 - Fix build bot after r340598.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 24 02:53:44 PDT 2018


Author: ioeric
Date: Fri Aug 24 02:53:44 2018
New Revision: 340602

URL: http://llvm.org/viewvc/llvm-project?rev=340602&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Basic/FileManager.cpp

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=340602&r1=340601&r2=340602&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Fri Aug 24 02:53:44 2018
@@ -316,14 +316,18 @@ const FileEntry *FileManager::getFile(St
   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;
 }
 




More information about the cfe-commits mailing list