Commit Graph

754 Commits

Author SHA1 Message Date
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
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
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
Anthony Latsis
b6be6da277 ASTGen: Translate associated type declarations
Plus tweak `DefaultDefinitionTypeRequest` caching to support querying the
cached type when dumping. This fixes a crash where type computation is
triggered in the dumper before import resolution in `-dump-parse` mode.
2023-09-12 20:37:50 +03:00
Anthony Latsis
da427adaa6 ASTGen: Translate inheritance clauses 2023-09-12 20:37:50 +03:00
Anthony Latsis
345a7f8aad ASTGen: Translate protocol declarations 2023-09-12 20:37:50 +03:00
Anthony Latsis
a49bf1986a ASTGen: Translate class generic parameter clauses 2023-09-12 20:37:50 +03:00
Anthony Latsis
7b25bfcab7 ASTGen: Translate function generic parameter clauses 2023-09-12 20:37:50 +03:00
Anthony Latsis
6293332cba ASTGen: Translate default arguments 2023-09-12 20:37:50 +03:00
Anthony Latsis
808ab1b064 [NFC] ASTGen: Extract ParamDecl and ParameterList translation into a new file 2023-09-12 20:37:50 +03:00
Anthony Latsis
034a39a00c ASTGen: Set brace locations for iterable declaration contexts 2023-09-12 20:37:50 +03:00
Anthony Latsis
1291333fde ASTGen: Cache parsed IterableDeclContext members using the request evaluator
...instead of adding them to the iterable context lest they be re-parsed using
the legacy parser and later re-added through `IterableDeclContext::loadAllMembers`.
2023-09-12 20:37:50 +03:00
Anthony Latsis
a141fba7fc [NFC] ASTGen: Don't unnecessarily bridge TypeAliasDecl::setUnderlyingTypeRepr 2023-09-12 20:37:50 +03:00
Anthony Latsis
4b314a7c9a ASTGen: Fix enough source locations that we can start diffing AST dumps
... and tidy up adjacent code along the way.
2023-09-12 20:37:50 +03:00
Anthony Latsis
4b2cdedc48 ASTGen: Start diagnosing instances of an invalid syntax tree 2023-09-12 20:37:50 +03:00
Anthony Latsis
e72b421fa4 [NFC] ASTGen: Rename "Diagnostics.swift" → "DiagnosticsBridge.swift"
This file deals with emitting SwiftSyntax diagnostics via the C++ engine and
rendering C++ diagnostics via SwiftSyntax rather than ASTGen diagnostics.
2023-09-12 20:37:50 +03:00
Anthony Latsis
cd55d760ed ASTGen: Skip leading trivia when forming bridged source locations 2023-09-12 20:37:49 +03:00
Anthony Latsis
ea164cd0a0 [NFC] ASTGen: Optimize and flatten the transform + withBridgedArrayRef pattern via bump allocation
To encourage usage of  lazy transformations, define `bridgedArrayRef`
on `LazyCollectionProtocol`.
2023-09-12 20:33:39 +03:00
Anthony Latsis
92c1bdc219 [NFC] ASTGen: Define visit(_:) overloads that take an optional to achieve consistent self.visit recursion pattern 2023-09-12 13:33:47 +03:00
Anthony Latsis
59c2623aba [NFC] ASTGen: Extract TokenSyntaxBridgedIdentifier mapping into a method 2023-09-12 13:33:47 +03:00