[all-commits] [llvm/llvm-project] 41115e: [clang][deps] NFC: Check the correct context hashe...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Mon Jun 14 05:05:08 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 41115efca642981c2165cdf9ef2b2148605faa12
      https://github.com/llvm/llvm-project/commit/41115efca642981c2165cdf9ef2b2148605faa12
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/test/ClangScanDeps/modules-full.cpp
    M clang/test/ClangScanDeps/modules-inferred.m

  Log Message:
  -----------
  [clang][deps] NFC: Check the correct context hashes in tests

The `clang-scan-deps` tests for the full output format were written under the assumption that most TUs/modules have the same context hash. This is no longer true, since we're changing the original compilation options. This patch updates the tests, which no longer conflate multiple context hashes into a single FileCheck variable.


  Commit: 80c0c639687ef52f5c432ea059ff9cb53125d08e
      https://github.com/llvm/llvm-project/commit/80c0c639687ef52f5c432ea059ff9cb53125d08e
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-06-14 (Mon, 14 Jun 2021)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
    A clang/test/ClangScanDeps/Inputs/preserved-args/cdb.json.template
    A clang/test/ClangScanDeps/Inputs/preserved-args/mod.h
    A clang/test/ClangScanDeps/Inputs/preserved-args/module.modulemap
    A clang/test/ClangScanDeps/Inputs/preserved-args/tu.c
    A clang/test/ClangScanDeps/preserved-args.c

  Log Message:
  -----------
  [clang][deps] Prevent unintended modifications of the original TU command-line

One of the goals of the dependency scanner is to generate command-lines that can be used to explicitly build modular dependencies of a translation unit. The only modifications to these command-lines should be for the purposes of explicit modular build.

However, the current version of dependency scanner leaks its implementation details into the command-lines.

The first problem is that the `clang-scan-deps` tool adjusts the original textual command-line (adding `-Eonly -M -MT <target> -sys-header-deps -Wno-error -o /dev/null `, removing `--serialize-diagnostics`) in order to set up the `DependencyScanning` library. This has been addressed in D103461, D104012, D104030, D104031, D104033. With these patches, the `DependencyScanning` library receives the unmodified `CompilerInvocation`, sets it up and uses it for the implicit modular build.

Finally, to prevent leaking the implementation details to the resulting command-lines, this patch generates them from the **original** unmodified `CompilerInvocation` rather than from the one that drives the implicit build.

Reviewed By: dexonsmith

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


Compare: https://github.com/llvm/llvm-project/compare/11e2922bb7ad...80c0c639687e


More information about the All-commits mailing list