[PATCH] D51641: [VFS] Cache the current working directory for the real FS.

Pavel Labath via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 20 12:36:56 PST 2018

labath added subscribers: JDevlieghere, labath.
labath added a comment.

Might I ask what was the motivation for this change? Performance optimalization?

I am asking this because this makes the RealFileSystem return bogus values for the CWD if it changes through means other than the VFS::setCurrentWorkingDirectory (which is something that, as a library, we can never rule out). We ran into problems with this in lldb where our tests use lldb as a library, and they are driven by a python scripts (which does some CWD changing as a part of test discovery).

If I understand the long scary comment in the `setCurrentWorkingDirectory` function correctly, the RealFileSystem wants to be independent of the OS notion of CWD. However, right now it's not doing either job very well (sharing the CWD with the OS nor being independent of it), because all other RFS functions will use the real OS CWD (as it is at the moment of the call), only `getCurrentWorkingDirectory` will return whatever was the last CWD set through the appropriate setter.

  rC Clang



More information about the cfe-commits mailing list