Commit Graph

56 Commits

Author SHA1 Message Date
Doug Gregor
020b69d4b6 [SE-0497] Implement @export attribute syntax
Implement the @export(implementation) and @export(interface) attributes
to replace @_alwaysEmitIntoClient and @_neverEmitIntoClient. Provide a
warning + Fix-It to start staging out the very-new
@_neverEmitIntoClient. We'll hold off on pushing folks toward
@_alwaysEmitIntoClient for a little longer.
2025-11-07 22:00:40 -08:00
Kuba Mracek
ee623f8d59 Add @section/@const handling of globals to ASTGen too 2025-11-03 13:47:51 -08:00
Becca Royal-Gordon
c9bb85a875 [NFC] Add DeclNameLoc to specialize/dynamicReplacement 2025-10-16 13:30:28 -07:00
Hamish Knight
2b8a1cccfd [AST] Store owning Decl/DeclContext on CustomAttr
Introduce CustomAttrOwner that can store either a Decl for an
attached attribute, or a DeclContext for e.g a type or closure
attribute. Store this on CustomAttr such that we can query it from
the name lookup requests.
2025-10-13 13:37:29 +01:00
Anthony Latsis
5620abbad8 Bridging: Bridge swift::CharSourceRange directly 2025-07-15 21:34:48 +01:00
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
Alexis Laferrière
81a0f98783 Merge pull request #82194 from xymus/cdecl-parser
Parser: Accept `@cdecl` with an optional identifier for a custom C name
2025-06-27 15:06:11 -07:00
Anthony Latsis
dd78cd6dbe ASTBridging: Bridge swift::PlatformKind directly 2025-06-20 16:46:03 +01:00
Anthony Latsis
8501c8776e ASTBridging: Bridge swift::ExternKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
0b0ebfc9fb ASTBridging: Bridge swift::ExposureKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
b2b79f3ad7 ASTBridging: Bridge swift::InlineKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
6527be558a ASTBridging: Bridge swift::NonIsolatedModifier directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
29ef3e300f ASTBridging: Bridge swift::InheritActorContextModifier directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
68bb4b33f9 ASTBridging: Bridge swift::EffectsKind directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
12de029d97 ASTBridging: Bridge swift::AccessLevel directly 2025-06-19 18:11:40 +01:00
Anthony Latsis
38360fe625 ASTBridging: Bridge swift::DeclAttrKind directly 2025-06-19 18:11:39 +01:00
Anthony Latsis
3e9923f0c0 ASTBridging: Bridge swift::AccessorKind directly 2025-06-19 04:26:52 +01:00
Alexis Laferrière
d9566c6c1e ASTGen: Accept @cdecl 2025-06-11 12:42:38 -07:00
Meghana Gupta
0dfa1fc312 Update spelling for representing lifetime dependencies to @_lifetime 2025-06-07 12:49:07 -07:00
Arnold Schwaighofer
13ff5abdb8 Introduce @specialized attribute
Implements SE-0460 -- the non-underscored version of @specialized.

It allows to specify "internal" (not abi affecting) specializations.

rdar://150033316
2025-05-23 13:12:47 -07:00
Pavel Yaskevich
c0aca5384b [ASTGen] Transform @_inheritActorContext into a custom attribute with an optional modifier 2025-05-14 20:07:59 -07:00
Alexis Laferrière
a6beaf8deb Merge branch 'main' into cdecl-global-function-checking 2025-04-16 11:19:37 -07:00
Pavel Yaskevich
07ff063ae3 [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-11 15:59:25 -07:00
Pavel Yaskevich
b1ffa063b6 [AST/Sema] Intoduce nonisolated(nonsending) as a replacement for @execution(caller) 2025-04-11 15:57:11 -07:00
Pavel Yaskevich
4b8c8e7d72 [AST/Sema] Replace @execution(concurrent) with @concurrent 2025-04-11 12:08:29 -07:00
Alexis Laferrière
02b5998536 Parser: Intro @cdecl attribute and gate it behind feature flag CDecl 2025-04-11 11:34:39 -07:00
Meghana Gupta
ef1e94577f Revert "Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout"
This reverts commit 6eaa07a880, reversing
changes made to e75ee3f4cf.
2025-04-04 09:50:13 -07:00
Artem Chikin
39e1791b67 Revert "Add support for inout lifetime dependence" 2025-04-04 09:00:09 -07:00
Meghana Gupta
d87a2b2ada Rename ParsedLifetimeDependenceKind::Scope -> ParsedLifetimeDependenceKind::Borrow 2025-04-03 17:22:13 -07:00
Meghana Gupta
cfacd25df4 Add support for @lifetime(&arg) 2025-04-03 17:22:06 -07:00
Rintaro Ishizaki
7add493002 [ASTGen] Generate '@_spi_available' attribute 2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
a2e40d6c31 [ASTGen] Generate @_typeEraser attribute 2025-03-16 15:18:59 -07:00
Rintaro Ishizaki
d1f892cbdc [ASTGen] Generate '@reasync' and '@rethrows'
Also, fallback 'shouldBeRejectedByParser' attribute names to
'CustomAttr'.
2025-03-16 15:14:27 -07:00
Rintaro Ishizaki
ff6cb11bb0 [ASTGen] Introduce 'AvailableAttr::createUnavailableInEmbedded()' 2025-03-07 04:14:50 -08:00
Rintaro Ishizaki
d60f1986a8 [ASTGen] Adopt AvailabilityDomainOrIdentifier scheme
Aligning with libParse
2025-03-07 04:14:50 -08:00
Rintaro Ishizaki
017c0d98ec [ASTGen] Generate AutoDiff attributes
`@differentiable`, `@derivative` and `@transpose`
2025-03-06 10:36:13 -08:00
Rintaro Ishizaki
924e1e8bf1 [ASTGen] Generate '@_rawLayout' attribute
Introduce 'generateTypeRepr(expr:)'.
2025-02-26 10:20:51 -08:00
Rintaro Ishizaki
81475be976 [ASTGen] Add an assertion for attribute as an modifier 2025-02-19 11:09:53 -08:00
Rintaro Ishizaki
b729746629 [AST] Make LifetimeDescriptor hold Identifier instead of StringRef
No reason to keep the name as a StringRef
2025-02-17 08:59:18 -08:00
Rintaro Ishizaki
94402b6c9d [ASTGen] Generate LifetimeAttr 2025-02-17 08:56:29 -08: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
Allan Shortlidge
06030d66aa AST: Introduce AvailabilityDomainOrIdentifier.
It provides a common way to represent either a parsed domain identifier or the
resolved domain.

NFC.
2025-02-13 21:18:05 -08:00
Rintaro Ishizaki
c56dd2efca [ASTGen] Generate miscellaneous availability related nodes
* `@_specialize` with `availability:` arguments
* `@backDeployed` attributes
* `@_originallyDefinedIn` attributes
* `#available()` and `#unavailable()` statement conditions
2025-02-07 10:01:07 -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
Pavel Yaskevich
667a976ec5 [ASTGen] Add support for @execution(...) attribute 2025-01-17 15:40:01 -08:00
Becca Royal-Gordon
9c1e00ce52 [ASTGen] Lower @abi in ASTGen 2024-12-19 15:49:35 -08:00
Doug Gregor
ee9c066050 Introduce a new Initializer subclass for the arguments of custom attributes
Since the introduction of custom attributes (as part of property
wrappers), we've modeled the context of expressions within these
attributes as PatternBindingInitializers. These
PatternBindingInitializers would get wired in to the variable
declarations they apply to, establishing the appropriate declaration
context hierarchy. This worked because property wrappers only every
applied to---you guessed it!---properties, so the
PatternBindingInitializer would always get filled in.

When custom attributes were extended to apply to anything for the
purposes of macros, the use of PatternBindingInitializer became less
appropriate. Specifically, the binding declaration would never get
filled in (it's always NULL), so any place in the compiler that
accesses the binding might have to deal with it being NULL, which is a
new requirement. Few did, crashes ensued.

Rather than continue to play whack-a-mole with the abused
PatternBindingInitializer, introduce a new CustomAttributeInitializer
to model the context of custom attribute arguments. When the
attributes are assigned to a declaration that has a
PatternBindingInitializer, we reparent this new initializer to the
PatternBindingInitializer. This helps separate out the logic for
custom attributes vs. actual initializers.

Fixes https://github.com/swiftlang/swift/issues/76409 / rdar://136997841
2024-12-06 17:40:32 -08:00
Rintaro Ishizaki
6d7b3d69d1 [ASTGen] Generate several attributes
* NonisolatedAttr
* SpecializeAttr
* UnavailableFromAsyncAttr
* DocumentationAttr
* StorageRestrictionsAttr
2024-12-05 15:12:00 -08:00