Commit Graph

7628 Commits

Author SHA1 Message Date
Hamish Knight
03d8ea5248 Introduce swift-xcodegen
This is a tool specifically designed to generate
Xcode projects for the Swift repo (as well as a
couple of adjacent repos such as LLVM and Clang).
It aims to provide a much more user-friendly experience
than the CMake Xcode generation (`build-script --xcode`).
2024-11-05 22:42:10 +00:00
Pavel Yaskevich
c2299ecaa4 Merge pull request #77377 from xedin/rdar139235128
[BuildTransform] Fix `walkExplicitReturnStmts` to walk implicit state…
2024-11-05 09:16:36 -08:00
Pavel Yaskevich
c5d0916746 [BuildTransform] Fix walkExplicitReturnStmts to walk implicit statements
Some statements introduce implicit braces and other things,
`walkExplicitReturnStmts` cannot ignore that while trying
to find explicit returns.

Resolves: rdar://139235128
2024-11-04 16:42:50 -08:00
Hamish Knight
7061a20edd [CS] Remove ConstraintSystem::getVarType
The logic here for completion wasn't actually
helping things since it would result in adding the
var overload to the system, which would result
in an ErrorType binding. We could turn the ErrorType
into a placeholder when resolving the overload,
but the simpler solution is to just allow CSGen
to turn the reference into a PlaceholderType. This
matches what we do for regular solving, and fixes
a crash with an IUO completion.

rdar://89369091
2024-11-04 17:08:20 +00:00
Daniel Rodríguez Troitiño
798f0e6b6b Merge pull request #77330 from drodriguez/swift-obj-root-strikes-back
[test] Fix incorrect usage of swift_obj_root in unified builds
2024-11-03 09:05:04 -08:00
Daniel Rodríguez Troitiño
6b27d33596 [validation-test] Add missing REQUIRES: macosx-x86_64 to test (#77357)
This test forces the usage of macosx-x86_64 and will fail if the x86_64
slice of the stdlib has not been built. Mark it as only running on
macosx-x86_64 to avoid the test failure in that case.
2024-11-02 19:00:22 -07:00
Daniel Rodríguez Troitiño
ba68faaed5 [test] Mark tests that use experimental/upcoming features as such
Find all the usages of `--enable-experimental-feature` or
`--enable-upcoming-feature` in the tests and replace some of the
`REQUIRES: asserts` to use `REQUIRES: swift-feature-Foo` instead, which
should correctly apply to depending on the asserts/noasserts mode of the
toolchain for each feature.

Remove some comments that talked about enabling asserts since they don't
apply anymore (but I might had miss some).

All this was done with an automated script, so some formatting weirdness
might happen, but I hope I fixed most of those.

There might be some tests that were `REQUIRES: asserts` that might run
in `noasserts` toolchains now. This will normally be because their
feature went from experimental to upcoming/base and the tests were not
updated.
2024-11-02 11:46:46 -07:00
Daniel Rodríguez Troitiño
facdb57f39 [test] Transform Swift Features.def into Lit available features
Take the `Features.def` file used in other parts of the code and create
a file that can be used from the LLVM Lit configuration files to add new
available features that can be checked from the tests with `REQUIRES`
and others.

The file `lit.swift-features.cfg.inc` is preprocessed by Clang and
generates a file with Python syntax that can be loaded from both
`lit.site.cfg.in` files. The preprocessing output is copied into the
different test directories in the build directory, and added it is added
as a dependency of them, so it will be generate when the test run or
when `Features.def` changes.

`EXPERIMENTAL_FEATURES` are only enabled if they are available in
production or the compiler is being built with assertions, while
`UPCOMING_FEATURES` and the rest of the `LANGUAGE_FEATURES` are always
available.
2024-11-02 11:41:09 -07:00
Daniel Rodríguez Troitiño
1e5903773b [test] Fix incorrect usage of swift_obj_root in unified builds
When doing an unified build (Swift being an external project of LLVM),
the Swift build is at `<llvm build dir>/tools/swift`, and that is the
value of `swift_obj_root`. However many products are actually placed in
`<llvm build dir>`, like `bin/`, `include/` and things like
`lib/swift/...` and others.

A couple of macros tests check the error messages printed by the
compiler against `swift_obj_root` (by the replacement done in
`PathSanitizingFileCheck` of `BUILD_DIR`) when it should have been
checking them against the top-level build directory, which will work in
both unified and non-unified builds (like `build-script` builds).
2024-11-01 11:25:59 -07:00
Slava Pestov
1acb61d23a SIL: Fix SILType::isLoweringOf() to correctly handle opaque archetypes
This predicate is meant to ask if the loweredType is equal to
`getLoweredType(pattern, formalType)` for *some* abstraction pattern.

If the formal type contained an opaque archetype, we performed a
different check, because we asked if loweredEqual is equal to
`getLoweredType(AbstractionPattern(formalType), formalType)`.

This caused a spurious SIL verifier failure when the payload of an
existential contained an opaque archetype, because we lower the
payload with the most general AbstractionPattern, so that
@thin metatypes become @thick, etc.

The regression test exercises this bug, and also another bug that was
present in 6.0 but was already fixed on main by one of my earlier
refactorings.

Fixes rdar://problem/138655637.
2024-10-30 13:19:46 -04:00
Ben Barham
f59b2f19e6 Merge branch 'main' into 2024-rebranch-to-main 2024-10-28 13:03:35 -07:00
Alex Hoppen
a313d4f50e Merge pull request #77120 from ahoppen/sdk-symlink
[SourceKit] Check if the realpath of a module is inside the SDK to decide if it's system
2024-10-24 15:48:23 -07:00
Ben Barham
746517c9f2 Merge remote-tracking branch 'origin/main' into manually-merge-main-to-rebranch
Conflicts:
  - `test/IRGen/has_symbol.swift` test updates in rebranch. The new test
    will fail, will fix in the next commit.
2024-10-24 14:20:17 -07:00
Slava Pestov
308b4f4161 Sema: Re-enable validation-test/Sema/type_checker_perf/slow/nil_coalescing.swift.gyb 2024-10-22 20:14:42 -04:00
swift-ci
98cf59bfc9 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-22 11:14:06 -07:00
Pavel Yaskevich
6754918b08 Merge pull request #77153 from xedin/issue-77003
[CSBindings] Limit `BindingSet::isViable` binding skipping to stdlib …
2024-10-22 11:11:48 -07:00
swift-ci
f55e335912 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-21 19:14:25 -07:00
Slava Pestov
1cbd7d3163 Merge pull request #77152 from slavapestov/fix-issue-77008
Sema: Give constraints a more dignified retirement
2024-10-21 22:10:05 -04:00
Pavel Yaskevich
2b11ecbec9 [CSBindings] Limit BindingSet::isViable binding skipping to stdlib collection types
This is follow-up to https://github.com/swiftlang/swift/pull/76487

It's reasonable to coalesce bindings of different kind if they don't
allow implicit conversions like stdlib collection types do.

Resolves: https://github.com/swiftlang/swift/issues/77003
2024-10-21 14:48:45 -07:00
Slava Pestov
6648508184 type_checker_perf tests should require no_asan
Fixes rdar://problem/138246764.
2024-10-21 17:25:38 -04:00
Alex Hoppen
a287e2ae8e [SourceKit] Check if the realpath of a module is inside the SDK to decide if it's system
On Windows, we run into the following situation when running SourceKit-LSP tests:
- The SDK is located at `S:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk` with `S:` being a substitution drive
- We find `Swift.swiftmodule` at `S:\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk\usr\lib\swift\windows\Swift.swiftmodule`
- Now, to check if `Swift.swiftmodule` is a system module, we take the realpath of the SDK, which resolves the substitution drive an results in something like `C:\Users\alex\src\Program Files\Swift\Platforms\Windows.platform\Developer\SDKs\Windows.sdk`
- Since we don’t take the realpath of `Swift.swiftmodule`, we will assume that it’s not in the SDK, because the SDK’s path is on `C:` while `Swift.swiftmodule` lives on `S:`

To fix this, we also need to check if a module’s real path is inside the SDK.

Fixes swiftlang/sourcekit-lsp#1770
rdar://138210224
2024-10-19 10:35:09 -07:00
swift-ci
02078feb01 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-19 06:16:37 -07:00
Slava Pestov
15db24238e Merge pull request #77112 from slavapestov/solver-perf-tests
Add a couple of solver performance tests
2024-10-19 09:14:15 -04:00
Slava Pestov
d502e556e9 Add a couple of solver performance tests 2024-10-18 17:54:25 -04:00
swift-ci
00cd798510 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-18 13:45:51 -07:00
Allan Shortlidge
082f0ac4b5 Tests: Use a more natural spelling for ABI triple lit substitutions.
`%target-swift-5.8-abi-triple` instead of `%target-swift-abi-5.8-triple`, for
example.
2024-10-18 10:11:36 -07:00
swift-ci
1df3ffb7cb Merge remote-tracking branch 'origin/main' into rebranch 2024-10-17 09:12:58 -07:00
Tim Kientzle
5bd2c4b93c Merge pull request #77027 from tbkka/tbkka-remotemirror-classexistential
Fix multi-payload enums with Class Existential payloads on 32-bit targets
2024-10-17 08:57:38 -07:00
Tim Kientzle
3abefd1dda Accomodate x86_64 vs. arm64 differences 2024-10-17 08:51:47 -07:00
Tim Kientzle
fe90ad5684 Let indirect enum cases export spare bits
To determine the correct enum layout, we first count various
categories of cases.  Before, we counted indirect generic cases as
"generic", but regular "generic" cases can't export spare bits.

Change this to count "indirect" cases as a separate category.
In particular, this ensures that fully-indirect enums use
spare bits from the pointers even when some or all of the cases
are generic.

Resolves rdar://133890406
2024-10-16 18:31:28 -07:00
Tim Kientzle
502941ca5a More arcana about MPEs carrying class existentials
The first word in a class existential is the class pointer itself.
This pointer exposes spare bits differently depending
on the platform, which becomes apparent when you try to reflect
an Optional carrying such an MPE.

Add new test cases and some logic to zero out the first
word of spare bit information only on platforms with 8-byte pointers.
2024-10-16 16:06:37 -07:00
swift-ci
0462851544 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-16 09:56:16 -07:00
nate-chandler
b5e3f42cad Merge pull request #77044 from nate-chandler/rdar137960229
[DiagnoseUnreachable] Ignore dead_end destroys.
2024-10-16 09:41:48 -07:00
Nate Chandler
ce368e8220 [DiagnoseUnreachable] Ignore dead_end destroys.
Such destroys mark the lifetime end of their operands along their
availability boundary.  They are currently inserted in this test case
by the ClosureLifetimeFixup pass, but in the fullness of time they will
be present for every value which is not explicitly destroyed (that's
what complete OSSA lifetimes is mostly about).

Currently, such destroys are diagnosed by DiagnoseUnreachable.  Fix the
diagnostic pass not to diagnose these valid instructions.

rdar://137960229
2024-10-15 21:00:16 -07:00
Tim Kientzle
a105cf5323 Fix multi-payload enums with Class Existential payloads on 32-bit targets
Class existentials expose spare bits from all of the pointers, not just the first one.
Due to a bad bug here, we were properly exposing spare bits from the first pointer,
but then claiming that all bits of subsequent pointers were spare.
This accidentally resulted in the correct operation on 64-bit targets
(it picked the highest-order spare bit, which happened to be spare
in both the broken mask and the correct mask).  But on 32-bit targets,
this exposed the high-order bits of pointers, which is incorrect.

Expand the test a bit while we're here as well.

Resolves rdar://132715829
2024-10-15 09:28:01 -07:00
swift-ci
b4f1024467 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-13 07:34:41 -07:00
Rintaro Ishizaki
8e8e4d0193 [Parse/Sema] Move OptionalEvaluationExpr wrapping to PreCheckTarget
This simplify the Parser diagnostics and some type checker logic.
2024-10-11 13:12:48 -07:00
swift-ci
24c3b5e002 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-07 17:15:46 -07:00
Mike Ash
ceb2853948 [Test] Temporarily disable reflect_Enum_values10 test on ARM64_32.
This test hits a bug on ARM64_32, disable it temporarily until we can fix it.
2024-10-07 16:16:07 -04:00
swift-ci
dee3d90d16 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-30 11:16:46 -07:00
Nate Chandler
350aaa4d39 [Test] Mark unsupported for OS stdlib.
The test verifies a stdlib behavior whose fix is not present in all
OSes.

rdar://136943907
2024-09-30 07:14:54 -07:00
swift-ci
4b2c2235c0 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-27 11:16:06 -07:00
nate-chandler
79b0a7cf78 Merge pull request #76739 from nate-chandler/rdar136388508_2
[Test] Added regression test.
2024-09-27 11:02:08 -07:00
Nate Chandler
03e101813d [Test] Added regression test. 2024-09-26 16:20:09 -07:00
Guillaume Lessard
03d9d04c2e [test] Test sendability of POSIXErrorCode 2024-09-24 13:11:26 -07:00
swift-ci
415b83acd6 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-24 05:54:22 -07:00
Hamish Knight
bbb04aaa20 [test] Disable bridging PCH in a few tests
The new driver builds a PCH by default, which the
old driver didn't do. These tests don't expect a
PCH, so avoid building it.
2024-09-22 21:15:45 +01:00
Hamish Knight
345619e9cb [test] Remove a test for linking against libraries in the resource dir
This is no longer a behavior we have in the new driver
(swiftlang/swift-driver#733).
2024-09-22 19:40:06 +01:00
swift-ci
5e0b892e9e Merge remote-tracking branch 'origin/main' into rebranch 2024-09-20 13:09:36 -07:00
Tim Kientzle
5d5627ae82 Merge pull request #76586 from tbkka/tbkka-enum-with-CF
Better support CoreFoundation types in RemoteMirror
2024-09-20 13:09:26 -07:00