mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[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.
This commit is contained in:
@@ -762,6 +762,7 @@ public protocol ExpressibleByDictionaryLiteral {
|
||||
/// `StringInterpolationProtocol` and have a matching `StringLiteralType`.
|
||||
///
|
||||
/// For more information, see the `StringInterpolationProtocol` documentation.
|
||||
@_unavailableInEmbedded
|
||||
public protocol ExpressibleByStringInterpolation
|
||||
: ExpressibleByStringLiteral {
|
||||
|
||||
@@ -787,6 +788,7 @@ public protocol ExpressibleByStringInterpolation
|
||||
init(stringInterpolation: StringInterpolation)
|
||||
}
|
||||
|
||||
@_unavailableInEmbedded
|
||||
extension ExpressibleByStringInterpolation
|
||||
where StringInterpolation == DefaultStringInterpolation {
|
||||
|
||||
@@ -940,6 +942,7 @@ public protocol _ExpressibleByColorLiteral {
|
||||
|
||||
/// A type that can be initialized using an image literal (e.g.
|
||||
/// `#imageLiteral(resourceName: "hi.png")`).
|
||||
@_unavailableInEmbedded
|
||||
public protocol _ExpressibleByImageLiteral {
|
||||
/// Creates an instance initialized with the given resource name.
|
||||
///
|
||||
@@ -950,6 +953,7 @@ public protocol _ExpressibleByImageLiteral {
|
||||
|
||||
/// A type that can be initialized using a file reference literal (e.g.
|
||||
/// `#fileLiteral(resourceName: "resource.txt")`).
|
||||
@_unavailableInEmbedded
|
||||
public protocol _ExpressibleByFileReferenceLiteral {
|
||||
/// Creates an instance initialized with the given resource name.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user