Commit Graph

1088 Commits

Author SHA1 Message Date
Allan Shortlidge
250479177e Merge pull request #78653 from tshortli/suppress-option-parsing-warnings-in-swiftinterfaces
Frontend: Honor warning suppression when parsing arguments from swiftinterfaces
2025-01-15 09:45:40 -08:00
Allan Shortlidge
3c5ae232dc Frontend: Honor warning suppression when parsing arguments from swiftinterfaces.
Diagnostics are suppressed when parsing swiftinterface files, since the
warnings emitted from compiling the swiftinterface of a dependency would just
be a nuisance. It follows that warnings generated when parsing the arguments in
a swiftinterface file should also be suppressed, but that wasn't happening
because the diagnostic engine of the main compile was used for parsing. Pass
the diagnostic engine of the compiler subinstance instead, and proactively
suppress warnings before parsing begins.

Resolves rdar://142814164.
2025-01-14 23:07:24 -08:00
Andrew Trick
0e33dfc8b6 Fix LifetimeDependence feature guard for variable accessors.
Guard variable declarations by `#if $LifetimeDependence` if they have a
~Escapable type. Accessing the declaration implies a lifetime dependence.
2025-01-14 15:41:58 -08:00
Joe Groff
4420f27e42 Merge pull request #78615 from jckarter/addressable-as-suppressable-feature
`AddressableTypes` should be a SUPPRESSIBLE_LANGUAGE_FEATURE.
2025-01-14 08:39:42 -08:00
Joe Groff
b9062195e6 AddressableTypes should be a SUPPRESSIBLE_LANGUAGE_FEATURE.
Types annotated as `@_addressableForDependencies` are still usable by older
compilers that don't know about nonescapable types or lifetime dependencies,
since it only affects the behavior of the type when it's the source of a
dependency.
2025-01-13 13:41:09 -08:00
Alejandro Alonso
09d122af7c Merge pull request #76438 from Azoy/vector
[stdlib] Slab
2025-01-12 10:36:25 -08:00
Allan Shortlidge
11abffb2f4 AST: Adopt new AvailableAttr constructor in attribute inference.
It was difficult to preserve the existing, buggy behavior of availability
attribute inference with respect to attributes specifying availability for
non-platform-specific domains. Instead, this change improves attribute merging
by tracking every domain independently, and only merging attributes from the
same domain.
2025-01-10 18:43:12 -08:00
Alejandro Alonso
f76d841540 Rename to Slab 2025-01-09 10:39:45 -08:00
Allan Shortlidge
7ea778f3a0 Sema: Diagnose @backDeployed functions with missing bodies in swiftinterfaces.
A `@backDeployed` function printed in a `.swiftinterface` must have a function
body so that SILGen can emit a fallback copy to call when the back deployed
function is unavailable. Previously, the compiler would crash in SILGen when
compiling an interface containing a back deployed function without a body.

Resolves rdar://141593108.
2025-01-03 09:15:12 -08:00
Doug Gregor
aab36f63f2 Revert "Sema: Diagnose @backDeployed functions with missing bodies in swiftinterfaces" 2024-12-21 21:53:46 -08:00
Allan Shortlidge
bfd7752cdd Merge pull request #78327 from tshortli/back-deployed-without-body
Sema: Diagnose `@backDeployed` functions with missing bodies in swiftinterfaces
2024-12-20 18:00:03 -08:00
Allan Shortlidge
ebda3e2d44 Sema: Diagnose @backDeployed functions with missing bodies in swiftinterfaces.
A `@backDeployed` function printed in a `.swiftinterface` must have a function
body so that SILGen can emit a fallback copy to call when the back deployed
function is unavailable. Previously, the compiler would crash in SILGen when
compiling an interface containing a back deployed function without a body.

Resolves rdar://141593108.
2024-12-20 12:02:04 -08:00
Becca Royal-Gordon
0d34b4da5b Print @abi into module interface (suppressibly) 2024-12-19 15:49:34 -08:00
Mykola Pokhylets
5ac1cba8d1 Handle versioning of the IsolatedDeinit feature 2024-12-12 16:41:02 +09:00
Mykola Pokhylets
bc80529d02 Revert "Merge pull request #77438 from swiftlang/revert-77364-mpokhylets/non-experimental-isolated-deinit"
This reverts commit 11781a5fd1, reversing
changes made to 2ee2f1eb2c.
2024-12-12 16:41:02 +09:00
Richard Howell
a007833cc0 Add IsSDKRelative field to ModuleInterfaceLayout
When serializing the module interface path of an interface that
is part of the SDK, we serialize relative to the SDK path. During
deserialization we need to know if a path was serialized relative
to the SDK or not. The existing logic assumes any relative path
has been serialized relative to the SDK, which makes it impossible
to compile modules from relative swiftinterface paths that are not
part of the SDK.

Update the swiftmodule file to include an attribute to show if the
path was serialized relative to the SDK or not, which is used
during deserialization to correctly reconstruct the interface path.
2024-12-04 08:14:59 -08:00
Saleem Abdulrasool
b660d20c85 Frontend: re-serialise static library status
When compiling the swiftmodule from the textual swift interface, ensure
that we re-serialise the static or dynamic nature of the module. This is
required for proper code generation where the static and dynamic linking
is material to symbolic references. This also opens the possibility of
optimizations on other platforms via internalisation of the symbols.

Fixes: #77756
2024-11-27 14:25:17 -08:00
Erik Eckstein
7cceaff5f3 SIL: don't print operand types in textual SIL
Type annotations for instruction operands are omitted, e.g.

```
  %3 = struct $S(%1, %2)
```

Operand types are redundant anyway and were only used for sanity checking in the SIL parser.

But: operand types _are_ printed if the definition of the operand value was not printed yet.
This happens:

* if the block with the definition appears after the block where the operand's instruction is located

* if a block or instruction is printed in isolation, e.g. in a debugger

The old behavior can be restored with `-Xllvm -sil-print-types`.
This option is added to many existing test files which check for operand types in their check-lines.
2024-11-21 18:49:52 +01:00
Allan Shortlidge
4291f07f84 ModuleInterface: Add some tests for swiftinterfaces with redundant features enabled. 2024-11-20 11:36:13 -08:00
Pavel Yaskevich
4a9d20d877 Merge pull request #77684 from xedin/switch-swiftinterface-version-to-use-Version
[Frontend] Switch `-interface-compiler-version` to `Version`
2024-11-19 08:56:58 -08:00
Meghana Gupta
1be434d954 Merge pull request #77637 from meg-gupta/lifetimeexperimental
Enable NonEscapable types by default and move lifetime dependence support under a new feature
2024-11-19 00:25:21 -08:00
Meghana Gupta
e8abd59da5 Update tests 2024-11-18 18:09:19 -08:00
Pavel Yaskevich
7c8000b3a5 [Frontend] Switch -interface-compiler-version to Version
`SWIFT_COMPILER_VERSION` has more than 4 components and it's
easier to use `Version` API over `VersionTuple` as well.
2024-11-18 15:11:36 -08:00
Artem Chikin
77fde76150 Ignore in-package transitive dependencies when building from non-package textual interface
This change ensures that when loading some module dependency 'Bar' which has a package-only dependency on 'Foo', only the following clients attempt to resolve/load 'Foo':
- Source compilation with package-name equal to that of 'Bar'.
- Textual interface compilation of a *'package'* interface with package-name equal to that of 'Bar'.

Ensuring that the following kinds of clients do not attempt to resolve/load 'Foo':
- Source compilation with package-name different to that of 'Bar'
- Textual interface compilation of a public or private interface, regardless of package name.

This fixes the behavior where previously compilation of a Swift textual interface dependency 'X' from its public or private interface, with an interface-specified package-name, from a client without a matching package-name, resulted in a lookup of package-only dependencies of modules loaded into 'X'. This behavior is invalid if we are not building from the package textual interface, becuase the module dependency graph is defined by the package name of the source client, not individual module dependency package name. i.e. In-package module dependencies are resolved/loaded only if the parent source compile matches the package name.

Resolves rdar://139979180
2024-11-18 13:29:30 -08:00
Dario Rexin
abfa450e3e Merge pull request #77597 from drexin/wip-139375022
[IRGen] Set minimum runtime availability version for CVW
2024-11-14 06:11:37 -08:00
Dario Rexin
c0c31c0613 [IRGen] Set minimum runtime availability version for CVW
rdar://139375022

CVW should not be generated when the deployment target does not have the necessary runtime functions.
2024-11-13 22:36:15 -08:00
Doug Gregor
cb6e3db847 Merge pull request #77579 from DougGregor/revert-abi-comments-printing
Revert "Emit mangled names for public symbols into the .swiftinterface"
2024-11-13 02:24:14 -08:00
Doug Gregor
34c020d5f4 Revert "Emit mangled names for public symbols into the .swiftinterface"
This reverts commit 0aff85ced7.
2024-11-12 22:38:47 -08:00
Meghana Gupta
184058e4ac Merge pull request #76588 from meg-gupta/lifetimeremovefeatureguardincompiler
Remove feature guard on lifetime dependence inference
2024-11-12 18:38:41 -08:00
Meghana Gupta
b7c4ef44e0 Update some test configs where stdlib is loaded later 2024-11-12 12:05:19 -08:00
nate-chandler
359f898bbf Merge pull request #77546 from nate-chandler/general-coro/20241110/1
[CoroutineAccessors] Ban read+_read and modify+_modify.
2024-11-12 10:40:52 -08:00
Allan Shortlidge
902892a59f AST: Print opaque result types correctly in swiftinterfaces.
Fixes a bug where references to the opaque types of other decls were printed
with the `some Type` syntax, breaking the interface. Only the opaque type
introduced by a declaration should be printed with the `some Type` syntax;
other opaque types must always be printed as a stable addresses instead.

Resolves rdar://134582913.
2024-11-11 21:52:27 -08:00
Nate Chandler
0089d4d54e [CoroutineAccessors] Ban _read+read. 2024-11-11 18:34:02 -08:00
Meghana Gupta
7383bb3475 Merge pull request #77466 from meg-gupta/lifetimeswiftsyntax
Remove -disable-experimental-parser-round-trip from @lifetime tests
2024-11-08 21:12:49 -08:00
Slava Pestov
fcd6985c53 Merge pull request #77463 from slavapestov/fix-rdar139089004
AST: Add workaround for incorrect mangling of conditional conformances with pack requirements
2024-11-08 10:45:14 -05:00
Konrad `ktoso` Malawski
b5964a05a5 Merge branch 'main' into revert-77364-mpokhylets/non-experimental-isolated-deinit 2024-11-08 09:03:21 +09:00
Meghana Gupta
84a0d9c0b2 Remove -disable-experimental-parser-round-trip from @lifetime tests 2024-11-07 14:38:01 -08:00
Alex Hoppen
fb0b3fa90c Merge pull request #77149 from Azoy/swift-syntax-integer-types
[ASTGen/Parse] Implement ASTGen changes for integer generics from Swift Syntax and restrict parsing integer types in certain contexts
2024-11-07 14:04:26 -08:00
Slava Pestov
69e3aaf6fe AST: Add workaround for incorrect mangling of conditional conformances with pack requirements
I added commit 7eecf97132 a while ago
to fix a newly-added assertion failure that came up, however this
had the inadvertent side effect of changing symbol mangling and
ASTPrinter behavior.

The problem in both instances was that we would incorrectly return
certain requirements as unsatisfied when really they are satisfied.

There is nothing to fix in the ASTPrinter, because printing redundant
requirements does not change the generic signature of the extension;
they are simply dropped. I added a test to exercise the new behavior
showing that the requirements are dropped.

As for the mangler, the fix introduced an ABI break, because the
symbol name of a conformance descriptor includes its conditional
requirements, so we must preserve the redundant requirements forever.
The IRGen test has some examples of manglings that are incorrect but
must be preserved.

I'm plumbing down a flag to isRequirementSatified() to preserve
compatibility with the old behavior where we would mangle these
redundant requirements. No other callers should pass this flag,
except for the mangler.

Fixes rdar://139089004.
2024-11-07 16:28:26 -05:00
Allan Shortlidge
817e4517de Merge pull request #77442 from tshortli/disable-availability-checking 2024-11-07 00:47:04 -08:00
Allan Shortlidge
d8be24b395 Sema: Fix -disable-availability-checking.
Suppression of diagnostics about use of unavailable declarations in
equivalently unavailable contexts now relies on querying the
`TypeRefinementContext` hierarchy. Generation of the TypeRefinementContext tree
was suppressed when `-disable-availability-checking` was specified, though,
causing some unavailability diagnostics to be emitted when they ought to be
suppressed.

Instead of refusing to generate a `TypeRefinementContext` hierarchy, instead
just avoid populating nodes for `if #available` checks for OS versions since
these checks are meant to have no effect when `-disable-availability-checking`
is specified.

Resolves rdar://138987918.
2024-11-06 17:20:31 -08:00
Konrad `ktoso` Malawski
aadc67ec0e Revert "Make IsolatedDeinit non-experimental" 2024-11-07 09:59:00 +09:00
Alejandro Alonso
400bfb227c Remove disable parser round trip on some tests 2024-11-06 13:56:06 -08:00
Allan Shortlidge
e49b248bee Frontend: Remove -disable-print-package-name-for-non-package-interface.
It is unsound to expose `package` declarations in textual interfaces without a
package identity for them to belong to so we should not offer this flag.

Resolves rdar://139361524.
2024-11-06 11:16:18 -08:00
Allan Shortlidge
b345418eca Merge pull request #77408 from tshortli/revert-package-fixes
Revert removal of `-package-name` from swiftinterfaces
2024-11-06 10:31:34 -08:00
Alex Hoppen
9a48cad432 Merge pull request #76939 from ahoppen/enable-parser-roundtrip
Enable experimental parser round-trip in test cases that no longer need it
2024-11-05 18:51:31 -08:00
Konrad `ktoso` Malawski
52d55a1426 Merge pull request #77364 from nickolas-pohilets/mpokhylets/non-experimental-isolated-deinit 2024-11-06 11:49:07 +09:00
Allan Shortlidge
49b59f69c9 Revert https://github.com/swiftlang/swift/pull/75745.
Finishes resolving rdar://139236053.
2024-11-05 14:37:56 -08:00
Allan Shortlidge
fa5b783e3f Revert https://github.com/swiftlang/swift/pull/76244.
Partially resolves rdar://139236053.
2024-11-05 14:13:39 -08:00
Artem Chikin
8e3a6207b9 Merge pull request #76915 from artemcm/AsyncScanExperiment
[Dependency Scanning] Parallelize Clang module queries
2024-11-05 10:04:31 -08:00