Commit Graph

13 Commits

Author SHA1 Message Date
Artem Chikin
709676c20c [Dependency Scanning] Make GlobalModuleDependenciesCache aware of the current scanning action's target triple
And only resolve cached dependencies that came from scanning actions with the same target triple.

This change means that the `GlobalModuleDependenciesCache` must be configured with a specific target triple for every scannig action, and it will only resolve previously-found dependencies from previous scannig actions using the exact same triple.

Furthermore, the `GlobalModuleDependenciesCache` separately tracks source-file-based module dependencies as those represent main Swift modules of previous scanning actions, and we must be able to resolve those regardless of the target triple.

Resolves rdar://83105455
2021-09-20 11:21:16 -07:00
Xi Ge
e12148ae13 libSwiftScanner: add an API to invoke compiler in process 2021-07-13 14:56:19 -07:00
Artem Chikin
7e2c8e97fc [Dependency Scanning] Add ability for -scan-dependencies action to serialize and deserialize dependency scanner cache from a .moddepcache file.
Using the serialization format added in https://github.com/apple/swift/pull/37585.

- Add load/save code for the `-scan-dependencies` code-path.
- Add `libSwiftDriver` entry-points to load/store the cache of a given scanner instance.
2021-06-01 14:45:50 -07:00
Artem Chikin
0e6f6a54d4 Remove spurious comment 2021-02-10 10:55:02 -08: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
cc400bf759 [Dependency Scanning] Ensure INITIALIZE_LLVM() is invoked on scanner creation to populate LLVM's target data store. 2021-01-07 09:08:21 -08:00
Artem Chikin
fd031589a0 [Dependency Scanning] Remove the C string getter in favour of client-side string construction
(Using string length provided by the type)
2021-01-07 09:08:21 -08:00
Artem Chikin
58e5402807 [Dependency Scanning] Use size_t for array sizes and re-arrange array struct type fields to be consistent. 2021-01-07 09:08:21 -08:00
Artem Chikin
d621e22ffe [Dependency Scanning] Use DEFINE_SIMPLE_CONVERSION_FUNCTIONS macro instead of defining own wrap/unwrap functions for the opaque scanner type. 2021-01-07 09:08:21 -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
f91c8a8574 [Dependency Scanning] Refactor string implementation to always malloc and tie lifetime to owning object. 2021-01-07 09:08:21 -08:00
Artem Chikin
53e53db6c0 [Dependency Scanning] Factor the shared library libSwiftScan into tools and add exports file.
This library now relires on a static compiler library called `swiftDependencyScan`, which is also common to being used by `swift-frontend` for its dependency scanner invocations.
2021-01-07 09:08:20 -08:00