Commit Graph

195377 Commits

Author SHA1 Message Date
Bassam (Sam) Khouri
6ab6482730 Tests: enable Swift PM tests in Windows toolchain build
Enable the SwiftPM tests in the Windows toolchain build to get extra
confidence the change did not introduce any regression on the Windows
platform.

Execute SwiftPM tesst in parallel

Fixes: swiftlang/swift-package-manager#8895
2025-12-02 13:06:16 -05:00
Anthony Latsis
01360d1b03 Merge pull request #85588 from swiftlang/jepa-main2
[test] Add tracking test for https://github.com/swiftlang/swift/issues/85587
2025-12-02 17:31:18 +00:00
Adrian Prantl
0e55f81931 Merge pull request #66580 from adrian-prantl/110333983
Make source locations for standard library calls explicit
2025-12-02 08:56:32 -08:00
Evan Wilde
d2681c5224 Merge pull request #85778 from etcwilde/ewilde/export-glibc-clang-overlay
CMake: Add GlibC Clang Overlay to export set
2025-12-02 08:26:49 -08:00
Si Beaumont
c9b3ded5e3 Enable BPF target in LLVM backend by default (#85630)
Adding the BPF target to the LLVM backend, allows eBPF programs to be
built using the clang that ships with the OSS toolchains.

Should be a low-risk change, which I've tested locally by explicitly
specifying the `--llvm-targets-to-build` flag:

```console
% build/Ninja-ReleaseAssert/llvm-linux-aarch64/bin/clang -print-targets | grep bpf
    bpf        - BPF (host endian)
    bpfeb      - BPF (big endian)
    bpfel      - BPF (little endian)

% touch empty.c

% build/Ninja-ReleaseAssert/llvm-linux-aarch64/bin/clang -target bpf -c empty.c -o empty.o

% file empty.o
empty.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), not stripped
```



Looks like a negligible increase in build time vs previous PR toolchain
builds:

| Job | Build script analyzer total | LLVM time (sec) |

|----------------------|-----------------------------|-------------------|
| #1584 (this PR)[^0] | 2hr 21m 53s | 1178.85 |
| #1583 (previous)[^1] | 2hr 22m 8s | 1171.51 |
| ...failed runs... | ...failed runs... | ...failed runs... |
| #1578 (previous)[^2] | 2hr 22m 40s | 1171.47 |
| #1577 (previous)[^3] | 2hr 21m 48s | 1168.54 |
| #1576 (previous)[^4] | 2hr 20m 39s | 1174.80 |


And an increased of size comparison of PR toolchain(s) vs last nightly
main, it
looks like it's gone up a bit, but not by this PR:

| PR | `stat -c %s` | Link |

|-------------|--------------|----------------------------------------------------------------|
| — | 1187466342 |
swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu20.04.tar.gz[^5] |
| This PR | 1212116532 |
pull-request/85630/1584/ubuntu2204/PR-ubuntu2204.tar.gz[^6] |
| Previous PR | 1213404191 |
pull-request/85358/1583/ubuntu2204/PR-ubuntu2204.tar.gz[^7] |
| Previous PR | 1213116282 |
pull-request/79684/1578/ubuntu2204/PR-ubuntu2204.tar.gz[^8] |

[^0]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1584/consoleText
[^1]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1583/consoleText
[^2]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1578/consoleText
[^3]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1577/consoleText
[^4]: https://ci.swift.org/job/swift-PR-toolchain-Linux/1576/consoleText

[^5]:
https://download.swift.org/development/ubuntu2004/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a/swift-DEVELOPMENT-SNAPSHOT-2025-08-27-a-ubuntu20.04.tar.gz
[^6]:
https://download.swift.org/tmp/pull-request/85630/1584/ubuntu2204/PR-ubuntu2204.tar.gz
[^7]:
https://download.swift.org/tmp/pull-request/85358/1583/ubuntu2204/PR-ubuntu2204.tar.gz
[^8]:
https://download.swift.org/tmp/pull-request/79684/1578/ubuntu2204/PR-ubuntu2204.tar.gz
2025-12-02 16:21:52 +00:00
Aidan Hall
90e12147e0 Merge pull request #85456 from aidan-hall/pack-opt-fix-weather-swb
PackSpecialization: Fix result & type parameter handling
2025-12-02 15:38:32 +00:00
Carl Peto
dd9543f126 Merge pull request #85589 from carlpeto/eng/PR-164566321
Always show the crashed thread first
2025-12-02 15:05:52 +00:00
Carl Peto
53722a3239 Merge pull request #85483 from carlpeto/fix-backtrace-stderr-color-bug
Backtrace incorrectly picks up colour from stdout instead of stderr
2025-12-02 15:03:38 +00:00
Susana Monteiro
9e216edf5e Merge pull request #85643 from susmonteiro/susmonteiro/remove-annotationonly-flag
[cxx-interop] Remove annotationOnly flag from Escapability request
2025-12-02 14:36:56 +00:00
Susana Monteiro
fd6e6b35a6 Merge pull request #85642 from susmonteiro/susmonteiro/reapply-implicit-constructors
[cxx-interop] Reapply implicitly defined copy and move constructors
2025-12-02 14:23:00 +00:00
Anthony Latsis
91d2323b16 [test] Add tracking test for https://github.com/swiftlang/swift/issues/85587 2025-12-02 12:21:35 +00:00
Charles Zablit
ce082bcc83 Merge pull request #85612 from charles-zablit/charles-zablit/windows/fix-arm64-build-python 2025-12-02 12:55:28 +01:00
Kavon Farvardin
1f696739ef Merge pull request #85450 from kavon/keypath-metadata-fix
IRGen/ABI: fix count of requirements in getAddrOfGenericEnvironment
2025-12-02 03:23:49 -08:00
Alastair Houghton
354b461f7f Merge pull request #85312 from al45tair/concurrency-6.3-not-6.2
[Concurrency] Change all of the StdlibDeploymentTarget 6.2s to 6.3.
2025-12-02 10:51:09 +00:00
Alex Hoppen
efb41bff49 Merge pull request #85669 from ahoppen/pretty-index-stacktrace
Add pretty stack trace entry for all index operations
2025-12-02 11:37:23 +01:00
susmonteiro
b06631e4da [cxx-interop] Remove annotationOnly flag from Escapability request 2025-12-02 09:27:30 +00:00
susmonteiro
fbfcd4d241 [cxx-interop] Implicitly defined copy and move constructors 2025-12-02 09:15:37 +00:00
Hamish Knight
c73951bac6 Merge pull request #85739 from hamishknight/direct-conv 2025-12-02 08:40:48 +00:00
eeckstein
8d50f20965 Merge pull request #85728 from eeckstein/print-sil-ownership
SIL: add an option `-sil-print-ownership` to print ownership
2025-12-02 07:32:11 +01:00
Doug Gregor
88fc259605 Merge pull request #85776 from DougGregor/extern-global-variables-embedded
[Embedded] Only strip "external" from global variables that have definitions
2025-12-01 22:25:50 -08:00
Pavel Yaskevich
4b33db0a84 Merge pull request #85605 from xedin/tilde-sendable-cond-conformances
[Concurrency] Allow conditionally conforming to `Sendable` when confo…
2025-12-01 21:53:25 -08:00
Arnold Schwaighofer
36a3c6e611 Merge pull request #85644 from aschwaighofer/wip_embedded_exits_with_eriks_changes_v1
[embedded] Fix associated type conformances for specialized witness tables
2025-12-01 16:40:31 -08:00
Doug Gregor
6b3935201d [Embedded] Only strip "external" from global variables that have definitions
Embedded Swift ends up rewriting the linkage of global variables as
part of linking together all of the Swift modules. Doing so for extern
global variables (e.g., ones meant to be implemented in C) breaks the
LLVM module, because they will never have definitions. Only make this
change when the global variable is a definition.
2025-12-01 15:47:32 -08:00
Evan Wilde
e7a8bf7288 CMake: Add GlibC Clang Overlay to export set
Adding the Glibc Clang Overlay interface target to the installed export
set. The interface library exists to plumb the appropriate flags through
the build graph and ensure that the modulemap and header file are
generated when depended on.

Interface libraries need to be in the export set when depended on by a
public library to ensure that the appropriate install interface flags
are exposed to targets importing the library from outside of the build
system, regardless of whether the interface library actually installs
any files.

This fixes the configuration-time error:

Export called with target "swiftGlibc" which requires
"SwiftGlibcClangOverlay" that is not in any export set.
2025-12-01 15:27:48 -08:00
Kavon Farvardin
38af19b95a IRGen/ABI: fix count of requirements in getAddrOfGenericEnvironment
`irgen::addGenericRequirements` will later filter out Copyable
and Escapable requirements, so this field's count isn't accurate
if it's using the pre-filtered number.

This should in theory only affect the metadata emission for keypaths,
specifically, the caller `IRGenModule::getAddrOfKeyPathPattern`.
2025-12-01 15:07:34 -08:00
Egor Zhdan
61fc6356e0 Merge pull request #85486 from egorzhdan/egorzhdan/wrap-in-objc
[cxx-interop] Wrap methods that take Obj-C params in `#if defined(__OBJC__)`
2025-12-01 22:58:49 +00:00
Hamish Knight
cb66f4f158 Merge pull request #85741 from hamishknight/related-fix
[Index] Handle implicit reference relations for type sugar
2025-12-01 22:50:57 +00:00
Hamish Knight
03b9190998 Merge pull request #85750 from hamishknight/fuzzy
[test] Add some more known crashers
2025-12-01 21:49:52 +00:00
Anthony Latsis
1a3a9a99d8 Merge pull request #85759 from swiftlang/jepa-main4
Address some overload deprecations in `llvm::support::endian`
2025-12-01 21:31:09 +00:00
Gábor Horváth
981ad6647f Merge pull request #85711 from Xazax-hun/virtual-move-only-types
[cxx-interop] Fix crash when virtual methods take move-only types
2025-12-01 21:09:47 +00:00
Gábor Horváth
e9eff08a52 Merge pull request #85731 from Xazax-hun/suppress-arc-warning
[cxx-interop] Suppress warning in non-arc Obj-C++
2025-12-01 21:09:27 +00:00
Susana Monteiro
92cbcb6864 Merge pull request #85485 from susmonteiro/susmonteiro/remove-request-cycles
[cxx-interop] Refactor ClangTypeEscapability and CxxValueSemantics requests
2025-12-01 21:09:03 +00:00
Gábor Horváth
bf1dbc6d36 Merge pull request #85694 from Xazax-hun/const-frts-collision
[cxx-interop] Do not drop CV qualifiers during printing template names
2025-12-01 21:08:28 +00:00
Aidan Hall
96dca43eb9 Merge pull request #85244 from aidan-hall/fixing-debug-info-rebase
Retain more debug info in optimized builds
2025-12-01 20:49:40 +00:00
Zachary 'Clack' Cole
6cf36b194f Merge pull request #85652 from clackary/fix/85020-metatype-resolution
[CSOptimizer] Also favor existential metatype candidates in paramType isAny fast path
2025-12-01 13:45:43 -07:00
Daniel Rodríguez Troitiño
83a9913ac1 [test] Propagate CMake shared linker flags for tests to use (#85623)
The same that some setups needs the `CMAKE_EXE_LINKER_FLAGS` propagated
for the test to compile plugins in the same configuration as the
compiler was using, the `CMAKE_SHARED_LINKER_FLAGS` needs to be
propagated if one wants to match the configuration used by CMake to
create libraries during the tests.

Add a new `config` value derived from `CMAKE_EXE_LINKER_FLAGS`, turn
that value into a substitution for the `Macros` tests, and use the
substibution in one test that creates a shared object. This allows the
shared object to be linked in the same way that it has been configured
in CMake.
2025-12-01 09:41:27 -08:00
Daniel Rodríguez Troitiño
51d2f2b61d [CMake] Explicitly disable LTO if no LTO option is provided (#85621)
When compiling Swift as an LLVM external project (not the non-unified
workflow from the build-script), if one tries to enable LTO for LLVM
projects it will end up affecting Swift and the Swift standard library,
even if the options `SWIFT_TOOLS_ENABLE_LTO` and
`SWIFT_STDLIB_ENABLE_LTO` are disabled or using their default values,
because [HandleLLVMOptions] modifies the `CMAKE_C/CXX_FLAGS` globally.

By setting `-fno-lto` explicitly when those options are disabled or
using their default values, the options from `CMAKE_C/CXX_FLAGS` are
overriden, and the `SWIFT_*_ENABLE_LTO` controls the usage or not of LTO
optimizations and the presence of bitcode in the object files.

[HandleLLVMOptions]:
b58b2a34d5/llvm/cmake/modules/HandleLLVMOptions.cmake (L1278-L1310)
2025-12-01 09:40:59 -08:00
Michael Gottesman
24c69c674d Merge pull request #85604 from gottesmm/alloc_stack_non_nested
[irgen] Implement support for alloc_stack non_nested.
2025-12-01 09:38:06 -08:00
Adrian Prantl
80c8bf0591 Merge pull request #85655 from adrian-prantl/161134092
[Debug Info] Represent type alias existantials in debug info
2025-12-01 08:42:22 -08:00
Zev Eisenberg
a994527a23 [SE-0489] Better debugDescription for EncodingError and DecodingError (#80941)
Now accepted as
[SE-0489](https://github.com/ZevEisenberg/swift-evolution/blob/main/proposals/0489-codable-error-printing.md).

# To Do

- [x] confirm which version of Swift to use for the availability
annotations. Probably 6.3 at time of writing.

# Context

Re: [Swift forum
post](https://forums.swift.org/t/the-future-of-serialization-deserialization-apis/78585/77),
where a discussion about future serialization tools in Swift prompted
Kevin Perry to suggest that some proposed changes could actually be made
in today's stdlib.

# Summary of Changes

Conforms `EncodingError` and `DecodingError` to
`CustomDebugStringConvertible` and adds a more-readable
`debugDescription`.

# Future Directions

This is a pared-down version of some experiments I did in
[UsefulDecode](https://github.com/ZevEisenberg/UsefulDecode). The
changes in this PR are the best I could do without changing the public
interface of `DecodingError` and `EncodingError`, and without modifying
the way the `JSON`/`PropertyList` `Encoder`/`Decoder` in Foundation
generate their errors' debug descriptions.

In the above-linked
[UsefulDecode](https://github.com/ZevEisenberg/UsefulDecode) repo, when
JSON decoding fails, I go back and re-decode the JSON using
`JSONSerialization` in order to provide more context about what failed,
and why. I didn't attempt to make such a change here, but I'd like to
discuss what may be possible.

# Examples

To illustrate the effect of the changes in this PR, I removed my changes
to stdlib/public/core/Codable.swift and ran my new test cases again.
Here are the resulting diffs.

##
`test_encodingError_invalidValue_nonEmptyCodingPath_nilUnderlyingError`

### Before
`invalidValue(234, Swift.EncodingError.Context(codingPath:
[GenericCodingKey(stringValue: "first", intValue: nil),
GenericCodingKey(stringValue: "second", intValue: nil),
GenericCodingKey(stringValue: "2", intValue: 2)], debugDescription: "You
cannot do that!", underlyingError: nil))`

### After
`EncodingError.invalidValue: 234 (Int). Path: first.second[2]. Debug
description: You cannot do that!`

## `test_decodingError_valueNotFound_nilUnderlyingError`

### Before
`valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath:
[GenericCodingKey(stringValue: "0", intValue: 0),
GenericCodingKey(stringValue: "firstName", intValue: nil)],
debugDescription: "Description for debugging purposes", underlyingError:
nil))`

### After
`DecodingError.valueNotFound: Expected value of type String but found
null instead. Path: [0].firstName. Debug description: Description for
debugging purposes`

## `test_decodingError_keyNotFound_nonNilUnderlyingError`

### Before
`keyNotFound(GenericCodingKey(stringValue: "name", intValue: nil),
Swift.DecodingError.Context(codingPath: [GenericCodingKey(stringValue:
"0", intValue: 0), GenericCodingKey(stringValue: "address", intValue:
nil), GenericCodingKey(stringValue: "city", intValue: nil)],
debugDescription: "Just some info to help you out", underlyingError:
Optional(main.GenericError(name: "hey, who turned out the lights?"))))`

### After
`DecodingError.keyNotFound: Key \'name\' not found in keyed decoding
container. Path: [0].address.city. Debug description: Just some info to
help you out. Underlying error: GenericError(name: "hey, who turned out
the lights?")`

## `test_decodingError_typeMismatch_nilUnderlyingError`

### Before
`typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath:
[GenericCodingKey(stringValue: "0", intValue: 0),
GenericCodingKey(stringValue: "address", intValue: nil),
GenericCodingKey(stringValue: "city", intValue: nil),
GenericCodingKey(stringValue: "birds", intValue: nil),
GenericCodingKey(stringValue: "1", intValue: 1),
GenericCodingKey(stringValue: "name", intValue: nil)], debugDescription:
"This is where the debug description goes", underlyingError: nil))`

### After
`DecodingError.typeMismatch: expected value of type String. Path:
[0].address.city.birds[1].name. Debug description: This is where the
debug description goes`

## `test_decodingError_dataCorrupted_nonEmptyCodingPath`

### Before
`dataCorrupted(Swift.DecodingError.Context(codingPath:
[GenericCodingKey(stringValue: "first", intValue: nil),
GenericCodingKey(stringValue: "second", intValue: nil),
GenericCodingKey(stringValue: "2", intValue: 2)], debugDescription:
"There was apparently some data corruption!", underlyingError:
Optional(main.GenericError(name: "This data corruption is getting out of
hand"))))`

### After
`DecodingError.dataCorrupted: Data was corrupted. Path: first.second[2].
Debug description: There was apparently some data corruption!.
Underlying error: GenericError(name: "This data corruption is getting
out of hand")`

## `test_decodingError_valueNotFound_nonNilUnderlyingError`

### Before
`valueNotFound(Swift.Int, Swift.DecodingError.Context(codingPath:
[GenericCodingKey(stringValue: "0", intValue: 0),
GenericCodingKey(stringValue: "population", intValue: nil)],
debugDescription: "Here is the debug description for value-not-found",
underlyingError: Optional(main.GenericError(name: "these aren\\\'t the
droids you\\\'re looking for"))))`

### After
`DecodingError.valueNotFound: Expected value of type Int but found null
instead. Path: [0].population. Debug description: Here is the debug
description for value-not-found. Underlying error: GenericError(name:
"these aren\\\'t the droids you\\\'re looking for")`

##
`test_encodingError_invalidValue_emptyCodingPath_nonNilUnderlyingError`

### Before
`invalidValue(345, Swift.EncodingError.Context(codingPath: [],
debugDescription: "You cannot do that!", underlyingError:
Optional(main.GenericError(name: "You really cannot do that"))))`

### After
`EncodingError.invalidValue: 345 (Int). Debug description: You cannot do
that!. Underlying error: GenericError(name: "You really cannot do
that")`

## `test_decodingError_typeMismatch_nonNilUnderlyingError`

### Before
`typeMismatch(Swift.String, Swift.DecodingError.Context(codingPath:
[GenericCodingKey(stringValue: "0", intValue: 0),
GenericCodingKey(stringValue: "address", intValue: nil),
GenericCodingKey(stringValue: "1", intValue: 1),
GenericCodingKey(stringValue: "street", intValue: nil)],
debugDescription: "Some debug description", underlyingError:
Optional(main.GenericError(name: "some generic error goes here"))))`

### After
`DecodingError.typeMismatch: expected value of type String. Path:
[0].address[1].street. Debug description: Some debug description.
Underlying error: GenericError(name: "some generic error goes here")`

## `test_encodingError_invalidValue_emptyCodingPath_nilUnderlyingError`

### Before
`invalidValue(123, Swift.EncodingError.Context(codingPath: [],
debugDescription: "You cannot do that!", underlyingError: nil))`

### After
`EncodingError.invalidValue: 123 (Int). Debug description: You cannot do
that!`

## `test_decodingError_keyNotFound_nilUnderlyingError`

### Before
`keyNotFound(GenericCodingKey(stringValue: "name", intValue: nil),
Swift.DecodingError.Context(codingPath: [GenericCodingKey(stringValue:
"0", intValue: 0), GenericCodingKey(stringValue: "address", intValue:
nil), GenericCodingKey(stringValue: "city", intValue: nil)],
debugDescription: "How would you describe your relationship with your
debugger?", underlyingError: nil))`

### After
`DecodingError.keyNotFound: Key \'name\' not found in keyed decoding
container. Path: [0]address.city. Debug description: How would you
describe your relationship with your debugger?`

## `test_decodingError_dataCorrupted_emptyCodingPath`

### Before
`dataCorrupted(Swift.DecodingError.Context(codingPath: [],
debugDescription: "The given data was not valid JSON", underlyingError:
Optional(main.GenericError(name: "just some data corruption"))))`

### After
`DecodingError.dataCorrupted: Data was corrupted. Debug description: The
given data was not valid JSON. Underlying error: GenericError(name:
"just some data corruption")`

##
`test_encodingError_invalidValue_nonEmptyCodingPath_nonNilUnderlyingError`

### Before
`invalidValue(456, Swift.EncodingError.Context(codingPath:
[GenericCodingKey(stringValue: "first", intValue: nil),
GenericCodingKey(stringValue: "second", intValue: nil),
GenericCodingKey(stringValue: "2", intValue: 2)], debugDescription: "You
cannot do that!", underlyingError: Optional(main.GenericError(name: "You
really cannot do that"))))`

### After
`EncodingError.invalidValue: 456 (Int). Path: first.second[2]. Debug
description: You cannot do that!. Underlying error: GenericError(name:
"You really cannot do that")`
2025-12-01 11:34:00 -05:00
Arnold Schwaighofer
0c882d42ce Merge pull request #85625 from aschwaighofer/wip_embedded_cast_tuples
[embedded] Allow casting to tuples and tighten the check which existentials we support in embedded with existentials
2025-12-01 08:27:43 -08:00
Rauhul Varma
27ebe4dd95 Merge pull request #85492 from swiftlang/rauhul/cxx-exception-personality 2025-12-01 08:25:25 -08:00
Arnold Schwaighofer
a71e3d92cd [embedded] Use the type witness from the specialized conformance
rather then the specialized conformance's root conformance (which is the  variable's value)
2025-12-01 07:41:28 -08:00
Erik Eckstein
103d3c2f85 SILPrinter: print forwarding ownership for struct and tuple instructions
Print `forwarding: <ownership>` if the ownership of the result mismatches the operand ownership(s).
We already do this for all other forwarding instructions, but `struct` and `tuple` were missing.
2025-12-01 16:00:58 +01:00
Erik Eckstein
3ade98c84e SILPrinter: add an option -sil-print-ownership to print the ownership of instruction results
With this option the ownership of instruction results is printed in the comments at the end of the line, e.g.

```
  %3 = struct $S (%2, %1)                         // ownership: owned
```

And even without enabling this option, ownership comments are printed if the ownership of a result mismatches with its type.
That can happen e.g. for non-trivial enums which are constructed with a trivial case:

```
enum E {
  case A
  case B(AnyObject)
}

  %1 = enum $E, #E.A!enumelt  // type of %1 is non trivial, but ownership is "none"
```
2025-12-01 16:00:58 +01:00
Hamish Knight
bf760aa3dd Merge pull request #85615 from jamieQ/async-let-it-be
[Sema]: suppress unexpected type warning on some async-let patterns
2025-12-01 14:39:08 +00:00
Slava Pestov
56630519ea Merge pull request #85656 from slavapestov/fix-rdar164519548
Sema: Fix infinite loop in OrderDeclarations::operator()
2025-12-01 08:19:42 -05:00
Hamish Knight
639d331012 Merge pull request #85670 from hamishknight/bool-fix 2025-12-01 13:06:07 +00:00
Charles Zablit
715cba10c8 Merge pull request #85614 from charles-zablit/charles-zablit/windows/fix-batch-script 2025-12-01 12:48:50 +01:00
Anthony Latsis
345c601626 Address some overload deprecations in llvm::support::endian
See:
* https://github.com/llvm/llvm-project/pull/161045
* https://github.com/llvm/llvm-project/pull/160979
2025-12-01 11:19:25 +00:00