[all-commits] [llvm/llvm-project] 83902c: Reapply "[clang][deps] Split translation units int...

Ben Langmuir via All-commits all-commits at lists.llvm.org
Wed Aug 31 09:45:48 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 83902c403611af3a52453867cb8848fb3fd6a39c
      https://github.com/llvm/llvm-project/commit/83902c403611af3a52453867cb8848fb3fd6a39c
  Author: Ben Langmuir <blangmuir at apple.com>
  Date:   2022-08-31 (Wed, 31 Aug 2022)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h
    M clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
    M clang/lib/Tooling/DependencyScanning/CMakeLists.txt
    M clang/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
    A clang/test/ClangScanDeps/deprecated-driver-api.c
    M clang/test/ClangScanDeps/diagnostics.c
    M clang/test/ClangScanDeps/header-search-pruning-transitive.c
    M clang/test/ClangScanDeps/modules-context-hash-ignore-macros.c
    M clang/test/ClangScanDeps/modules-context-hash-outputs.c
    M clang/test/ClangScanDeps/modules-context-hash-warnings.c
    M clang/test/ClangScanDeps/modules-context-hash.c
    M clang/test/ClangScanDeps/modules-dep-args.c
    M clang/test/ClangScanDeps/modules-fmodule-name-no-module-built.m
    M clang/test/ClangScanDeps/modules-full.cpp
    M clang/test/ClangScanDeps/modules-implicit-dot-private.m
    M clang/test/ClangScanDeps/modules-incomplete-umbrella.c
    M clang/test/ClangScanDeps/modules-inferred.m
    M clang/test/ClangScanDeps/modules-no-undeclared-includes.c
    M clang/test/ClangScanDeps/modules-pch-common-submodule.c
    M clang/test/ClangScanDeps/modules-pch-common-via-submodule.c
    M clang/test/ClangScanDeps/modules-pch.c
    A clang/test/ClangScanDeps/multiple-commands.c
    M clang/test/ClangScanDeps/removed-args.c
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp
    M clang/utils/module-deps-to-rsp.py

  Log Message:
  -----------
  Reapply "[clang][deps] Split translation units into individual -cc1 or other commands"

Attempt to fix the test failures observed in CI:
* Add Option dependency, which caused BUILD_SHARED_LIBS builds to fail
* Adapt tests that accidentally depended on the host platform: platforms
  that don't use an integrated assembler (e.g. AIX) get a different set
  of commands from the driver. Most dependency scanner tests can use
  -fsyntax-only or -E instead of -c to avoid this, and in the rare case
  we want to check -c specifically, set an explicit target so the
  behaviour is independent of the host.

Original commit message follows.

---

Instead of trying to "fix" the original driver invocation by appending
arguments to it, split it into multiple commands, and for each -cc1
command use a CompilerInvocation to give precise control over the
invocation.

This change should make it easier to (in the future) canonicalize the
command-line (e.g. to improve hits in something like ccache), apply
optimizations, or start supporting multi-arch builds, which would
require different modules for each arch.

In the long run it may make sense to treat the TU commands as a
dependency graph, each with their own dependencies on modules or earlier
TU commands, but for now they are simply a list that is executed in
order, and the dependencies are simply duplicated. Since we currently
only support single-arch builds, there is no parallelism available in
the execution.

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




More information about the All-commits mailing list