[all-commits] [llvm/llvm-project] 5b064a: [clang][deps] Simplify by-module-name scan API (#1...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Thu Mar 5 10:27:09 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5b064a2c168c2f8a08e86c4540c0adb838db030a
      https://github.com/llvm/llvm-project/commit/5b064a2c168c2f8a08e86c4540c0adb838db030a
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M clang/include/clang/DependencyScanning/DependencyScannerImpl.h
    M clang/include/clang/DependencyScanning/DependencyScanningWorker.h
    M clang/include/clang/Tooling/DependencyScanningTool.h
    M clang/lib/DependencyScanning/DependencyScannerImpl.cpp
    M clang/lib/DependencyScanning/DependencyScanningWorker.cpp
    M clang/lib/Tooling/DependencyScanningTool.cpp
    M clang/tools/clang-scan-deps/ClangScanDeps.cpp

  Log Message:
  -----------
  [clang][deps] Simplify by-module-name scan API (#184376)

The by-module-name scanning APIs are fairly spread out. There's the main
`CompilerInstanceWithContext` class that provides a constructor,
`initialize()` and `computeDependencies()`. Then there's the
`DependencyScanningWorker` that optionally owns
`CompilerInstanceWithContext` and re-exposes two `initialize()` and one
`computeDependencies()` functions. Lastly, there's
`DependencyScanningTool` that again re-exposes two variants of
`initialize()` and one `computeDependencies()`.

The current setup makes it unnecessarily difficult to make changes to
these APIs (as observed in
https://github.com/swiftlang/llvm-project/pull/12453).

This PR makes `CompilerInstanceWithContext` standalone, and hides the
construct + initialize pattern behind a static factory function. This
makes it harder to misuse the API (forgetting to call `initialize()`,
calling it twice, etc.) and means changes now need to only touch single
class instead of three classes spread over multiple files.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list