[all-commits] [llvm/llvm-project] 056264: [clang][deps] Implement efficient in-process `Modu...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Tue Mar 18 14:01:25 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 056264b838df94b689d3213424d78f8b9452041b
      https://github.com/llvm/llvm-project/commit/056264b838df94b689d3213424d78f8b9452041b
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-03-18 (Tue, 18 Mar 2025)

  Changed paths:
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h
    A clang/include/clang/Tooling/DependencyScanning/InProcessModuleCache.h
    M clang/lib/Tooling/DependencyScanning/CMakeLists.txt
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    A clang/lib/Tooling/DependencyScanning/InProcessModuleCache.cpp

  Log Message:
  -----------
  [clang][deps] Implement efficient in-process `ModuleCache` (#129751)

The dependency scanner uses implicitly-built Clang modules under the
hood. This system was originally designed to handle multiple concurrent
processes working on the same module cache, and mutual exclusion was
implemented using file locks. The scanner, however, runs within single
process, making file locks unnecessary. This patch virtualizes the
interface for module cache locking and provides an implementation based
on `std::shared_mutex`. This reduces `clang-scan-deps` runtime by ~17%
on my benchmark.

Note that even when multiple processes run a scan on the same module
cache (and therefore don't coordinate efficiently), this should still be
correct due to the strict context hash, the write-through
`InMemoryModuleCache` and the logic for rebuilding out-of-date or
incompatible modules.



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