Commit Graph

184973 Commits

Author SHA1 Message Date
Saleem Abdulrasool
7992380a57 Merge pull request #81405 from compnerd/installation
Supplemental: add installation rules for StringProcessing
swift-DEVELOPMENT-SNAPSHOT-2025-05-10-a
2025-05-09 16:54:33 -07:00
Saleem Abdulrasool
7e89e205bc Merge pull request #81406 from compnerd/reflection
Overlay: enable reflection on Windows
2025-05-09 16:24:42 -07:00
Pavel Yaskevich
37e2f374aa [CSApply] Don't attempt to mark autoclosures as non-implicit
While building an initializer call the declaration reference
should have the same implicitness as the call when it doesn't
require thunking, otherwise don't attempt to mark autoclosures
as non-implicit because it could break assumptions elsewhere.
2025-05-09 14:43:48 -07:00
Becca Royal-Gordon
7e7f9d024b Fix @_implements type resolution diagnostics
If a type in an `@_implements` attribute failed to resolve, Sema would assume it was because the type existed but wasn’t a protocol, even if there was another reason for the problem (such as the type not existing). Explicitly resolve the TypeRepr again through a path that will produce diagnostics.
2025-05-09 14:41:10 -07:00
Doug Gregor
9d493db479 [SE-0470] Fix synthesized conformances with default main actor isolation
When defaulting to main-actor isolation, types that have synthesized
conformances (e.g., for Equatable, Hashable, Codable) were getting
nonisolated members by default. That would cause compiler errors
because the conformances themselves defaulted to main-actor isolation
when their types were.

Be careful to only mark these members as 'nonisolated' when it makes
sense, and leave them to get the isolation of their enclosing type
when the conformance might have isolation. This ensures that one can
use synthesis of these protocols along with default main-actor mode.

There is a one-off trick here to force the synthesized CodingKeys to
be nonisolated, because the CodingKey protocol requires Sendable.
We'll separately consider whether to generalize this rule.

More of rdar://150691429.
2025-05-09 14:35:56 -07:00
Pavel Yaskevich
a058ffc998 [Concurrency] Diagnose loss of global actor isolation in async function conversions
Perform `Sendable` checking on parameter/result of the function
type when conversion between asynchroneous functions results in
a loss of global actor isolation attribute because access would
result in data crossing an isolation boundary.

This is a warning until Swift language mode 6.

Resolves: rdar://130168104
2025-05-09 13:05:57 -07:00
Pavel Yaskevich
0bcbde4940 [Diagnostics] Replace last references to AsyncCallerExecution with NonisolatedNonsendingByDefault 2025-05-09 13:03:01 -07:00
Artem Chikin
94898aabf5 [Dependency Scanning][C++Interop] Do not query 'CxxStdlib' Swift overlay for textual modules which were not built with c++interop
When we discover a textual module dependency which is a module which was not originally built from source using C++ interop (specifying '-formal-cxx-interoperability-mode=off'), avoid looking up the C++ standard library Swift overlay for it. This is required for the case of the 'Darwin' module, for example, which includes headers which map to C++ stdlib headers when the compiler is operating in C++ interop mode, but the C++ standard library Swift overlay module itself depends on 'Darwin', which results in a cycle. To resolve such situations, we can rely on the fact that Swift textual interfaces of modules which were not built with C++ interop must be able to build without importing the C++ standard library Swift overlay, so we avoid specifying it as a dependency for such modules.

The primary source module, as well as Swift textual module dependencies which *were* built with C++ interop will continue getting a direct depedency of the 'CxxStdlib' Swift module.

Resolves rdar://150222155
2025-05-09 13:00:14 -07:00
Pavel Yaskevich
fbaf7ce017 [Diagnostics] Rename the note file to match the NonisolatedNonsendingByDefault feature group declaration 2025-05-09 11:52:29 -07:00
Hamish Knight
b53c411655 [Frontend] Avoid storing StringRef values in ModuleAliasMap
Previously we would insert StringRefs that reference the keys in the
map, but that breaks if the invocation ever gets copied. Switch to
`std::string`.

rdar://148130166
2025-05-09 19:49:50 +01:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Augusto Noronha
8ea544879b Merge pull request #81385 from augusto2112/get-sig-bits-ret
[RemoteMirror] Remove accidental unconditional return
2025-05-09 11:36:38 -07:00
Mike Ash
161209f132 Merge pull request #81380 from mikeash/function-cast-ptrauth
[Concurrency] Use reinterpret_cast for function_cast when ptrauth is on.
2025-05-09 14:08:44 -04:00
John Hui
027a178ada Merge pull request #81395 from j-hui/dont-swiftify-invalid-expr
[Swiftify] Do not swiftify non-Swift-like counted_by exprs
2025-05-09 11:07:46 -07:00
Henrik G. Olsson
efd70b1f54 Prevent silgen for macro expansions with type errors (#81396)
Due to a bug in how macros on nodes imported from clang are evaluated,
their function body is not always type checked. This forces type
checking before silgen of a macro originating on a node imported from
clang, to prevent crashing in silgen.

rdar://150940383
2025-05-09 10:27:27 -07:00
Yuta Saito
6bb2b64b4d Merge pull request #81197 from kateinoigakukun/yt/asan-wasi 2025-05-10 01:24:44 +08:00
Artem Chikin
80c71fd3a9 [Dependency Scanning] Reduce number of module loaders instantiated for textual interface scanning sub-instance 2025-05-09 10:23:00 -07:00
Evan Wilde
1a546a9ccb [FreeBSD]: Optional observation pthread primitives
The pthread APIs on FreeBSD do not include nullability APIs so the
pthread mutex APIs are imported as pointers to optional values.
Other platforms include nullability APIs and import the pthread APIs as
pointers to the mutex. Splitting the locking primitive type based on the
OS.

Fixes: rdar://150880976
2025-05-09 10:08:35 -07:00
Saleem Abdulrasool
0fe855f860 Overlay: enable reflection on Windows
Enable this feature by default on Windows to keep parity with macOS.
2025-05-09 09:59:53 -07:00
Saleem Abdulrasool
7a7ac3c700 Supplemental: add installation rules for StringProcessing
Introduce install targets for the StringProcessing module. This is a
prerequisite for building a static variant of the standard library to
enable the statically linked early swift driver for Windows to
bootstrap.
2025-05-09 09:59:01 -07:00
Saleem Abdulrasool
fcb6d54b7a Runtimes: disable CMP0157 when building with the old driver
The C++ driver does not work properly with the split build (CMP0157).
Disable this to allow bootstrapping the static runtime on Windows.
2025-05-09 09:58:29 -07:00
Eric Miotto
c018f679e8 Revert "Fallback to legacy way to build compiler-rt in some Linux bots"
This reverts commit 0441a81211.
2025-05-09 09:20:04 -07:00
Evan Wilde
6ad5c40caa Merge pull request #81364 from etcwilde/ewilde/extend-swift-cmake-options
[Build-Script]: Extend Swift cmake options
2025-05-09 09:07:48 -07:00
finagolfin
e76b97e2b7 [build-script] Add an option to build the Foundation tests in another mode (#78390)
Use it in the linux CI presets to set them to Debug mode and speed up
the linux CI, plus add a new preset which keeps building them in Release
mode.

I was looking at a passing linux CI run and saw the log timings at the
end: it takes [longer to build and test the swift-foundation repos than
to compile all 7k+ mostly C++ files in
LLVM](https://ci.swift.org/job/swift-PR-Linux/18996/console)!
```
--- Build Script Analyzer ---
Build Script Log: /home/build-user/build/.build_script_log
Build Percentage 	 Build Duration (sec) 	 Build Phase
================ 	 ==================== 	 ===========
9.2%              	 1132.94               	 Running tests for foundationtests
9.1%              	 1120.57               	 linux-x86_64-swift-build
9.0%              	 1104.2                	 Building llvm
7.2%              	 878.84                	 Running tests for swiftfoundationtests
6.5%              	 796.81                	 Running tests for swiftpm
5.6%              	 684.7                 	 Building swiftpm
5.5%              	 667.92                	 linux-x86_64-swift-test
4.9%              	 597.64
```
Looking at the log, building swift-foundation in release mode takes a
long time, so let's see if changing it to debug mode helps. Some
background - the Foundation repos are built twice on the linux CI: once
by CMake, which is the version installed in the toolchain, then a second
time by SwiftPM purely for testing.

This pull only affects that second SwiftPM build for testing, which is
not shipped in the final toolchain but thrown away.
2025-05-09 21:07:01 +05:30
Mike Ash
cf48debc73 Merge pull request #81186 from jabrylg/add-json-summary-to-swift-inspect-dump-raw-metadata
[swift-inspect] Add json and summary options to DumpRawMetadata
2025-05-09 11:22:50 -04:00
Max Desiatov
7db6c5ddaa Build CMake on macOS if one is not preinstalled (#81161)
We build CMake on all platforms (except Darwin for an unknown reason) if CMake is not preinstalled. Since CMake 4.0 regresses certain build configurations, there's currently no way to build on Darwin without installing an older CMake version 3.x manually. This can be simplified if we build a pinned version of CMake consistently on all platforms.
2025-05-09 15:59:05 +01:00
Anthony Latsis
0e6f3a8d54 Merge pull request #81375 from AnthonyLatsis/nocapture-both-ways
[test] Match `nocapture` to succeed both on main and rebranch
2025-05-09 14:37:32 +01:00
Doug Schaefer
609b79830a Merge pull request #81391 from dschaefer2/sourcekit-test-asn1
Add ASN1 module to SourceKit-LSP Test
2025-05-09 09:31:42 -04:00
Yuta Saito
3dc24b83bd Merge pull request #81387 from kateinoigakukun/yt/remove-wasilibc-workaround 2025-05-09 19:03:57 +08:00
Max Desiatov
fa8f747c90 Add typing to update_checkout.py (#81160)
As Python 3.5 added support for type hints and we require Python 3.6 or later, let's try to add a type hint to a single function so that development experience is slightly improved and we can test this feature in our code before applying it more widely. Editors with support for Python LSP servers can pick it and stop flagging this function or its
invocations as type errors.
2025-05-09 11:06:30 +01:00
John Hui
203acbbb47 [NFC] Tidy up formatting for CountedByExpressionValidator
(Renamed from CATExprValidator)
2025-05-09 00:25:20 -07:00
Henrik G. Olsson
8e27947b2a [Swiftify] Handle anonymous parameters (#81384)
_SwiftifyImport would expand with syntax errors if applied to a function
with anonymous parameters, because it would try to refer to parameters
using the name `_`. Detect these cases and create names for unnamed
parameters.

rdar://150955944
2025-05-08 23:28:14 -07:00
eeckstein
3b6805a86f Merge pull request #81373 from eeckstein/fix-embedded-error
EmbeddedSwiftDiagnostics: fix and improve some embedded diagnostic errors
2025-05-09 07:04:19 +02:00
John Hui
e5b1f4a251 [Swiftify] Do not swiftify non-Swift-like counted_by exprs
__counted_by (and __sized_by) expressions can have arbitrary C syntax
in them, such as:

    void foo(int * __counted_by(*len) p, int *len);

When @_SwififyImport tries to generate Swift code for this, the
expression `*len` leads to a syntax error, since it isn't valid Swift.

This patch adds a check to ensure we only attach the Swiftify macro to
__counted_by expressions that are also syntactically valid in Swift.

rdar://150956352
2025-05-08 21:13:20 -07:00
Alejandro Alonso
02d9779ba3 Merge pull request #81184 from Azoy/no-more-is-array-type
[AST] Rename isArrayType and split the InlineArray portion
2025-05-08 20:52:51 -07:00
Konrad `ktoso` Malawski
60694624e7 Merge pull request #81372 from ktoso/wip-sign-protocol-ptr
[Distributed] pointer auth protocol pointers as we use conformsToProtocol
2025-05-09 11:10:22 +09:00
Jamie
996510e9e8 [docs][gardening]: fix typo in KeyPaths.md
remove a superfluous word
2025-05-08 20:28:50 -05:00
Daniil Kovalev
a5c727125e Fix compilation errors appearing due to missing <cstdint> include (#81233)
This patch resolves the issue by adding missing `<cstdint>` includes.
For SmallVector.h, such a change was already introduced in LLVM repository:
7e44305041

<!--
If this pull request is targeting a release branch, please fill out the
following form:

https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1

Otherwise, replace this comment with a description of your changes and
rationale. Provide links to external references/discussions if
appropriate.
If this pull request resolves any GitHub issues, link them like so:

  Resolves <link to issue>, resolves <link to another issue>.

For more information about linking a pull request to an issue, see:

https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue
-->

<!--
Before merging this pull request, you must run the Swift continuous
integration tests.
For information about triggering CI builds via @swift-ci, see:

https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci

Thank you for your contribution to Swift!
-->
2025-05-08 17:43:29 -07:00
Doug Schaefer
0c765883ed Add ASN1 module to SourceKit-LSP Test
Super surprised to see the build for swift test hardcoded in
the build.ps1 script instead of in the sourcekit-lsp repo.
At any rate, looks like I need to add the dependency on ASN1
here too.

This is to support changes in SwiftPM that add the dependency
which translates through to sourcekit-lsp.

https://github.com/swiftlang/swift-package-manager/pull/8610
2025-05-08 20:14:00 -04:00
Yuta Saito
e32566154b [wasm] Remove workaround for wasi-libc's check-symbols target
Our LLVM has been already updated to 19, so we no longer need to
workaround the `__FPCLASS_XXX` macro issue in wasi-libc's
check-symbols target.
2025-05-08 23:31:35 +00:00
Henrik G. Olsson
59d7d3160f [Swiftify] Emit @availability when expansions contain Span (#81320)
This prevents errors when compiling for older targets using a newer
compiler.

rdar://150740330
2025-05-08 16:13:24 -07:00
Anthony Latsis
55e5618eab [test] Match nocapture to succeed both on main and rebranch
Both the syntax and relative order of the LLVM `nocapture` parameter
attribute changed upstream in 29441e4f5fa5f5c7709f7cf180815ba97f611297.
To reduce conflicts with rebranch, adjust FileCheck patterns to expect
both syntaxes and orders anywhere the presence of the attribute is not
critical to the test. These changes are temporary and will be cleaned
up once rebranch is merged into main.
2025-05-08 23:52:43 +01:00
Anthony Latsis
2faa94712a [test] IRGen: Adjust FileCheck pattern for new initializes attribute in upstream LLVM
The parameter attribute was introduced in
5ece35df8586d0cb8c104a9f44eaae771de025f5 (llvm-project) and is expected
here according to the lowered function body.

Match it using a wildcard regex, since it is not relevant to this test.

This is intended to reduce future conflicts with rebranch.
2025-05-08 23:46:05 +01:00
Anthony Latsis
d42c3999ae [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-08 23:44:13 +01:00
Rauhul Varma
23f0fb5941 Merge pull request #81371 from swiftlang/rauhul/embedded-tooling 2025-05-08 15:37:09 -07:00
Augusto Noronha
6a6b0ce80b [RemoteMirror] Remove accidental unconditional return 2025-05-08 15:15:43 -07:00
Alejandro Alonso
d5970d93b8 Check if we're a bound struct 2025-05-08 14:30:01 -07:00
Konrad `ktoso` Malawski
e4c0c79d65 Apply suggestions from code review 2025-05-09 06:24:14 +09:00
Dario Rexin
058638ee90 Merge pull request #81339 from drexin/wip-150722907
[IRGen] Emit llvm fneg operation for Builtin.fneg_*
2025-05-08 13:48:43 -07:00
Mike Ash
0f2b047155 [Concurrency] Use reinterpret_cast for function_cast when ptrauth is on.
We need to use reinterpret_cast when ptrauth is enabled to ensure that any necessary auth-and-sign operations are performed.

rdar://150747009
2025-05-08 16:28:45 -04:00