[PATCH] D94844: [VFS] Add support to RedirectingFileSystem for mapping a virtual directory to one in the external FS.
Nathan Hawes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 15 16:17:39 PST 2021
nathawes created this revision.
nathawes added a reviewer: JDevlieghere.
Herald added subscribers: dexonsmith, hiraditya.
nathawes requested review of this revision.
Herald added projects: clang, LLVM.
Herald added subscribers: llvm-commits, cfe-commits.
Previously file entries in the -ivfsoverlay yaml could map to a file in the external file system (specified via the 'external-contents' property, taking a path), but directories had to list their contents in the form of other file or directory entries (via the 'contents' property, taking an array). Allowing directory entries to map to a directory in the external file system (via the same 'external-contents' property as file entries) makes it possible to present an external directory's contents in a different location and, in combination with the 'fallthrough' option, overlay one directory's contents on top of another.
As an example, with the yaml below:
{ 'roots': [
{
'type': 'directory',
'name': '//root/',
'contents': [
{
'type': 'directory',
'name': 'mappeddir',
'external-contents': '//root/foo/bar'
}
]
}
]}
The path '//root/mappeddir/somefile' would map to '//root/foo/bar/somefile' in the external file system. If that file wasn't found in the external file system and the 'fallthrough' configuration option is true, it would fall back to checking for '//root/mappeddir/somefile' in the external file system. This effectively overlays the contents of //root/foo/bar/ on top of //root/mappeddir.
This patch also refactors OverlayFileSystem's directory iterator implementation (OverlayFSDirIterImpl) and VFSFromYamlDirIterImpl into a single implementation, addressing a FIXME about their conceptual similarity.
Resolves rdar://problem/72485443
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D94844
Files:
clang/test/VFS/Inputs/vfsoverlay-directory-relative.yaml
clang/test/VFS/Inputs/vfsoverlay-directory.yaml
clang/test/VFS/directory.c
llvm/include/llvm/Support/VirtualFileSystem.h
llvm/lib/Support/VirtualFileSystem.cpp
llvm/unittests/Support/VirtualFileSystemTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94844.317096.patch
Type: text/x-patch
Size: 51243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210116/bfa45acb/attachment-0001.bin>
More information about the cfe-commits
mailing list