simark added a comment.

I found something fishy.  There is this code in FileManager.cpp:
  if (UFE.File)
    if (auto RealPathName = UFE.File->getName())
      UFE.RealPathName = *RealPathName;

The real path is obtained from `UFE.File->getName()`.  In the `RealFile` 
implementation, it returns the `RealName` field, which is fine.  For other 
implementations, it uses `File::getName`, which is:

  /// Get the name of the file
  virtual llvm::ErrorOr<std::string> getName() {
    if (auto Status = status())
      return Status->getName().str();
    else
      return Status.getError();
  }

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).


Repository:
  rC Clang

https://reviews.llvm.org/D48903



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

Reply via email to