[all-commits] [llvm/llvm-project] 060f3f: [clang][deps] Make dependency directives getter th...

Jan Svoboda via All-commits all-commits at lists.llvm.org
Wed Apr 23 10:33:33 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 060f3f0dd1614b624b527e871019970e4303de11
      https://github.com/llvm/llvm-project/commit/060f3f0dd1614b624b527e871019970e4303de11
  Author: Jan Svoboda <jan_svoboda at apple.com>
  Date:   2025-04-23 (Wed, 23 Apr 2025)

  Changed paths:
    M clang/include/clang/Frontend/CompilerInstance.h
    M clang/include/clang/Lex/DependencyDirectivesScanner.h
    M clang/include/clang/Lex/Preprocessor.h
    M clang/include/clang/Lex/PreprocessorOptions.h
    M clang/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h
    M clang/lib/Frontend/CompilerInstance.cpp
    M clang/lib/Lex/PPLexerChange.cpp
    M clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp
    M clang/unittests/Lex/PPDependencyDirectivesTest.cpp

  Log Message:
  -----------
  [clang][deps] Make dependency directives getter thread-safe (#136178)

This PR fixes two issues in one go:
1. The dependency directives getter (a `std::function`) was being stored
in `PreprocessorOptions`. This goes against the principle where the
options classes are supposed to be value-objects representing the `-cc1`
command line arguments. This is fixed by moving the getter directly to
`CompilerInstance` and propagating it explicitly.
2. The getter was capturing the `ScanInstance` VFS. That's fine in
synchronous implicit module builds where the same VFS instance is used
throughout, but breaks down once you try to build modules asynchronously
(which forces the use of separate VFS instances). This is fixed by
explicitly passing a `FileManager` into the getter and extracting the
right instance of the scanning VFS out of it.



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