Commit Graph

45942 Commits

Author SHA1 Message Date
Steven Wu
bd23859a4a Merge pull request #80751 from cachemeifyoucan/eng/PR-148465899-6.2
[6.2][Caching][Macro] Make macro plugin options cacheable
2025-04-15 09:05:33 -07:00
Doug Gregor
50f0ebca9f Drop the ".md" suffix from diagnostic group file names in GROUP
While here, document the GROUP macro appropriately.
2025-04-15 07:03:22 -07:00
Doug Gregor
214ba6d55b Fix bad merge in feature definition 2025-04-14 17:03:28 -07:00
Doug Gregor
89f246985e Collapse two implementations into ExistentialLayout::containsNonMarkerProtocols
(cherry picked from commit 53707a121c)
2025-04-14 16:38:41 -07:00
Doug Gregor
5e29333d6b [SE-0470] Enable isolated conformances by default
The IsolatedConformances feature moves to a normal, supported feature.
Remove all of the experimental-feature flags on test cases and such.

The InferIsolatedConformances feature moves to an upcoming feature for
Swift 7. This should become an adoptable feature, adding "nonisolated"
where needed.

(cherry picked from commit 3380331e7e)
2025-04-14 16:38:22 -07:00
Doug Gregor
69758f6213 [SE-0470] Downgrade some isolated conformance-related errors to warnings in Swift 5
(cherry picked from commit e8b3065293)
2025-04-14 16:36:57 -07:00
Doug Gregor
49ebfcbab2 Move generic signature check for isolated conformances into GenericSignatureImpl
This is going to need a proper implementation in the requirement
machine. For the moment, provide a slightly-less-broken implementation
but leave a test case where we incorrectly accept racey code.

(cherry picked from commit 92774e0a3c)
2025-04-14 16:36:54 -07:00
Gábor Horváth
ae55f3e4ec Merge pull request #80631 from swiftlang/gaborh/nested-foreign-type-metadata-on-6.2 2025-04-14 11:10:25 -07:00
Gábor Horváth
710c26e87d Merge pull request #80710 from swiftlang/gaborh/escapable-type-nonesc-field-on-6.2 2025-04-14 11:10:04 -07:00
Gábor Horváth
06c8e8fc0d Merge pull request #80721 from swiftlang/gabroh/safe-wrappers-in-prod-on-6.2 2025-04-14 11:09:47 -07:00
Konrad 'ktoso' Malawski
059e5dd15e [Concurrency] Parent task cancellation must cancel task group itself.
Seems that during refactorings of child cancellations we somehow missed
also cancelling the group itself. It seems we did not have good test
coverage of the addTaskUnlessCancelled somehow and thus this slipped
through.

This adds a regression test for addTaskUnlessCancelled and fixes how we
handle the cancellation effect in TaskStatus.

resolves #80789
resolves rdar://149177600
2025-04-14 17:43:55 +09:00
Alastair Houghton
55ec37253e [Concurrency] Fix size of AsyncTask::PrivateStorage.
Because `TaskAllocator` is not a round multiple of the machine word
size on 64-bit platforms, I think we end up with padding before the
`TaskLocal::Storage` following it, which makes the `PrivateStorage`
structure larger than the calculation in `ABI/Task.h`.

rdar://149067144
2025-04-14 09:28:50 +01:00
Alastair Houghton
670be7df63 [Concurrency] Remove -executor-factory option and replace with magic type.
We decided that using a magic typealias to set the executor factory was better
than using a compiler option. Remove the `-executor-factory` option, and replace
by looking up the `DefaultExecutorFactory` type, first in the main module, and
then if that fails in Concurrency.

rdar://149058236
2025-04-14 09:23:03 +01:00
Andrew Trick
097dba34ff Merge pull request #80709 from atrick/62-irgen-addressable
[6.2] Fix IRGen for @_addressable params which may be "captured".
2025-04-11 18:03:01 -07:00
Nate Chandler
ce510590d9 NFC: [OSSACompleteLifetime] Allow forced verifying 2025-04-11 17:24:50 -07:00
Nate Chandler
cb0dafba55 [Gardening] OSSACompleteLifetime: Add slash to doc 2025-04-11 17:24:50 -07:00
nate-chandler
08e3a98ad7 Merge pull request #80741 from nate-chandler/cherrypick/release/6.2/rdar148941214
6.2: [CoroutineAccessors] Use yield_once_2 on Darwin and Linux.
2025-04-10 22:43:52 -07:00
Steven Wu
f96b81975a [Caching][Macro] Make macro plugin options cacheable
Currently, the macro plugin options are included as cache key and the
absolute path of the plugin executable and library will affect cache
hit, even the plugin itself is identical.

Using the new option `-resolved-plugin-validation` flag, the macro
plugin paths are remapped just like the other paths during dependency
scanning. `swift-frontend` will unmap to its original path during the
compilation, make sure the content hasn't changed, and load the plugin.
It also hands few other corner cases for macro plugins:

* Make sure the plugin options in the swift module is prefix mapped.
* Make sure the remarks of the macro loading is not cached, as the
  mesasge includes the absolute path of the plugin, and is not
  cacheable.

rdar://148465899
(cherry picked from commit 3d38d0dd56)
2025-04-10 16:52:15 -07:00
fahadnayyar
c37700b316 Merge pull request #80715 from swiftlang/fahadnayyar/6.2/cxx-frt-ctor
🍒 [6.2] [cxx-interop] Import public constructor of C++ foreign reference types as Swift initializers
2025-04-10 15:47:05 -07:00
Nate Chandler
77055a5eb1 [CoroutineAccessors] Control ABI via flag. 2025-04-10 14:47:05 -07:00
Mike Ash
7a3393c677 Merge pull request #80696 from mikeash/move-priority-escalation-define-6.2
[6.2][Concurrency] Move SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION to ABI/Task.h.
2025-04-10 17:39:24 -04:00
Andrew Trick
e048dd1cf1 Fix IRGen for @_addressable params which may be "captured".
Simply omit the 'nocapture' attribute on the parameter.

Fixes rdar://148039510 ([nonescapable] IRGen: lower addressable
params to LLVM: captures(ret: address, provenance))

(cherry picked from commit 2d9df8ff78)
2025-04-10 09:43:13 -07:00
Gabor Horvath
8caef318cf [cxx-interop] Make safe interop wrapper accessible in production compilers
Explanation: The experimental feature flag was not available for production
compilers. There is no reason for that.
Issue: rdar://148961491
Risk: Low, no functional changes other than making the flag available.
Original PR: #80713
Reviewer:
2025-04-10 16:06:44 +01:00
fahadnayyar
f3ecb7ea8b [cxx-interop] convert CXXForeignReferenceTypeInitializers into SuppressCXXForeignReferenceTypeInitializers to be an opt-out flag
Turning the feature "ctor of C++ foreign reference types is callable as Swift Initializers" on by default.

rdar://148285972
2025-04-10 05:55:05 -07:00
Meghana Gupta
b3881cde1d Merge pull request #80645 from meg-gupta/lifetimeinoutcp
[6.2] Add support for inout lifetime dependencies
2025-04-10 03:04:28 -07:00
Gábor Horváth
8c4be8a37d [6.2][cxx-interop] Diagnose Escapable C++ types with non-escapable fields
Explanation: In Swift, Escapable types cannot have non-escapable stored
properties. Unfortunately, these checks could be circumvented via C++
interop, constructing invalid Swift code. This patch errors out on
importing C++ code of this shape.
Issue: rdar://148899224
Risk: Low, the fix is fairly targeted to the affected scenario.
Testing: Added tests to test suite
Original PR: #80671
Reviewer: John Hui
2025-04-10 10:23:57 +01:00
Andrew Trick
8802395ab3 Merge pull request #80652 from atrick/62-address-specialize
[6.2] Fix GenericSpecializer for addressable parameters.
2025-04-09 13:53:07 -07:00
Mike Ash
e95a12fc6e [6.2][Concurrency] Move SWIFT_CONCURRENCY_ENABLE_PRIORITY_ESCALATION to ABI/Task.h.
We check it in Task.h so it needs to be defined by that point.

(cherry picked from commit 8fa76431e2)
2025-04-09 16:18:35 -04:00
Mike Ash
29db1eca14 Merge pull request #80644 from mikeash/fix-task-sizes-6.2
[6.2][Concurrency] Fix task status and private storage sizes.
2025-04-09 13:37:37 -04:00
Steven Wu
496885702d [BridgingHeaderChaining] Bind bridging header module when load module
When loading a module with embedded bridging header, bind the bridging
header module in the context when bridging header auto chaining is used.
This is because all the bridging header contents are chained into a PCH
file so binary module with bridging header should reference the PCH file
for all declarations.

rdar://148538787
(cherry picked from commit 02ee2f4d62)
2025-04-09 10:31:41 -07:00
Meghana Gupta
00bda986a9 Introduce InoutLifetimeDependence feature 2025-04-09 10:19:11 -07:00
Meghana Gupta
374ceb6a80 [NFC] Update diagnostic msg 2025-04-09 10:18:11 -07:00
Meghana Gupta
96aeea9f2b Rename ParsedLifetimeDependenceKind::Scope -> ParsedLifetimeDependenceKind::Borrow 2025-04-09 10:18:11 -07:00
Meghana Gupta
91ad1451ce Add support for @lifetime(&arg) 2025-04-09 10:18:11 -07:00
Andrew Trick
4608c06f78 Fix GenericSpecializer for addressable parameters.
Addressable parameters must remain indirect.

Incidentally also fixes an obvious latent bug in which all specialization was
disabled if any metatypes could not be specialized.

Fixes rdar://145687827 (Crash of inline-stored Span properties with optimizations)

(cherry picked from commit 935b5e7ea2)
2025-04-08 14:02:19 -07:00
Andrew Trick
78c9fe4c56 Add SILFunctionType::isAddressable & ApplySite::isAddressable.
(cherry picked from commit 501abb0975)
2025-04-08 14:02:19 -07:00
Andrew Trick
da2894ba2c [NFC] fix a dropUnusedArguments parameter name
(cherry picked from commit 6898e33edd)
2025-04-08 14:02:18 -07:00
Mike Ash
7edc799b16 [6.2][RemoteMirror] Fix AsyncTask child iteration.
Iterating child tasks depends on knowing the size of AsyncTask, and changing the size of the task broke it. Instead of relying on mirroring the full structure in our out-of-process definitions, add a debug variable to libswift_Concurrency that contains the size of AsyncTask.

While we're there, add some more validation to child task enumeration. Check each child task's metadata pointer to make sure that it actually points to the AsyncTask metadata, and have the inner loop also increment and check ChildTaskLoopCount to stop runaway iteration in that loop.

rdar://148836760

(cherry picked from commit e3057031da)
2025-04-08 15:23:05 -04:00
Mike Ash
aa2b4e3322 [6.2][Concurrency] Fix task status and private storage sizes.
ActiveTaskStatusSize is 2 words, not 4, on most targets.

PrivateStorageSize is measured in bytes, not words, so the Storage field needs to be a char[].

(cherry picked from commit d1cb5d9c26)
2025-04-08 15:23:05 -04:00
Allan Shortlidge
38e56fcec0 ModuleInterface: Guard declarations that use the $CustomAvailability feature. 2025-04-08 10:35:33 -07:00
Allan Shortlidge
1cd636d9b3 Serialization: Encode custom availability domains.
When serializing `@available` attributes, if the attribute applies to a custom
domain include enough information to deserialize the reference to that domain.

Resolves rdar://138441265.
2025-04-08 10:35:32 -07:00
Gábor Horváth
8e6daf75ec [6.2][cxx-interop] Fix a rare compilation error in reverse interop header
Explanation: Fix a compilation error in the generated reverse interop
header when a nested foreign type is used in a generic context and it is
reexposed to C++.
Issue: rdar://148597079
Risk: Low, the fix is fairly targeted to the affected scenario.
Testing: Added tests to test suite
Reviewer: @egorzhdan
2025-04-08 11:32:08 +01:00
Hamish Knight
e8c85fa34b Merge pull request #80599 from hamishknight/cap-req-6.2
[6.2] [Sema] Requestify PatternBindingDecl capture computation
2025-04-08 03:30:47 +01:00
Hamish Knight
ca76d7e7e5 Merge pull request #80597 from hamishknight/message-in-a-crash-log-6.2
[6.2] [Mangler] Include verification errors in the crash log
2025-04-08 02:04:43 +01:00
nate-chandler
88fb10ed3b Merge pull request #80589 from nate-chandler/cherrypick/release/6.2/rdar148744816
6.2: [SIL] Fix bridged begin_apply results.
2025-04-07 16:46:48 -07:00
eeckstein
8975d1e7de Merge pull request #80578 from eeckstein/isolated-conformance-opt-6.2
[6.2] CastOptimizer: handle isolated conformances
2025-04-07 20:25:20 +02:00
Hamish Knight
362a239b02 Merge pull request #80581 from hamishknight/mangle-less-6.2
[6.2] [Mangler] Avoid mangling local discriminator for attached macros
2025-04-07 18:58:30 +01:00
Hamish Knight
999169e7ae [Sema] Requestify PatternBindingDecl capture computation
Introduce `PatternBindingCaptureInfoRequest`, and kick it after
contextualizing a property initializer. This ensures it gets run
for stored properties added by macro expansions.

rdar://143429551
2025-04-07 17:29:36 +01:00
Hamish Knight
fd7c2595f2 [Basic] Introduce abortWithPrettyStackTraceMessage
Introduce a convenience for aborting while printing a given message
to a frame of the pretty stack trace. Use this in the existing places
where we're currently doing this.
2025-04-07 17:05:35 +01:00
Joe Groff
5d81f4d83a Merge pull request #80544 from jckarter/canonicalize-integer-generic-parameters-6.2
[6.2] Canonicalize different spellings of the same integer generic parameter.
2025-04-07 08:00:00 -07:00