Commit Graph

184973 Commits

Author SHA1 Message Date
Pavel Yaskevich
82497af27d [Tests] NFC: Add a test-case for main-actor isolated struct and nonisolated protocol 2025-06-16 15:58:25 -07:00
Mike Ash
020dde58fc Merge pull request #82245 from mikeash/auth-code-function-begone
[Runtime] Remove redundant swift_auth_code_function, use existing swift_auth_code.
2025-06-16 18:50:20 -04:00
Dario Rexin
61581563c8 [Test] Fix Interpreter/layout_string_witnesses_dynamic.swift
rdar://151476435

Two tests incorrectly assigned values to an uninitialized pointer instead of initializing it. This caused crashes on some distros.
2025-06-16 15:16:46 -07:00
Eric Miotto
1218df3f4e Wire --llvm-include-tests in build-script
This was apparently missing in the migration of the llvm product
from build-script-impl to build-script,
2025-06-16 15:01:52 -07:00
Eric Miotto
218799aedb [build-script] build LLVMTestingSupport only if target is generated
Otherwise the build will fail if we pass `--no-llvm-include-tests` or we
set directly `LLVM_INCLUDE_TESTS` directly to `FALSE`/`OFF`

Addresses rdar://153562845
2025-06-16 15:01:32 -07:00
Yuta Saito
3371e5ffd3 Merge pull request #82174 from kateinoigakukun/yt/build-libxml2 2025-06-17 06:13:34 +09:00
Sima Nerush
7e42a19187 [Concurrency] Make sure to still infer global actor if the conformance kind is explicit. 2025-06-16 13:59:15 -07:00
Sima Nerush
4fca62a771 [Concurrency] Look for explicit 'nonisolated' when getting isolation from protocol conformances. 2025-06-16 13:59:15 -07:00
Pavel Yaskevich
64404f5b7d Merge pull request #82229 from xedin/rdar-152689053
[Concurrency] NonisolatedNonsendingByDefault: Except `@Test` test-cases and `$` prefixed declarations from migration
2025-06-16 13:42:17 -07:00
Hamish Knight
05ae4c4729 [test] Add a few more known type-checker crashers 2025-06-16 21:02:30 +01:00
Cyndy Ishida
64168edbf5 [Modules] Allow implicit conversions when loading interfaces with invalid os versions (#82228)
Initially, the compiler rejected building dependencies that contained OS
versions in an invalid range. However, this happens to be quite
disruptive, so instead allow it and request that these versions be
implicitly bumped based on what `llvm::Triple::getCanonicalVersionForOS`
computes.

resolves: rdar://153205856
2025-06-16 12:46:32 -07:00
Hamish Knight
060c9f4c5f Merge pull request #82237 from hamishknight/cod-cycle
[Sema] Scale back CodingKeys hack in `TypeChecker::lookupUnqualifiedType`
2025-06-16 20:37:35 +01:00
Eric Miotto
d3f8bbffcb Merge pull request #82124 from edymtt/edymtt/remove-old-way-of-building-compiler-rt
build-script: Remove support for legacy way of building compiler-rt
2025-06-16 12:35:21 -07:00
Hamish Knight
274ba536c6 Merge pull request #82254 from hamishknight/open-and-shut-case
[xcodegen] `realpath` Swift target sources
2025-06-16 20:30:46 +01:00
Max Desiatov
d733338626 build-script: fix --skip-build-llvm not having full effect (#82233)
While LLVM cannot be completely disabled when Swift or LLDB are built, we should still allow skipping LLVM configuration and build steps when Swift and LLDB are not built. This can happen, for example, when `build-script` user wants an ad-hoc incremental build with `--skip-build-swift` and `--skip-build-lldb` for products that don't depend on LLVM and Swift, or if LLVM and Swift were already configured and built in previous `build-script` invocations.
2025-06-16 12:05:31 -07:00
Anthony Latsis
b40b192227 ASTBriding: Bridge swift::DiagnosticKind directly 2025-06-16 19:11:35 +01:00
Anthony Latsis
106d5f4461 {AST,Basic}Bridging: Use SWIFT_COMPUTED_PROPERTY 2025-06-16 19:11:32 +01:00
Andrew Trick
125a0862a9 LifetimeDependence type check: infer trivial _read accessor
This fixes a small oversight in the type checker's LifetimeDependence
inference. Allow inference on _read accessors even when 'self' is a trivial
type. This is needed because the compiler synthesizes a _read accessor even when
the user defines a getter (this is probably a mistake, but it's easire to just
fix inference at this point). There is no workaround because it defining both a
getter and '_read' is illegal!

    extension UnsafeMutableRawBufferPointer {
      var mutableBytes: MutableRawSpan {
        @_lifetime(borrow self)
        get {
          unsafe MutableRawSpan(_unsafeBytes: self)
        }
      }
    }

Fixes rdar://153346478 (Can't compile the
UnsafeMutableRawBufferPointer.mutableBytes property)
2025-06-16 10:41:06 -07:00
Doug Schaefer
bf6694d137 Merge pull request #82265 from swiftlang/revert-80405-t/main/update_swiftpm_presets
Revert "Tests: enable Swift PM tests in Windows toolchain build"

Should address hangs people are seeing in toolchain builds.
2025-06-16 06:53:33 -07:00
Bassam (Sam) Khouri
3e1273feeb Revert "Tests: enable Swift PM tests in Windows toolchain build" 2025-06-16 09:46:39 -04:00
Hamish Knight
6570da30e0 [test] Clean up some crasher test cases 2025-06-16 11:19:53 +01:00
Hamish Knight
27ec6e3a45 [xcodegen] realpath Swift target sources
Make sure we call `realpath` for the Swift target sources read from
the build settings to ensure we canonicalize their casing.
2025-06-15 20:29:17 +01:00
Hamish Knight
01dbed9107 [xcodegen] NFC: Rename resolvingSymlinks -> realPath 2025-06-15 20:28:20 +01:00
Dario Rexin
2a3999049f [IRGen] Emit null check before swift_conformsToProtocol for nullable metatypes
rdar://149882902

swift_conformsToProtocol does not properly handle nullptr values, which can currently be passed if the source type is an optional metatype. This change adds emission of a null check before calling the runtime function in these cases.
2025-06-13 17:00:11 -07:00
Mike Ash
ec6a042831 [Runtime] Remove redundant swift_auth_code_function, use existing swift_auth_code.
rdar://153169049
2025-06-13 18:46:23 -04:00
Anthony Latsis
08d71a46eb Basic, SIL: Include <swift/bridging> when avaiable instead of defining our own macros 2025-06-13 23:13:26 +01:00
Pavel Yaskevich
17976c7775 [Concurrency] NonisolatedNonsendingByDefault: Don't attempt to migrate $ prefixed declarations
These are special declarations that are synthesized by the compiler
or a macro and warnings about them are non-actionable.
2025-06-13 14:36:41 -07:00
Pavel Yaskevich
f2f5d234dc [Concurrency] NonisolatedNonsendingByDefault: Don't attempt to migrate swift-testing test cases
The execution of these functions is controlled by the testing
framework and it's okay if their behavior changes when the feature
flag is enabled.

Resolves: rdar://152687527
2025-06-13 14:36:35 -07:00
Slava Pestov
9a101ca8f6 Sema: Relax enum parameter pack restriction for CodingKeys 2025-06-13 14:54:44 -04:00
Slava Pestov
84997b47ef Sema: Protocols don't have implicit members 2025-06-13 14:54:43 -04:00
Hamish Knight
6fd128ff67 [Sema] Scale back CodingKeys hack in TypeChecker::lookupUnqualifiedType
I previously added this hack to match the logic in
`TypeChecker::lookupUnqualified`, but it turns out that can introduce
request cycles for cases where `CodingKeys` is used in a generic
requirement for one of `Codable`'s potential value witnesses. Scale
back the hack such that it's only done when we get an initial empty
lookup result, ensuring we maintain source compatibility. Both these
lookup hacks should go away once we properly handle CodingKeys 
synthesis.

rdar://153096639
2025-06-13 19:42:48 +01:00
Egor Zhdan
607dd4a7d4 [cxx-interop] Import nullability of templated function parameters correctly
This teaches ClangImporter to respect the `_Nonnull`/`_Nullable` arguments on templated function parameters.

Previously Swift would only import a non-annotated function overload. Using an overload that has either  `_Nonnull` or `_Nullable` would result in a compiler error. The non-annotated overload would get imported with incorrect nullability: Swift would always assume non-null pointers, which was inconsistent with non-templated function parameters, which are mapped to implicitly unwrapped optionals.

With this change all three possible overloads are imported, and all of them get the correct nullability in Swift.

rdar://151939344
2025-06-13 18:15:52 +01:00
Hamish Knight
9a0a831b01 Merge pull request #82147 from hamishknight/fix-nested-arenas
[CS] Avoid solver-allocated inputs with `typesSatisfyConstraint`
2025-06-13 16:53:51 +01:00
Gabor Horvath
ddacdf416d [cxx-interop] Shared references are considered safe
This patch makes sure we don't get warnings in strict memory safe mode
when using shared references. Those types are reference counted so we
are unlikely to run into lifetime errors.

rdar://151039766
2025-06-13 15:41:51 +01:00
Alastair Houghton
c1f638846a Merge pull request #82214 from al45tair/eng/PR-151975988
[Tests][Concurrency] Turn off async_taskgroup test for back-deployment.
2025-06-13 11:03:21 +01:00
Alastair Houghton
6936e2b4cd Merge pull request #82176 from al45tair/eng/PR-148168098
[IRGen] Don't use GOTPCREL relocations for x86 ELF.
2025-06-13 10:23:54 +01:00
Hamish Knight
fad9e24362 Merge pull request #82201 from hamishknight/no-copy 2025-06-13 08:01:40 +01:00
Yuta Saito
521cf5ec29 [wasm] Build and install libxml2 for Wasm SDK 2025-06-13 11:46:46 +09:00
John Hui
44aba1382d [SourceKit] Support location info for macro-expanded Clang imports
Currently, when we jump-to-definition for decls that are macro-expanded
from Clang imported decls (e.g., safe overloads generated by
@_SwiftifyImport), setLocationInfo() emits a bongus location pointing to
a generated buffer, leading the IDE to try to jump to a file that does
not exist.

The root cause here is that setLocationInfo() calls getOriginalRange()
(earlier, getOriginalLocation()), which was not written to account for
such cases where a macro is generated from another generated buffer
whose kind is 'AttributeFromClang'.

This patch fixes setLocationInfo() with some refactoring:

-   getOriginalRange() is inlined into setLocationInfo(), so that the
    generated buffer-handling logic is localized to that function. This
    includes how it handles buffers generated for ReplacedFunctionBody.

-   getOriginalLocation() is used in a couple of other places that only
    care about macros expanded from the same buffer (so other generated
    buffers not not relevant). This "macro-chasing" logic is simplified
    and moved from ModuleDecl::getOriginalRange() to a free-standing
    function, getMacroUnexpandedRange() (there is no reason for it to be
    a method of ModuleDecl).

-   GeneratedSourceInfo now carries an extra ClangNode field, which is
    populated by getClangSwiftAttrSourceFile() when constructing
    a generated buffer for an 'AttributeFromClang'. This could probably
    be union'ed with one or more of the other fields in the future.

rdar://151020332
2025-06-12 18:22:06 -07:00
Pavel Yaskevich
00aa22f7b2 Merge pull request #82218 from xedin/rdar-152687353-move-check-higher
[Concurrency] NonisolatedNonsendingByDefault/NFC: Move 'same module' …
2025-06-12 16:40:31 -07:00
Saleem Abdulrasool
0311223ea4 ClangImporter: work around the inability to adjust the Darwin overlay (#82213)
Explicitly carve out `_stdio.stdin`, `_stdio.stdout`, `_stdio.stderr` as
unaliased as the macros are explicitly imported through the `_stdio`
overlay.
2025-06-12 16:17:52 -07:00
John Hui
270f56aed3 Merge pull request #82042 from j-hui/silence-warnings
[NFC] Silence some unused variable warnings
2025-06-12 15:41:23 -07:00
Stephen Canon
b67050b61d SIMD test IR not ASM (#82078) 2025-06-12 14:38:04 -07:00
Yuta Saito
41b0b28fab Merge pull request #81793 from kateinoigakukun/yt/build-swift-testing-wasip1-threads 2025-06-13 06:30:45 +09:00
Mishal Shah
5fe71b8828 Merge pull request #81823 from swiftlang/owenv-update-system
[update-checkout] Update swift-system to 1.5.0
2025-06-12 13:00:44 -07:00
Artem Chikin
1c08abab43 Merge pull request #82169 from artemcm/DepScanImportAccessControl
[Dependency Scanning] Keep track of each imported module's access control
2025-06-12 12:41:51 -07:00
Meghana Gupta
e42b564800 Merge pull request #82033 from meg-gupta/fixinlinercrash
Fix an inliner crash when inlining begin_apply with scoped lifetime dependence
2025-06-12 10:53:19 -07:00
Pavel Yaskevich
f0502c2257 [Concurrency] NonisolatedNonsendingByDefault/NFC: Move 'same module' check higher
This is a follow-up to https://github.com/swiftlang/swift/pull/82173
which moves the check higher to make it an early exist.
2025-06-12 10:40:31 -07:00
Alastair Houghton
7a359a5e09 Merge pull request #82202 from al45tair/eng/PR-153152063
[Concurrency] Fix null pointer dereference for task-to-thread model.
2025-06-12 18:32:08 +01:00
Andrew Trick
d90903a823 Merge pull request #82189 from atrick/lifedep-trivial-inout
Disallow @_lifetime(borrow) for trivial 'inout' arguments
2025-06-12 10:30:54 -07:00