simark added inline comments.

================
Comment at: lib/Basic/FileManager.cpp:395
+  SmallString<128> RealPathName;
+  if (!FS->getRealPath(InterndFileName, RealPathName))
+    UFE->RealPathName = RealPathName.str();
----------------
ioeric wrote:
> It seems that at this point, we have failed to find `FileName` in vfs (with 
> `getStatValue` above), so `getRealPath` would also fail? 
> 
> In general, the virtual file here can be an actual *virtual* file that 
> doesn't exist anywhere, and I think there are users who use this to map 
> virtual file (possibly with relative paths) into file manager (while they 
> should really use overlay vfs!).
> It seems that at this point, we have failed to find FileName in vfs (with 
> getStatValue above), so getRealPath would also fail?

From what I understood, this code will be executed if the file actually exists 
but it's the first time we access it (we won't take the return at line 373).  
If we take the return at line 373, then some previous invocation of getFile or 
getVirtualFile has created the file, and that invocation would have been 
responsible for computing the real path.

> In general, the virtual file here can be an actual *virtual* file that 
> doesn't exist anywhere, and I think there are users who use this to map 
> virtual file (possibly with relative paths) into file manager (while they 
> should really use overlay vfs!).

My thinking was that the worst that could happen is that `getRealPath` fails in 
that case.


Repository:
  rC Clang

https://reviews.llvm.org/D49197



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to