Michael Gottesman
6f3d45219a
[ast] Represent a parameter's isolation at the SIL level.
...
I did this by adding flag on SILParamInfo.
rdar://121387872
2024-01-23 15:20:22 -08:00
Andrew Trick
a80686b485
[SIL] bridge MoveValue and BeginBorrow .isFromVarDecl
2024-01-22 08:29:07 -08:00
Michael Gottesman
9513d298ec
[region-isolation] Add parsing/serialization/type system support for a transferring OwnershipSpecifier.
2024-01-18 13:20:28 -08:00
Pavel Yaskevich
6cdab78028
Merge pull request #70867 from xedin/dynamic-enforcement-of-witness-isolation-with-preconcurrency
...
[TypeChecker/SILGen] Dynamic enforcement of witness/objc isolation with @preconcurrency attribute
2024-01-17 10:01:37 -08:00
Doug Gregor
255009dddb
Implement #isolation macro to produce the isolation of the current context
...
Introduce a new expression macro that produces an value of type
`(any AnyActor)?` that describes the current actor isolation. This
isolation will be `nil` in non-isolated code, and refer to either the
actor instance of shared global actor in other cases.
This is currently behind the experimental feature flag
OptionalIsolatedParameters.
2024-01-16 14:25:51 -08:00
Pavel Yaskevich
574aee0113
[AST] Allow @preconcurrency attribute in inheritance clause
2024-01-16 10:29:47 -08:00
Rintaro Ishizaki
409b2760f9
[ASTGen] Statements
2023-12-18 16:09:25 -08:00
Hamish Knight
f9730a7f40
[ASTGen] Generate SubscriptDecls
2023-12-15 21:44:31 +00:00
Hamish Knight
9710a6575d
[ASTGen] Better handle ParamDecl arg/param name generation
...
Move the logic onto the ASTGen side, and plumb
through the flag that will allow subscripts
to have a different argument name defaulting
behavior.
2023-12-15 21:44:30 +00:00
Hamish Knight
29bfdac299
[ASTGen] Generate AccessorDecls
2023-12-15 21:44:30 +00:00
Hamish Knight
28cfe4b7db
[ASTGen] Generate type annotations for bindings
...
Handle the wrapping of TypedPatterns when a type
annotation is specified, and the implicit wrapping
behavior for previously written NamedPatterns.
2023-12-15 21:44:30 +00:00
Hamish Knight
b04d5d5abc
[ASTGen] Better handle pattern binding entries
...
Generate all entries, and ensure we introduce a
PatternBindingInitializer context for non-local
cases. Also use this opportunity to cleanup
`PatternBindingDecl::create`.
2023-12-15 21:44:30 +00:00
Rintaro Ishizaki
a6d732a186
Merge pull request #70408 from rintaro/astgen-expr-alphabetical
2023-12-12 17:09:09 -08:00
Rintaro Ishizaki
9147787cb6
[ASTGen] Reorder expression bridging function alphabetically
...
NFC
2023-12-12 11:14:54 -08:00
Rintaro Ishizaki
eb46b6f352
[ASTGen] Implement patterns
...
Except `MissingPatternSyntax`
2023-12-11 14:00:40 -08:00
Rintaro Ishizaki
3a4ecf9d4a
[ASTGen] Implement non-refutable patterns
2023-12-11 12:33:42 -08:00
Rintaro Ishizaki
847a5671e6
[ASTGen] BridgedXXXTypeRepr_createParsed return the sub type if possible
...
Just for the consistensy with other BridgedXXX_createParsed().
2023-12-08 15:07:58 -08:00
Rintaro Ishizaki
8f70dc3535
[ASTGen] Implement PackElementTypeRepr, InverseTypeRepr and class constraint
2023-12-08 12:15:16 -08:00
Rintaro Ishizaki
5e271ec4ee
[ASTGen] Implement PackElement and PackExpansion expressions
2023-12-08 12:15:05 -08:00
Rintaro Ishizaki
0084a8a834
[ASTGen] Implement unary expressions
...
AwaitExpr, BorrowExpr, ConsumeExpr, CopyExpr, TryExpr, ForceTryExpr,
and OptionalTryExpr.
2023-12-08 12:15:05 -08:00
Rintaro Ishizaki
471cba2eca
[ASTGen] Implement dictionary literal expression generation
2023-12-08 12:15:04 -08:00
Rintaro Ishizaki
8b026f2334
[ASTGen] Implement DotSelfExpr generation
2023-12-08 12:12:16 -08:00
Meghana Gupta
b6326f5f24
Add initial support for _resultDependsOn
...
These attributes are used to establish lifetime dependence between
argument and the result.
Add them under NonEscapableTypes experimental feature
2023-12-06 16:38:38 -08:00
Rintaro Ishizaki
7ab4003a96
[ASTGen] Move getIdentifier() etc to ASTGenVisitor
...
Now that `getIdentifier()` has some logic in it. It's not a simple
bridging.
2023-12-05 14:32:09 -08:00
Rintaro Ishizaki
a7a0b329f2
Merge pull request #70168 from rintaro/astgen-sequenceexpr
...
[ASTGen] Implement SequenceExpr generation
2023-12-04 11:31:36 -08:00
Rintaro Ishizaki
0c111ace0a
[ASTGen] Implement SequenceExpr generation
2023-12-04 06:50:31 -08:00
Hamish Knight
f4e09c5531
[AST] Tighten up invariants around IfStmt
...
The 'then' statement must be a BraceStmt, and
the 'else' must either be a BraceStmt or an IfStmt.
2023-12-04 11:09:01 +00:00
Rintaro Ishizaki
4796ea458a
[ASTGen] Generate compound name expression
...
Bridge DeclBaseName, DeclNameRef, and DeclNameLoc.
Implement UnresolvedMemberExpr generation.
2023-11-30 14:42:02 -08:00
Erik Eckstein
8681131c58
add some comments in the bridging headers
2023-11-28 09:02:10 +01:00
Erik Eckstein
7752fbfdf9
SIL: add Type.selfOrAnyFieldHasValueDeinit
...
Implemented by adding a recursive property in TypeLowering
2023-11-27 09:21:32 +01:00
Rintaro Ishizaki
215abe6d40
[ASTGen] Start generating Patterns
2023-11-14 10:47:31 -08:00
Hamish Knight
9216672db7
Improve some bridging interfaces
...
Migrate a bunch of structs to classes, and
uppercase field names.
2023-10-31 11:06:41 +00:00
Hamish Knight
e2b8d98edc
[Basic] Abstract BridgedOStream
...
Define using the wrapper macro.
2023-10-31 11:06:41 +00: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
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
dc899c53de
[AST] Use consistent naming for bridging functions
...
Add a `Bridged` prefix to match the name being
exposed to Swift, and to match the other bridging
functions. Also while here, use `SWIFT_NAME` for
some bridging functions that were missing it.
2023-10-30 23:49:58 +00:00
Hamish Knight
25546d2178
[AST] Remove redundant typedefs
...
These aren't needed in C++
2023-10-30 23:49:58 +00:00
Hamish Knight
28b7fd70d1
[AST] Abstract away a couple of bridging wrappers
...
Move these into ASTBridgingWrappers.def.
2023-10-30 23:49:57 +00:00
Hamish Knight
2ac0860716
[AST] Remove BridgedVarDecl + BridgedNominalTypeDecl duplicates
...
These are now stamped out by the ASTBridgingWrappers.
2023-10-30 23:49:56 +00:00
Hamish Knight
6afde8a6d2
Remove CBasicBridging and CASTBridging
...
Merge with BasicBridging and ASTBridging
respectively. The changes here should be pretty
uncontroversial, I tried to keep it to just moving
code about.
2023-10-30 23:49:56 +00:00
Hamish Knight
cae5d33368
[AST] Move BridgedNominalTypeDecl + BridgedVarDecl to ASTBridging
...
And renaming OptionalBridgedVarDecl to
BridgedNullableVarDecl for consistency with the
existing nullable AST node wrappers.
2023-10-30 23:49:55 +00:00
Hamish Knight
fce1cb54d5
[AST] Merge BridgedDiagnosticEngine + BridgedDiagEngine
...
Introduce a macro that can stamp out wrapper
classes for underlying C++ pointers, and use
it to define BridgedDiagnosticEngine in
ASTBridging. Then, migrate users of
BridgedDiagEngine onto it.
2023-10-30 23:49:55 +00:00
Erik Eckstein
04b1ab6941
Rename BridgedDiagnosticEngine -> BridgedDiagEngine
...
So that it does not collide with BridgedDiagnosticEngine in CASTBridging.h.
This hopefully fixes an asan crash.
rdar://116686158
2023-10-11 20:41:30 +02:00
Erik Eckstein
93db0897c8
ASTBridging: fix storage size of BridgedDiagnosticFixIt
...
and fix the static_assert error message
2023-10-11 07:59:20 +02:00
Erik Eckstein
6bf7c0c954
ASTBridging: make BridgedDiagnosticEngine a typedef again
...
Diverging from the definition in CASTBridging probably causes a compiler crash in the swift runtime when getting the metatype for BridgedDiagnosticEngine.
rdar://116686158
2023-10-11 07:58:51 +02:00
Erik Eckstein
2dbd6cc56b
SwiftCompilerSources: rework bridging
...
Introduce two modes of bridging:
* inline mode: this is basically how it worked so far. Using full C++ interop which allows bridging functions to be inlined.
* pure mode: bridging functions are not inlined but compiled in a cpp file. This allows to reduce the C++ interop requirements to a minimum. No std/llvm/swift headers are imported.
This change requires a major refactoring of bridging sources. The implementation of bridging functions go to two separate files: SILBridgingImpl.h and OptimizerBridgingImpl.h.
Depending on the mode, those files are either included in the corresponding header files (inline mode), or included in the c++ file (pure mode).
The mode can be selected with the BRIDGING_MODE cmake variable. By default it is set to the inline mode (= existing behavior). The pure mode is only selected in certain configurations to work around C++ interop issues:
* In debug builds, to workaround a problem with LLDB's `po` command (rdar://115770255).
* On windows to workaround a build problem.
2023-10-09 09:52:52 +02:00
Allan Shortlidge
f9a93a55d7
NFC: Fix duplicate definition of macro warnings.
...
Centralize the `SWIFT_{BEGIN/END}_NULLABILITY_ANNOTATIONS` definitions in a new
Nullability.h header to share.
2023-07-27 13:02:22 -07:00
Alex Lorenz
220e6faad4
Revert "[cxx-interop][SwiftCompilerSources] Use swift::DiagnosticEngine instead of BridgedDiagnosticEngine"
...
This reverts commit e9dedf3c27 .
The revert is required as foreign reference types are available for SwiftStdlib 5.8 and above, but the Swift compiler
sources back deploy to older stdlibs as well.
2023-04-11 15:28:14 -07:00
Zoe Carver
ac131dfbf6
Merge pull request #60786 from zoecarver/unavailable-attr-class-templates
...
[cxx-interop] Mark un-specialized class templates as unavailable in Swift.
2022-10-26 11:07:56 -07:00