This is an archive of the discontinued LLVM Phabricator instance.

[Clang][ScanDeps] Use the virtual path for module maps
ClosedPublic

Authored by Bigcheese on Nov 18 2021, 4:17 PM.

Details

Summary

This patch makes clang-scan-deps use the virtual path for module maps instead of the on disk path. This is needed so that modulemap relative lookups are done correctly in the actual module builds. The file dependencies still use the on disk path as that's what matters for build invalidation.

Diff Detail

Event Timeline

Bigcheese requested review of this revision.Nov 18 2021, 4:17 PM
Bigcheese created this revision.
jansvoboda11 accepted this revision.Nov 19 2021, 6:07 AM

LGTM provided the Windows crash gets resolved.

This revision is now accepted and ready to land.Nov 19 2021, 6:07 AM

There were two issues for Windows.

The first is an actual bug in the Clang VFS that should be fixed separately. You cannot pass just main.m as the input to Clang. Clang asks for its parent directory textually, which is .. It then tries to stat ., which the VFS rejects. Not sure why it's OK on non-Windows.

The other issue is not handling path separators in the FileCheck test. Fixed by adding sed 's:\\\\\?:/:g'.

I'm uploading a new patch and will commit on clean precommit tests.

Bigcheese updated this revision to Diff 391166.Dec 1 2021, 4:53 PM
This revision was landed with ongoing or failed builds.Dec 14 2021, 10:21 AM
This revision was automatically updated to reflect the committed changes.
rsmith added a subscriber: rsmith.Dec 14 2021, 5:17 PM
rsmith added inline comments.
clang/test/ClangScanDeps/modulemap-via-vfs.m
6–7

There seems to be a problem with this test: it's writing a module cache to the current working directory instead of writing it into somewhere under %t. Presumably this just requires adding a module cache path parameter?

lenary added a subscriber: lenary.Jan 4 2022, 11:07 AM
lenary added inline comments.
clang/test/ClangScanDeps/modulemap-via-vfs.m
6–7

I think the easiest fix is to change the command string in the json below, to update the passed -fmodules-cache-path. I'm working on a patch right now.

lenary added a comment.Jan 5 2022, 4:01 AM

@Bigcheese have you got a fix for the vfs issue with . and ..?

Looking closely at your comment, I'm surprised you landed this without an llvm-lit xfail for windows, given your comment above.

lenary reopened this revision.Jan 5 2022, 4:18 AM

Update: I'm going to revert this on main. This patch was accepted conditionally on you fixing the windows crash, which you have not done, so this was landed without being accepted.

Revert is here: https://reviews.llvm.org/rGea835171389a

When you re-land this, don't forget to include the changes from D116611, please.

This revision is now accepted and ready to land.Jan 5 2022, 4:18 AM
lenary requested changes to this revision.Jan 5 2022, 4:18 AM
This revision now requires changes to proceed.Jan 5 2022, 4:18 AM

Update: I'm going to revert this on main. This patch was accepted conditionally on you fixing the windows crash, which you have not done, so this was landed without being accepted.

Revert is here: https://reviews.llvm.org/rGea835171389a

When you re-land this, don't forget to include the changes from D116611, please.

There is no crash on Windows with this patch. The issue is if you pass main.m instead of DIR/main.m. The commit that landed had both fixes I mentioned. Did you try this on Windows or look at the bots? In the future please be more careful.

lenary added a comment.Jan 5 2022, 4:48 AM

Update: I'm going to revert this on main. This patch was accepted conditionally on you fixing the windows crash, which you have not done, so this was landed without being accepted.

Revert is here: https://reviews.llvm.org/rGea835171389a

When you re-land this, don't forget to include the changes from D116611, please.

There is no crash on Windows with this patch. The issue is if you pass main.m instead of DIR/main.m. The commit that landed had both fixes I mentioned. Did you try this on Windows or look at the bots? In the future please be more careful.

I did try this on windows, and I'm still seeing a crash about traversal segments, I'll continue investigating that crash.

lenary accepted this revision.Jan 6 2022, 9:56 AM

@Bigcheese I am sorry - after a lot of further investigation, it was due to an odd interaction with some downstream changes. I will re-land your changes, with correct attribution to you.

This revision is now accepted and ready to land.Jan 6 2022, 9:56 AM