[all-commits] [llvm/llvm-project] 146ec7: [clang][deps] NFC: Stop going through ClangTool

Jan Svoboda via All-commits all-commits at lists.llvm.org
Fri Sep 10 02:02:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 146ec74a8382dc820809d0a2bf4b918d0b5e6603
      https://github.com/llvm/llvm-project/commit/146ec74a8382dc820809d0a2bf4b918d0b5e6603
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2021-09-10 (Fri, 10 Sep 2021)

  Changed paths:
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

  Log Message:
  -----------
  [clang][deps] NFC: Stop going through ClangTool

The dependency scanner currently uses `ClangTool` to invoke the dependency scanning action.

However, `ClangTool` seems to be the wrong level of abstraction. It's intended to be run over a collection of compile commands, which we actively avoid via `SingleCommandCompilationDatabase`. It automatically injects `-fsyntax-only` and other flags, which we avoid by calling `clearArgumentsAdjusters()`. It deduces the resource directory based on the current executable path, which we'd like to change to deducing from `argv[0]`.

Internally, `ClangTool` uses `ToolInvocation` which seems to be more in line with what the dependency scanner tries to achieve. This patch switches to directly using `ToolInvocation` instead. NFC.

Reviewed By: dexonsmith

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




More information about the All-commits mailing list