Commit Graph

184973 Commits

Author SHA1 Message Date
Evan Wilde
fd2ba8b95d Fix the ARM architecture on FreeBSD
The 64-bit ARM architecture spelling on FreeBSD is aarch64, not arm64.
This results in a build failure about a missing
`freebsd/arm64/swiftrt.o` while building the runtimes.
2025-05-20 21:38:41 -07:00
eeckstein
0ceb5171ff Merge pull request #81649 from eeckstein/global-inlinearray-initialization
Allow more complex InlineArray initializations to end up in a statically initialized global
2025-05-21 06:24:28 +02:00
Slava Pestov
490edfa523 Merge pull request #81564 from slavapestov/fix-issue-78191
IRGen: Fix miscompile when a generic parameter is fixed to a tuple containing a pack
2025-05-21 00:06:59 -04:00
Bassam (Sam) Khouri
a530f90a71 Revert "preset: build with no assertion for swiftpm on linux (#81217)"
This reverts commit 39cf29b8ed.
2025-05-20 22:01:48 -04:00
Augusto Noronha
c8eba86c3e Merge pull request #79171 from augusto2112/debug-info-witness-table
[DebugInfo] Emit debug info for witness tables
2025-05-21 09:23:04 +09:00
Nate Chandler
aa49b8540d [TypeLowering] Record packs used in signatures.
To determine whether an instruction may require pack metadata, the types
of its operands are examined.

Previously, the top level type was checked for having a pack in its
signature, and the whole type was checked for having a type anywhere in
its layout (via TypeLowering).  This didn't account for the case where
the metadata was required for a resilient type which uses a pack in its
signature.

Here, during type lowering, a type having a pack in its signature is
counted towards the type having a pack.

Fixes a compiler crash.

rdar://147207926
2025-05-20 16:53:28 -07:00
Nate Chandler
77376b6cfc [update-checkout] Gracefully degrade time match.
Previously, when invoking the script with match-timestamp, if the
refspec was absent, the find_rev_by_timestamp function would throw an
exception and the script would hang forever.

Here, it is first checked via `git rev-parse --verify $REFSPEC` that the
refspec actually exists in the target repo.  If it does not, the refspec
is just omitted from the command, giving the latest commit before the
currently checked out one.
2025-05-20 15:56:10 -07:00
Holly Borla
5fe71f1880 [Diagnostics] Add a brief summary to the documentation for several
concurrency errors.
2025-05-20 15:22:50 -07:00
finagolfin
98c3993503 [test] Fix IRGen/framepointer.sil for the test-simulator CI (#81643)
which generates IR without a llvm.trap function

All the normal CI generated this:
```
ret i32 %1
}

; Function Attrs: cold noreturn nounwind memory(inaccessiblemem: write)
declare void @llvm.trap() #1

attributes #0 = { "frame-pointer"=
```
But the test-simulator CI doesn't for some reason, so just check for the
closing brace instead.
2025-05-20 14:35:05 -07:00
Saleem Abdulrasool
8d15d57253 Merge pull request #81597 from compnerd/objectification
Runtimes: mark CommandLineSupporta as an OBJECT library
2025-05-20 14:12:00 -07:00
Anthony Latsis
d27a021064 Merge pull request #81633 from AnthonyLatsis/acer-campestri-2
Sema: Fix an issue with `NonisolatedNonsendingByDefault` migration fo…
2025-05-20 21:28:52 +01:00
Michael Gottesman
a6901d8006 Merge pull request #81571 from gottesmm/pr-d7a7ebea7af14e2f9f1ce266febd0c983e3fc888
[rbi] Treat a partial_apply as nonisolated(unsafe) if all of its captures are nonisolated(unsafe).
2025-05-20 11:56:06 -07:00
Erik Eckstein
47db3fcfbb Optimizer: move the getGlobalInitialization utility from OptUtils.swift to SimplifyLoad.swift
Because it's not used anywhere else anymore
2025-05-20 20:46:40 +02:00
Erik Eckstein
51fda635a5 InitializeStaticGlobals: rewrite the pass to better optimize InlineArrays
Instead of looking for a single store to the global in a global-init function, build a GlobalInitValue tree.
This is a data structure representing the init value of the global. It can handle complex InlineArray initializations,
like `init(repeating:)`.

rdar://150859232
2025-05-20 20:46:40 +02:00
Erik Eckstein
d7580e4919 Optimizer: move the Value.lookThroughTruncOrBitCast from SimplifyPointerToAddress.swift to OptUtils.swift 2025-05-20 20:46:33 +02:00
Erik Eckstein
29541fa8f1 SILGen: use builtin prepareInitialization instead of zeroInitializer when generating SIL for Builtin.emplace
`zeroInitializer` is blocking optimizations, but it is not needed because the closure of `Builtin.emplace` will initialize the memory anyway.
We only need to tell mandatory passes that this memory should be treated as initialized.
2025-05-20 20:46:33 +02:00
Erik Eckstein
9052652651 add the prepareInitialization builtin.
It is like `zeroInitializer`, but does not actually initialize the memory.
It only indicates to mandatory passes that the memory is going to be initialized.
2025-05-20 20:46:33 +02:00
Erik Eckstein
3cbe94d7d1 inliner: tune the heuristic for constructors to be inlined into global initializer functions.
Inlining constructors into global initializers increase the changes that the global can be initialized statically.
2025-05-20 20:46:33 +02:00
Erik Eckstein
e3b770853a SIL: add GlobalVariable.type 2025-05-20 20:46:33 +02:00
Ben Barham
7e63d08300 Merge pull request #81582 from bnbarham/remove-sk-diag-path
[SourceKit] Remove diagnostics path calculation
2025-05-20 11:17:01 -07:00
Stephen Canon
3aa7b592b6 Implement Builtin.select binding llvm select instruction (#81598)
Not used (yet), but needed to implement SIMD.replacing(with:where:) idiomatically, and probably useful otherwise.
2025-05-20 13:30:59 -04:00
Steven Wu
391446d4b3 [DependencyScanning] Avoid extra cc1 arg round-trip to speed up bridging
Use the underlying compiler invocation inside module scanning result to
speed up the clang module dependency bridging. This avoids converting
cc1 arguments to compiler invocation and back, just to modify the cc1
arguments needed for building PCM using swift-frontend.

rdar://151705822
2025-05-20 09:54:54 -07:00
Artem Chikin
d8176a7e89 [Compile Time Values] Add syntactic verification of valid expressions in '@const' contexts
Syntactically verify that initializer expressions of '@const' variables and argument expressions to '@const' parameters consist strictly of syntactically-verifiable set of basic values and operations
2025-05-20 09:38:36 -07:00
Justice Adams
dfa4bf7348 [cmake] include CheckCompilerFlag in CatalystSupport (#81623)
add missing import
swift-DEVELOPMENT-SNAPSHOT-2025-05-20-a
2025-05-20 11:33:14 -05:00
Mike Ash
cef762bcf9 [Test] Disable chained fixups for typeref_decoding_asan.swift.
ObjectFileContext doesn't currently support chained fixups. We previously disabled chained ifxups in some other reflection tests but not this one.

rdar://137532051
2025-05-20 12:24:24 -04:00
Pavel Yaskevich
a64984af45 Merge pull request #81572 from xedin/adopt-inheritActorContextAlways-in-Task-APIs
[stdlib] Adopt `@_inheritActorContext(always)` on `Task.immediate`
2025-05-20 09:05:35 -07:00
Pavel Yaskevich
37e1fc8794 Merge pull request #81627 from xedin/rdar-151029517
[Concurrency] Infer `@preconcurrency @MainActor` in default main acto…
2025-05-20 09:05:12 -07:00
Anthony Latsis
7e8040544d Merge pull request #81636 from AnthonyLatsis/puk
[test] Fix REQUIRES line in test
2025-05-20 16:50:27 +01:00
Henrik G. Olsson
6534b9b14f [Swiftify] Copy doc comment from clang node (#81584)
Swift nodes imported from clang don't have doc comments carried over,
but IDEs are clever enough to fetch the comments from the associated
clang node. The swift node in the macro expansion from _SwiftifyImport
doesn't have a clang node directly associated with it however.

This patch adds the same comment from the clang node to the
_SwiftifyImport macro invocation node. Since the macro has access to
this node, it can easily copy over its leading trivia.

For now the comment is not altered at all, meaning @param still remains
even if the parmeter is removed.

rdar://151346977
2025-05-20 08:06:20 -07:00
Alastair Houghton
28732f4a8b Revert "[Concurrency] Add underscore prefixes for not yet official API." 2025-05-20 15:44:26 +01:00
Egor Zhdan
2e3df1c0f3 [cxx-interop] Relax a SILVerifier assertion for immortal reference types
Immortal C++ foreign reference types get TrivialTypeLowering instead of ReferenceTypeLowering, since they do not have retain/release lifetime operations. This was tripping up an assertion in SILVerifier.

rdar://147251759 / resolves https://github.com/swiftlang/swift/issues/80065
2025-05-20 13:58:43 +01:00
Anthony Latsis
eafc48fb1a [test] Fix REQUIRES line in test 2025-05-20 12:08:44 +01:00
Charles Zablit
1b549b66a7 fix dependency issue 2025-05-20 11:17:35 +01:00
susmonteiro
72b13b3b48 [cxx-interop] Fix metadata mismatch regarding fields of structs 2025-05-20 10:15:14 +01:00
Hamish Knight
3ec3421987 Merge pull request #81604 from hamishknight/pretty-crash
Adopt `ABORT` throughout the compiler
2025-05-20 10:05:03 +01:00
Anthony Latsis
2d7e040d4d Sema: Fix an issue with NonisolatedNonsendingByDefault migration for closures
See the inline comments for more details. Depending on the closure's
type signature, sometimes adding the attribute will break code. Fix this
by also adding inferred effects to the signature in these cases.
2025-05-20 08:18:33 +01:00
finagolfin
998a6769a7 Merge pull request #81601 from finagolfin/droid
Fix standalone stdlib build on Unix and make some Android CI tweaks
2025-05-20 12:13:38 +05:30
John Hui
2c7d01fa91 [NFC] Use explicit ImportedType() constructor 2025-05-19 22:17:08 -07:00
Mishal Shah
4ba91f28e1 Merge pull request #81629 from swiftlang/drexin-patch-6
Disable layout_string_witnesses_dynamic.swift
2025-05-19 20:49:05 -07:00
Cal Stephens
9a3f33de8e Support trailing commas in types within expressions 2025-05-19 18:56:53 -07:00
Dario Rexin
b6e7f96c76 Disable layout_string_witnesses_dynamic.swift
rdar://151476435

The test is currently crashing on Amazon Linux 2, so until we have a solution, we are disabling it.
2025-05-19 18:39:34 -07:00
Pavel Yaskevich
0598b8c9f4 [stdlib] Task.immediate annotate operation parameter with @_implicitSelfCapture
Since the "operation" inherits the context of the actor it should
also be possible to reference its members without explicit use of
`self.`.
2025-05-19 18:01:23 -07:00
Pavel Yaskevich
8c05636e28 [stdlib] Concurrency: Add @_alwaysEmitIntoClient to add Task.*immediate* 2025-05-19 18:01:07 -07:00
Saleem Abdulrasool
028624c30d Runtimes: mark CommandLineSupporta as an OBJECT library
This allows compaction into swiftCore when building mirroring the
beahviour of the old build system. This matters solely when building
with a static library distribution of swiftCore where you would
previously need to explicitly link against the swiftCommandLineSupport
library when building with the new build system.
2025-05-19 17:36:49 -07:00
Joe Groff
10a80f544f Merge pull request #81583 from jckarter/resilient-types-arent-addressable-inside-resilience-domain
SIL: Resilient types don't need to be treated as addressable-for-dependencies inside their resilience domain.
2025-05-19 17:29:43 -07:00
Egor Zhdan
0c197d15c8 Merge pull request #81609 from swiftlang/egorzhdan/disable-std-function-rhel
[cxx-interop] Temporarily disable a test for `std::function` on UBI 9
2025-05-20 00:08:53 +01:00
Cal Stephens
9072d860d9 Revert changes to trailing commas in attributes like @available 2025-05-19 16:00:42 -07:00
eeckstein
017f029035 Merge pull request #81603 from eeckstein/unconditional-class-casts
IRGen: fix failing unconditional class casts
2025-05-20 00:28:33 +02:00
Pavel Yaskevich
6561476059 [Concurrency] Infer @preconcurrency @MainActor in default main actor mode for language modes < 6
`@MainActor` errors are hard errors, even in minimal concurrency checking in Swift 5 mode.
When users set the default isolation to main actor, we should infer `@preconcurrency @MainActor`
in language modes < 6 to get the right diagnostic staging behavior.

Resolves: rdar://151029517
2025-05-19 15:25:06 -07:00
John Hui
5aa5bcfea2 [NFC] [cxx-interop] Flatten findOptionSetEnum() and move it to ImportEnumInfo.cpp
It's at home there alongside other ObjC enum-specific logic, rather than
in the middle of ImportDecl.cpp (since it isn't directly or exclusively
related to importing decls).
2025-05-19 14:21:49 -07:00