Commit Graph

151 Commits

Author SHA1 Message Date
Slava Pestov
af8c8f1671 Sema: Remove non-experimental associated type inference 2024-03-07 17:30:17 -05:00
Xi Ge
834ade5f99 cmake: avoiding generating ABI baseline files when building stdlib
We have a regression test checked in the compiler repository to detect ABI breakges as the
stdlib evolves, therefore we don't need to generate these side car files for ABI checking
purposes that could be potentially done externally.

Related to: rdar://118465899
2024-02-29 11:36:57 -08:00
Kavon Farvardin
ee12fd6655 NCGenerics: reenable round-trip for mangling 2024-02-06 08:15:26 -08:00
Michael Gottesman
42a4d2d0cd Merge pull request #71236 from gottesmm/pr-213cb762cfa24a27de8dc40f5c2929451d1825cb
[stdlib] Add an option SWIFT_STDLIB_ENABLE_STRICT_CONCURRENCY_COMPLETE to enable building the stdlib with strict-concurrency=complete.
2024-01-31 11:20:32 -08:00
Michael Gottesman
2db4b5ca52 [stdlib] Add an option SWIFT_STDLIB_ENABLE_STRICT_CONCURRENCY_COMPLETE to enable building the stdlib with strict-concurrency=complete.
It is currently by default off.
2024-01-29 21:21:05 -08:00
Saleem Abdulrasool
1864caad5e build: migrate to CMake based build of swift-format
This allows us to build swift-format with dynamic linking against the
toolchain build of the swift-syntax and swift-argument-parser packages.
Wire up the swift-markdown build and hoist the swift-format build prior
to sourcekit-lsp. This sets us up for supporting swift-format based
formatting in the LSP.
2024-01-26 15:51:29 -08:00
Kavon Farvardin
fc9575cda9 [NCGenerics] enable new associated type inference
The experimental-associated-type-inference flag is needed to correctly
build programs when NoncopyableGenerics is enabled.
2024-01-23 22:41:59 -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
Allan Shortlidge
e5c6bb649c Remove support for Swift 3 @objc inference.
Obsolete the `-enable-swift3-objc-inference` option and related options by
removing support for inferring `@objc` attributes using Swift 3 rules.
Automated migration from Swift 3 has not been supported by the compiler for
many years.
2024-01-11 15:40:04 -08:00
Kavon Farvardin
29d6d6aaf0 [NCGenerics] disable mangling roundtrip checking
This is a temporary measure until I get a chance to fix the symbol
mangling. This round-tripper is exactly flagging the current
known issue in that all of the symbols get extra `Copyable` and
`Escapable` requirements mangled into them, and thus reconsituting the
type from the mangled name doesn't give you the same type back.
2024-01-10 19:37:21 -08:00
Alejandro Alonso
e37ecac163 Merge pull request #68857 from Azoy/atomics
[stdlib] Atomics
2024-01-10 12:03:08 -08:00
Slava Pestov
ab28449be7 stdlib: Don't build with -enable-experimental-associated-type-inference for now
Some CI jobs use an older toolchain, which chokes when building the stdlib
with this flag.

Fixes rdar://119895175.
2024-01-03 16:28:22 -05:00
Alejandro Alonso
2c0b473b8d Add Synchronization module 2023-12-18 14:01:16 -05:00
Alejandro Alonso
6d6e55a931 Apply feedback from pitch 2023-12-18 14:01:15 -05:00
Alejandro Alonso
ae983d8f84 Add Synchronization module 2023-12-18 14:01:14 -05:00
Rokhini Prabhu
ed8ed32dba Clean up Concurrency build system so that all the logic around choice of
which executor for which type of setting, is consolidated and we have a
single knob we use to determine when to use dispatch as our global
executor.

Radar-Id: rdar://problem/119416196
2023-12-13 16:09:51 -08:00
Slava Pestov
4bf0cc2490 Always build the stdlib with -enable-experimental-associated-type-inference 2023-12-10 11:21:35 -05:00
Rintaro Ishizaki
f327bf7616 [CMake] Correct dependencies
HeaderDependencies.cpp and the stdlib filelist didn't have dependencies.
That causes issues when the content is changed.
2023-11-16 13:54:14 -08:00
Mike Ash
967c5c6a75 Merge pull request #69542 from mikeash/retain-release-override-optional
[Runtime] Add option to remove override point for retain/release.
2023-11-08 19:51:29 -05:00
Egor Zhdan
f8b5143573 [build] Respect DEPLOYMENT_VERSION_{IOS|TVOS|WATCHOS} for Swift sources
See https://github.com/apple/swift/pull/69512

rdar://117699474
2023-11-06 16:20:24 +00:00
Mike Ash
6606850232 [Runtime] Add option to remove override point for retain/release.
Add a `SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE` CMake option. When set to true, swift_retain/release and the other functions in InstrumentsSupport.h can be overridden by setting the appropriate global function pointer, as is already the case. When set to false, those function pointers are removed and the functions always go into the default implementation.

Set `SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE` to false when building the minimal stdlib, and set it to true otherwise by default.

rdar://115987924
2023-10-31 15:26:01 -04:00
Egor Zhdan
e192ee24d1 [build] Respect DEPLOYMENT_VERSION_OSX for Swift-only targets
The CMake flag `DEPLOYMENT_VERSION_OSX` is currently only passed to the C compiler. This change makes sure it is also passed to the Swift compiler, e.g. when building Swift-only targets like Cxx or CxxStdlib.

rdar://117699474
2023-10-30 19:22:02 +00:00
Kavon Farvardin
3da894d704 [NoncopyableGenerics] provide stdlib build option
This helps set the stage for getting the stdlib building
correctly with `NoncopyableGenerics` enabled. Disabled by
default for now so this is an NFC.
2023-10-25 09:27:36 -07:00
Eric Miotto
03c490cc11 [CMake] add option to generate API descriptors for the standard library (#69228)
This would be needed to stop using `swift-api-extract` in some
internal configurations.

Given the limited scope, only add this as a CMake flag.

Addresses rdar://117019309
2023-10-18 07:23:27 -07:00
Kuba (Brecka) Mracek
75838507d8 Merge pull request #68929 from kubamracek/embedded-sdk3
[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3
2023-10-03 07:02:19 -07:00
Kuba Mracek
d579c62fee [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 3 2023-10-02 17:55:02 -07:00
Kuba Mracek
268a1e3556 Revert "[embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2"
This reverts commit a1a48b5c83.
2023-10-02 09:35:21 -07:00
Kuba Mracek
a1a48b5c83 [embedded] Resolve empty -sdk path warning in embedded stdlib build, take 2 2023-09-28 09:17:32 -07:00
Kuba Mracek
0962d826b3 Revert "[embedded] Resolve empty -sdk path warning in embedded stdlib build"
This reverts commit 1b1db053d5.
2023-09-27 23:10:31 -07:00
Kuba Mracek
1b1db053d5 [embedded] Resolve empty -sdk path warning in embedded stdlib build 2023-09-27 14:50:25 -07:00
Kuba Mracek
3cacb3659d [embedded] Do not emit .swiftinterface files for fragile modules (embedded stdlib, Cxx.swiftmodule) 2023-09-26 17:59:19 -07:00
Rintaro Ishizaki
18d791ccfd [CMake] Avoid add_custom_command output being used from multiple target
without a target. Because Xcode generator  doesn't like it.
Use add_custom_command_target instead.
2023-09-19 16:58:12 -07:00
Kuba Mracek
ae2e903574 [embedded] Build an initial embedded Swift standard library
This isn't a "complete" port of the standard library for embedded Swift, but
something that should serve as a starting point for further iterations on the
stdlib.

- General CMake logic for building a library as ".swiftmodule only" (ONLY_SWIFTMODULE).
- CMake logic in stdlib/public/core/CMakeLists.txt to start building the embedded stdlib for a handful of hardcoded target triples.
- Lots of annotations throughout the standard library to make types, functions, protocols unavailable in embedded Swift (@_unavailableInEmbedded).
- Mainly this is about stdlib functionality that relies on existentials, type erasure, metatypes, reflection, string interpolations.
- We rely on function body removal of unavailable functions to eliminate the actual problematic SIL code (existentials).
- Many .swift files are not included in the compilation of embedded stdlib at all, to simplify the scope of the annotations.
- EmbeddedStubs.swift is used to stub out (as unavailable and fatalError'd) the missing functionality.
2023-09-16 12:38:46 -07:00
Rintaro Ishizaki
a182bdf584 [CMake] Update source file list only if different
Use 'copy_if_different' instead of 'file(GENERATE'. Somehow
'file(GENERATE' failed with

  CMake Error: Files to be generated by multiple different commands:
2023-09-15 13:46:49 -07:00
Rintaro Ishizaki
b888abfd38 [CMake] Update source file list only if different
Write source file list using 'file(GENERATE' so that they are updated
only if thier content is changed. Otherwise stdlib modules are rebuild
everytime cmake configuration happens.
2023-09-15 10:37:40 -07:00
Rintaro Ishizaki
ca41171be5 [CMake] Copy '.private.swiftinteface' to swift_static.
'.private.swiftinterface' should be a part of the module. And it's
declared as `OUTPUT` file list, but they were never created. Because of
that the target was always rebuilt.
2023-09-15 10:35:16 -07:00
Ben Barham
afd3f172cb [stdlib] Set PYTHONIOENCODING when building the stdlib
Ubuntu 18.04 seems to be defaulting to 'ascii', causing an error when
using line-directive combined with the utf-8 diagnostic output used when
early swift syntax is enabled.
2023-08-30 11:41:11 -07:00
Rintaro Ishizaki
0aa0aac72e [CMake] Always use builder's runtime for building Swift code in Linux
Some non-stdlib thing e.g. swift-backtrace still might be built before
the runtime is built. For building Swift code in Linux "hosttools",
always set 'LD_LIBRARY_PATH' to the runtime in the builder.
2023-08-29 16:36:24 +00:00
Saleem Abdulrasool
3f828e915a build: ensure that we push -static into the flags
The CxxStdlib module is built statically only.  We would previously
build the static library but indicate dynamic linking.  This would
incorrectly code generate in the client on Windows making it impossible
to use the module.
2023-08-07 08:51:55 -07: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
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
Alex Lorenz
045fcf3ff5 [interop] Prohibit use of C++ APIs in public interfaces that opt-in into library evolution
The CxxStdlib overlay now has to be built without library evolution enabled.
2023-04-13 10:48:09 -07:00
Evan Wilde
e5bbffc38b Handle catalyst interface swap
Need to swap out the private interface for catalyst builds.
2023-04-03 15:48:44 -07:00
Evan Wilde
14956ef82b Build private swift interface files from stdlib
We have various pieces of SPI that are getting used in tests that are
failing occasionally. The swiftmodule file has the SPI, so if the
compiler loads from the swiftmodule file, everything works fine. If the
compiler loads the interface from the swiftinterface file, it fails to
find the `startOnMainActor` declaration.
2023-03-23 10:45:04 -07:00
Alejandro Alonso
09b1476ddf Stop building Reflection 2023-03-14 11:49:38 -07:00
Evan Wilde
2785d18061 Enable swift color diagnostics in stdlib
I want pretty colors. I will have my pretty colors. :)
2023-03-04 23:40:13 -08:00
Philippe Hausler
8a7f6009b9 Initial draft of observation 2023-02-27 17:09:00 -08:00
Arnold Schwaighofer
e12130c19c Add swift-async-frame-pointer=never when relative protocol witness tables is on
Building a static library in debug does not work when using
swift-async-frame-pointer.
2023-02-01 07:12:49 -08:00
Arnold Schwaighofer
770648f161 Initial runtime changes to support relative protocol witness tables 2023-01-31 10:59:37 -08:00
Alejandro Alonso
c7a9360806 [Reflection] Build the _Runtime and Reflection modules (#62973)
* Move Runtime into _Runtime

Fix more _Runtime names

* Add availability to all API

* Build _Runtime and Reflection modules

* Use threading's mutex for all platforms

add stdlib include
2023-01-17 09:30:16 -08:00