Commit Graph

200693 Commits

Author SHA1 Message Date
Doug Gregor da170e7e8e [Embedded] Only emit global variables from another module if they are @used 2026-05-20 08:35:25 -07:00
Doug Gregor 047932a6d4 Prevent CMO from serializing an @export(interface) global variable 2026-05-20 08:35:23 -07:00
Doug Gregor 92dcbd17c6 [SIL] Explicitly keep the code generation model in SILGlobalVariable
Just like we do with SILFunction, allow a code generation model to be
specified on a SILGlobalVariable and maintain that through the printed
and serialized forms.
2026-05-20 08:35:22 -07:00
Doug Gregor ae942071ae @export(interface|implementation) on a property affects its accessors 2026-05-20 08:35:22 -07:00
Doug Gregor 5241b7492a Address code review comments 2026-05-20 08:35:22 -07:00
Doug Gregor 5e94f94926 Disable tests for wasm for the moment 2026-05-20 08:35:20 -07:00
Doug Gregor b393f0bfa8 [Embedded] Eliminate special-case handling of declarations used externally
Declarations that are potentially used externally, including those
exposed to foreign languages (e.g., via `@c`), placed in a specific
section (`@section`), or explicitly marked used (`@used`) are
generally eagerly emitted in IR. Embedded Swift was overriding this in
a partial manner, applying specific linkage rules to them to force
them to have unique definitions (regardless of the code generation
model) and then overriding the behavior later on when it came to lazy
emission.

Remove the special cases for Embedded. These declarations will now
follow the same linkage rules as all other declarations, greatly
simplifying the "is non-unique definition" check, and will be
considered as being emitted non-lazily.
2026-05-20 08:35:18 -07:00
Doug Gregor 7e07babbd0 Fix test for ELF 2026-05-20 08:35:14 -07:00
Doug Gregor 7d48e98f5e Replace the DeferredCodeGen feature with CodeGenerationModel=<model>
The default code generation model for Embedded Swift is "inlinable".
DeferredCodeGen made the default code generation model
"implementation", and there was no spelling for "interface".

Introduce the experimental feature CodeGenerationModel=<model>, which
can be any of those three options. The default remains "inlinable", but
one can now specify "implementation" (which keeps most everything in
SIL) or "interface" (which only keeps the generic things in SIL). The
"interface" mode is more like non-embedded Swift for non-generic
declarations, emitting them into the IR (only) but not SIL. Generic
declarations would remain in SIL.

Implements rdar://172433062.
2026-05-20 08:35:13 -07:00
Doug Gregor 14bc0baecf Introduce the notion of an "effective" code generation model
The code generation model for a particular declaration or conformance
can be defined explicitly with `@export(interface)`,
`@export(implementation)`, or `@inlinable` (for declarations),
indicating where the definition will occur.

Embedded Swift also has some limitations on what can be emitted into
IR. For example, a generic function cannot be `@export(interface)`
because Embedded Swift does not support unspecialized generics.

Compute the effective code generation model based on what was
explicitly specified, the limitations of the model, and the default
code generation model for the given module, which defaults to
"inlinable" but can be made "implementation" by the DeferredCodeGen
feature. Use the effective code generation model for IR- and SIL-level
determinations of linkage and where to emit symbols.
[WIP] Start computing and using the "effective" code generation model

FIXUP linkage of the alias symbol
2026-05-20 08:35:11 -07:00
John Hui e350e7e716 Merge pull request #89156 from j-hui/c_int128 2026-05-20 07:58:47 -07:00
John Hui 2f48ecb66b Merge pull request #89276 from j-hui/templated-operator-crash 2026-05-20 07:56:51 -07:00
Konrad `ktoso` Malawski efd8843a26 [Distributed][docs] Fix cut off sentence (#89279)
Fix cut off sentence in executor explanation.

resolves rdar://177443891
swift-DEVELOPMENT-SNAPSHOT-2026-05-20-a
2026-05-20 06:37:00 -07:00
eeckstein 2c8abb273f Merge pull request #89278 from eeckstein/instruction-deletion-asserts
SIL: add more assert checks for deleting instructions
2026-05-20 15:31:16 +02:00
Argyrios Kyrtzidis 81f4ef3ef7 Merge pull request #89143 from akyrtzi/akyrtzi/pr/cas-input-index-stored-in-result
[CAS] Store the input index along the compiler results
2026-05-20 06:25:33 -07:00
Egor Zhdan 5cbb591a9f Merge pull request #89039 from egorzhdan/egorzhdan/libstdcxx-coroutine
[cxx-interop] Add remaining C++23 headers into libstdc++ modulemap
2026-05-20 12:46:52 +01:00
Gábor Horváth c9e20ac40e Merge pull request #89211 from Xazax-hun/refcounted-ptr-improvements
[cxx-interop] SWIFT_REFCOUNTED_PTR improvements
2026-05-20 11:40:08 +01:00
Aidan Hall 199eb62e2a Merge pull request #89216 from aidan-hall/restore-large-inline-array-test
large_inline_array.swift.gyb: Increase timeout and re-enable
2026-05-20 11:06:47 +01:00
Allan Shortlidge e2ded0d1a6 Merge pull request #89232 from tshortli/member-import-visibility-cgfloat-double-implicit-conversion
Sema: Add source loc to implicit `CGFloat`/`Double` conversion
2026-05-20 02:17:56 -07:00
Erik Eckstein 04bb607464 SIL: add more assert checks for deleting instructions
* `assert` -> `ASSERT` for checking if an instruction is deleted twice. This will let us catch an error also with non-assert compiler builds.
* add checks that a deleted instructions is not used and is not using other values

This will hopefully give us more information for some rare non-deterministic compiler crashes.
rdar://176816390
2026-05-20 10:09:43 +02:00
John Hui 168c928212 [cxx-interop] Fix crash when specializing a templated SubscriptDecl
rewriteIntegerTypes unwrapped the outer (Self) -> ... curry layer for
any instance member, constructor, or static decl. SubscriptDecl
interface types are not curried this way (they are already
(Args) -> Element), so the strip overshot into the bare element type
and the subsequent getParams() dereferenced garbage.

Gate the unwrap on hasImplicitSelfDecl(), which is the precise
condition for having an outer Self curry layer.

rdar://177482177
2026-05-19 18:34:26 -07:00
Allan Shortlidge 75ee444a94 Sema: Add source loc to implicit CGFloat/Double conversion.
This ensures MemberImportVisibility diagnostics about missing imports of
CoreFoundation for `CGFloat.init(_:)` get a source location.

Resolves rdar://177380270.
2026-05-19 14:50:32 -07:00
Allan Shortlidge 2ea5a79344 Tests: Mark SILGenFunction-emitThrow-24ea1f.swift as fixed (#89268)
Resolves fall out from https://github.com/swiftlang/swift/pull/88948.
2026-05-19 14:46:09 -07:00
Allan Shortlidge de6676024a Merge pull request #88489 from tshortli/member-import-visibility-allow-default-implementations
Sema: Allow default implementations of conformance requirements regardless of visibility
2026-05-19 14:00:01 -07:00
elsa 1e3e681584 Remove deprecated PrintCSEInternals flag (#89248)
Resolves rdar://177222636

The -print-cse-internals flag was deprecated as a part of the Swift
rewrite of the CSE pass.
It was still being used in
[utils/check-incremental](https://github.com/swiftlang/swift/blob/2ed7079b9bdf4f2583577c4fb37b5881af65236b/utils/check-incremental#L109-L110).
2026-05-19 12:25:57 -07:00
Ben Cohen 3c7cd8fc0c SILGen: handle non-Error destinations in emitThrow (#88948)
`emitThrow` previously asserted that the only legal mismatch between the
in-flight error type and the throw destination was `any Error`, then
existential-erased to `Error`. Anything else Sema accepted — `do
throws(any P) where P: Error`, or a class subtype of the destination —
crashed the assertion (or, before that was tightened, miscompiled at
runtime).

Dispatch on the destination type:
- existential: erase, looking up conformance to each protocol in the
destination's existential layout (so `any P` works, not just `any
Error`);
- class: emit an `upcast`.

Anything else still hits an `unreachable` — Sema rejects those today, so
hitting it would indicate a Sema regression rather than a missing SILGen
path.

Fixes https://github.com/swiftlang/swift/issues/83826.
2026-05-19 11:37:08 -07:00
Argyrios Kyrtzidis 429416cabd [CAS] Store the input index along the compiler results
This allows replaying the cached compiler results from an upstream CAS,
if we know the key, without needing access to the caching key input CAS tree.
2026-05-19 11:09:35 -07:00
Susana Monteiro abf9f9dff0 Merge pull request #89212 from susmonteiro/susmonteiro/new-lit-target-split-file
[cxx-interop] Add target-run-simple-swift-split-file
2026-05-19 19:08:30 +01:00
Augusto Noronha 27ba7beb5c Merge pull request #89138 from augusto2112/fix-protocol-typealias-typeref
[RemoteInspection] Fix generic typealiases in DemanglingForTypeRef
2026-05-19 10:47:18 -07:00
Slava Pestov cfc3ebfe4a Fix RUN: line in checkConformance-25eedf.swift (#89253) 2026-05-19 09:56:53 -07:00
Aidan Hall b2661ffac6 Merge pull request #89130 from aidan-hall/lifedep-partial-apply-extra-regression-test
Lifetimes: Add a regression test for partial apply result types
2026-05-19 17:44:05 +01:00
Aidan Hall 0a5bb082de Merge pull request #89123 from aidan-hall/pack-opt-nothrow
PackSpecialization: Handle error result separately, propagate apply nothrow & async flags
2026-05-19 17:13:06 +01:00
Carl Peto 8b87e3db49 [Backtracing] [Windows] Bugfixes for windows image crash logs (#89218)
- Fix issue with no build id showing up as `000000`... (e.g. no debug
info), now shows as `<no build id>` as intended.
- Try to avoid loading PE file unless it's necessary on Windows
symbolicating backtraces.
- DefaultSymbolLocator: PDB file finding now respects the overridable
path for use in the offline symbolicator (no effect on standard
backtracing).
- Record timestamp/size in Image Info on windows for possible future use
in offline symbolicator

---------

Co-authored-by: Carl Peto <carlpeto@Carls-MacBook-Pro.local>
2026-05-19 16:35:38 +01:00
Xi Ge e562a4b6c1 Merge pull request #89227 from nkcsgexi/hide-types-on-emit 2026-05-18 19:19:49 -07:00
Slava Pestov e33a43aa3e Merge pull request #89167 from slavapestov/clean-up-variadic-parameter-requirement-check
Sema: Fix crash when declaring an old-style variadic parameter with nonescaping type
2026-05-18 22:19:08 -04:00
Aviva 5e21033451 Merge pull request #89230 from slavapestov/fix-midair-collision-with-compiler-crasher
Fix mid-air collision
2026-05-18 15:20:37 -07:00
Slava Pestov 4e6d0154f0 Fix mid-air collision 2026-05-18 18:15:03 -04:00
Pavel Yaskevich 6ceb787a93 Merge pull request #89200 from jamieQ/global-actor-req-docs
[docs][NFC]: improve GlobalActorAttributeRequest doc comment
2026-05-18 15:03:51 -07:00
Slava Pestov 1de87f81b5 Merge pull request #89215 from slavapestov/create-implicit-constructor-generic-property-wrapper-fix
Sema: Fix type parameter/archetype mixup in createImplicitConstructor()
2026-05-18 17:33:40 -04:00
Slava Pestov 6b2bddf552 Merge pull request #89217 from slavapestov/resolve-crashers-ide-test-fix
resolve-crashes.py: Special-case %target-swift-ide-test
2026-05-18 17:33:26 -04:00
Guillaume Lessard 616e61a367 Merge pull request #89188 from glessard/rdar177198190-ref-mutableref-conformances 2026-05-18 13:00:24 -07:00
Xi Ge 886f856f7e [Serialization] Substitute HiddenType for hidden stored-property types when emitting binary modules
The substitution is driven by a canonical type to mangled name table on ASTContext,
populated by exportability checking at the same site where the corresponding
diagnostics are suppressed. After this change, the module emitter and module
loader see hidden types differently: the emitter still sees the real types
defined in the bridging header, while the loader sees only a mangled name
wrapped in a HiddenType placeholder.
2026-05-18 12:48:59 -07:00
Hamish Knight d99873ba58 Merge pull request #89209 from hamishknight/fuzzy
[test] Add some more known crashers
2026-05-18 20:38:00 +01:00
Michael Gottesman 2ed7079b9b Merge pull request #89205 from gottesmm/pr-90ccc9c6f540c159d9e379f62249a01e6bc1d7c2
[region-isolation] Fix false-positive errors in NSObject actor initializers
2026-05-18 10:27:23 -07:00
Emil Pedersen c0cc0827de Merge pull request #89071 from Snowy1803/debug-bb
[DebugInfo] Supplement debug values with Debug Basic Blocks
2026-05-18 17:32:35 +01:00
Hamish Knight 58230feb80 Merge pull request #89179 from hamishknight/add-test
[test] Add additional test for inverse with class protocol composition
2026-05-18 15:52:46 +01:00
Slava Pestov 6ee56fea53 resolve-crashes.py: Special-case %target-swift-ide-test
Resolving an IDE crasher should remove the "not" entirely, because
swift-ide-test exits with code 0 even when the source is invalid.
2026-05-18 10:50:11 -04:00
Slava Pestov f05d1cab32 Sema: Fix crash when declaring an old-style variadic parameter with nonescaping type
This is not supported for the same reason you can't have a noncopyable
variadic parameter, but the code was hard-coded to check for copyability
only.

Generalize this to apply the generic signature for Array via the
common code path, and add a custom note to explain why those requirements
are checked in the first place.

Cleaning this up also fixed some fuzzer crashes.

Reported on the forums:
https://forums.swift.org/t/variadic-escapable-arguments-crash-the-compiler/86727/2
2026-05-18 10:49:23 -04:00
Slava Pestov 853db7a568 Sema: Fix type parameter/archetype mixup in createImplicitConstructor()
Some new logic was added in 8bb3bf09fb but
it would overwrite a contextual type stored in the 'type' local variable
with an interface type.

Instead, let's only map the type into the generic environment after we
figure out what's going on with the property wrapper.
2026-05-18 10:33:57 -04:00
Aidan Hall 6297fcd815 large_inline_array.swift.gyb: Increase timeout and re-enable
Increase the timeout to 60 seconds, the originally-intended value.

This test was temporarily disabled in #89022.
2026-05-18 15:24:46 +01:00