This is an archive of the discontinued LLVM Phabricator instance.

[clang] support relative roots to vfs overlays
ClosedPublic

Authored by rmaz on Dec 22 2021, 9:39 AM.

Details

Summary

This diff adds support for relative roots to VFS overlays. The directory root
will be made absolute from the current working directory and will be used to
determine the path style to use. This supports the use of VFS overlays with
remote build systems that might use a different working directory for each
compilation.

Diff Detail

Event Timeline

rmaz created this revision.Dec 22 2021, 9:39 AM
rmaz requested review of this revision.Dec 22 2021, 9:39 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 22 2021, 9:39 AM
rmaz edited the summary of this revision. (Show Details)Dec 22 2021, 9:47 AM
rmaz edited the summary of this revision. (Show Details)Dec 22 2021, 10:01 AM
rmaz updated this revision to Diff 395896.Dec 22 2021, 10:04 AM

clang-format changes

This LGTM but I'm interested to hear from folks with more knowledge about the VFS' desired behavior to comment on if this will have any unexpected side effects

This LGTM but I'm interested to hear from folks with more knowledge about the VFS' desired behavior to comment on if this will have any unexpected side effects

I haven't reviewed the patch, but looking at the description I don't have concerns with this.

@benlangmuir or @vsapsai, any thoughts from you?

Each VFS may have its own working directory, so it could be surprising if we use the OS working directory instead of that. This is complicated by the fact the VFS working directory may not be set yet during parsing the yaml (I haven't checked). I'm not really sure what to recommend here. If we do change this, we should document the new behaviour in the doc comment for RedirectingFileSystem though.

rmaz added a comment.Jan 14 2022, 7:36 AM

Each VFS may have its own working directory, so it could be surprising if we use the OS working directory instead of that. This is complicated by the fact the VFS working directory may not be set yet during parsing the yaml (I haven't checked). I'm not really sure what to recommend here. If we do change this, we should document the new behaviour in the doc comment for RedirectingFileSystem though.

I don't believe the working directory will be set on the VFS at this point, no. If you're happy with the change then i'll update the header docs to describe this behaviour, unless there is another way to achieve using relative paths for root entries in the overlay yaml?

rmaz updated this revision to Diff 400008.Jan 14 2022, 7:55 AM

Add comment to describe relative root path behaviour

benlangmuir accepted this revision.Jan 14 2022, 9:54 AM
This revision is now accepted and ready to land.Jan 14 2022, 9:54 AM

Make sure the test failure gets fixed, but otherwise LGTM.

x64 debian > LLVM-Unit.Support/_/SupportTests::VFSFromYAMLTest.RelativePaths

rmaz updated this revision to Diff 400102.Jan 14 2022, 12:06 PM

Update VirtualFileSystemTest to validate relative root paths.

rmaz updated this revision to Diff 400894.Jan 18 2022, 9:57 AM

Windows test fixes

rmaz updated this revision to Diff 400983.Jan 18 2022, 2:21 PM

Rebase on stable commit

This revision was automatically updated to reflect the committed changes.