[all-commits] [llvm/llvm-project] 77924d: [clang][deps] Modules don't contribute to search p...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed Mar 16 04:18:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77924d60efa8b3a0278361fe77403a71576c9349
      https://github.com/llvm/llvm-project/commit/77924d60efa8b3a0278361fe77403a71576c9349
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-03-16 (Wed, 16 Mar 2022)

  Changed paths:
    M clang/include/clang/Lex/HeaderSearch.h
    M clang/lib/Lex/HeaderSearch.cpp
    M clang/test/Preprocessor/search-path-usage.m

  Log Message:
  -----------
  [clang][deps] Modules don't contribute to search path usage

To reduce the number of modules we build in explicit builds (which use strict context hash), we prune unused header search paths. This essentially merges parts of the dependency graph.

Determining whether a search path was used to discover a module (through implicit module maps) proved to be somewhat complicated. Initial support landed in D102923, while D113676 attempts to fix some bugs.

However, now that we don't use implicit module maps in explicit builds (since D120465), we don't need to consider such search paths as used anymore. Modules are no longer discovered through the header search mechanism, so we can drop such search paths (provided they are not needed for other reasons).

This patch removes whatever support for detecting such usage we had, since it's buggy and not required anymore.

Depends on D120465.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121295


  Commit: 6007b0b67bcb7c446f012357e34d5cd3b6c58d88
      https://github.com/llvm/llvm-project/commit/6007b0b67bcb7c446f012357e34d5cd3b6c58d88
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-03-16 (Wed, 16 Mar 2022)

  Changed paths:
    M clang/lib/Lex/HeaderSearch.cpp

  Log Message:
  -----------
  [clang][deps] NFC: Use range-based for loop instead of iterators

The iterator is not needed after the loop body anymore, meaning we can use more terse range-based for loop.

Depends on D121295.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121685


  Commit: d73daa9135463ad4d4a08a9f0a75e109f921ad54
      https://github.com/llvm/llvm-project/commit/d73daa9135463ad4d4a08a9f0a75e109f921ad54
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-03-16 (Wed, 16 Mar 2022)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
    A clang/test/ClangScanDeps/header-search-pruning-transitive.c

  Log Message:
  -----------
  [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


  Commit: 1e25ff84d89e94ec7af6352b02e2d74a5e273a85
      https://github.com/llvm/llvm-project/commit/1e25ff84d89e94ec7af6352b02e2d74a5e273a85
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2022-03-16 (Wed, 16 Mar 2022)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    A clang/test/ClangScanDeps/modules-pch-dangling.c

  Log Message:
  -----------
  [clang][deps] Fix traversal of precompiled dependencies

The code for traversing precompiled dependencies is somewhat complicated and contains a dangling iterator bug.

This patch simplifies the code and fixes the bug.

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D121533


Compare: https://github.com/llvm/llvm-project/compare/e3deb7d88b0c...1e25ff84d89e


More information about the All-commits mailing list