10 Commits

Author SHA1 Message Date
Cyndy Ishida
15c3793cdf
[clang][scan-deps] Report a scanned TU's visible modules (#147969)
Clients of the dependency scanning service may need to add dependencies
based on the visibility of importing modules, for example, when
determining whether a Swift overlay dependency should be brought in
based on whether there's a corresponding **visible** clang module for
it.
This patch introduces a new field `VisibleModules` that contains all the
visible top-level modules in a given TU.
Because visibility is determined by which headers or (sub)modules were
imported, and not top-level module dependencies, the scanner now
performs a separate DFS starting from what was directly imported for
this computation.

In my local performance testing, there was no observable performance
impact.

resolves: rdar://151416358

---------

Co-authored-by: Jan Svoboda <jan@svoboda.ai>
2025-07-11 09:33:55 -07:00
Qinkun Bao
43d042b350
Revert "[clang][scan-deps] Add option to disable caching stat failures" (#145528)
Reverts llvm/llvm-project#144000

First buildbot failure:
https://lab.llvm.org/buildbot/#/builders/164/builds/11064
2025-06-24 11:12:05 -04:00
Michael Spencer
6110dead89
[clang][scan-deps] Add option to disable caching stat failures (#144000)
While the source code isn't supposed to change during a build, in some
environments it does. This adds an option that disables caching of stat
failures, meaning that source files can be added to the build during
scanning.

This adds a `-no-cache-negative-stats` option to clang-scan-deps to
enable this behavior. There are no tests for clang-scan-deps as there's
no reliable way to do so from it. A unit test has been added that
modifies the filesystem between scans to test it.
2025-06-20 13:28:05 -07:00
Steven Wu
7a52b93837
[DependencyScanning] Add ability to scan TU with a buffer input (#125111)
Update Dependency scanner so it can scan the dependency of a TU with
a provided buffer rather than relying on the on disk file system to
provide the input file.
2025-02-04 16:37:29 -08:00
Jan Svoboda
6a4eaf9b33
[clang][deps] Add -o flag to specify output path (#88767)
This makes it possible to pass "-o /dev/null" to `clang-scan-deps` and
skip some potentially expensive work, making timings less noisy. Also
removes the need for stream redirection.
2024-04-16 19:49:07 -07:00
Michael Spencer
fb07d9cc09
[clang][DepScan] Make OptimizeArgs a bit mask enum and enable by default (#71588)
Make it easier to control which optimizations are enabled by making
OptimizeArgs a bit masked enum. There's currently only one such
optimization, but more will be added in followup commits.
2023-11-07 16:06:59 -08:00
Jan Svoboda
e766e3afed [clang][deps] Print timing information
This patch adds new `-print-timing` option to `clang-scan-deps`. It measures the wall and process time taken to scan dependencies for the compilation database. This provides more representative data compared to measuring the timing for the whole tool invocation, since that includes parsing and generating JSON files, which can be significant for larger inputs.

Reviewed By: akyrtzi

Differential Revision: https://reviews.llvm.org/D147815
2023-04-20 11:18:32 -07:00
Alex Brachet
384fca554a Reland "[clang-scan-deps] Migrate to OptTable"
Differential Revision: https://reviews.llvm.org/D139949
2023-04-14 19:16:10 +00:00
Alex Brachet
521554a7ee Revert "[clang-scan-deps] Migrate to OptTable"
This reverts commit 0c60ec699fc1ccca2e444ceb041cad9b1dca3a64.
2023-01-13 18:17:46 +00:00
Alex Brachet
0c60ec699f [clang-scan-deps] Migrate to OptTable
Differential Revision: https://reviews.llvm.org/D139949
2023-01-13 18:11:29 +00:00