[PATCH] D128008: [clang][deps] Sort submodules when calculating dependencies

Ben Langmuir via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 16 14:37:01 PDT 2022


benlangmuir created this revision.
benlangmuir added reviewers: jansvoboda11, Bigcheese.
Herald added a project: All.
benlangmuir requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128008

Files:
  clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
  clang/test/ClangScanDeps/submodule-order.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128008.437703.patch
Type: text/x-patch
Size: 3342 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220616/299c26d8/attachment.bin>


More information about the cfe-commits mailing list