[PATCH] D48903: [VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Simon Marchi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 9 09:58:39 PDT 2018


simark marked an inline comment as done.
simark added a comment.

In https://reviews.llvm.org/D48903#1155403, @ilya-biryukov wrote:

> In https://reviews.llvm.org/D48903#1154846, @simark wrote:
>
> > With the `InMemoryFileSystem`, this now returns a non-real path.  The result is that we fill `RealPathName` with that non-real path.  I see two options here:
> >
> > 1. Either the FileManager is wrong to assume that `File::getName` returns a real path, and should call `FS->getRealPath` to do the job.
> > 2. If the contract is that the ` File::getName` interface should return a real path, then we should fix the `File::getName` implementation to do that somehow.
> >
> >   I would opt for 1.  This way, we could compute the `RealPathName` field even if we don't open the file (unlike currently).
>
>
> I'd also say `FileManager` should use `FileSystem::getRealPath`. The code that does it differently was there before `FileSystem::getRealPath` was added.
>  And `RealFile` should probably not do any magic in `getName`, we could add a separate method for (`getRealName`?) if that's absolutely needed.


I made `FileManager::getFile` use `FileSystem::getRealPath` and see no regression in clang and clang-tools-extra.


Repository:
  rC Clang

https://reviews.llvm.org/D48903





More information about the cfe-commits mailing list