[Dependency Scanning] Specify dependency inputs of Swift module dependencies on the command line

Do this by computing a transitive closure on the computed dependency graph, relying on the fact that it is a DAG.
The used algorithm is:
```
for each v ∈ V {
    T(v) = { v }
}
for v ∈ V in reverse topological order {
    for each (v, w) ∈ E {
         T(v) = T(v) ∪ T(w)
    }
}
```
This commit is contained in:
Artem Chikin
2023-02-03 16:49:00 -08:00
parent c1599fede4
commit c989823775
7 changed files with 305 additions and 70 deletions

View File

@@ -656,19 +656,6 @@ struct llvm::DenseMapInfo<ModuleIdentifierArrayKind> {
}
};
namespace std {
template <>
struct hash<ModuleDependencyID> {
using UnderlyingKindType = std::underlying_type<ModuleDependencyKind>::type;
std::size_t operator()(const ModuleDependencyID &id) const {
auto underlyingKindValue = static_cast<UnderlyingKindType>(id.second);
return (hash<string>()(id.first) ^
(hash<UnderlyingKindType>()(underlyingKindValue)));
}
};
} // namespace std
namespace swift {
class ModuleDependenciesCacheSerializer {