Commit Graph

187628 Commits

Author SHA1 Message Date
Eric Miotto
fa725278e4 Runtimes: add support for Runtime module
* take the chance to rename the containing folder, as in this context it
  should be clear we are talking about the Runtime module and not the
  Swift runtime
* this will fail to build for Apple platforms until we land #84388 -- to
  signal this, comment the invocations that would add the dependency on
  the Darwin overlay
* piggyback a fix to ensure we rebuild always all the external projects
  in the Supplemental superbuild used in macOS PR testing

Addresses rdar://160774902
2025-09-19 05:12:09 -07:00
Kavon Farvardin
6e6516c115 Merge pull request #84332 from kavon/use-isSelfParameter
silgen: use isSelfParameter instead of custom check
2025-09-16 20:55:57 -07:00
Kavon Farvardin
ce5dc9a83e Merge pull request #84333 from kavon/load-copy-does-retain 2025-09-16 20:48:42 -07:00
Doug Gregor
56f60635b1 Merge pull request #84328 from DougGregor/coroframealloc-backdeploy 2025-09-16 20:15:50 -07:00
Susana Monteiro
f648dbbbca Merge pull request #84237 from susmonteiro/susmonteiro/cxxrecord-semantics
[cxx-interop] Refactor copyability out of CxxRecordSemantics
2025-09-17 03:05:45 +01:00
Allan Shortlidge
c78725359b Merge pull request #84327 from tshortli/really-require-swift-version-in-module-interfaces
Frontend: Require explicit language mode when emitting swiftinterfaces
2025-09-16 15:57:26 -07:00
Andrew Trick
9007036d2e Merge pull request #84276 from atrick/remove-span-unsafenonescapable
Mutable[Raw]Span.init() does not need @_unsafeNonescapableResult
2025-09-16 15:30:21 -07:00
Kavon Farvardin
2dea3ca3fc sil: load [copy] affects reference counting
Based on what I see from OwnershipModelEliminator,
`%x = load [copy] %y` can turn into a plain load
followed by a retain of the loaded value.

See `NonTrivialLoadableTypeLowering::emitLoad`
2025-09-16 15:25:20 -07:00
Kavon Farvardin
ecf701133a silgen: use isSelfParameter instead of custom check 2025-09-16 15:22:58 -07:00
Allan Shortlidge
01d458b7a3 Merge pull request #84311 from tshortli/preconcurrency-import-in-swiftinterface
ModuleInterface: Print imports with @preconcurrency in swiftinterface files
2025-09-16 13:09:48 -07:00
Mishal Shah
04ff59bf95 Merge pull request #84329 from etcwilde/ewilde/freebsd-notest-package
FreeBSD: No-test package preset
2025-09-16 11:24:04 -07:00
Evan Wilde
30e3d56d2e FreeBSD: No-test package preset
Adding preset for producing FreeBSD toolchains without running tests.
2025-09-16 11:16:26 -07:00
Doug Gregor
f7264e327f [IRGen] Only use a stub for swift_coroFrameAlloc when we need it
swift_coroFrameAlloc was introduced in the Swift 6.2 runtime. Give it
the appropriate availability in IRGen, so that it gets weak
availability when needed (per the deployment target). Then, only
create the stub function for calling into swift_coroFrameAlloc or
malloc (when the former isn't available) when we're back-deploying to
a runtime prior to Swift 6.2. This is a small code size/performance
win when allocating coroutine frames on Swift 6.2-or-newer platforms.

This has a side effect of fixing a bug in Embedded Swift, where the
swift_coroFrameAlloc was getting unconditionally set to have weak
external linkage despite behind defined in the same LLVM module
(because it comes from the standard library).

Fixes rdar://149695139 / issue #80947.
2025-09-16 10:51:12 -07:00
Allan Shortlidge
9067051c29 Frontend: Require explicit language mode when emitting swiftinterfaces.
If a .swiftinterface file does not include an explicit `-language-mode` option
(or its predecessor `-swift-version`) and needs to be built as a dependency of a
client compilation, then the invocation to build the module from interface
would end up inheriting the language mode that the client code is built with.
This can result in spurious type checking diagnostics or even mis-compilation.
To ensure that a module interface is always built using the language mode that
its source code was originally built with, require an explicit `-language-mode`
option when emitting swiftinterface files.

In https://github.com/swiftlang/swift/pull/84307 this diagnostic was downgraded
to a warning. The failures it caused in PR testing should now be resolved.

Resolves rdar://145168219.
2025-09-16 10:25:14 -07:00
Allan Shortlidge
ba62465cc0 Merge pull request #84259 from tshortli/member-import-visibility-migrate-crash
Sema: Fix a crash in migrate mode for `MemberImportVisibility`
2025-09-16 10:15:50 -07:00
Allan Shortlidge
255c460a4a Merge pull request #84309 from tshortli/runtimes-specify-language-mode
CMake: Runtimes: Specify language mode explicitly
2025-09-16 10:09:21 -07:00
David Smith
2c02ba3189 Remove a retain-release pair from -count for bridged arrays (#84247) 2025-09-16 12:41:27 -04:00
Mishal Shah
2bdc1f4d15 Merge pull request #84324 from swiftlang/jepa-main4
[presets]: Add `--skip-early-swift-driver` to llvm-only preset
2025-09-16 08:18:06 -07:00
Anthony Latsis
c6e52262c4 [presets]: Add --skip-early-swift-driver to llvm-only preset 2025-09-16 16:16:19 +01:00
susmonteiro
2640c71ec0 [cxx-interop] Refactor copyability out of CxxRecordSemantics 2025-09-16 14:40:16 +01:00
Jakub Florek
a5c6156525 Merge pull request #84045 from MAJKFL/new-sil-licm-pass-copy-ownership
Ownership support for LICM
2025-09-16 11:02:28 +01:00
Allan Shortlidge
6cc9a7d509 CMake: Runtimes: Specify language mode explicitly.
The compiler will soon require that any module with a `.swiftinterface` be
built with an explicit language mode specified on the command line. This
prevents misinterpretation of the `.swiftinterface` when building it for
clients that aren't building with the default language mode.

Add explicit `-swift-version` arguments to the builds of various Runtimes
libraries to comply with this new requirement.
2025-09-15 20:52:15 -07:00
Allan Shortlidge
d8fac32dd8 Sema: Fix a crash in migrate mode for MemberImportVisibility.
`TypeChecker::resolveDeclRefExpr()` would leave error nodes in the AST when
performing fallback name lookups with `MemberImportVisibility`. When running in
migration mode for `MemberImportVisibility`, these error nodes would then cause
the compiler to either diagnose a missing error or to crash during SILGen.

Instead of restricting name lookup during `TypeChecker::resolveDeclRefExpr()`,
allow it to find candidates with missing imports and then diagnose them if
necessary before forming a resolve decl ref.

Resolves rdar://154361861.
2025-09-15 20:48:06 -07:00
Allan Shortlidge
4841bcffa1 ModuleInterface: Print imports with @preconcurrency in swiftinterface files.
When a module has been imported `@preconcurrency` in source, when it is printed
in a `swiftinterface` file it should be printed along with the attribute to
ensure that type checking of the module's public declarations behaves
consistently.

This fix is a little unsatisfying because it adds another a linear scan over
all imports in the source for each printed import. This should be improved, but
it can be done later.

Resolves rdar://136857313.
2025-09-15 17:33:13 -07:00
Yuta Saito
2b6ea81b9e Merge pull request #84285 from kateinoigakukun/yt/fix-tagged-funcptr
[Legacy Driver][wasm] Pass `--table-base` to reserve low function addresses
2025-09-16 08:26:04 +09:00
Mishal Shah
e8a9286c4a Merge pull request #84307 from tshortli/revert-require-swift-version-in-module-interfaces
Frontend: Temporarily downgrade `error_module_interface_requires_language_mode`
2025-09-15 14:13:11 -07:00
Allan Shortlidge
e2c8235a2c Frontend: Temporarily downgrade 'error_module_interface_requires_language_mode'.
Downgrade the new error in https://github.com/swiftlang/swift/pull/84244 to a
warning.

The PR smoke test build is using a different build system that is failing to
pass `-swift-version` arguments when building various stdlib modules. That
needs to be fixed, but for now we also need to unblock CI.
2025-09-15 14:10:24 -07:00
Doug Gregor
01873c996f Merge pull request #84283 from DougGregor/embedded-swift-untyped-throws-restriction
[Embedded] Diagnose untyped throws as an Embedded Swift restriction
2025-09-15 12:55:16 -07:00
Mishal Shah
a28d7a7e52 Merge pull request #80820 from swiftlang/maxd/bump-wasmkit
Bump WasmKit in `update-checkout-config.json` to 0.1.6
2025-09-15 11:57:13 -07:00
Pavel Yaskevich
5207b0ec8a Merge pull request #84287 from xedin/issue-84150
[CSSimplify] Fix key path to function conversion to check key path re…
2025-09-15 11:48:30 -07:00
Allan Shortlidge
cfe9f90347 Merge pull request #84244 from tshortli/require-swift-version-in-module-interfaces
Frontend: Require `-language-mode` option when emitting swiftinterfaces
2025-09-15 10:08:23 -07:00
Meghana Gupta
c764244df0 Merge pull request #84180 from meg-gupta/borrowandmutatepr
Add preliminary support for borrow accessors
2025-09-15 10:01:15 -07:00
Artem Chikin
926fc78b4c Merge pull request #84191 from artemcm/InMemoryDepScanSerializedDiagnostics
[Dependency Scanning] Configure a serialized diagnostics consumer for in-memory scans
2025-09-15 11:54:44 -04:00
Joe Groff
798621e9c5 Merge pull request #84264 from jckarter/trivial-address-only-switch
SILGen: Don't copy_addr [take] trivial address-only values.
2025-09-15 07:34:16 -07:00
Yuta Saito
5431bb115b [test][wasm] Add test to kill the missing func addr reservation 2025-09-15 14:30:10 +00:00
Doug Gregor
865c643cac Suppress Embedded Restriction diagnostics in code that won't be compiled as Embedded
When emitting diagnostics for the Embedded Swift restrictions outside
of Embedded Swift mode, consider `#if $Embedded` and `#if
hasFeature(Embedded)` configurations. If the code where we would emit
the diagnostic would be disabled in Embedded Swift by one of those
checks, don't emit the diagnostic. This helps code that can compile
either with Embedded or regular Swift stay within the restrictions on
Embedded Swift.
2025-09-15 07:10:00 -07:00
Gábor Horváth
b5ef290c1c Merge pull request #84203 from Xazax-hun/handle-unowned-in-impicit-value-init
[cxx-interop] Handle Unowned values in implicit value ctors
2025-09-15 16:06:33 +02:00
Hamish Knight
607abb99f9 Merge pull request #84272 from a7medev/add-parameter-name-to-signature
[IDE] Add internal parameter names in signature help
2025-09-15 14:46:13 +01:00
Jakub Florek
e84bc084f4 Check for aliasing destroy_addr before hoisting load_borrow - end_borrow pair. 2025-09-15 12:42:30 +01:00
Egor Zhdan
99e9ed8213 Merge pull request #84274 from egorzhdan/egorzhdan/rm-dead-partial-var
[cxx-interop] Remove dead logic in const import
2025-09-15 10:06:02 +01:00
Hamish Knight
6761d8474d Merge pull request #84273 from hamishknight/the-whole-hole
[CS] Avoid forming DependentMemberType with hole base in `InferableTypeOpener`
2025-09-15 09:33:34 +01:00
Hamish Knight
411e14d00b Merge pull request #84275 from hamishknight/skippy
[CS] Avoid skipping SingleValueStmtExpr branch with ReturnStmt for completion
2025-09-15 09:33:17 +01:00
Pavel Yaskevich
ac27f53c04 [CSSimplify] Fix key path to function conversion to check key path requirements
`KeyPath` types now have conformance requirements placed on their
`Root` and `Value` types which need to be checked even when there
is a key path to function conversion involved, otherwise the solver
would be accepting invalid code.

Note that without function conversion the requirements come from
a type opened during assignment - https://github.com/swiftlang/swift/pull/80081/files.

Resolves: https://github.com/swiftlang/swift/issues/84150
2025-09-15 00:35:19 -07:00
Saleem Abdulrasool
57ad3607af Merge pull request #84268 from compnerd/packaging
utils: disable packaging on PR tests
2025-09-15 00:00:57 -07:00
Meghana Gupta
aeac529925 [NFC] Add notes on self argument of borrow accessor being non-lexical 2025-09-14 23:38:18 -07:00
Meghana Gupta
d3e41e5f2b Update SwiftCompilerSources' OwnershipLiveness utility for borrow accessors
It uses a check on conformance to ForwardInstruction for walking down guaranteed forwarding uses.
Since apply of borrow accessors cannot be represented as ForwardingInstruction, handle them separately.

Representing apply of borrow accessors for consistent handling in the optimizer is TBD.
2025-09-14 23:38:10 -07:00
Meghana Gupta
11097c4b9e Avoid inserting lexical scope for arguments of borrow accessors while inlining 2025-09-14 23:38:09 -07:00
Meghana Gupta
58957c3da2 [NFC] Update feature flags 2025-09-14 23:38:08 -07:00
Meghana Gupta
a42511e041 [NFC] Replace ApplyInst::getSubstCalleeConv()::hasGuaranteedAddressResult() with ApplyInst::hasGuaranteedAddressResult() 2025-09-14 23:38:07 -07:00
Meghana Gupta
995d6a77d9 Update hasGuaranteedResult and hasGuaranteedAddressResult 2025-09-14 23:38:06 -07:00