Commit Graph

803 Commits

Author SHA1 Message Date
Hamish Knight
fce1cb54d5 [AST] Merge BridgedDiagnosticEngine + BridgedDiagEngine
Introduce a macro that can stamp out wrapper
classes for underlying C++ pointers, and use
it to define BridgedDiagnosticEngine in
ASTBridging. Then, migrate users of
BridgedDiagEngine onto it.
2023-10-30 23:49:55 +00:00
Hamish Knight
fe0ad60fe8 [ASTGen] Fix a couple of @_cdecl param types
These are `void *` on the C side.
2023-10-30 23:49:54 +00:00
Hamish Knight
356cf31d83 [ASTGen] Migrate onto some BasicBridging types
Migrate onto BridgedStringRef, and the
BasicBridging equivalents of BridgedSourceLoc
and BridgedArrayRef.
2023-10-30 23:49:53 +00:00
Hamish Knight
e5442fea50 [ASTGen] Enable C++ interop 2023-10-30 23:49:52 +00:00
Hamish Knight
d1fa767c84 Merge pull request #69326 from hamishknight/null-and-void 2023-10-23 23:54:50 +01:00
Hamish Knight
9da66906d5 [ASTGen] NFC: Fixup formatting 2023-10-23 18:41:10 +01:00
Hamish Knight
4a4a04888c [ASTGen] Introduce nullable variants of bridging wrappers
For nullable nodes, introduce both a non-null and
nullable variant of the bridging wrapper. This
allows us to annotate the necessary parameters
as nullable, but keep the returns of the bridged
`createParsed` methods non-null.
2023-10-23 18:00:13 +01:00
Hamish Knight
5d105f175d [ASTGen] NFC: Format with swift-format
This uses the same formatting configuration as
sourcekit-lsp.
2023-10-23 10:51:23 +01:00
Hamish Knight
11b8549442 Merge pull request #69229 from hamishknight/boxing-match
[ASTGen] Introduce wrapper types for AST nodes
2023-10-21 15:08:24 +01:00
Hamish Knight
3639d866cb Address review feedback 2023-10-20 22:57:14 +01:00
Hamish Knight
2ad64f1a40 [ASTGen] Use SWIFT_NAME in some more places 2023-10-20 22:57:13 +01:00
Hamish Knight
6d3c0c88a7 [ASTGen] Introduce wrapper types for AST nodes
Stamp out wrapper types for all the AST nodes,
and use them for ASTGen, with members being
imported on those types.
2023-10-20 22:57:12 +01:00
Harlan Haskins
4ac34a40ea @retroactive conformance syntax and checking (#36068) 2023-10-20 14:27:03 -07:00
Rintaro Ishizaki
bce5eeb78d [ASTGen] Null-terminate error messsages from ASTGen
Always null-terminate `BridgedString` by  `allocateBridgedString()`.
It had `nullTerminated: Bool` option, but allocating one extra byte
doesn't harm anything. Always null-terminate the string just for
client's convenience.

rdar://117205829
2023-10-19 13:29:57 -07:00
Rintaro Ishizaki
37a637447f Merge pull request #69027 from rintaro/macro-resolveerror-rdar115571427
[Macros] Improve macro plugin loading macro definition resolution diagnostics
2023-10-16 17:35:48 -07:00
Rintaro Ishizaki
444fcfabba [Macros] Tweak macro resolution error messages 2023-10-13 10:38:08 -07:00
Arnold Schwaighofer
0a5cb1e93f Merge pull request #69160 from aschwaighofer/wip_partial_sil_support_for_generic_throws
Preliminary SIL and IRGen support for error_indirect
2023-10-13 09:34:44 -07:00
Arnold Schwaighofer
9482b0c86b Preliminary SIL and IRGen support for error_indirect
IRGen lowering of non-fixed-sized typed errors and the SIL support necessary to
spell out IRGen test cases.
2023-10-12 18:09:52 -07:00
Rintaro Ishizaki
28aad9d126 [Macros] Return plugin loading error as result
Instead of emitting an warning to the diagnostic engine, return the
plugin loading error as the result of the request. So that the user
can decide to emit it as a warning or an error.
2023-10-12 16:08:54 -07:00
Rintaro Ishizaki
f8c7bd94f3 [ASTGen] Cleanup string bridging
* BridgedString for ASTGen -> C++ string returnings
* Null terminated C-strings for C++ -> ASTGen string arguments
* UnsafeMutableRawPointer for C++ -> ASTGen diagnostic engine arguments
2023-10-12 12:57:28 -07:00
Hamish Knight
042ccdda01 Merge pull request #68344 from hamishknight/do-it 2023-10-10 10:26:12 +01:00
Hamish Knight
2eb90c370a Merge pull request #68860 from ChiduAnush/changeRawSyntaxToBumpPtrAllocator 2023-10-09 20:50:42 +01:00
Hamish Knight
33f94bc874 Introduce do expressions 2023-10-06 11:17:48 +01:00
Rintaro Ishizaki
7ac5d65479 [ASTGen] Use standard headers
For whatever reason, using standard headers in modules imported from
Swift code (i.e. depending on Darwin overlay) is no longer an issue.

rdar://115438609
2023-10-04 15:12:17 -07:00
saehejkang
a4da2760be [ASTGen]: Make ASTGenVisitor not conform to SyntaxTransformVisitor 2023-10-03 22:28:23 -05:00
chidambaram
8b50a0d9c6 ASTGen: Expose BumpPtrAllocator as @_spi(BumpPtrAllocator) 2023-10-01 13:46:46 +05:30
Doug Gregor
e51faf20ab Adjust to typed-throws syntax node renames 2023-09-29 17:30:12 -07:00
Doug Gregor
1d976a3754 [Typed throws] Map the experimental feature flag over to the new parser's flag 2023-09-29 14:18:10 -07:00
Doug Gregor
ef642098f2 [Typed throws] Parsing and AST representation for typed errors
Parse typed throw specifiers as `throws(X)` in every place where there
are effects specified, and record the resulting thrown error type in
the AST except the type system. This includes:
* `FunctionTypeRepr`, for the parsed representation of types
* `AbstractFunctionDecl`, for various function-like declarations
* `ClosureExpr`, for closures
* `ArrowExpr`, for parsing of types within expression context

This also introduces some serialization logic for the thrown error
type of function-like declarations, along with an API to extract the
thrown interface type from one of those declarations, although right
now it will either be `Error` or empty.
2023-09-29 10:51:51 -07:00
Rintaro Ishizaki
8dbde04c61 Merge pull request #68408 from rintaro/fetch-content
[CMake] Replace early swift-syntax with FetchContent
2023-09-28 11:22:10 -07:00
Alex Hoppen
8dec9addfc [ASTGen] Relax assertion on BridgedSourceLoc initializer
We do allow `SourceLoc` to point to the address right after the buffer ends to point to the end of a file.
2023-09-26 15:46:54 -07:00
Alex Hoppen
bd3a7551f8 Merge pull request #68643 from saehejkang/bridged-source-loc-assert-pos
[ASTGen]: Assert that the position is within buffer bounds for BridgedSourceLoc
2023-09-25 21:25:29 -07:00
saehejkang
a3d59b360c [ASTGen]: fix force-unwrap for buffer.baseAddress 2023-09-22 21:25:55 -05:00
saehejkang
2aac5d90c4 [ASTGen]: force unwrap buffer 2023-09-22 20:31:22 -05:00
saehejkang
4b4f97796a [ASTGen]: precondition that position is within buffer 2023-09-20 19:30:44 -05:00
saehejkang
df9ae88bd8 [ASTGen]: assert that position is within buffer bounds 2023-09-19 18:08:30 -05:00
Minhyuk Kim
8169658621 [ASTGen] Refactor bridgedSourceLoc and move to a function of SyntaxProtocol 2023-09-20 00:05:42 +09:00
Ben Barham
041691184c [CMake] Replace early swift-syntax with FetchContent
Use FetchContent to include swift-syntax directly in swift. This can be
thought of as an `add_subdirectory` for a directory outside the root.

The default build directory will be `_deps/swiftsyntax-subbuild/`, though
the modules and shared libraries will be built in `lib/swift/host` by
passing down `SWIFT_HOST_LIBRARIES_DEST_DIR` to avoid copying them as we
were doing previously.
2023-09-18 14:44:10 -07:00
Anthony Latsis
ae83632d94 [NFC] ASTGen: Add Swift names to bridging functions for decls 2023-09-15 09:11:41 +03:00
Anthony Latsis
a1ba72c520 ASTGen: Translate precedence group declarations 2023-09-12 20:37:51 +03:00
Anthony Latsis
a8db87a3fa ASTGen: Translate import declarations 2023-09-12 20:37:51 +03:00
Anthony Latsis
5e46243356 ASTGen: Translate initializer declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
58ce5d10cb ASTGen: Translate deinitializer declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
96f13f51fc ASTGen: Translate operator declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
de155c9783 ASTGen: Translate extension declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
76e2cdc45a ASTGen: Translate enum element payloads 2023-09-12 20:37:50 +03:00
Anthony Latsis
fa1c9fd506 ASTGen: Translate enum case declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
4a5325a25a ASTGen: Translate enumeration declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
b4b4a58688 ASTGen: Translate actor declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
ca8f911b62 ASTGen: Translate generic where clauses 2023-09-12 20:37:50 +03:00