[PATCH] D36265: Support lib changes to allow VFS implementation handling working dir locally.

Ilya Biryukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 05:08:10 PDT 2017


ilya-biryukov added subscribers: chapuni, klimek.
ilya-biryukov added a comment.

Hi, @chapuni,

@klimek  told me you could probably help with Windows-specific questions.

We're working on making clang's `vfs::RealFileSystem` more thread-friendly. Current implementation uses process-global working directory, we want to get rid of that. (`vfs::FileSystem` has `setCurrentWorkingDirectory` and must do all relative paths lookups according to its value).
To do that, we want to store file descriptor of working directory in `vfs::RealFileSystem` and do all lookups relatively to that. On Unix we achieve that by calling `openat` and their equivalents.
This review contains a prototype of the changes we need to Support library to make it work on Unix. The question is how to do it properly on Windows.

After doing some research, it seems that we should use `NtCreateFile` and pass proper `ObjectAttributes.RootDirectory` (e.g. see this stackoverflow question <https://stackoverflow.com/questions/32138524/is-there-a-windows-equivalent-of-openat>).
But AFAIU, this means we'll have to rewrite the Windows version `Path.inc` to use `Nt`-functions everywhere.
What are your thoughts on that? Is it ok to rewrite `Path.inc` to use `Nt` functions? Are there any alternative implementations/APIs that would work for us?


https://reviews.llvm.org/D36265





More information about the llvm-commits mailing list