Commit Graph

10 Commits

Author SHA1 Message Date
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
1559b37c03 [Basic] Remove unnecessary 'const' from several briding functions 2025-02-05 10:37:56 -08:00
Rintaro Ishizaki
df2ada37df [ASTGen] Generate AvailableAttr
* Move `AvailabilitySpec` handling logic to AST, so they can be shared
  between libParse and ASTGen
* Requestify '-define-availability' arguments parsing and parse them
  with 'SwiftParser' according to the 'ParserASTGen' feature flag
* Implement 'AvailableAttr' generation in ASTGen
2025-02-04 23:40:01 -08:00
Hamish Knight
9d4a78678a [Sema] Add logic to diagnose regex feature availability
Add the necessary compiler-side logic to allow
the regex parsing library to hand back a set of
features for a regex literal, which can then be
diagnosed by ExprAvailabilityWalker if the
availability context isn't sufficient. No tests
as this only adds the necessary infrastructure,
we don't yet hand back the features from the regex
parsing library.
2024-10-28 17:09:47 +00:00
Erik Eckstein
ed67e36ce5 bridging: reduce #ifdef USED_IN_CPP_SOURCE in bridging headers
Especially avoid any constructors in `#ifdef USED_IN_CPP_SOURCE` blocks, because this breaks Windows ARM64.
2024-10-25 09:47:56 +02:00
Hamish Knight
5d99fe63e9 Rename get() -> unbridged() on bridging wrappers 2023-10-31 11:06:39 +00:00
Hamish Knight
3cb74e911b Address review feedback 2023-10-30 23:50:01 +00:00
Hamish Knight
2a6d93f505 [Basic] Improve API of BridgedArrayRef + BridgedData
Remove the default constructor footgun present with
the struct implementations, and sprinkle some
`SWIFT_NAME` and bridging utilities to make them
nicer to work with.
2023-10-30 23:49:59 +00:00
Hamish Knight
e0f57f84f0 [AST] Cleanup ASTBridging + BasicBridging
Sort AST node bridging functions into Expr, Stmt,
Decl, and TypeRepr, and tweak the headers to use
`MARK`.
2023-10-30 23:49:59 +00:00
Hamish Knight
ce23252a3f [Basic] Improve some bridging APIs
Improve APIs for BridgedStringRef,
BridgedOwnedString, and BridgedSourceLoc.
2023-10-30 23:49:53 +00:00