Commit Graph

184973 Commits

Author SHA1 Message Date
Alejandro Alonso
62eda2ca02 Update ASTMangler.cpp 2025-05-08 13:12:45 -07:00
Ben Barham
6667471b3d Merge pull request #81115 from beccadax/abi-let-you-graduate
Finish implementing `@abi` (SE-0476)
2025-05-08 12:52:00 -07:00
Meghana Gupta
1cdfd01575 Merge pull request #81362 from meg-gupta/enableassert
Remove disabled asserts in LifetimeDependence
2025-05-08 12:27:16 -07:00
Alexis Laferrière
f6dd432450 PrintAsObjC Test: Test pointer types with @cdecl 2025-05-08 11:31:51 -07:00
Qiongsi Wu
024dbd040f Merge pull request #81243 from qiongsiwu/eng_144794793
[Dependency Scanning] Update Uses of `ModuleDeps::ClangModuleDeps`

https://github.com/llvm/llvm-project/pull/137421 changes the type of `ModuleDeps::ClangModuleDeps`. This PR updates Swift's use of this data structure to use the correct fields. 

rdar://144794793
2025-05-08 11:11:17 -07:00
John McCall
a08b1cbb1d Merge pull request #81370 from rjmccall/fix-iso-def-arg-idx-calc
Fix argument index calculations for isolated default arguments
2025-05-08 13:26:15 -04:00
Erik Eckstein
be322877b1 EmbeddedSwiftDiagnostics: improve error message for non-specialized generic function calls
Tell the user if the specialization isn't done because of a dynamic Self type.

rdar://150865684
2025-05-08 19:21:08 +02:00
Erik Eckstein
aacb4d458f Swift AST: add Type.hasDynamicSelf 2025-05-08 19:21:08 +02:00
Erik Eckstein
f52f491936 EmbeddedSwiftDiagnostics: check apply diagnostics also for begin_apply and partial_apply 2025-05-08 19:21:08 +02:00
Erik Eckstein
d9c7a68249 EmbeddedSwiftDiagnostics: fix a wrong "cannot use co-routines (like accessors) in -no-allocations mode" error
rdar://150890424
2025-05-08 19:21:08 +02:00
Erik Eckstein
9348f5e8d4 MandatoryPerformanceOptimizations: force inlining of transparent co-routines
This might be necessary if `-enable-testing` is turned on, because in this mode function linkages are different than in a regular build.
2025-05-08 19:21:08 +02:00
Alejandro Alonso
0574c9d254 Fix test to use target cpu 2025-05-08 10:20:16 -07:00
Alejandro Alonso
bf8840bdfd Allow the mangler to disregard inverses 2025-05-08 10:17:59 -07:00
Doug Gregor
61ac302fb7 Factor out effects checking of ApplyExpr to not be specific to ApplyExpr 2025-05-08 09:07:19 -07:00
Doug Gregor
ff830dd12d [Effects] Simplify handling of LookupExpr in effects checking
Our logic for doing the "declaration reference" classification was
unnecessarily convoluted, and did "unsafe" classification twice for
properties and subscripts that have other effects (throws/async) on
their getters. Simplify it.
2025-05-08 09:07:15 -07:00
Eric Miotto
78234e2f73 Merge pull request #81340 from edymtt/edymtt/build-llvm-testing-support-by-default-to-support-run-test
LLVM build product: build LLVMTestingSupport by default
2025-05-08 08:34:03 -07:00
Max Desiatov
cb038fa0da Build WasmKit with the freshly-built SwiftPM 2025-05-08 16:11:55 +01:00
Robert Widmann
7c5a59f4a3 Merge pull request #81359 from CodaFi/sending-type-beat
[ClangImporter] Import 'swift_attr("sending")' As a Type Attribute
2025-05-08 13:08:11 +01:00
Max Desiatov
07d611ec5a Merge branch 'main' of https://github.com/swiftlang/swift into maxd/install-wasmkit 2025-05-08 13:03:41 +01:00
Hamish Knight
f861cfcb72 Merge pull request #81351 from hamishknight/disk-golf swift-DEVELOPMENT-SNAPSHOT-2025-05-08-a 2025-05-08 09:57:23 +01:00
Mishal Shah
cf4de4ae9b Merge pull request #80559 from AnthonyLatsis/pleurotus-ostreatus
CODEOWNERS: Cover some root files
2025-05-08 01:25:13 -07:00
Anthony Latsis
db20188dbb CODEOWNERS: Fix missing write access errors 2025-05-08 09:23:11 +01:00
Anthony Latsis
b057846fdc CODEOWNERS: Cover some root files 2025-05-08 09:23:09 +01:00
Mishal Shah
d3d48ab4fc Merge pull request #81276 from jamieQ/readme-universal-arch
[gardening]: update macos architecture wording in README build state matrix
2025-05-08 01:21:19 -07:00
Konrad 'ktoso' Malawski
d7152c789d [Distributed] pointer auth protocol pointers as we use conformsToProtocol 2025-05-08 13:05:53 +09:00
Doug Schaefer
4630fbcf8b Merge pull request #81353 from dschaefer2/sourcekit-lsp-asn1
Add SwiftASN1 to sourcekit-lsp dependencies for Windows.
2025-05-07 23:57:54 -04:00
Rauhul Varma
12dbe021ea Add llvm embedded tools to toolchains
Updates the build presets for macOS and linux toolchains to include
llvm-objdump and llvm-objcopy needed for embedded platform development.
2025-05-07 19:48:06 -07:00
John McCall
93b593bb5c Fix argument index calculations for isolated default arguments.
Fixes rdar://150060837
2025-05-07 20:04:38 -04:00
Artem Chikin
8cd193fc08 [Dependency Scanning] Remove 'ClangImporter' instance from dependency scanning worker
Move relevant logic directly into the worker
2025-05-07 16:43:45 -07:00
Hamish Knight
df32362c09 Merge pull request #81350 from hamishknight/cmd-prefix
[xcodegen] A couple of command-line handling tweaks
2025-05-07 23:47:43 +01:00
Eric Miotto
a95bb31d87 Merge pull request #81354 from edymtt/edymtt/build-compiler-rt-the-old-way-for-linux-aarch64-package-bots
Fallback to legacy way to build compiler-rt in some Linux bots
2025-05-07 15:20:39 -07:00
Evan Wilde
004a738c70 [Build-Script]: Extend Swift cmake options
The existing swift-cmake-options flag overwrites all flags computed by
build-script. Sometimes it is useful to be able to append additional
CMake flags without overwriting the existing flags.
This patch adds `--extra-swift-cmake-options` that adds the specified
flags to the Swift CMake configuration instead of overwriting them.

This also adds a similar `--extra-llvm-cmake-options`, which adds the
new flags to the end, allowing one to replace and overwrite CMake flags
that build-script computed.
Due to the parameter passing mechanisms in build-script-impl, while this
behavior would be useful for Swift, it is not immediately apparent how
one would best implement this at this time.
2025-05-07 14:49:45 -07:00
Alejandro Alonso
d26bde798e Start building the runtime demangle tree for extended existentials 2025-05-07 13:56:25 -07:00
fahadnayyar
b311c63ea9 [cxx-interop] Remove SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT annotation (#81329)
This patch removes the `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT`
annotation while maintaining the support for
`SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`. These type-level annotations
were initially introduced in
[PR-81093](https://github.com/swiftlang/swift/pull/81093) to reduce the
annotation burden in large C++ codebases where many C++ APIs returning
`SWIFT_SHARED_REFERENCE` types are exposed to Swift.

### Motivation
The original goal was to make C++ interop more ergonomic by allowing
type-level defaults for ownership conventions
for`SWIFT_SHARED_REFERENCE` types . However, defaulting to retained
return values (+1) seems to be problematic and poses memory safety
risks.

### Why we’re removing `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT`

- **Memory safety risks:** Defaulting to retained can potentially lead
to use-after-free bugs when the API implementation actually returns
`unowned` (`+0`). These errors are subtle and can be hard to debug or
discover, particularly in the absence of explicit API-level
`SWIFT_RETURNS_(UN)RETAINED` annotations.
- **Risky transitive behavior:** If a `SWIFT_SHARED_REFERENCE` type is
annotated with `SWIFT_RETURNED_AS_RETAINED_BY_DEFAULT`, any new C++ API
returning this type will inherit the retained behavior by default—even
if the API's actual return behavior is unretained. Unless explicitly
overridden with `SWIFT_RETURNS_UNRETAINED`, this can introduce a silent
mismatch in ownership expectations and lead to use-after-free bugs. This
is especially risky in large or evolving codebases where such defaults
may be overlooked.
- **Simpler multiple inheritance semantics:** With only one type-level
default (`SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`), we avoid
complications that can arise when multiple base classes specify
conflicting ownership defaults. This simplifies reasoning about behavior
in class hierarchies and avoids ambiguity when Swift determines the
ownership convention for inherited APIs.

### Why we’re keeping `SWIFT_RETURNED_AS_UNRETAINED_BY_DEFAULT`
- It still enables projects to suppress warnings for unannotated C++
APIs returning `SWIFT_SHARED_REFERENCE` types, helping to reduce noise
while maintaining clarity.
- It encourages explicitness for retained behavior. Developers must
annotate retained return values with `SWIFT_RETURNS_RETAINED`, making
ownership intent clearer and safer.
- The worst-case outcome of assuming unretained when the return is
actually retained is a memory leak, which is more tolerable and easier
to debug than a use-after-free.
- Having a single default mechanism improves clarity for documentation,
diagnostics, and long-term maintenance of Swift/C++ interop code.
2025-05-07 13:25:25 -07:00
Anthony Latsis
93882f214b Merge pull request #81355 from AnthonyLatsis/arachnocampa-luminosa-2
[test] Clean up overlooked dead test files and bring back accidentally deleted test after...
2025-05-07 21:14:21 +01:00
Ben Troller
3123cb0407 Merge pull request #81311 from btroller/clean-up-obj-interop-templating-in-remote-mirror
[RemoteMirror] Clean up templating used by Remote Mirror's SwiftReflectionContext to handle ObjC interop being enabled/disabled in the target.
2025-05-07 12:34:11 -07:00
Meghana Gupta
5f0d37ca30 Remove disabled asserts in LifetimeDependence 2025-05-07 12:10:18 -07:00
Nate Cook
e68069f891 [stdlib] Allow a default for optional interpolations (#80547)
This adds an `appendInterpolation` overload to
`DefaultStringInterpolation` that includes a parameter for providing a
default string when the value to interpolate is `nil`. This allows this
kind of usage:

```swift
let age: Int? = nil
print("Your age is \(age, default: "timeless")")
// Prints "Your age is timeless"
```

The change includes an additional fixit when optional values are
interpolated, with a suggestion to use this `default:` parameter.
2025-05-07 12:47:02 -05:00
Robert Widmann
edcde7c55c [ClangImporter] Import 'swift_attr("sending")' As a Type Attribute
Previously, `__attribute__((swift_attr("sending")))` would only be
resolved when attached to declarations. This patch expands it to be
a type attribute as well, which enables it to occur in the result and
parameter positions for blocks, function pointers, and lambdas.

Resolves rdar://148435359
2025-05-07 18:19:38 +01:00
Rintaro Ishizaki
62b7a6f380 Merge pull request #81346 from rintaro/macros-definition-typecheck-ifconfig
[Macros] Don't include attr range when checking macro definition
2025-05-07 09:29:34 -07:00
Pavel Yaskevich
f298bdeda5 Merge pull request #81345 from xedin/rdar-150777469
[CSFix] SE-0470: Warn about missing `@Sendable` for unapplied static …
2025-05-07 09:10:48 -07:00
Anthony Latsis
8928b538b3 [test] Bring back accidentally deleted test case in...
...https://github.com/swiftlang/swift/pull/81280. The deleted test was
`test/FixCode/fixits-if-else.swift`. Resurrect it in a better place and
switch it to the diagnostic verifier, as it was intended to along with
other moved tests in that PR.
2025-05-07 16:44:27 +01:00
Anthony Latsis
3cf3d62a5d [NFC][test] Clean up overlooked dead auxiliary test files after...
...https://github.com/swiftlang/swift/pull/81280.
2025-05-07 16:13:49 +01:00
eeckstein
46c5e9e5a1 Merge pull request #81341 from eeckstein/closure-optimizations
SILCombine: handle `mark_dependence` in some closure optimizations
2025-05-07 16:16:40 +02:00
Doug Schaefer
ffa15b814d Add SwiftASN1 to sourcekit-lsp dependencies for Windows.
Updates the build.ps1 script to add the SwiftASN1 package support
to it's CMake build. This was caused by this dependency being added
to a module in SwiftPM that sourcekit-lsp imports.
2025-05-07 09:57:06 -04:00
Eric Miotto
0441a81211 Fallback to legacy way to build compiler-rt in some Linux bots
In particular, this ensures we are able to build Linux packages for aarch64.

Addresses rdar://150423995
2025-05-07 06:53:35 -07:00
Hamish Knight
398efdcdaa [ASTDumper] Remove hasNonStandardOutput
Conditionalizing logic based on the exact output stream is brittle
since e.g the client may be writing to an intermediate buffer before
forwarding onto the output. For the ASTDumper itself, the client
already passes whether or not it expects a fully semantic dump, use
that instead. For `printContext`, the only client relying on this
was some `ResolvedRangeInfo` tests, but these don't actually care
about the computed discriminator, adjust the tests to not care.
2025-05-07 14:01:20 +01:00
Hamish Knight
8503ce0604 [xcodegen] Stop at shell operator in parseKnownCommandOnly
We're dealing with a potentially arbitary shell command here, so make
sure we don't continue parsing after a shell operator such as `&&`.
2025-05-07 13:48:45 +01:00
Hamish Knight
71d367a7d9 [xcodegen] Remove duplicate file check from tryAddTarget
I don't recall why I added this, a file can be in multiple targets
and xcodegen handles that case just fine.
2025-05-07 13:48:45 +01:00
Hamish Knight
a404893f26 [xcodegen] Ignore -fdiagnostics-color
Avoid introducing ANSI escape sequences in the Xcode build log.
2025-05-07 13:48:45 +01:00