Commit Graph

29 Commits

Author SHA1 Message Date
Owen Voorhees
e6c9dceae9 Update OS versions requiring stdlib OS rpaths 2025-09-21 09:47:18 -07:00
Artem Chikin
50c0dd844f [Dependency Scanning] Refactor 'createScanQueryContext' to directly return an error 2025-09-12 15:50:40 -07:00
Artem Chikin
c82048559a [Dependency Scanning] Configure a thread-safe serialized diagnostics consumer for in-memory scans
This change introduces a thread-safe version of the 'SerializedDiagnosticConsumer' and refactors scanning compilation instance creation code to ensure this consumer gets added when the scanner query configuration command-line includes '-serialized-diagnostics-path' option.
2025-09-11 09:50:24 -07:00
Artem Chikin
1cd1193e6c [Dependency Scanning] Give each scanner worker a unique Diagnostic Engine
Otherwise, when multiple workers encounter a diagnostic simultaneously we can encounter races which lead to corrupted diagnostic data or crashes

Resolves rdar://159598539
2025-09-03 13:52:44 -07:00
Artem Chikin
a78ee29692 [Dependency Scanning] Remove obsolete placeholder module concept
This was used a long time ago for a design of a scanner which could rely on the client to specify that some modules *will be* present at a given location but are not yet during the scan. We have long ago determined that the scanner must have all modules available to it at the time of scan for soundness. This code has been stale for a couple of years and it is time to simplify things a bit by deleting it.
2025-06-12 08:32:25 -07:00
swift-ci
fffd12b39b Merge remote-tracking branch 'origin/main' into rebranch 2024-07-11 09:16:06 -07:00
Artem Chikin
a47bf3641a [Dependency Scanning] Construct a hollow output on query failure to carry diagnostic output 2024-07-10 12:46:54 -07:00
swift-ci
e54e333862 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-22 14:15:04 -07:00
Steven Wu
47598bbe8f [ScanDependency] Respect working directory set inside invocation
Teach scanner to respect the working directory set in the invocation
through scanner C API.

Also add test infrastructure to testing scanner from C API. Break up
DependencyScan lib into two so the swift-scan-test and remain small
without understanding swift AST.

rdar://127626011
2024-05-22 11:04:45 -07:00
Ben Barham
acd0efa67f Migrate to common OptTable macros
`OptTable` was a source of consistent churn due to new arguments to the
`OPTION` macro. LLVM 3f092f37b7362447cbb13f5502dae4bdd5762afd extracted
the handling of the common option parts (eg. an ID and an info) out into
separate macros to reduce this - use those here (since unsurprisingly,
more arguments were added).
2024-04-08 08:58:58 -07:00
Artem Chikin
d2a8e32bc5 [Dependency Scanning] Collect emitted diagnostics per-scan-query 2024-02-27 14:51:54 -08:00
Allan Shortlidge
35fd79af57 NFC: Import llvm/TargetParser/Host.h instead of llvm/Support/Host.h. 2024-01-16 13:27:54 -08:00
swift-ci
d86c449532 Merge remote-tracking branch 'origin/main' into rebranch 2023-09-25 09:36:22 -07:00
Artem Chikin
b4dfb6baa1 [Dependency Scanning] Implement parallel imported module resolution
'ModuleDependencyScanner' maintains a Thread Pool along with a pool of workers
which are capable of executing a filesystem lookup of a named module dependency.
When resolving imports of a given Swift module, each import's resolution
operation can be issued asunchronously.
2023-09-22 14:11:26 -07:00
Evan Wilde
3258fbc493 Fix strlen(StringRef) usage
strlen on a StringRef doesn't work. Replacing it.
2023-08-03 10:06:44 -07:00
Evan Wilde
41d59b215a Update Triple.h location
Triple moved from ADT to TargetParser. Updating includes to reflect
that.
2023-07-17 10:53:42 -07:00
Artem Chikin
60806ef64d [Dependency Scanning] Consider scanned module name a part of the scanning context (hash)
As well as a couple of additional frontend options that seem like they may impact scanning result.

Resolves rdar://108464467
2023-04-25 11:05:16 -07:00
Artem Chikin
1b4bc33e68 [libSwiftScan] Add V2 target info query API that takes compiler executable path as parameter
This new version takes the path to the compiler executable as a parameter, in order for libSwiftScan to compute compiler-relative portions of runtimeLibraryPaths, runtimeResourcePath. V1, without knowing the path to the compiler executable, produced incomplete sets of these paths.
2023-01-23 09:39:46 -08:00
Artem Chikin
a59db26a55 [Dependency Scanner] Rename 'GlobalModuleDependenciesCache' -> 'SwiftDependencyScanningService' 2022-12-19 11:08:50 -08:00
Artem Chikin
baec3154a0 [Dependency Scan] Remove redundant recombination of arguments in 'initCompilerInstanceForScan' into a string, before being re-parsed.
This does not seem to serve a purpose other than corrupting arguments with whitespaces - they get merged into one large string where the whitespace boundary between arguments and whitespaces within arguments are blurred.

Part of rdar://98985453
2022-08-22 16:12:58 -07:00
Artem Chikin
d24e15812b Build libSwiftStaticMirror as a standalone library with minimal required dependencies.
This separates it from `libSwiftScan` and allows us to build this library without building much of the rest of the compiler.

Also refactor `utils/build-parser-lib` into `utils/build-tooling-libs` which builds both SwiftSyntaxParser and SwiftStaticMirror.
2022-02-09 12:28:21 -08:00
Artem Chikin
40a1b321f5 Add libSwiftScan entry-point to query target info.
This provides the library with functionality to answer `-print-target-info` queries in place of calls to `swift-frontend`.
2021-11-12 11:01:45 -08:00
Saleem Abdulrasool
2c15beb98e unittests: add a more verbose error message
This test was failing for me locally due to a path configuration issue.
Add an indication which option is missing.
2021-04-05 09:48:00 -07:00
Artem Chikin
b3259eaac0 Make string_set_dispose method a part of public API.
It is not a distinct result returned by `swiftscan_compiler_supported_arguments_query` and `swiftscan_compiler_supported_features_query`, not owned by any other type, so it must be disposed of by the clients.
2021-02-10 10:54:05 -08:00
Artem Chikin
0bfff6beb6 Add libSwiftScan entry-points to query supported compiler flags and compiler features
For the client library (`libSwiftDriver`), this is critical for multiplexing library instances, and for compatibility with different versions of `libSwiftDrvier`.

Resolves rdar://73631930
2021-02-10 10:46:07 -08:00
Artem Chikin
4eae21c563 Change file generation in the DependencyScan.ModuleDeps unittest to hopefully work better on windows. 2021-01-07 16:53:23 -08:00
Artem Chikin
41a09a4092 [Dependency Scanning] Establish object ownership convention by using a Foundation-style ownership signals naming scheme across the API surface.
Foundation-style ownership signals documentation:
https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html#//apple_ref/doc/uid/20001148-CJBEJBHH
2021-01-07 09:08:21 -08:00
Artem Chikin
d1cc689c01 [Dependency Scanning] Fix the DependencyScan unit test harness to reflect C API changes. 2021-01-07 09:08:21 -08:00
Artem Chikin
75a8cfa048 [Dependency Scanning] Add a C API layer for dependency scanning tool, scanning actions, and scan results.
Adds a C API layer consisting of:
- Data structures used to represent in-memory result of dependency scanning
- Opaque dependency scanner tool (C wrapper for `DependencyScanningTool`)

Refactors `ScanDependencies.cpp` to produce dependency scanning result in the form of the above binary format.
2021-01-07 09:08:20 -08:00