Commit Graph

19 Commits

Author SHA1 Message Date
Becca Royal-Gordon
e71f837b1f [NFC] Stub module selector DeclNameRef/Loc members 2025-05-14 11:16:02 -07:00
Rintaro Ishizaki
ddd5b12661 [ASTGen] Handle trailing where clause in macro declarations 2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
017c0d98ec [ASTGen] Generate AutoDiff attributes
`@differentiable`, `@derivative` and `@transpose`
2025-03-06 10:36:13 -08:00
Rintaro Ishizaki
38bafb3872 Merge pull request #79513 from rintaro/astgen-macro-expanded-syntax 2025-02-24 15:06:24 -08:00
Rintaro Ishizaki
f48282c92b [ASTGen] Generate trailing where clause for SubscriptDecl
It was just missing.
2025-02-21 11:36:29 -08:00
Rintaro Ishizaki
aae50a88c5 [ASTGen] Fix expanded macro buffer parsing and AST generation
Parse expanded buffer into dedicated syntax.

Also rename `BridgedGeneratedSourceFileKindAttribute` to
`BridgedGeneratedSourceFileKindAttributeFromClang` because C++ decl
(i.e. `GeneratedSourceInfo::Kind::AttributeFromClang`) was renamed a
while ago.
2025-02-21 09:56:36 -08:00
Rintaro Ishizaki
8833ff58a2 [AST] Sink the flag collection logic from Parse to AST
* Collect flag in `ParamDecl::setTypeRepr()`.

* [ASTGen] Separate `BridgedParamDecl.setTypeRepr(_:)` from
`BridgedParamDecl.createParsed(_:)` aligning with C++ API. The majority
of the creations don't set the typerepr.

* Update `ParamSpecifierRequest::evaluate` to handle non-implicit
`ParamDecl` without `TypeRepr` (i.e. untyped closure parameter), instead
of `setSpecifier(::Default)` manually in Parse.
2025-02-20 10:04:49 -08:00
Rintaro Ishizaki
6980509f8c [ASTGen] Generate DefaultArgumentInitializer
Rework ParamDecl contextualization.
2025-02-18 11:13:39 -08:00
Rintaro Ishizaki
b7b28b6d8e [ASTGen] Correctly store static spelling and location to PBD 2025-02-17 11:16:53 -08:00
Hamish Knight
1e8dc55b7f [AST] NFC: Remove InitRetType
This is no longer used.
2025-02-16 18:52:23 +00:00
Rintaro Ishizaki
6ea6a31ec7 [ASTGen] Generate TopLevelCodeDecl for PatternBindingDecl
* Instead of hoisting VarDecl in the bridging functions, do it in
  ASTGen.
* Introduce `Decl::forEachDeclToHoist` to handle VarDecls in
  PatternBindingDecl, and EnumElementDecl in EnumCaseDecl.
* Intorduce `withBridgedSwiftClosure(closure:call:)` as a callback
  mechanism between Swift and C++
* In `generate(sourceFile:)`, instead of using `generate(codeBlockItem:)`
  handle `CodeBlockItemSyntax.Item` manually to handle `TLCD` wrapping
  and `VarDecl` hoisting.
* Make `generate(variableDecl:)` handle TLCD correctly.
2025-02-13 00:09:22 -08:00
Rintaro Ishizaki
cb049d8ed1 [ASTGen] Generate anonymous closure parameters
E.g. '$0'
2025-02-07 19:39:57 -08:00
Becca Royal-Gordon
201ccaf053 [NFC] [ASTGen] Refactor attribute attachment
Use `Decl::attachParsedAttrs()` instead of `Decl::setAttrs()` to attach attributes to a declaration in ASTGen. This causes the common attribute-setup logic there to be run.

NFC in this commit because none of the attributes that have special setup logic are currently implemented in ASTGen. Prepares to add support for `@abi` in a future commit.
2024-12-19 15:49:35 -08:00
Rintaro Ishizaki
71ca3e129a [ASTGen] Use syntax tree based interface hash 2024-12-12 09:51:09 -08:00
Rintaro Ishizaki
6d7b3d69d1 [ASTGen] Generate several attributes
* NonisolatedAttr
* SpecializeAttr
* UnavailableFromAsyncAttr
* DocumentationAttr
* StorageRestrictionsAttr
2024-12-05 15:12:00 -08:00
Rintaro Ishizaki
093d0dffb4 [ASTGen] Generate MacroDecl 2024-11-14 15:10:08 -08:00
Rintaro Ishizaki
dc156a644a [ASTGen] Generate Swift key-path expressions 2024-11-05 13:38:21 -08:00
Rintaro Ishizaki
dfdba15121 [ASTGen] Generrate MacroExpansionExpr 2024-10-30 22:43:26 -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