Commit Graph

248 Commits

Author SHA1 Message Date
Hamish Knight
8f4fbe3d9a [cmake] Remove remaining XCODE checks
I missed these when ripping out support for CMake Xcode project
generation.
2025-06-09 22:16:12 +01:00
Anthony Latsis
4f4141fea8 Frontend: Obsolete -fixit-all and -emit-fixits-path
With `ARCMigrate` and `arcmt-test` removed from clang in
https://github.com/llvm/llvm-project/pull/119269 and the new code
migration experience under way (see
https://github.com/swiftlang/swift-evolution/pull/2673), these options
are no longer relevant nor known to be in use. They were introduced
long ago to support fix-it application in Xcode.

For now, turn them into a no-op and emit a obsoletion warning.
2025-05-07 02:30:30 +01:00
Alastair Houghton
ab8e561583 Merge pull request #78516 from al45tair/eng/PR-124913332
[Backtracing] Implement API per SE-0419
2025-01-28 10:48:33 +00:00
Alastair Houghton
432c138ccf [Backtracing][Tests] Tweak swift-backtrace dependency.
We only want to add the `swift-backtrace` binary dependency when the
SDK we're looking at actually has `swift-backtrace` enabled.

rdar://124913332
2025-01-23 16:32:41 +00:00
Kuba Mracek
5ca4293ca4 [embedded] Fix lit site config for embedded QEMU tests to generate lit.swift-features.cfg 2025-01-19 11:22:17 -08:00
Alastair Houghton
6c0749d369 [Backtracing][Tests] Fix the name of the swift-backtrace dependency.
Because it's a target executable, the name of the dependency is suffixed
with the SDK.

rdar://124913332
2025-01-17 10:09:37 +00:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
Henrik G. Olsson
ef9d2b744d Rename pointer bounds (#78210)
* Make pointer bounds non-experimental

* Rename @PointerBounds to @_SwiftifyImport

* Rename filenames containing PointerBounds

* Add _PointerParam exception to stdlib ABI test

* Add _PointerParam to stdlib API changes

* Rename _PointerParam to _SwiftifyInfo
2024-12-20 11:36:01 +01:00
Daniel Rodríguez Troitiño
753cbcd2af [test] Generate Lit Swift features file once during CMake generation (#77658)
Some people are reporting problems with the features file being missing
during testing. Try executing the same process that will regenerate the
files when dependencies change during CMake generation, so the file is
there after the project is configured.

(Maybe)
Fixes #77642
2024-11-18 09:24:45 -08:00
Henrik G. Olsson
0678829cf7 Add @PointerBounds macro (#76969)
Add @PointerBounds macro

@PointerBounds is a macro intended to be applied by ClangImporter when
importing functions with pointer parameters from C headers. By
leveraging C attributes we can get insight into bounds, esapability, and
(eventually) lifetimes of pointers, allowing us to map them to safe(r)
and more ergonomic types than UnsafePointer.

This initial macro implementation supports CountedBy and Sizedby, but
not yet EndedBy. It can generate function overloads with and without an
explicit count parameter, as well as with UnsafeBufferPointer or Span
(if marked nonescaping), and any of their combinations. It supports
nullable/optional pointers, and both mutable and immutable pointers.
It supports arbitrary count expressions. These are passed to the macro
as a string literal since any parameters referred to in the count
expression will not have been declared yet when parsing the macro.

It does not support indirect pointers or inout parameters. It supports
functions with return values, but returned pointers can not be bounds
checked yet.

Bounds checked pointers must be of type Unsafe[Mutable]Pointer[?]<T>
or Unsafe[Mutable]RawPointer[?]. Count expressions must conform to
the BinaryInteger protocol, and have an initializer with signature
"init(exactly: Int) -> T?" (or be of type Int).

rdar://137628612

---------

Co-authored-by: Doug Gregor <dgregor@apple.com>
2024-11-11 14:54:25 -08: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
Kuba Mracek
dd1e3a9640 [embedded] Add a riscv32-qemu-virt QEMU test configuration 2024-10-28 21:37:52 -07:00
Kuba Mracek
8620a99b18 [embedded] Add QEMU-based testing configs for ARM and AVR for runtime testing 2024-10-25 14:52:49 -07:00
Meghana Gupta
e6fc5c2e6d Delete SWIFT_ENABLE_EXPERIMENTAL_NONESCAPABLE_TYPES flag 2024-09-16 14:08:16 -07:00
Daniel Rodríguez Troitiño
f27139ea16 [test] Wire libMockPlugin and swift-plugin-server as test dependencies (#74808)
The build script will build these pieces because they are wired to the
tools and compiler components, but when using `ninja` or `cmake`
directly to clean the build, and then later `check-swift-validation` and
other test targets, it would not rebuild those targets, failing many of
the macros/plugins tests.
2024-06-28 02:16:26 -07:00
Kuba Mracek
6eeef12849 [embedded] Add a embedded-libraries CMake target to simplify the test dependencies 2024-06-23 13:08:01 -07:00
Kuba Mracek
97706f2270 [embedded] Normalize spelling of SWIFT_SHOULD_BUILD_EMBEDDED_STDLIB for lit.site.cfg.in 2024-06-19 09:22:24 -07:00
Kuba Mracek
37ed08dc7b Add a build-script + CMake flag to enable/disable building the _Volatile module 2024-06-17 13:18:55 -07:00
Alastair Houghton
90ea73810b [Tests] Remove erroneous swiftRemoteInspection dependency.
This was added by #71839 as part of a fix for the
`TypeRoundTrip/round-trip.swift` test, but it isn't necessary and
it's breaking nightly builds.

rdar://128000843
2024-05-13 15:01:44 +01:00
Alastair Houghton
2297c3f5b6 [Build][Test] Fix TypeRoundTrip/round-trip.swift.
`TypeRoundTrip/round-trip.swift` tries to link with `libswiftRemoteInspection`,
but that library isn't in the default link path, so we need to add a `-L`
option to the command line in the test.

Also, we should check that `SWIFT_BUILD_REMOTE_MIRROR` is enabled and
disable the test if not, because otherwise `libswiftRemoteInspection` won't
have been built.

rdar://123503470
2024-05-06 08:46:05 +01:00
Alastair Houghton
ae1c0455f3 [Build] Add the new fully-static Linux SDK.
Declare a new `LINUX_STATIC` SDK and configure it.

Add options to set the build architectures for the `LINUX` and
`LINUX_STATIC` SDKs, similar to what we have for Darwin, because
we'll be cross-compiling.

Also add an option to point the build system at the sources for
the musl C library, which we're using for `LINUX_STATIC`.

rdar://123503470
2024-05-02 14:56:18 +01:00
Artem Chikin
01d891ad99 Merge pull request #72834 from artemcm/UpstreamVisionOS
Introduce visionOS Platform
2024-04-15 09:33:49 -07:00
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Nuri Amari
b0b228b37a [test][embedded] Declare embedded-volatile as a test depdency
We fail to build the embedded variant of this target before running the
embedded/volatile* tests, then fail to import `_Volatile`.
2024-04-08 19:13:48 -07:00
Doug Gregor
922e3daaea Remove build infrastructure for globally enabling noncopyable types
Now that the compilation model of noncopyable types is enabled everywhere,
and one can enable the feature for specific modules, we no longer need a
separate build-script/CMake option to enable it globally. Remove it all.
2024-03-19 13:35:31 -07:00
Daniel Rodríguez Troitiño
88ec9ee414 [test][embedded] Declare embedded-synchronization as a test dependency (#72356)
PR #72293 added the synchronization module to embedded, and it was added
as dependency of `ALL`, but not of the `-test-depends` targets. If one
is using the `-test-depends` targets, the synchronization library for
embedded will not be build, and the test will fail.

This is a follow up to #72329. I had a partial build to test that, and
I did not notice this was also missing.
2024-03-16 09:06:49 -07:00
Daniel Rodríguez Troitiño
9c5216f5e9 [test] Add swift-scan-test to test dependencies (#72280)
The swift-scan-test is exclusively used from the tests, but it was not
added to the `*-test-depends` targets, so trying to prepare the test
dependencies will not had build it, and test failures will happen.
2024-03-13 09:35:07 -07:00
Meghana Gupta
f3a85b118f Add build-script option and lit config for nonescapable_types
With this build-script has a flag --enable-experimental-nonescpable-types=1
to enable this feature in stdlib.

Also we can now add // REQUIRES: nonescapable_types to tests which run only when
the compiler is built with this feature turned on.
2024-03-06 21:57:03 -08:00
Kuba Mracek
433fbdb861 [embedded] Declare embedded-darwin and embedded-concurrency as test dependencies 2024-02-15 10:54:16 -08:00
Kavon Farvardin
b92fe5f2e9 [build-script] fix NoncopyableGenerics option
This patch introduces `--enable-experimental-noncopyable-generics` for
the build script. It replaces
`--swift-stdlib-experimental-noncopyable-generics`

The old build option only enables the feature when building the
stdlib, but if we've built the stdlib with NoncopyableGenerics, the
compiler should be hardwired to have that feature enabled, too.

This patch also introduces the `noncopyable_generics` lit parameter, so
that tests assuming the system was built with the feature can live
in-tree and be tested, if they specify `REQUIRES: noncopyable_generics`.
2024-01-23 22:41:59 -08:00
Artem Chikin
73b01dccfc Remove incremental builds from the Legacy driver
The C++-based driver is deprecated and this will help reduce the code surface that requires maintenance as the legacy driver is fully sunset.
2024-01-16 16:34:51 -08:00
Alejandro Alonso
b68e864b5f Try to appease CI
more test fixes
2024-01-03 13:01:24 -05:00
Daniel Rodríguez Troitiño
4df621332f [test] Add dependency to the embedded-stdlib (#70215)
When not building `all`, like the `build-script` does in CI, the tests
did not have a dependency on `embedded-stdlib`, and those tests will
fail to pass if one was using CMake/Ninja to execute the tests after
something like `ninja clean`.

The dependency is added if the embedded stdlib is being built.
2023-12-05 14:33:46 -08:00
Rintaro Ishizaki
00f9935297 [Windows] Enable macros in Windows
After FetchContent changes, macros in Windows were disabled.
2023-09-30 14:50:07 -07:00
Rintaro Ishizaki
f8f7109f7e [CMake] Use global SWIFT_HOST_TRIPLE consistently
Instead of calling 'get_swift_host_triple()' repeatedly, because it
always return the same value.
2023-09-21 09:59:17 -07:00
Rintaro Ishizaki
8909c8a56e [CMake] Centralize the logic to get host '-target' tripple
And pass the value to 'swift-syntax', so they gets correct deployment
target.
2023-09-18 14:44:12 -07:00
Evan Wilde
e54b18370d Delete backdeploy concurrency library
This library served its purpose and has overstayed its welcome.
The library shipped in Xcode can't change again from the state it was
in, so changes to the sources here will not affect that library, which
is confusing. The library does not currently build due to changes in the
runtime headers, so it does not give meaningful signal to anything
anymore. If you need to test things in a backdeploy concurrency
environment, use the copy from the toolchain in Xcode as that will give
you a far clearer picture of what the code will actually be running with
than the state of the sources here did.
2023-08-20 11:01:23 -07:00
Cyndy Ishida
a533c63d78 Update references of tapi-diff to readtapi in tests (#67877) 2023-08-12 08:18:06 -07:00
Max Desiatov
05919751b4 test/CMakeLists.txt: set correct resources path for static stdlib (#67629)
For platforms that support only static stdlib (i.e. `if(NOT SWIFT_BUILD_DYNAMIC_STDLIB AND SWIFT_BUILD_STATIC_STDLIB)` we should set `test_resource_dir` value correctly to use the `swift_static` subdirectory.
2023-08-01 16:53:39 +01:00
Evan Wilde
669285fd17 Merge pull request #65534 from stephank/fix/cmake-3.25
build: fix accidental cmake expansions
2023-07-24 09:44:14 -07:00
Max Desiatov
e495eed891 test/CMakeLists.txt: add support for WASI SDK (#67474)
WASI SDK should be supported in `test/CMakeLists.txt` like the rest of the SDKs for us to be able to build tests for this platform.
2023-07-22 22:48:50 +01:00
Stéphan Kochen
7b460ce495 build: fix accidental cmake expansions
As of CMake 3.25, there are now global variables `LINUX=1`, `ANDROID=1`,
etc. These conflict with expressions that used these names as unquoted
strings in positions where CMake accepts 'variable|string', for example:

- `if(sdk STREQUAL LINUX)` would fail, because `LINUX` is now defined and
  expands to 1, where it would previously coerce to a string.

- `if(${sdk} STREQUAL "LINUX")` would fail if `sdk=LINUX`, because the
  left-hand side expands twice.

In this patch, I looked for a number of patterns to fix up, sometimes a
little defensively:

- Quoted right-hand side of `STREQUAL` where I was confident it was
  intended to be a string literal.

- Removed manual variable expansion on left-hand side of `STREQUAL`,
  `MATCHES` and `IN_LIST` where I was confident it was unintended.

Fixes #65028.
2023-07-17 21:50:50 +02:00
Cyndy Ishida
4f0e866061 [TBDGen] Ensure symbols listed include maccatalyst when library is built (#67160)
zippered.

This also introduces a dependency on new testing tool
llvm-tapi-diff. This allows for a structural difference check on tbd
files.

resolves: rdar://107368040
2023-07-07 08:40:07 -07:00
Steven Wu
2b7d38dc16 [CAS] Improve swift cas options
Using the same CASOption from clang to communicate CAS configurations so
it is easier to exchange CAS configuration between them.
2023-06-26 10:34:26 -07:00
Steven Wu
b1f99b8e93 [CAS] swift dependency scanning using CAS for compiler caching (#66366)
Teach swift dependency scanner to use CAS to capture the full dependencies for a build and construct build commands with immutable inputs from CAS.

This allows swift compilation caching using CAS.
2023-06-12 10:55:53 -07:00
Alastair Houghton
ee5596428f [Backtracing][Linux] Enable Linux backtracing, add tests.
Turn on the Linux backtracing implementation and update the tests.

rdar://101623265
2023-06-07 09:08:18 +01:00
Erik Eckstein
e7af73e2de Replace the swift-llvm-opt binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:53:12 +02:00
Erik Eckstein
2b2bc45e08 Replace the swift-dependency-tool binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:51:04 +02:00
Erik Eckstein
8ce6038a42 Replace the sil-passpipeline-dumper binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:49:33 +02:00
Erik Eckstein
e3a174b85e Replace the sil-llvm-gen binary with a symlink to swift-frontend
rdar://76551283
2023-04-24 13:48:23 +02:00