Commit Graph

184374 Commits

Author SHA1 Message Date
Jonathan Grynspan
561836a6e6 [6.2] Add Equatable and Hashable conformance to GUID. 2025-10-10 17:48:06 -04:00
Henrik G. Olsson
d00f711af7 Merge pull request #84755 from hnrklssn/cherry-pick-swiftify-import-as-method-6.2
Cherry-pick [6.2] [Swiftify] Add support for free functions imported as instance methods
2025-10-10 11:00:06 -07:00
Gábor Horváth
bf2671510d Merge pull request #84768 from Xazax-hun/fix-overrelease-destroy-hoist-on-6.2
[6.2][cxx-interop] Delay lowering unowned convention until ownership elimination
swift-6.2-DEVELOPMENT-SNAPSHOT-2025-10-09-a
2025-10-09 02:40:33 +01:00
nate-chandler
b5fed1546e Merge pull request #84763 from nate-chandler/cherrypick/release/6.2/rdar161606892_2
6.2: [VariadicGenerics] Fix memeffect of metadata accessor.
2025-10-08 15:36:36 -07:00
John McCall
d42b260497 Merge pull request #84732 from rjmccall/variadic-witness-fixes-6.2
[6.2] Fix some major SILGen bugs with pack handling:
2025-10-08 16:35:09 -04:00
Gábor Horváth
40bea13e68 [6.2][cxx-interop] Delay lowering unowned convention until ownership elimination
Explanation: Unowned result conventions do not work well with OSSA. Retain the
result right after the call when we come out of OSSA so we can treat the
returned value as if it was owned when we do optimizations.

This fix a miscompilation due to the DestroyAddrHoisting pass hoisting destroys
above copies with unowned sources. When the destroyed object was the last
reference to the pointed memory the copy is happening too late resulting in
a use after free.

Issues: rdar://160462854
Original PRs: #84612
Risk: We change where retaining of the unowned return values
happen in the optimization pipeline. It is hard to anticipate all the
possible effects but it should make the optimizer more correct.
Testing: Added a compiler test.
Reviewers: @eeckstein, @atrick
2025-10-08 18:57:54 +01:00
Henrik G. Olsson
d1dbf8e3bb complete availability 2025-10-08 09:26:01 -07:00
Alejandro Alonso
2a18def9a5 Merge pull request #84749 from Azoy/62-sext-instead-of-zext
[6.2] [IRGen] Correctly sext instead of zext for negative integer types
swift-6.2-DEVELOPMENT-SNAPSHOT-2025-10-08-a
2025-10-08 08:03:43 -07:00
Alejandro Alonso
4fb9e6e1de Merge pull request #84748 from Azoy/62-deserialization-issue
[6.2] [Serialization] Serialize isAddressable on param decls
2025-10-08 08:03:15 -07:00
Nate Chandler
dab39bbf91 [VariadicGenerics] Fix memeffect of metadata accessor call.
Follow up to https://github.com/swiftlang/swift/pull/84635/.

The metadata accessor for a variadic generic type takes as arguments
packs of metadata records and witness tables, and each such pack is
passed in a buffer. So the call to any such accessor is not correctly
annotated memory(none).

rdar://161606892
2025-10-08 06:50:04 -07:00
Nate Chandler
9ab224212e [VariadicGenerics] Fix memeffect of metadata accessor.
The metadata accessor for a variadic generic type takes as arguments
packs of metadata records and witness tables, and each such pack is
passed in a buffer.  So any such accessor is not correctly annotated
`memory(none)`.

rdar://161606892
2025-10-08 06:50:04 -07:00
Henrik G. Olsson
d983f30cd3 comment test cases unsupported in Swift 6.2 2025-10-08 00:30:28 -07:00
Henrik G. Olsson
6a9ac22cd2 Merge pull request #84507 from hnrklssn/swiftify-import-as-method
[Swiftify] Add support for free functions imported as instance methods

(cherry picked from commit ed4f058c01)
2025-10-07 20:12:44 -07:00
Alejandro Alonso
fbf07e7d54 Merge pull request #84655 from Azoy/negative-nancy
[IRGen] Correctly sext instead of zext for negative integer types
2025-10-07 14:27:08 -07:00
Alejandro Alonso
9c4a299cd8 Merge pull request #84625 from Azoy/fix-lifetime-serialization
[Serialization] Serialize isAddressable on param decls
2025-10-07 14:19:23 -07:00
John McCall
fd918f1a12 Fix some major SILGen bugs with pack handling:
- Calls to variadic-generic protocol requirements weren't applying
  substitutions properly, so expansion-sensitive types in the callee
  signature weren't pairing properly with their expansions in the
  caller.

- emitPackTransform had an over-destroy if the transformation function
  actually emitted into the temporary element directly.

- There were some MV ownership assertions that were wrong, which
  revealed that the corresponding code really didn't handle consuming/
  borrowing mismatches properly at all.

- We were completely mishandled consuming packs.

Fixes #81002, #80995, and #81600.
2025-10-07 16:04:14 -04:00
Alexis Laferrière
6c8822466e Merge pull request #84670 from xymus/deser-objc-conformance-6.2
[6.2] Serialization: Align conformance recovery logic across modes
2025-10-07 09:18:11 -07:00
Andrew Trick
7992a52261 Merge pull request #84660 from atrick/62-lifedep-tempaddress-unreachable
[6.2] [NFC] LifetimeDependence computeAddressRange comments and test case
2025-10-04 05:16:35 -07:00
Andrew Trick
ed158ffdcb [NFC] LifetimeDependence computeAddressRange comments and test case
(cherry picked from commit ac9a5b6d164b3824fdfcbf638af8724ec6e2751c)
2025-10-03 20:50:02 -07:00
Andrew Trick
6039ca2240 LifetimeDependenceDiagnostics: extend temp alloc to unreachable.
When a non-Escapable value depends on the address of a trivial value, we use a
special computeAddressableRange analysis to compute the trivial value's
scope. Extend that analysis to include unreachable paths.

Fixes this pattern:

    inlineStorage.span.withUnsafeBytes

where inlineStorage is a trivial type defined in the user module. This
does not reproduce directly with InlineArray, but it is a problem for
user modules that have their own trivial wrapper around an InlineArray.

Fixes rdar://161630684 (Incorrect diagnostic: lifetime-dependent value escapes its scope)

(cherry picked from commit 98b7d5906cffa0cf7a481ba47a6acd746e388ac9)
2025-10-03 20:50:02 -07:00
Andrew Trick
57a3acf412 Comment LifetimeDependenceScopeFixup. Explain unreachable paths.
(cherry picked from commit 72ea350a9d38227dec3908521730552fe50a1909)
2025-10-03 20:50:02 -07:00
Alexis Laferrière
593b6c4e6a Serialization: Align conformance recovery logic across modes
Always give up early when attempting to deserialize a protocol
conformance broken by a context change. Don't attempt to replace missing
members of the conformance signature with invalid one, just mark the
whole protocol conformance as invalid.

The previous recovery logic, only for SourceKit mode and LLDB, was
inserting invalid conformances in the signature instead of dropping the
whole protocol conformance. It lead to failures later in the same
`finishNormalConformance` when accessing the invalid conformances.

rdar://98925842
2025-10-03 10:07:55 -07:00
Pavel Yaskevich
80f8cfbc04 Merge pull request #84654 from xedin/rdar-129359362-6.2
[6.2][TypeChecker] Avoid checking lazy property accessors if they haven't …
2025-10-03 08:54:56 -07:00
Pavel Yaskevich
d91b4647a7 [TypeChecker] Avoid checking lazy property accessors if they haven't been synthesized yet
Ttheir availability is going to match the property itself.
This is a workaround for lazy type-checking because synthesis
of accessors for such properties requires a reference to
`self` which won't be available because pattern binding
for the variable was skipped.

Resolves: rdar://129359362
Resolves: rdar://159463230
Resolves: https://github.com/swiftlang/swift/issues/84041
(cherry picked from commit 6e7de5c1e0)
2025-10-02 23:27:35 -07:00
Egor Zhdan
7885b07d97 Merge pull request #84562 from egorzhdan/egorzhdan/6.2-lifetime-methods-test
🍒[cxx-interop] Fix lifetime-operation-methods.swift
swift-6.2-DEVELOPMENT-SNAPSHOT-2025-10-01-a
2025-09-30 15:16:24 +01:00
Egor Zhdan
6fc3dfbcb4 [cxx-interop] Fix lifetime-operation-methods.swift in optimized mode
(cherry picked from commit 92c97290f1)
2025-09-29 11:54:14 +01:00
Egor Zhdan
2610a414c3 [cxx-interop] Add missing // REQUIRES: executable_test
rdar://161132127
(cherry picked from commit 172b998fae)
2025-09-29 11:54:10 +01:00
Yuta Saito
32846ed97b Merge pull request #84434 from kateinoigakukun/yt/cherry-pick-gh84215-release-6.2 swift-6.2-DEVELOPMENT-SNAPSHOT-2025-09-27-a swift-6.2-DEVELOPMENT-SNAPSHOT-2025-09-29-a 2025-09-27 07:52:29 +09:00
Mishal Shah
5117ae57d3 Merge pull request #84531 from al45tair/eng/PR-161391330
[Linux][Backtracing] Don't try to use `process_vm_readv()`.
2025-09-26 13:20:44 -07:00
Pavel Yaskevich
9ffb30354d Merge pull request #84495 from xedin/dar-157663660-6.2
[6.2][Concurrency] Prevent some extraneous function conversion sendability checking
2025-09-26 09:21:31 -07:00
Gábor Horváth
711b9dfad4 Merge pull request #84291 from Xazax-hun/handle-unowned-in-impicit-value-init-on-6.2
[6.2][cxx-interop] Handle Unowned values in implicit value ctors
2025-09-26 15:42:36 +01:00
Alastair Houghton
2b7c0aa1f6 [Linux][Backtracing] Don't try to use process_vm_readv().
We used to try to use `process_vm_readv()` if `CAP_SYS_PTRACE` is
enabled.  This avoided using signal handlers to catch crashes when
we try to read through an invalid pointer, but it complicates the
code and it turns out not to work on some Linux kernels where
the `process_vm_readv()` syscall is unavailable.

rdar://159930644
2025-09-26 08:57:04 +01:00
Owen Voorhees
5904da14c3 Merge pull request #84440 from owenv/owenv/6.2-rpath
[6.2]Update OS versions requiring stdlib OS rpaths
swift-6.2-DEVELOPMENT-SNAPSHOT-2025-09-26-a
2025-09-25 14:30:05 -07:00
Gábor Horváth
9e1b104de2 Merge pull request #84203 from Xazax-hun/handle-unowned-in-impicit-value-init
[cxx-interop] Handle Unowned values in implicit value ctors
2025-09-25 16:20:11 +01:00
Gábor Horváth
295b5c60d7 Merge pull request #84430 from Xazax-hun/unbalanced-refcount-in-pods-on-6.2
[6.2][cxx-interop] Fix over-releasing reference members of trivial C++ types
2025-09-25 16:12:02 +01:00
Egor Zhdan
14ade316f2 Merge pull request #84462 from egorzhdan/egorzhdan/6.2-retain-release-methods
🍒[cxx-interop] Allow retain/release operations to be methods
2025-09-25 15:30:48 +01:00
eeckstein
47a8384056 Merge pull request #84456 from eeckstein/fix-smallprojectionpath-6.2
[6.2] fix handling of large indices in SmallProjectionPath
2025-09-25 12:51:35 +02:00
Allan Shortlidge
cced98513f Merge pull request #84470 from tshortli/skip-isolated-deinit-availability-diags-during-emit-module-6.2
[6.2] Sema: Don't diagnose isolated deinit availability in skipped function bodies
2025-09-25 01:37:54 -07:00
Mishal Shah
aa4abecb9e Merge pull request #84506 from swiftlang/amazon-linux-2023-cherry-picks
[6.2] XFAIL `Interop/cxx/stdlib/use-std-function.swift` on Amazon Linux 2023
2025-09-24 20:46:20 -07:00
Andrew Sukach
a6d356d9a9 XFAIL Interop/cxx/stdlib/use-std-function.swift on Amazon Linux 2023
(cherry picked from commit 1a144932a7)
2025-09-24 20:44:36 -07:00
Mishal Shah
cbad8a5d9d Merge pull request #84194 from swiftlang/fedora-41-swift-6.2
[6.2] Fix/disable tests for Fedora 41
2025-09-24 20:41:22 -07:00
Adrian Prantl
955e590dfc Merge pull request #84497 from adrian-prantl/move-xfail-config-6.2
[windows] move llvm test overrides to the llvm-project repository
2025-09-24 20:31:27 -07:00
Charles Zablit
459a69232b [windows] move llvm test overrides to the llvm-project repository
(cherry picked from commit e48c9a42f7)
2025-09-24 12:48:41 -07:00
Pavel Yaskevich
a886c5f38a [Concurrency] Prevent extraneous sendability checking when applying nonisolated(nonsending)
`nonisolated(nonsending)` is not presented in interface types
which means that references to declarations that have this attribute
require a function conversion to apply it. Function conversion
checking should detect that and avoid sendability checking for
situations like that but there is really no conversion there.

(cherry picked from commit ce3310050b)
2025-09-24 12:06:26 -07:00
Pavel Yaskevich
18809358e1 [Concurrency] Avoid Sendable checking for conversions that strip @Sendable from nonisolated(nonsending) function type
The isolation doesn't change in this cause and making function type
non-Sendable means that it woun't be able to leave the current concurrency
domain and the compiler won't generate a thunk.

(cherry picked from commit 40c9674dfd)
2025-09-24 12:06:25 -07:00
Pavel Yaskevich
4699419dab [Concurrency] Check function conversions after their sub-expressions have been checked
Explicit closure expressions gets their isolation inferred during
actor isolation checking, if they appear as a sub-expression to
a function conversion we need to delay function checking until
the closure was processed. It shouldn't matter for other cases.

(cherry picked from commit 61fbaa7af7)
2025-09-24 12:05:59 -07:00
Pavel Yaskevich
641cfe06be [Concurrency] Fix @Sendable closures not inferring nonisolated(nonsending)
If there are no explicit concurrency attributes, isolated parameters,
or captures associated with the closure it should infer `nonisolated(nonsending)`
for the parent conversion injected by the solver (this conversion is injected
because the solver cannot check captures to elide it).

The change pushes `isIsolationInferenceBoundaryClosure` check down
with added benefit of getting preconcurrency context from the parent.

(cherry picked from commit 3ae34e8e68)
2025-09-24 12:05:51 -07:00
Andrew Trick
232511f037 Merge pull request #84408 from atrick/62-fix-test-utf8
[6.2] Mark a UTF8Span test unavailable on watchOS.
swift-6.2-DEVELOPMENT-SNAPSHOT-2025-09-24-a
2025-09-23 13:05:30 -07:00
Allan Shortlidge
8f61ec2c71 Sema: Don't diagnose isolated deinit availability in skipped function bodies.
As a follow-up fix for https://github.com/swiftlang/swift/pull/83545, avoid
incorrectly diagnosing isolated deinit availability during module emission
jobs, which skip type checking non-inlinable function bodies and therefore
don't build accurate availability scopes for those bodies. It's ok to skip
these diagnostics during module emission since they should still be emitted
during compilation jobs.

Resolves rdar://161178785.
2025-09-23 12:05:26 -07:00
Egor Zhdan
c5c33d6c5a [cxx-interop] Allow retain/release operations to be methods
Some foreign reference types such as IUnknown define retain/release operations as methods of the type.

Previously Swift only supported retain/release operations as standalone functions.

The syntax for member functions would be `SWIFT_SHARED_REFERENCE(.doRetain, .doRelease)`.

rdar://160696723
(cherry picked from commit e78ce6165f)
2025-09-23 14:45:41 +01:00