This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps][lex] Avoid canonicalization of remapped framework directories
ClosedPublic

Authored by jansvoboda11 on Oct 12 2022, 6:38 PM.

Details

Summary

In D134923, the scanner introduced canonicalization of framework directories when reporting module map paths in order to increase module sharing. However, if we canonicalize framework directory that plays a role in a VFS remapping, and later try to use that module map to build the module, header lookup can fail. This happens when the module headers are remapped using the original framework path.

This patch fixes that. The implementation relies on the fact that the chain of directories in VFS remapping are assigned DirectoryEntry objects distinct from their on-disk counterparts. If we detect that case, we avoid the canonicalization.

Diff Detail

Event Timeline

jansvoboda11 created this revision.Oct 12 2022, 6:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 6:38 PM
Herald added a subscriber: ributzka. · View Herald Transcript
jansvoboda11 requested review of this revision.Oct 12 2022, 6:38 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 12 2022, 6:38 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
benlangmuir accepted this revision.Dec 1 2022, 4:19 PM

Please add a comment about why this equality check is necessary.

clang/lib/Lex/ModuleMap.cpp
1307

Wouldn't this indicate the particular VFS has a bug?

This revision is now accepted and ready to land.Dec 1 2022, 4:19 PM
benlangmuir added inline comments.Dec 1 2022, 4:22 PM
clang/lib/Lex/ModuleMap.cpp
1307

^ Sorry this question was an old draft, you can disregard.

This revision was landed with ongoing or failed builds.Dec 1 2022, 7:59 PM
This revision was automatically updated to reflect the committed changes.