Commit Graph

75 Commits

Author SHA1 Message Date
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
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
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
5f49c9f2f3 [Dependency Scanning] Fix modulemap module name for the _InternalSwiftScan module. 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
Artem Chikin
d017fd430b [Dependency Scanning] Add setters for the scanner invocation context and a creation method to return an isntance of the opaque invocation 2021-01-07 09:08:20 -08:00
Artem Chikin
ca1694442d [Dependency Scanning] Export opaque types as pointers to C structs instead of void* for better type-safety and cleaner code 2021-01-07 09:08:20 -08:00
Artem Chikin
108e9da448 [Dependency Scanning] Make scanner invocation context (argc, argv, working_dir) an opaque type 2021-01-07 09:08:20 -08:00
Artem Chikin
cff741b60f [Dependency Scanning] Make the prescan dependency scan result (import set) an opaque structure 2021-01-07 09:08:20 -08:00
Artem Chikin
c6705ad090 [Dependency Scanning] Make the batch scan entry container an opaque type 2021-01-07 09:08:20 -08:00
Artem Chikin
409de733f7 [Dependency Scanning] Make the overall dependency scan result (inter-module dependency graph) an opaque structure 2021-01-07 09:08:20 -08:00
Artem Chikin
5cacff4d84 [Dependency Scanning] Make a module's dependency info an opaque structure 2021-01-07 09:08:20 -08:00
Artem Chikin
fcf943370e [Dependency Scanning] Change C API prefix to: swiftscan from ds and adopt query method naming scheme of:
`<prefix>_<object>_<action>`
2021-01-07 09:08:20 -08:00
Artem Chikin
d0220e50ff [Dependency Scanning] Add entry-point to DependencyScanningTool and the corresponding C API for a batch scan operation 2021-01-07 09:08:20 -08:00
Artem Chikin
2ad960083a [Dependency Scanning] Use an opaque type for dependency module details with API query functions for individual fields 2021-01-07 09:08:20 -08:00
Artem Chikin
75b8a0ea44 [Dependency Scanning] Add entry-point to DependencyScanningTool and the corresponding C API for an import prescan operation 2021-01-07 09:08:20 -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
Xi Ge
a86f89da48 SwiftSyntax Parser: expose parser diagnostics via C API.
This allows SwiftSyntax to listen to emitted diagnostics during
parsing.

rdar://48439271
2019-03-01 15:22:21 -08:00
Xi Ge
e07a8cf2a6 SyntaxParser: set up a C API to get a hash value indicating the node declaration set
To ensure SwiftSyntax calls a compatible parser library, this patch sets
up a C API that returns a constant string calculated during compilation time to indicate
the version of syntax node declarations. The same hash will be calculated
in the SwiftSyntax (client) side as well by using the same algorithm.

During runtime, SwiftSyntax will verify its hash value is identical to the
result of calling swiftparse_node_declaration_hash before actual
parsing happens.

This patch only sets the API up. The actual implementation of the
hashing algorithm will come later.
2019-02-06 17:33:48 -08:00
Argyrios Kyrtzidis
aa97c4e327 [SwiftSyntaxParser] Clarify doc-comment about the order of the nodes that the parser provides 2019-01-10 16:50:46 -08:00
Argyrios Kyrtzidis
7d56a195e6 [SwiftSyntaxParser] Add doc-comments for swiftparse_parser_t 2019-01-10 16:36:32 -08:00
Argyrios Kyrtzidis
484479dde4 [SyntaxParser] Remove leftover type declaration and adjust the *_EXPORTS macro name
Also fixup some doc-comments.
2019-01-10 08:10:44 -08:00
Argyrios Kyrtzidis
1dc288fb23 Introduce C parser library
Add a shared library with a C API that provides access to the syntactic parser with callbacks for the inference of raw syntax nodes.
This is primarily intended to be used by SwiftSyntax to speed-up source code parsing for it.
2019-01-09 18:30:45 -08:00