Commit Graph

613 Commits

Author SHA1 Message Date
Saleem Abdulrasool
e1fcb90331 Merge pull request #68525 from hjyamauchi/wrapped-modularization-error-remarks
Emit diagnostics/remarks out of wrapped ModularizationError
2023-09-21 09:43:43 -07:00
Erik Eckstein
f0b811c45f SIL: add the end_init_let_ref instruction
This instructions marks the point where all let-fields of a class are initialized.
This is important to ensure the correctness of ``ref_element_addr [immutable]`` for let-fields,
because in the initializer of a class, its let-fields are not immutable, yet.
2023-09-19 15:10:30 +02:00
Erik Eckstein
e5eb15dcbe Swift SIL: replace the set_deallocating instruction with begin_dealloc_ref
Codegen is the same, but `begin_dealloc_ref` consumes the operand and produces a new SSA value.
This cleanly splits the liferange to the region before and within the destructor of a class.
2023-09-19 15:10:30 +02:00
Hiroshi Yamauchi
c5dc68a348 Emit diagnostics/remarks out of wrapped ModularizationError
The diagnostics/remarks out of the ModularizationError wrapped in a
TypeError (eg. coming from resolveCrossReference) is otherwise just
dropped but could help better understand C/C++ interop issues.
2023-09-18 08:17:58 -07:00
Alejandro Alonso
dadbbb4d02 Fix raw layout deserialization
Update raw_layout.swift
2023-08-18 20:36:27 -07:00
Slava Pestov
e5c7d251a2 Serialization: Fix serializing normal conformance xrefs for tuple conformances
Fixes rdar://problem/113707902.
2023-08-10 16:15:45 -04:00
Nate Chandler
e5d87f75a8 [SIL] Add source formal type to checked_cast_br.
It is necessary for opaque values where for casts that will newly start
out as checked_cast_brs and be lowered to checked_cast_addr_brs, since
the latter has the source formal type, IRGen relies on being able to
access it, and there's no way in general to obtain the source formal
type from the source lowered type.
2023-07-27 15:04:15 -07:00
Holly Borla
74c9bfb02e [NFC] Update a macro serialization test for the change to ExtensionMacro. 2023-06-30 16:06:13 -07:00
eeckstein
7fcfcdeecf Merge pull request #66990 from eeckstein/bare-objects
SIL: add a `bare` attribute to `global_value` and `alloc_ref`
2023-06-29 18:48:44 +02:00
Erik Eckstein
625619ee17 SIL: add a bare attribute to global_value
The `bare` attribute indicates that the object header is not used throughout the lifetime of the value.
This means, no reference counting operations are performed on the object and its metadata is not used.
The header of bare objects doesn't need to be initialized.
2023-06-29 06:57:05 +02:00
Erik Eckstein
b08710d911 SIL: add a bare attribute to alloc_ref
The `bare` attribute indicates that the object header is not used throughout the lifetime of the object.
This means, no reference counting operations are performed on the object and its metadata is not used.
The header of bare objects doesn't need to be initialized.
2023-06-29 06:57:05 +02:00
Holly Borla
c867c7c917 [Macros] Allow extension macros to specify conformances in the attached
attribute.
2023-06-28 00:42:23 -07:00
Slava Pestov
f432270d79 Add serialization test for round-tripping PackElementType 2023-06-06 15:54:11 -04:00
Hamish Knight
4e838e0a26 Serialize package and SPI doc comments in swiftsourceinfo
Previously we were using the same set of conditions
for serializing as for swiftdoc, so excluded them.
However it's reasonable to have them in the
swiftsourceinfo.
2023-04-26 12:38:38 +01:00
Doug Gregor
ae4a5ded8f [Macros] Improve parsing, representation, and serialization of role attributes
Parse compound and special names in the macro role attributes
(`@freestanding` and `@attached`). This allows both compound names and
initializers, e.g., `init(coding:)`.

Fixes rdar://107967344.
2023-04-21 11:36:06 -07:00
Slava Pestov
3d9a79e4b1 Merge pull request #64777 from slavapestov/sil-optimizer-variadic-generics
SIL optimizer fixes for variadic generics
2023-04-03 11:30:03 -04:00
Slava Pestov
1d27f5b386 Serialization: Actually deserialize same-shape requirements
I added a test for this a while ago... but the test wasn't running. Fix the
test, and fix the bug.
2023-03-30 14:10:27 -04:00
Doug Gregor
38230b79f9 [Macros] Add (de-)serialization for expanded macro definitions 2023-03-29 16:32:32 -07:00
Doug Gregor
9d9f8326c8 [Macros] Allow macro parameters to have default arguments.
SE-0382 allows macro parameters to have default arguments. Enable these
default arguments, with the normal type checking rules. One
significant quirk to this implementation is that the actual default
argument values don't make it to the macro implementation. This is a
previously-unconsidered design problem we'll need to address.

Tracked by rdar://104043987.
2023-03-26 22:13:37 -07:00
Pavel Yaskevich
ed5984abe6 Merge pull request #64213 from xedin/rdar-104384604
[BuilderTransform] Verify that builder type has at least one accessible build{Partial}Block
2023-03-14 15:07:43 -07:00
Pavel Yaskevich
6b323f1663 [BuilderTransform] Verify that builder type has at least one accessible build{Partial}Block
Check accessibility of all build{Partial}Block overloads and
diagnose if none of them are as accessible as type, otherwise
swift interfaces could end up with invalid result builder
declarations when type is public and all builder methods are
internal.

Resolves: rdar://104384604
2023-03-08 12:46:50 -08:00
Kavon Farvardin
da3f2e2666 add addtl coverage for when the moveonly type is not used
We want to ensure that the deserialization error added
for this test doesn't trigger when the moveonly type
is not used by the importing module.

part of rdar://106262652
2023-03-06 17:42:55 -08:00
Sophia Poirier
70cffb06f3 [Variadic Generics] type parameter pack syntax change: T... -> each T 2023-03-02 14:42:28 -08:00
Richard Wei
ecc33865b9 [Macros] Fix MacroDecl serialization crash with custom parameter attributes
Type-check `MacroDecl`'s parameter list so that custom attributes on parameters will have a type. Fixes a serialization crash.
2023-02-23 05:00:28 +08:00
Holly Borla
f1953f311f [Macros] Don't invoke ResolveMacroRequest for the same custom attribute with
different DeclContexts.
2023-02-15 14:58:24 -08:00
Holly Borla
d6e4b707db [Macros] Update member attribute macro test cases to account for a change in
the MemberAttributeMacro protocol in SwiftSyntax.
2023-02-06 10:15:09 -08:00
Doug Gregor
182950bacb Update to account for SwiftSyntaxMacros module rename and overhaul 2023-01-28 09:00:54 -08:00
Holly Borla
32a0705e90 [Macros] Use the singular 'memberAttribute' spelling for attached member
attribute macros.
2023-01-26 21:52:39 -08:00
Doug Gregor
976060e29c Merge pull request #63220 from AtariDreams/deprecations
Fix DeclarationMacro deprecations
2023-01-26 17:04:08 -08:00
Doug Gregor
5a9a654adb Adopt @freestanding(expression) for all @expression macros 2023-01-25 17:07:38 -08:00
Rose
0a380cbba3 Fix DeclarationMacro deprecations
These deprecations are simple renames, but this PR should get rid of the warnings.
2023-01-25 13:50:02 -05:00
Kavon Farvardin
1356694043 experimentally allow move-only classes
A lot of existing regression tests rely on there
being some form of move-only classes, despite
them being something that will not be available
to users (and not complete).

This change introduces a `MoveOnlyClasses`
experimental feature so that those tests don't
need to be fully rewritten just yet. You need to
include `-enable-experimental-feature MoveOnlyClasses` along with
`-enable-experimental-move-only` to get move-only classes.
2023-01-23 22:33:27 -08:00
Holly Borla
94abc252bf [Macros] Type-check attached macro arguments. 2023-01-22 11:26:02 -08:00
Holly Borla
ae1f8248b3 [Serialization] Don't serialize macro custom attributes. 2023-01-17 17:24:52 -08:00
Doug Gregor
43cadcad3a [Macros] Serialization and printing for @attached. 2023-01-14 21:48:43 -08:00
Holly Borla
6725f365ba [Variadic Generics] Update tests for syntax changes. 2023-01-07 09:50:14 -08:00
Pavel Yaskevich
3c03449797 [MiscDiagnostics] OpaqueTypes: Handle unrelated #available conditions gracefully
`OpaqueUnderlyingTypeChecker` should skip conditional availability
blocks if none of the conditions restrict the current target.

Resolves: rdar://103445432
2023-01-04 15:36:46 -08:00
Doug Gregor
f78f5729c3 Start requiring expression macros to be marked with @expression 2022-12-22 09:18:05 -08:00
Doug Gregor
3be6344619 Eliminate dependencies on _SwiftSyntaxMacros having actual macros in it 2022-12-14 16:13:48 -08:00
Doug Gregor
4ce0834c51 [Macros] Serialization support for macro declarations. 2022-11-28 18:33:09 -08:00
Slava Pestov
07aae0cb4f Add minimal SILGen and Serialization tests for variadic generics 2022-11-12 02:13:54 -05:00
Michael Gottesman
78ffc87c70 [move-only] Make sure we can properly deserialize deinits from structs/enums.
We previously had a cast<ClassDecl> here. I changed it to NominalTypeDecl and
added tests for this.

rdar://102173184
2022-11-09 19:40:04 -08:00
Michael Gottesman
5406131e8c [move-only] Emit a nice error if a move only type is imported into a module that does not have experimental-move-only enabled.
This just prevents user confusion when they forget to do this since weird
behavior /could/ result.

rdar://102062737
2022-11-07 16:11:46 -08:00
Nate Chandler
ed623d7b64 [NFC] Shortened SIL [init] flag.
Instead of writing out [initalization] for some instructions, use [init]
everywhere.
2022-10-27 10:38:54 -07:00
Anthony Latsis
bdad7e9dec Merge pull request #60947 from AnthonyLatsis/migrate-test-suite-to-gh-issues-20
Gardening: Migrate test suite to GH issues p. 20
2022-09-17 12:41:22 +03:00
Erik Eckstein
97b2354be6 SIL: add needsStackProtection flags for address_to_pointer and index_addr instructions.
Also add new "unprotected" variants of the `addressof` builtins:
* `Builtin.unprotectedAddressOf`
* `Builtin.unprotectedAddressOfBorrow`
2022-09-08 08:42:22 +02:00
Anthony Latsis
c1fcdc4134 Gardening: Migrate test suite to GH issues: Serialization 2022-09-04 07:02:59 +03:00
YOCKOW
d10381557b [NFC] Python Lint: Fix E275(missing whitespace after keyword) issues. 2022-08-21 16:07:07 +09:00
Holly Borla
8713d78704 [PrintOptions] Print explicit 'any' in SIL. 2022-08-18 01:15:12 -04:00
Slava Pestov
b36f37cc72 Serialization: Preserve identity of opened generic environments
We used to create a new environment for each opened archetype, which is
incorrect when deserializing a nested type of another opened archetype.
2022-08-15 13:59:12 -04:00