Commit Graph

184973 Commits

Author SHA1 Message Date
Mike Ash
5382e12d60 Merge pull request #81824 from mikeash/globalactorreference-ptrauth
[Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
2025-05-29 15:57:39 -04:00
Hamish Knight
c287f53580 Merge pull request #81809 from hamishknight/range-expansion
[SourceKit] Properly handle cursor info range for macro expansions
2025-05-29 20:23:54 +01:00
Philipp Gabriel
0d9be9750f [Sema] Type inference from default expression doesn’t compile in free function (#79989)
This is an attempt to solving
https://github.com/swiftlang/swift/issues/72199.
As I've already lined out in the issue, this seems to be a two-fold
problem.

The first one was a rather easy fix, as I've seen similar approaches in
different parts of the codebase. It is pretty much just un-currying the
generic function.

The second problem was, that `DependentMemberType`s were counted towards
the generic-parameter-should-only-be-mentioned-once-limit even though
you cannot infer the generic type from the dependent member type.
2025-05-29 20:21:35 +01:00
Mike Ash
c9329db81c Merge pull request #81814 from mikeash/taskgroup-fixes
[Concurrency] Fix races/overflows in TaskGroup implementation.
2025-05-29 14:25:27 -04:00
Ryan Mansfield
257e833c27 Re-add UNSUPPORTED for watchos arm64_32 in lto_autolink.swift.
Tests are failing with:

<unknown>:0: error: unknown target triple 'arm64_32-unknown-linux-gnu'
<unknown>:0: error: clang importer creation failed
2025-05-29 14:22:44 -04:00
susmonteiro
c3077bfedb [cxx-interop] Ensure field offset vector matches the structs/fields metadata 2025-05-29 18:35:30 +01:00
Andrew Trick
51090b62bb LifetimeDependenceInsertion: allow dependency on Builtin.addressof()
This mostly makes it easier to test dependency corner cases. The analysis still
doesn't recognize UnsafeRawPointer.init(), so regular users still need to use
_overrideLifetime.

Fixes rdar://137608270 ([borrows] Add Builtin.addressof() support
for @addressable arguments)
2025-05-29 10:27:03 -07:00
Alastair Houghton
d110464649 [Build] Fix macos vs macosx issue.
The module triple bizarrely omits the "x" from "macosx".

Also disable some of this code on non-Apple platforms.

rdar://150944675
2025-05-29 18:18:44 +01:00
Hamish Knight
b7d26fdfde [test] Add some known type-checker + parser crashers 2025-05-29 16:23:50 +01:00
Anthony Latsis
43e79a3d3b [test] Match nocapture to succeed both on main and rebranch in reenabled tests
Both the syntax and relative order of the LLVM `nocapture` parameter
attribute changed upstream in
https://github.com/llvm/llvm-project/pull/123181.
To reduce conflicts with rebranch, adjust FileCheck patterns to expect
both syntaxes and orders anywhere the presence of the attribute is not
critical to the test. These changes are temporary and will be cleaned
up once rebranch is merged into main.
2025-05-29 15:10:09 +01:00
Anthony Latsis
0a1b8b0d50 [test] Fix misspelled FileCheck directives 2025-05-29 15:09:36 +01:00
Anthony Latsis
9753d23597 Merge pull request #81819 from AnthonyLatsis/neotrygon
Basic: Adjust condition for include after macro removal in upstream LLVM
2025-05-29 15:06:51 +01:00
eeckstein
d29da0a6d9 Merge pull request #81830 from eeckstein/fix-simplify-apply
SimplifyApply: don't do the raw-enum comparison optimization for custom RawRepresentable enums
swift-DEVELOPMENT-SNAPSHOT-2025-05-29-a
2025-05-29 12:58:18 +02:00
Erik Eckstein
1a5ea19a85 SimplifyApply: don't do the raw-enum comparison optimization for custom RawRepresentable enums
Because we don't know what the custom `rawValue` can do.

Fixes a miscompile
rdar://152143111
2025-05-29 08:12:17 +02:00
Erik Eckstein
28985f4d41 Swift AST: add var EnumDecl.hasRawType 2025-05-29 08:12:17 +02:00
Ryan Mansfield
44ec621980 Add %target-codesign to executables and dylibs in newly added AutoDiff tests. 2025-05-28 23:13:30 -04:00
Mike Ash
ea785c191c [Runtime] Add ptrauth attribute to TargetGlobalActorReference conformance pointer.
When the TargetGlobalActorReference conformance is an indirect pointer, the indirect pointer is signed when ptrauth is enabled.

rdar://151945202
2025-05-28 21:06:20 -04:00
Mike Ash
5be22fa7cc [Concurrency] Fix races/overflows in TaskGroup implementation.
statusCompletePendingReadyWaiting(), offer(), and poll() did a one-off compare_exchange_strong which could fail if the group was concurrently cancelled. Put these into loops so that they are retried when needed.

DiscardingTaskGroup creation passed the group result type as the task result type. waitAll() would then use the group result type when collecting task results. Since the task result type is always Void in this case, this would overflow the result buffer if the group result type was larger. This often works as it writes into the free space of the task allocator, but can crash if it happens to be at the end of a page or the group result type is particularly large.

rdar://151663730
2025-05-28 20:58:33 -04:00
Owen Voorhees
95d9de1ec8 [update-checkout] Update swift-system to 1.5.0 2025-05-28 17:37:58 -07:00
Ben Barham
3c098782b4 Add the distribution tag to -print-target-info
Ideally this would also update the `--version` output to be overridden
by `SWIFT_TOOLCHAIN_VERSION`, but unfortunately various tools rely on
the current format (eg. swift-build).
2025-05-28 17:29:17 -07:00
Andrew Trick
f39044d4f3 Re-enable a test case in lifetime_depende_infer.swiftinterface.
This is fixed:
rdar://150073405 ([SILGen] support synthesized _modify on top of
borrowed getters with library evolution)
2025-05-28 16:14:11 -07:00
Konrad `ktoso` Malawski
8b4740f0cc Merge pull request #81797 from ktoso/wip-handle-public-import-distributed-awareness
[Distributed] account Distributed module use from DA declarations
2025-05-29 08:04:24 +09:00
Anthony Latsis
e7b2bc0d08 Basic: Adjust condition for include after macro removal in upstream LLVM
`HAVE_SYS_RESOURCE_H` was removed in
https://github.com/llvm/llvm-project/pull/123288, so this header is no
longer included at this particular location on rebranch, which breaks
the Linux build, where it is not transitively included either.

Use the same condition as in the use site
(`getChildrenMaxResidentSetSize`) instead.

Also, don't wrap `HAVE_GETRUSAGE` in `defined()` in case it does get
defined to 0.
2025-05-28 23:02:15 +01:00
michael-yuji
8738e722bd Merge branch 'main' into mchiu/freebsd 2025-05-28 14:44:11 -07:00
Pavel Yaskevich
d83ec7b3a5 [Diagnostics] Diagnose existential mismatch in a literal collection element position
If key or value of a literal collection expression doesn't conform
to protocol(s) expected by the contextual existential type, let's
diagnose that via a tailed collection mismatch fix instead of a
generic conformance one.

Resolves: rdar://103045274
2025-05-28 14:33:18 -07:00
Pavel Yaskevich
b3e9cf3424 [Diagnostics] Use argument mismatch fix for @autoclosure result positions
`@autoclosure` is associated with a parameter, we use argument mismatch fix
to diagnose missing explicit calls as well as any mismatches in that position.

Resolves: rdar://110527062
2025-05-28 14:33:18 -07:00
Pavel Yaskevich
ef2fa4a1b6 [Diagnostics] Don't attempt to force unwrap invalid optional chaining in the argument position
If the argument has an extra `?` or `!`, let's not attempt to force
optional (because it's use is already invalid) and re-introduce
the constraint with unwrapped type instead. This would help to diagnose
the invalid chaining as well as any argument to parameter mismatches.

Resolves: rdar://126080504
2025-05-28 14:33:17 -07:00
Pavel Yaskevich
5059f81da0 [Concurrent] Restored old symbol for obsoleted Task.startSynchronously
https://github.com/swiftlang/swift/pull/80821 added `@isolated(any)`
which is an ABI breaking change but since we are not planning to keep
this API around, let's use `@_silgen_name` to bring the old name back
for now.

Resolves: rdar://152178221
2025-05-28 14:27:02 -07:00
Guillaume Lessard
3d70e6087d [stdlib] fix an extraneous symbol exported by MutableSpan 2025-05-28 13:32:21 -07:00
Mykola Pokhylets
847a7d247b Update comments 2025-05-28 21:25:37 +02:00
Arnold Schwaighofer
7ac551636b Merge pull request #81714 from aschwaighofer/se0460
SE-0460: Introduce @specialized attribute
2025-05-28 12:03:48 -07:00
Nate Chandler
94e7582d93 [IRGen] This ArtificialLoc requires a debug scope.
An `IRGenFunction` may not have a debug scope--for example, a dispatch
thunk--but creating an `AritificalLocation` requires one.  Only create
an `ArtificalLocation` here if the `IRGenFunction` has one.

Unfortunately, I don't have an isolated test case.  Fixes a compiler
crash.
2025-05-28 11:19:03 -07:00
Hamish Knight
f6c73cd178 [SourceKit] Properly handle cursor info range for macro expansions
Make `getOriginalLocation` work with source ranges, and adjust the
cursor info logic to map the range into the original buffer. This
fixes the case where we were using bogus range lengths for macro
expansion decls.

rdar://151411756
2025-05-28 18:51:40 +01:00
Erik Eckstein
d8b5b3dc95 Swift SIL: Fix argument conventions for functions which have both, a direct and indirect result.
The function convention for the first argument is not identified as indirect-out.
This lets alias analysis assume that the memory pointed to by argument 0 cannot be written by the called function.

The problem is that subscripting a LazyFilterCollection (with the base index, e.g. `Int`) does not work as expected, because it returns the nth element of the base collection!
The fix is to implement the subscript "manually".

Fixes a mis-compile.
rdar://152160748
2025-05-28 18:05:34 +02:00
Yuta Saito
94b40d1bde Merge pull request #81799 from kateinoigakukun/yt/unify-wasmllvmruntime-build-dir
[wasm] Unify WasmLLVMRuntimeLibs and WasmThreadsLLVMRuntimeLibs build directories
2025-05-28 23:31:37 +09:00
Alastair Houghton
7e318e2c91 [Build] Use FATAL_ERROR, not ERROR.
We should be using `FATAL_ERROR` for error messages from CMake, not
just `ERROR`.
2025-05-28 14:55:49 +01:00
Alastair Houghton
c749e64f93 [Build] Fix variable name in new build system.
It should have been `SwiftCore_MODULE_TRIPLE`, not
`SwiftCore_SWIFT_MODULE_TRIPLE`.
2025-05-28 14:49:42 +01:00
Konrad `ktoso` Malawski
ff8b9f1453 [Distributed] fix typo in CHECK assertions (#81795)
... in distributed_actor_accessor_thunks_32bit.swift

Spotted a typo while skimming through the test so let's fix it. it
should be CHECK-SAME and not CHECK_SAME which would just do nothing
2025-05-28 00:24:11 -07:00
eeckstein
89bdb311ab Merge pull request #81780 from eeckstein/optimize-enum-comparison
Optimize enum comparisons
2025-05-28 07:01:29 +02:00
Yuta Saito
1592c9e2b3 [wasm] Unify WasmLLVMRuntimeLibs and WasmThreadsLLVMRuntimeLibs build directories
Having separate build product does not make sense and just adds
complexity to manage build directory names.
2025-05-28 04:14:23 +00:00
Konrad 'ktoso' Malawski
3b94f009d6 [Distributed] account Distributed module use from DA declarations
When issuing warnings about an import not needing to be public, we did
not account for the Distributed module MUST be imported when a
distributed actor is declared. This also actually means that a public
distributed actor effectively is a public use of the DistributedActor
protocol

resolves rdar://152129980
2025-05-28 12:54:07 +09:00
Joe Groff
dd59797638 Merge pull request #81617 from jckarter/no-non-escapable-property-descriptors
SILGen: Emit property descriptors for conditionally Copyable and Escapable types.
2025-05-27 19:22:56 -07:00
Marc Prud'hommeaux
cb3293b2e5 Update CI summary table on README to be more compact (#81647)
This PR updates the CI summary table in the README.md to summarize all
architectures for a host to be on the same line with the architecture
specified in the badge itself (rather than a generic "build" label),
thereby enabling the whole CI status to be visible on a single page.

It also adds accessibility labels to each of the CI badges for Global
Accessibility Awareness Month.
2025-05-27 17:23:55 -07:00
Michael Gottesman
6545a00df0 Merge pull request #81785 from gottesmm/pr-1489f56770ad7e22ae73fd5f1bdcc702edabba19
[region-isolation] Add a test showing that we do not infer nonisolated(unsafe) onto named closures.
2025-05-27 14:35:14 -07:00
Konrad `ktoso` Malawski
31b6ae2fcf Merge pull request #80984 from ktoso/task-names-update
[Concurrency][SE-review update] Task names update
2025-05-28 06:23:49 +09:00
Meghana Gupta
1998f416a5 Merge pull request #81678 from meg-gupta/fixsubst
Fix use-after-free on substituting function type involving conditional ~Escapable with Escapable type
2025-05-27 12:47:29 -07:00
Stephen Canon
592d72bba9 Concrete SIMD.init(repeating:) and SIMD.init(lowHalf:highHalf:) optimizations (#81766)
WIP to add more overloads to optimize SIMD codegen on concrete types.
Here we do:

- init(repeating:)
- init(lowHalf:highHalf:)

These are always inlined, even in debug, since LLVM knows how to lower
them to one or two instructions on the targets that we care about.
2025-05-27 15:15:13 -04:00
Michael Gottesman
746414bcd8 Merge pull request #81716 from gottesmm/pr-b82786e1ebbf00a9de46d342f0694a28999bc178
[send-non-sendable] Recurse to the full underlying value computation instead of just the object one when computing the underlying object of an address.
2025-05-27 11:39:48 -07:00
Allan Shortlidge
54e09736ef Merge pull request #81781 from tshortli/member-import-visibility-fixit-implicitly-internal
Sema: Omit `internal` from `MemberImportVisibility` fix-its when appropriate
2025-05-27 11:00:03 -07:00
Steven Wu
2999ab722d Merge pull request #81454 from cachemeifyoucan/clang-scanner-invocation-callback
[DependencyScanning] Avoid extra cc1 arg round-trip to speed up bridging
2025-05-27 10:58:35 -07:00