Commit Graph

46689 Commits

Author SHA1 Message Date
Adrian Prantl
e690f1d6c4 Merge pull request #83415 from adrian-prantl/157063577
[ClangImporter] Allow LLDB to prefer serialized bridging headers.
2025-08-04 11:09:39 -07:00
Adrian Prantl
eabcf41a54 Implement reflection support for Symbolic Extended Existential types.
This patch adds a new SymbolicExtendedExistentialTypeRef kind, and
wires it up in TypeDecoder, TypeRefBuilder, TypeLowering, and
ASTDemangler.

This is tested indirectly via the matching LLDB commit.
2025-08-04 08:36:37 -07:00
Hamish Knight
396a6a8fe6 Enable InlineArray type sugar
Promote it from an experimental feature.

rdar://155607927
2025-08-04 15:16:30 +01:00
Erik Eckstein
2ab045235f InitializeStaticGlobals: allow statically initialized globals of non-loadable types 2025-08-03 17:25:43 +02:00
Erik Eckstein
5076fecd44 SIL: add the recursive property isOrContainsRawLayout to SILTypeProperties 2025-08-03 17:25:32 +02:00
Erik Eckstein
0a953b60ca SIL/AST: add var InjectEnumAddrInst.element and var EnumElementDecl.hasAssociatedValues 2025-08-03 11:06:15 +02:00
Erik Eckstein
eeb7946d55 SIL: add rawLayoutSubstitutedLikeType and rawLayoutSubstitutedCountType in Type 2025-08-03 11:06:14 +02:00
John McCall
8a77cba10b Merge pull request #83501 from rjmccall/pack-tuple-projection-silgen
Fix projecting a tuple element out of a tuple with packs.
2025-08-02 14:32:27 -04:00
Mykola Pokhylets
86100fe685 Created separated warning group for warnings about unnecessary mutable weak variables 2025-08-02 20:24:46 +02:00
Mykola Pokhylets
89f8f8b9bf Wrap only changes related to the closure frontend logic 2025-08-02 20:24:46 +02:00
Mykola Pokhylets
ae48446716 Wrap SE-0481 into an upcoming feature until source incompatibilities are resolved 2025-08-02 20:24:21 +02:00
Hamish Knight
4f6e318940 Merge pull request #83477 from hamishknight/rec-room 2025-08-02 09:43:34 +01:00
John McCall
89d53258d7 Add PossiblyUniquePtr, a smart pointer that can dynamically store a
borrowed pointer.
2025-08-02 02:13:24 -04:00
Gábor Horváth
61d60eb6ad Merge pull request #83483 from Xazax-hun/turn-off-addressable
[cxx-interop] Move back addressability behind a flag
2025-08-02 07:13:17 +01:00
John McCall
670f69eadc Merge pull request #83491 from rjmccall/strengthen-sil-function-type-isolation-preconditions
Strengthen SILFunctionType's isolation preconditions
2025-08-02 02:13:01 -04:00
John McCall
2f6f3aae5f Merge pull request #83490 from rjmccall/sil-type-properties
Extract and use SILTypeProperties without a TypeLowering
2025-08-02 02:12:49 -04:00
Max Desiatov
6d042aeb4a Embedded WASI: fix storeEnumTagSinglePayload type mismatch (#83480)
This is a follow up to https://github.com/swiftlang/swift/pull/80862, where `storeEnumTagSinglePayload` in a special implementation of `ResultTypeInfo` for Embedded Swift had a mismatching number of arguments. The actual declaration of it in `ABI/ValueWitness.def` clearly includes one more argument.

```
/// void (*storeEnumTagSinglePayload)(T* enum, UINT_TYPE whichCase,
///                                   UINT_TYPE emptyCases, M *self);
/// Given uninitialized memory for an instance of a single payload enum with a
/// payload of this witness table's type (e.g Optional<ThisType>), store the
/// tag.
FUNCTION_VALUE_WITNESS(storeEnumTagSinglePayload,
                       StoreEnumTagSinglePayload,
                       VOID_TYPE,
                       (MUTABLE_VALUE_TYPE, UINT_TYPE, UINT_TYPE, TYPE_TYPE))
```

This function type mismatch is illegal when targeting Wasm and traps at run time.

Similarly to #80862, we're passing `nullptr` as the newly added argument, which is equivalent to the existing behavior on other platforms.

rdar://157219474
2025-08-01 15:38:59 -07:00
Max Desiatov
3cb8969bca Merge pull request #83479 from MaxDesiatov/initializeWithCopy-type-mismatch 2025-08-01 20:05:27 +01:00
John McCall
46be95847b Extract TypeLowering's recursive type properties into a header, add
functions to compute them directly without a TypeLowering object, and
change a lot of getTypeLowering call sites to just use that.

There is one subtle change here that I think is okay: SILBuilder used to
use different TypeExpansionContexts when inserting into a global:
- getTypeLowering() always used a minimal context when inserting into
  a global
- getTypeExpansionContext() always returned a maximal context for the
  module scope
The latter seems more correct, as AFAIK global initializers are never
inlinable. If they are, we probably need to configure the builder with
an actual context properly rather than making global assumptions.

This is incremental progress towards computing this for most types
without a TypeLowering, and hopefully eventually removing TL entirely.
2025-08-01 15:00:57 -04:00
Hamish Knight
fb7f2d0ff2 [CS] Limit the number of chained @dynamicMemberLookup lookups
Set an upper bound on the number of chained lookups we attempt to
avoid spinning while trying to recursively apply the same dynamic
member lookup to itself.

rdar://157288911
2025-08-01 19:08:04 +01:00
Adrian Prantl
a6678476d8 [ClangImporter] Prefer serialized bridging headers in LLDB.
Especially in an explicit modules project, LLDB might not know all the
search paths needed to imported the on disk header.

rdar://157063577
2025-08-01 10:20:27 -07:00
eeckstein
8335ce577f Merge pull request #83474 from eeckstein/fix-address-of-property-feature
rename the feature AddressOfProperty to AddressOfProperty2
2025-08-01 17:38:19 +02:00
Gabor Horvath
a97d3304b6 [cxx-interop] Move back addressability behind a flag
There was another crash found by the bootstrap build bots.

This reverts commit 37ae8a22f4, reversing
changes made to 6c8da764e2.
2025-08-01 16:24:32 +01:00
Max Desiatov
1eef09ad34 Embedded WASI: fix InitializeWithCopy VWT type mismatch
Fixes Embedded Swift concurrency tests that crash with this stack trace:

```
Error: Trap: indirect call type mismatch, expected FunctionType(parameters: [WasmTypes.ValueType.i32, WasmTypes.ValueType.i32], results: []), got FunctionType(parameters: [W
asmTypes.ValueType.i32, WasmTypes.ValueType.i32, WasmTypes.ValueType.i32], results: [WasmTypes.ValueType.i32])
    0: swift::AsyncTask::completeFuture(swift::AsyncContext*)
    1: completeTaskAndRelease(swift::AsyncContext*, swift::SwiftError*)
    2: completeTaskWithClosure(swift::AsyncContext*, swift::SwiftError*)
    3: $exIeAgHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TATQ0_
    4: $exIeAgHr_xs5Error_pIegHrzo_s8SendableRzs5NeverORs_r0_lTRyt_Tg5TQ0_
    5: $e1a4MainV4mainyyYaFZyyYacfU_TATQ0_
    6: $e1a4MainV4mainyyYaFZyyYacfU_TY1_
    7: swift_task_switch
    8: $e1a4MainV4mainyyYaFZyyYacfU_TQ0_
    9: $e1a4testSiyYaFTY0_
    10: swift::runJobInEstablishedExecutorContext(swift::Job*)
    11: swift_job_run
    12: $es19CooperativeExecutorC8runUntilyySbyXEKF
    13: $es19CooperativeExecutorCs07RunLoopB0ssACP3runyyKFTW
    14: swift_task_asyncMainDrainQueueImpl
    15: swift_task_asyncMainDrainQueue
    16: main
    17: __main_void
    18: _start
    19: unknown
```
2025-08-01 13:03:10 +01:00
Gábor Horváth
37ae8a22f4 Merge pull request #83430 from Xazax-hun/revert-addressable-flag
Revert "[cxx-interop] Move addressable parameters in interop behind a flag"
2025-08-01 08:37:25 +01:00
Pavel Yaskevich
6c8da764e2 Merge pull request #83439 from xedin/allow-debugging-of-decl-specialization-comparison
[CSRanking] Pass down a flag to enable debug output in `CompareDeclSp…
2025-08-01 00:08:01 -07:00
Erik Eckstein
ec8dcc98ad rename the feature AddressOfProperty to AddressOfProperty2
Fixes a build problem when using a mainline compiler with a 6.2 Swift.swiftinterface file.
This was caused by mistakenly cherry-picking the `#if $AddressOfProperty` conditions in the stdlib into 6.2 without the required compiler change.
2025-08-01 08:00:51 +02:00
Allan Shortlidge
fd4df735de Merge pull request #83406 from tshortli/rebaseline-features
AST/ModuleInterface: Re-baseline features
2025-07-31 17:01:17 -07:00
Michael Gottesman
c085cb77e4 Merge pull request #83405 from gottesmm/pr-fc0af1c444a7961af452c813a9bdc4cc2b5adbd8
[concurrency] Emit nonisolated(nonsending) async throw initializers correctly
2025-07-31 16:27:55 -07:00
John McCall
6f9aef413e Add an equality operator on FunctionTypeIsolation 2025-07-31 18:21:09 -04:00
Allan Shortlidge
2b8ab7fbab AST: Re-baseline SendingArgsAndResults feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
a37ce9a543 AST: Re-baseline IsolatedDeinit feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
71a5d9bd74 AST: Re-baseline ValueGenericsNameLookup feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
1d9e085197 AST: Re-baseline NonescapableTypes feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
dd28a3e4b5 AST: Re-baseline IsolatedAny feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
491a43a66b AST: Re-baseline MemorySafetyAttributes feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
b8441c1c5d AST: Re-baseline ValueGenerics feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
49dcbb7ad4 AST: Re-baseline BitwiseCopyable2 feature. 2025-07-31 10:21:55 -07:00
Allan Shortlidge
6dd3e49954 AST: Re-baseline BuiltinEmplaceTypedThrows feature. 2025-07-31 10:21:55 -07:00
Pavel Yaskevich
4d76319919 Merge pull request #83392 from xedin/rdar-156896778
[Sema] Increase depth and count limits for opaque result type substit…
2025-07-31 00:03:23 -07:00
Anthony Latsis
103521394b Merge pull request #82989 from CrazyFanFan/feature/fix-it-add-static-main
[Diagnostics] Add fix-it to `@main` struct without main static function.
2025-07-31 01:25:37 +01:00
Pavel Yaskevich
5899eb25bb [CSRanking] Pass down a flag to enable debug output in CompareDeclSpecializationRequest
There is no debug output from the `CompareDeclSpecializationRequest`
because the flag that enables it is not passed down from the primary
constraint system.
2025-07-30 13:32:21 -07:00
Anthony Latsis
bbd84429a0 Merge pull request #83400 from swiftlang/jepa-main
Address `llvm::PointerUnion::{is,get}` deprecations
2025-07-30 17:19:58 +01:00
Dave Lee
eeda39aea2 RemoteInspection: Add AsyncTaskInfo.IsSuspended based on HasTaskDependency (#82965)
Adds an `IsSuspended` field to `AsyncTaskInfo`, which is the same value
as `HasTaskDependency`, but uses the `Is<State>` naming to match
`IsEnqueued`, `IsRunning`, and `IsComplete`.

Based on the docs in Task.h:

```cpp
/// A task can have the following states:
///   * suspended: In this state, a task is considered not runnable
///   * enqueued: In this state, a task is considered runnable
///   * running on a thread
///   * completed
```

rdar://148663671
2025-07-30 08:27:49 -07:00
Chris McGee
26168f57cc Create tests for the two new symbol graph options
Add options to the driver and frontend options
2025-07-30 10:24:56 -04:00
Gabor Horvath
254f72fdb4 Revert "[cxx-interop] Move addressable parameters in interop behind a flag"
This reverts commit f270e36aa5.
2025-07-30 15:24:45 +01:00
Michael Gottesman
3871d22257 [concurrency] Emit nonisolated(nonsending) async throw initializers correctly.
Specifically, we were not inserting the implicit isolated parameter and were not
setting up the actor prologue. To keep this specific to nonisolated(nonsending)
code, I only setup the actor prologue if we know that we have something that is
nonisolated(nonsending).

I also ported some async initializer tests to run with/without
nonisolated(nonsending) just to increase code coverage.

rdar://156919493
2025-07-29 19:15:08 -07:00
JanBaig
988a3dcf25 [SIL] Introduce new SILDeclRef 2025-07-29 21:16:11 -04:00
Andrew Trick
0597fd927f Merge pull request #83390 from atrick/fix-trackifdead
Fix assertion in InstructionDeleter::trackIfDead.
2025-07-29 14:57:01 -07:00
Pavel Yaskevich
7df58a720f [Sema] Increase depth and count limits for opaque result type substitutions
Let's set the limits to high end of what we'd expect to prevent regressions.
These still require some profiling to fine-tune but the original limits are
far too small for SwiftUI views we see in pactice.

Resolves: rdar://156896778
2025-07-29 11:56:41 -07:00