Commit Graph

25 Commits

Author SHA1 Message Date
Anthony Latsis
9001ce4687 Bridging: Bridge swift::SourceRange directly 2025-07-15 21:33:28 +01:00
Anthony Latsis
6eb5d7d857 Bridging: Bridge swift::SourceLoc directly 2025-07-15 21:33:06 +01:00
Anthony Latsis
0e0fbc4160 Bridging: Bridge swift::Identifier directly 2025-07-10 17:58:13 +01:00
Rintaro Ishizaki
92a6fece48 [ASTGen] ObjC improvements
* Generate `#selector(...)` expression
* Generate `#keyPath(...)` expression
* Implicit `@objc` attribute for `@_objcImplementation` attribute
2025-03-20 05:04:58 -07:00
Rintaro Ishizaki
0ced6e06b4 [ASTGen] Generate CaptureListExpr
Move the capture list entry construction logic to
CaptureListEntry::createParsed() so that ASTGen can use it.
2025-02-16 05:22:46 -08:00
Rintaro Ishizaki
13380da3b4 [ASTGen] Generate ObjectLiteralExpr
e.g. '#imageLiteral(..)'
2025-02-13 16:17:47 -08:00
Rintaro Ishizaki
563ddc47e2 [AST] Eliminate 'SYNTAX_KIND' from MagicIdentifierKinds.def
Nothing is using it.
2025-02-12 23:19:34 -08:00
Rintaro Ishizaki
f25104ff24 [ASTGen] Generate MagicIdentifierLiteralExpr 2025-02-12 20:47:52 -08:00
Rintaro Ishizaki
cb049d8ed1 [ASTGen] Generate anonymous closure parameters
E.g. '$0'
2025-02-07 19:39:57 -08:00
Doug Gregor
8bb5bbedbc Implement an unsafe expression to cover uses of unsafe constructs
Introduce an `unsafe` expression akin to `try` and `await` that notes
that there are unsafe constructs in the expression to the right-hand
side. Extend the effects checker to also check for unsafety along with
throwing and async operations. This will result in diagnostics like
the following:

    10 |   func sum() -> Int {
    11 |     withUnsafeBufferPointer { buffer in
    12 |       let value = buffer[0]
       |                   |     `- note: reference to unsafe subscript 'subscript(_:)'
       |                   |- warning: expression uses unsafe constructs but is not marked with 'unsafe'
       |                   `- note: reference to parameter 'buffer' involves unsafe type 'UnsafeBufferPointer<Int>'
    13 |       tryWithP(X())
    14 |       return fastAdd(buffer.baseAddress, buffer.count)

These will come with a Fix-It that inserts `unsafe` into the proper
place. There's also a warning that appears when `unsafe` doesn't cover
any unsafe code, making it easier to clean up extraneous `unsafe`.

This approach requires that `@unsafe` be present on any declaration
that involves unsafe constructs within its signature. Outside of the
signature, the `unsafe` expression is used to identify unsafe code.
2025-01-10 10:39:14 -08:00
Rintaro Ishizaki
0ba92d84e5 [ASTGen] Generate closure signatures
Still TODO:
* Capture list
* Anonymous parameters
2024-11-11 12:21:38 -08:00
Rintaro Ishizaki
47f27a411c Merge pull request #77398 from rintaro/astgen-keypathexpr
[ASTGen] Generate Swift key-path expressions
2024-11-06 10:15:37 -08:00
Rintaro Ishizaki
dc156a644a [ASTGen] Generate Swift key-path expressions 2024-11-05 13:38:21 -08:00
Rintaro Ishizaki
e566a746c8 [ASTGen] Support macro expanded buffer
* Make ExportedSourceFile hold any Syntax as the root node
* Move `ExportedSourceFileRequest::evaluate()` to `ParseRequests.cpp`
* Pass  the decl context and `GeneatedSourceFileInfo::Kind` to
  `swift_ASTGen_parseSourceFile()` to customize the parsing
* Make `ExportedSourceFile` to hold an arbitrary Syntax node
* Move round-trip checking into `ExportedSourceFileRequest::evaluate()`
* Split `parseSourceFileViaASTGen` completely from C++ parsing logic
  (in `ParseSourceFileRequest::evaluate()`)
* Remove 'ParserDiagnostics' experimental feature: Now that we have
  ParserASTGen mode which includes the swift-syntax parser diagnostics.
2024-11-05 11:00:33 -08:00
Rintaro Ishizaki
dfdba15121 [ASTGen] Generrate MacroExpansionExpr 2024-10-30 22:43:26 -07:00
Rintaro Ishizaki
66138e8395 [ASTGen] Generate ForceValueExpr and BindOptionalExpr 2024-10-13 07:30:36 -07:00
Hamish Knight
7c3f965578 Merge pull request #76979 from hamishknight/regex-request
Requestify regex pattern parsing
2024-10-12 19:19:09 +01:00
Hamish Knight
6a435960b7 Requestify regex pattern parsing
Instead of doing the pattern parsing in both the
C++ parser and ASTGen, factor out the parsing into
a request that returns the pattern to emit, regex
type, and version. This can then be lazily run
during type-checking.
2024-10-11 19:25:58 +01:00
Hamish Knight
21cbfc4567 NFC: Remove unused var 2024-10-11 19:25:57 +01:00
Rintaro Ishizaki
cb6372a9c4 [ASTGen] Generate EditorPlaceholderExpr and 'do' expressions 2024-10-11 09:34:41 -07:00
Rintaro Ishizaki
e7a2102203 [ASTGen] Generate UnresolvedSpecializeExpr 2024-10-08 09:47:12 -07:00
Rintaro Ishizaki
834d98dca8 [ASTGen] Genrate InOutExpr 2024-10-08 09:47:11 -07:00
Rintaro Ishizaki
09f49b0c87 [ASTGen] Generate FloatLiteralExpr 2024-10-08 09:46:56 -07:00
Rintaro Ishizaki
7d9ba2d36d [ASTGen] Generate RegexLiteralExpr, SubscriptExpr, and SuperRefExpr 2024-10-08 09:34:17 -07:00
Rintaro Ishizaki
b5859240ab [ASTGen] Split ASTBridging.cpp into multiple files
ASTBridging.cpp was getting too big.
2024-10-04 10:48:56 -07:00