[clang][deps] Don't prune search paths used by dependencies
authorJan Svoboda <jan_svoboda@apple.com>
Wed, 16 Mar 2022 10:45:46 +0000 (11:45 +0100)
committerJan Svoboda <jan_svoboda@apple.com>
Wed, 16 Mar 2022 11:17:53 +0000 (12:17 +0100)
commitd73daa9135463ad4d4a08a9f0a75e109f921ad54
tree85e14027348ee9fe9e0a9cbb49ea39b4b031811c
parent6007b0b67bcb7c446f012357e34d5cd3b6c58d88
[clang][deps] Don't prune search paths used by dependencies

When pruning header search paths (to reduce the number of modules we need to build explicitly), we can't prune the search paths used in (transitive) dependencies of a module. Otherwise, we could end up with either of the following dependency graphs:

```
X:<hash1> -> Y:<hash2>
X:<hash1> -> Y:<hash3>
```

depending on the search paths of the translation unit we discovered `X` and `Y` from.

This patch fixes that.

Depends on D121295.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121303
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
clang/test/ClangScanDeps/header-search-pruning-transitive.c [new file with mode: 0644]