Commit Graph

21665 Commits

Author SHA1 Message Date
Kuba Mracek
0d4f91f271 [embedded] Add back lazy collection operations, collection diffing and StaticBigInt to Embedded Stdlib 2024-11-16 08:16:57 -08:00
John McCall
d8d70d9aac Add support for creating a task with a self-consuming task function.
Not used yet.
2024-11-15 22:51:57 -05:00
Konrad `ktoso` Malawski
45d15d1268 Merge pull request #76460 from finagolfin/ndk27 2024-11-15 17:50:40 +09:00
Artem Chikin
9cd689816c Revert "[NFC][CMake] Disable use of in-process 'libSwiftScan' queries when building the Standard Library" 2024-11-14 12:47:32 -08:00
Artem Chikin
201edb83f6 Merge pull request #77606 from artemcm/MoveLibSwiftScanOutOfTools
[CMake] Establish a dependency from standard library variants onto 'libSwiftScan'
2024-11-14 12:31:12 -08:00
Kuba (Brecka) Mracek
a680211a4f Merge pull request #77594 from kubamracek/embedded-int-parsing
[embedded] Enable integer parsing in Embedded Swift
2024-11-14 10:23:01 -08:00
Artem Chikin
338b9141e3 Move libSwiftScan from 'tools' to 'lib/Tooling'
'tools' should be reserved for executable tools.
2024-11-14 08:44:32 -08:00
Alastair Houghton
f2e48bd293 Merge pull request #76257 from AreaZR/e
Use instancetype for the benchmark and SwiftNativeNSObject
2024-11-14 14:18:00 +00:00
Egor Zhdan
f88b29bfdc Merge pull request #77445 from CrazyFanFan/feature_cxxset_remove
[cxx-interop] Allow removing elements from `std::set`.
2024-11-14 13:09:21 +00:00
Artem Chikin
419041163b Merge pull request #77601 from artemcm/DisableLibSwiftScanOnStdLib
[NFC][CMake] Disable use of in-process 'libSwiftScan' queries when building the Standard Library
2024-11-13 19:02:37 -08:00
artemcm
4deff61e11 [NFC][CMake] Disable use of in-process 'libSwiftScan' queries when building the Standard Library
Due to the ordering of our build system, we may encounter a race when building standard library variants using tools produced by Swift's 'tools' CMake build.
As a workaround, for now, ensure that the compiler building standard library variants does not rely on libSwiftScan built as part of 'tools'.
2024-11-13 23:15:08 +00:00
Allan Shortlidge
3914cdd425 Merge pull request #77578 from tshortli/warnings
stdlib/Concurrency: Resolve or suppress a bunch of warnings
2024-11-13 13:37:06 -08:00
Kuba Mracek
b370050dd0 [embedded] Enable integer parsing in Embedded Swift 2024-11-13 11:52:37 -08:00
Finagolfin
22833fbc54 [android] Update to LTS NDK 27c
Add a new bits/ header to the Android overlay, include runtime libraries that are
auto-extracted and listed many times to the list of libraries to be de-duplicated,
enable a C++ interop test that's working again, and update the doc with new
libraries that need to be available to run a simple executable.
2024-11-14 00:11:53 +05:30
Allan Shortlidge
1ee4924542 Concurrency: Suppress -Wcast-function-type-mismatch warnings. 2024-11-13 09:51:29 -08:00
Allan Shortlidge
806c60020c stdlib: Resolve an unused variable warning. 2024-11-13 09:51:29 -08:00
Allan Shortlidge
a549d0144e stdlib: Resolve -Wmissing-designated-field-initializers warnings. 2024-11-13 09:51:29 -08:00
Allan Shortlidge
3f42ec25f9 Concurrency: Fix warnings about unused functions. 2024-11-13 09:51:29 -08:00
Allan Shortlidge
17fd27554b stdlib: Adopt internal imports to suppress some warnings in tests. 2024-11-13 09:51:29 -08:00
Egor Zhdan
c20a2bfade Merge pull request #77559 from swiftlang/egorzhdan/cxxstdlib-resilient
[cxx-interop] Make Cxx and CxxStdlib libraries resilient
2024-11-13 16:45:01 +00:00
Crazy凡
aeaa8ecadd [cxx-interop] Allow removing elements from std::set. 2024-11-13 23:16:45 +08:00
Evan Wilde
af58e6e875 Merge pull request #77566 from etcwilde/ewilde/stdlib-rebuild-all-the-defines
[CMake] Cleaning up macOS symbol list
2024-11-12 22:02:00 -08:00
Dario Rexin
735aa98aad Merge pull request #77569 from drexin/wip-139708680
[Runtime] Add entry for native swift objc reference to initWithTakeTa…
2024-11-12 19:29:28 -08:00
Artem Chikin
e96fc88e58 Merge pull request #77541 from artemcm/AddSwiftScanDepToEmbeddedStdLib
[CMake] Add a dependency on 'libSwiftScan' for 'swiftCore'
2024-11-12 15:58:33 -08:00
Dario Rexin
591c2cbb65 [Runtime] Add entry for native swift objc reference to initWithTakeTable in CVW runtime
rdar://139708680

The entry was missing in the function table, causing runtime crashes.
2024-11-12 15:12:19 -08:00
Guillaume Lessard
4a909c7cc8 Merge pull request #77549 from glessard/buffer-update-fromContentsOf-null-check-removal
[stdlib] Elide some null-pointer checks in UM[R]BP bulk-copy functions
2024-11-12 15:51:20 -05:00
Nate Cook
e12e968570 Add contains(_:) methods to (Closed)Range (#76891)
The _StringProcessing module provides a generic, collection-based
`contains` method that performs poorly for ranges and closed ranges.
This addresses the primary issue by providing concrete overloads
for Range and ClosedRange which match the expected performance for
these operations.

This change also fixes an issue with the existing range overlap tests.
The generated `(Closed)Range.overlap` tests are ignoring the "other"
range type when generating ranges for testing, so all overlap tests
are only being run against ranges of the same type. This fixes things
so that heterogeneous testing is included.
2024-11-12 11:47:24 -08:00
Evan Wilde
e160e23dde [CMake] Connecting more flags and options
Making a more in-depth pass over the definition macros and flags in
SwiftSource.cmake _add_target_variant_swift_compile_flags.
These are only flags that actually matter for swiftCore though. This
does not include concurrency flags.
2024-11-12 11:31:10 -08:00
Artem Chikin
58709e58e7 [CMake] Add a dependency on 'libSwiftScan' for 'swiftCore'
It appears that 'swiftCore' and following associated 'embedded-stdlib-*' targets may begin building before the libSwiftScan library has completed building, which may cause crashes if the compiler process building 'swiftCore' attempts to load it.

Resolves rdar://137674862
2024-11-12 10:05:47 -08:00
Egor Zhdan
703e479135 [cxx-interop] Make Cxx and CxxStdlib libraries resilient
This enables library evolution for the two libraries that form the Swift overlay for the C++ standard library.

rdar://129169673
2024-11-12 17:22:03 +00:00
Guillaume Lessard
54066b2562 Merge pull request #77548 from glessard/rdar139668469-not-immortal-vincible
[span] express correct lifetimes for initializers
2024-11-12 07:40:41 -05:00
Guillaume Lessard
a50260b181 [stdlib] Avoid unnecessary null-pointer checks in UM[R]BP bulk-copy functions 2024-11-11 23:57:47 -05:00
Guillaume Lessard
76d22cc675 [span] correctly express lifetimes for initializers 2024-11-11 23:31:16 -05: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
Saleem Abdulrasool
fc18223576 Merge pull request #77490 from compnerd/frontend-flags
build: add `-Xfrontend` to `-strict-implicit-module-context`
2024-11-11 14:43:15 -08:00
Artem Chikin
60538d5918 Revert "Attempt to reduce the number of embedded stdlib targets being built simultaneously."
This reverts commit dfa1bdb1ce.
2024-11-11 14:42:59 -08:00
Tim Kientzle
694c533c7f Merge pull request #77496 from tbkka/tbkka-rdar138132321
[ObjC Bridging] Consistently bridge block types verbatim
2024-11-11 08:41:56 -08:00
Artem Chikin
f7013099c5 Merge pull request #77495 from swiftlang/artemcm/FewerEmbeddedStdLibParallelTasks
Attempt to reduce the number of embedded stdlib targets being built simultaneously.
2024-11-08 21:49:43 -08:00
Artem Chikin
dfa1bdb1ce Attempt to reduce the number of embedded stdlib targets being built simultaneously.
We are seeing strange crashes during embedded stdlib build stage on Ubuntu 24.04. These crashes only seem to occur when we dispatch many stdlib emit-module tasks at the same time. While we root-cause it, this change attempts to slow down the process to only two Embedded StdLib tasks at-a-time.

Workaround for rdar://137674862
2024-11-08 13:55:14 -08:00
Tim Kientzle
c262248a27 [ObjC Bridging] Consistently bridge block types verbatim
A `@convention(block)` closure in Swift is completely compatible with Objective-C
and does not need to be wrapped in a `__SwiftValue` box for use.

Previously, it was bridged verbatim when appearing by itself, but
could end up boxed when it went through array bridging.

The test verifies that:
* Objective-C does not see a `__SwiftValue` box
* Swift `type(of:)` does not see a `__SwiftValue` box
* Objective-C can actually call the closure

Resolves rdar://138132321
2024-11-08 13:49:21 -08:00
Ian Anderson
052cc2ec0d Merge pull request #77349 from ian-twilightcoder/clang-headers-need-modulemaps
[CMake] clang-builtin-headers needs to copy the module maps as well as the headers
2024-11-08 12:25:48 -08:00
Saleem Abdulrasool
87d4966d8c build: add -Xfrontend to -strict-implicit-module-context
When building with the early swift driver we need to add the explicit
`-Xfrontend` to make the option take effect.
2024-11-08 11:53:07 -08:00
Guillaume Lessard
20b85ed59d Merge pull request #76406 from glessard/rdar96837923-span 2024-11-07 18:25:49 -08:00
Dario Rexin
4ea0c9bbee Merge pull request #77431 from drexin/wip-138487964
[IRGen+Runtime] Fix tag bit mask handling for objc, unknown objects a…
2024-11-07 15:55:08 -08:00
Mike Ash
c0d64ba850 Merge pull request #77427 from mikeash/lazy-realization-weak-check
[Runtime] Weak-check _objc_supportsLazyRealization.
2024-11-07 17:45:46 -05:00
Guillaume Lessard
4fe9328b65 [span] follow the leading underscore rule
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2024-11-07 12:40:16 -08:00
Guillaume Lessard
386f041aa8 [span] fix an argument label
Co-authored-by: Karoy Lorentey <klorentey@apple.com>
2024-11-07 12:39:12 -08:00
Guillaume Lessard
0922b6b622 [span] improve argument labels for safe initializers 2024-11-07 11:19:28 -08:00
Guillaume Lessard
9a8f5a7e9d [span] update more doc-comments 2024-11-07 11:18:40 -08:00
Dario Rexin
3c7b556cf1 [IRGen+Runtime] Fix tag bit mask handling for objc, unknown objects and blocks
rdar://138487964

On platforms that don't have reserved bits in objc (including unknown) pointers, we use the spare bits for Swift enums, so they have to be masked out. Blocks don't have reserved bits on any platform.
2024-11-07 09:55:40 -08:00