This is an archive of the discontinued LLVM Phabricator instance.

[clang][deps] Sort submodules when calculating dependencies
ClosedPublic

Authored by benlangmuir on Jun 16 2022, 2:36 PM.

Details

Summary

Dependency scanning does not care about the order of submodules for correctness, so sort the submodules so that we get the same command-lines to build the module across different TUs. Otherwise, the order of inferred submodules can vary depending on the order of #includes in the including TU.

Note: a true canonical order for Module::submodules would probably be to match the order of module decls within the modulemap file and sort the header files for any inferred modules, but that might be expensive to compute all the time (requires iterating a directory in the filesystem).

Diff Detail

Event Timeline

benlangmuir created this revision.Jun 16 2022, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 2:36 PM
benlangmuir requested review of this revision.Jun 16 2022, 2:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 2:37 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jansvoboda11 accepted this revision.Jun 17 2022, 2:27 AM

Interesting edge-case. LGTM.

This revision is now accepted and ready to land.Jun 17 2022, 2:27 AM
This revision was landed with ongoing or failed builds.Jun 17 2022, 8:10 AM
This revision was automatically updated to reflect the committed changes.