[clang][deps] Make order of module dependencies deterministic
authorBen Langmuir <blangmuir@apple.com>
Tue, 7 Jun 2022 19:13:08 +0000 (12:13 -0700)
committerBen Langmuir <blangmuir@apple.com>
Wed, 8 Jun 2022 18:09:17 +0000 (11:09 -0700)
commit835fcf2aa5127bf99a1e6397c72153f00a0497b2
tree2264b03c28278ff6a3eb1fa174fcd08050498069
parent7a72dca74a27f1f6198cfabb064dc43274ee005d
[clang][deps] Make order of module dependencies deterministic

This fixes the underlying module dependencies, which had a
non-deterministic order, which was also visible in the order of calls to
DependencyConsumer methods. This was not directly observable in
the clang-scan-deps utility, because it was previously seeing a sorted
order from std::map in DependencyScanningTool. However, the underlying
API previously created a likely issue for any other clients. Note: if
you only apply the change from DependencyScanningTool, you can see the
issue in clang-scan-deps, and existing tests will fail
non-deterministicaly.

Differential Revision: https://reviews.llvm.org/D127243
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp