Commit Graph

291 Commits

Author SHA1 Message Date
Eric Miotto
332fe6a475 CMake: allow private libraries to be used on older OSes
To do so, use the deployment target versions used for tests.

Addresses rdar://157622116
2025-08-07 15:12:47 -07:00
Alejandro Alonso
5d745fe5d5 Update MinimalCollections.swift 2025-03-13 10:50:06 -07:00
Alejandro Alonso
0646c61cf5 Fix bidirectional test to account for RandomAccess 2025-03-13 10:11:51 -07:00
Alastair Houghton
0963036734 [Build] Make sure we declare LINUX_STATIC dependencies on Musl.
Everywhere there's a `SWIFT_MODULE_DEPENDS_LINUX Glibc`, there should be
a corresponding `SWIFT_MODULE_DEPENDS_LINUX_STATIC Musl`.

This usually won't bite us, depending on build order and parallelism, but
I hit one of these yesterday so went looking to see if there were any
others.

rdar://136208589
2024-09-18 09:40:58 +01:00
Alex Lorenz
57b89d5303 [android] add an android NDK Swift overlay module, and use it instead of Glibc 2024-05-28 12:57:38 -07:00
David Smith
9beb1c1147 Build fix 2023-05-18 16:54:25 -07:00
David Smith
42d60c3c9c Add some tests for default implementations on RangeReplaceableCollection 2023-05-16 12:27:27 -07:00
Evan Wilde
f8a54181a9 Zipper all the things!
This patch goes through and adds zippering and the swift module
dependencies to a bunch of pieces of the swift runtimes. Here's to
hoping I hit everything that needed to be hit. :D

With this patch, I'm seeing the appropriate modules under
lib/swift/maccatalyst, so things seem to be working right.
2022-12-22 13:41:59 -08:00
Josh Soref
644c18ca9b Spelling stdlib (#42444)
* spelling: against

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: algorithmic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: alignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: anything

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architectural

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architecture

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: are

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: artificial

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aside

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: being

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bidirectional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: characters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: circular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compiled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correctly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: covers

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: descriptor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dictionaries

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: greater

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: immortal

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initializes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iterable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: minimum

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: originally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sophisticated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trivia

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: wasn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:43 -07:00
swift-ci
d954e46524 Merge pull request #40027 from glessard/wCSIA-clarification 2021-11-05 20:26:43 -07:00
Guillaume Lessard
f16eda4db3 [stdlib] add a missing deprecation 2021-11-02 18:43:42 -06:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Mishal Shah
23c3b15f5f Support Xcode 13 beta
* Updating availability versions
* Remove all remaining overlays in stdlib/public/Darwin/*:
   - ObjectiveC
   - Dispatch
   - CoreFoundation
   - CoreGraphics
   - Foundation
2021-06-07 12:04:31 -07:00
Karoy Lorentey
0836707303 [stdlib] Deprecate MutableCollection._withUnsafeMutableBufferPointerIfSupported (#36003)
* [stdlib] Deprecate MutableCollection._withUnsafeMutableBufferPointerIfSupported

In Swift 5.0, [SE-0237] introduced the public `MutableCollection.withContiguousMutableStorageIfAvailable` method. It’s time we migrated off the old, underscored variant and deprecated it.

The default `MutableCollection.sort` and `.partition(by:)` implementations are currently calling this hidden method rather than the documented interface, preventing custom Collection implementations from achieving good performance, even if they have contiguous storage.

[SE-0237]: https://github.com/apple/swift-evolution/blob/master/proposals/0237-contiguous-collection.md

* [test] Update tests for stdlib behavior changes

* Update stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift

Co-authored-by: Nate Cook <natecook@apple.com>

* Update stdlib/private/StdlibCollectionUnittest/CheckMutableCollectionType.swift

Co-authored-by: Nate Cook <natecook@apple.com>

* Apply suggestions from code review

Co-authored-by: Nate Cook <natecook@apple.com>

* [test] LoggingMutableCollection: Fix logging targets

* [stdlib] Fix warning by restoring original workaround

Co-authored-by: Nate Cook <natecook@apple.com>
2021-02-26 11:32:27 -08:00
Saleem Abdulrasool
2fc5cbdc14 stdlib: remove swiftMSVCRT, replace with swiftCRT on Windows
This replaces swiftMSVCRT with swiftCRT.  The big difference here is
that the `visualc` module is no longer imported nor exported.  The
`visualc` module remains in use for a singular test wrt availability,
but this should effectively remove the need for the `visualc` module.

The difference between the MSVCRT and ucrt module was not well
understood by most.  MSVCRT provided ucrt AND visualc, combining pieces
of the old MSVCRT and the newer ucrt.  The ucrt module is what you
really wanted most of the time, however, would need to use MSVCRT for
the convenience aliases for type-generic math and the deprecated math
constants.

Unfortunately, we cannot shadow the `ucrt` module and create a Swift SDK
overlay for ucrt as that seems to result in circular dependencies when
processing the `_Concurrency` module.

Although this makes using the C library easier for most people, it has a
more important subtle change: it cleaves the dependency on visualc.
This means that this enables use of Swift without Visual Studio for the
singular purpose of providing 3 header files.  Additionally, it removes
the need for the installation of 2 of the 4 support files.  This greatly
simplifies the deployment process on Windows.
2020-10-15 16:02:01 -07:00
Ben Rimmington
f2c952cb69 [stdlib] Remove more unneeded numericCasts 2020-05-10 12:31:55 +01:00
3405691582
f8d0174b85 Build system recognizes OpenBSD.
Commit for CMake and build scripts to recognize OpenBSD. To keep this
commit relatively short, this just deals with the rather simple and
uncontroversial changes to the build system.

Note that OpenBSD calls "x86_64" as "amd64", Since the Swift stdlib will
be put in a subdirectory named after ARCH, to ensure the standard
library is properly found later, we use the native architecture name for
OpenBSD in the build system rather than trying to deal with the
difference the other way around.
2020-04-03 13:34:17 -04:00
Nate Cook
c6183ee71b Add RangeSet and discontiguous collection operations (#28161)
This adds the RangeSet and DiscontiguousSlice types, as well as collection
operations for working with discontiguous ranges of elements. This also adds
a COWLoggingArray type to the test suite to verify that mutable collection
algorithms don't perform unexpected copy-on-write operations when mutating
slices mid-operation.
2020-02-22 15:33:03 -06:00
David Zarzycki
8732b15597 [Testing] Fix unused/read-only variable warnings 2020-01-27 06:12:02 -05:00
Slava Pestov
7cc4be421f Fix invalid method overrides in StdlibCollectionUnittest 2019-07-02 15:43:02 -04:00
Puyan Lotfi
6691fda8ec Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
There are situations where you want to build against a libc that is out
of tree or that is not the system libc (Or for cross build scenarios).
This is a change for passing the -sdk and include paths for things like
this.
2019-07-01 09:43:47 -07:00
Saleem Abdulrasool
114e812631 stdlib: permit builtin Collections and Unicode tests everywhere
The pthread dependency has been lifted through the Windows port
generalising the SwiftThreadExtras.  Enable building these unit test
binaries which are needed for the validation test suite.
2019-06-02 11:19:25 -07:00
Ross Bayer
23a868e9f2 Merge pull request #24382 from Rostepher/usr-lib-install-name-dir
[Build System: CMake] Update the default install_name_dir to /usr/lib/swift for the standard library and overlays.
2019-05-13 15:05:22 -07:00
Ross Bayer
dfb2d31e74 Rename the LIBRARY_INSTALL_NAME_DIR argument in add_swift_target_library to DARWIN_INSTALL_NAME_DIR which better explains that this argument only controls the install_name_dir for Darwin platforms. 2019-04-29 16:46:09 -07:00
Ross Bayer
b855119fbe Added a new CMake cache variable to control the private standard library install_name_dir. Those libraries are not going to be installed in /usr/lib/swift and thus need to be controlled via a separate mechanism. 2019-04-29 16:46:09 -07:00
Keita Nonaka
2771eb520c fix warnings 2019-04-18 13:11:57 -04:00
Ben Cohen
11769d2494 Add tests for withContiguousStorageIfAvailable 2018-12-07 17:30:13 -08:00
Ben Cohen
ad50a39b12 [stdlib] Add withContiguous{Mutable}StorageIfAvailable (#21092)
* Add MutableCollection.withContiguousMutableStorageIfAvailable

* Add withContiguousMutableStorageIfAvailable impls

* Add tests on concrete types

* Add Sequence.withContiguousStorageIfAvailable

* Implement withContiguousStorageIfAvailable in concrete types
2018-12-07 10:01:18 -08:00
Karoy Lorentey
8e77a2655a [test] StdlibUnittest: Add missing hash(into:) implementations 2018-11-29 15:55:17 +00:00
Ben Cohen
df2307e035 [stdlib][DNM] Collapse sequence and collection wrappers (#20221)
* Concretize dropFirst/Last/sufix/prefix from Sequence

Remove split customization point

Eliminate SubSequence from Sequence protocol

Collapse LazyCollection

Collapse LazyMapCollection

Eliminate _SequenceWrapper

Collapse LazyFilterCollection

Collapse LazyDrop/PrefixWhileCollection

Fix tests, ABI stability update

Collapse FlattenSequence

* Add entries to source/ABI compatible expected results.

* Update tests to avoid pre-10.14 objc runtime bug

* Expunge _preprocessingPass
2018-11-14 10:05:58 -08:00
Ben Cohen
dbc2e21522 Remove customization points from Sequence and Collection (#19995) 2018-10-31 18:58:00 -07:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Soroush Khanlou
5736cacc9a Add count(where:) and tests (#16099)
* add count(where:) and tests

* Revise count(where:) documentation

* Remove errant word in abstract

* add a benchmark for ranges and strings with help from @natecook1000

* update benchmark to use Array instead of Range
2018-09-13 12:37:06 -05:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Ben Cohen
4694310e51 [stdlib] Some minor cleanup (#18130)
* Remove case destructuring to _

* Remove some Iterator.Element

* Which idiot wrote this? Oh.

* Switch NibbleSort to just use default impls... shouldn't change perf
2018-07-21 17:29:57 -07:00
Ben Cohen
34610780fd Break out conformances into extensions (#18098)
Replace LoggingRangeReplaceableCollection variants with typealiases

Replace LoggingMutableCollection variants with typealiases.

Collapse BufferAccessLoggingMutableCollection variants into typealiases

Turn LoggingRandomAccessCollection into a typealias

Turn LoggingBidirectionalCollection into a typealias
2018-07-20 12:50:12 -07:00
Karoy Lorentey
3bcd7f9bd3 [gardening][test] Allow Emacs to modify degybbed files in StdlibUnittest 2018-06-25 17:16:39 +01:00
Jordan Rose
2b31ba339f [CMake] Add explicit Glibc dependencies to account for "autolinking" (#16401)
76ef276 made the compiler autolink libraries more eagerly than before.
This normally wouldn't affect the products we build with CMake, but
when an overlay is autolinked the compiler also puts in a dummy symbol
to make sure it gets linked. So now we have to link to the overlay
directly.
2018-05-04 17:18:35 -07:00
Nate Cook
b1ab7d89db [stdlib] Implement sequence/collection methods for searching from the end (#13337)
This implements the new last(where:), and lastIndex(of/where:) methods as
extensions on `BidirectionalCollection`, which partially implements SE-204.
The protocol requirements for `Sequence` and `Collection` as described
in the proposal need to wait until there's a solution for picking up the
specialized versions in types that conditionally conform to `BidirectionalCollection`.
2018-04-23 20:47:26 -05:00
Nate Cook
58933d88c5 [stdlib] Rename index(...) methods to firstIndex(...)
A la SE-204.
2018-04-21 18:07:25 -05:00
Michael Ilseman
c4614a9208 [test] De-gyb stdlib unittest.
StdlibUnittest uses gyb to avoid duplicating many source-context
arguments. However, this means that any test that wishes to add new
expect helpers has to also be gybbed. Given that this structure hasn't
changed in years, and we should have a real language support
eventually, de-gyb it.
2018-04-19 13:06:14 -07:00
Mark Lacey
32d006de4a stdlib: Collapse some multi-line closures to single-line closures.
The change in CheckMutableCollectionType.swift.gyb previously resulted
in a runtime failure, and before that a compiler crash.

It appears that whatever type checker bug(s) were causing the issue
have been resolved in the last few months, so I'm returning this
closure to a single-expression form and cleaning up a couple other
places where we had an unneeded temporary as well.

Resolves rdar://problem/33781464.
2018-04-03 22:26:33 -07:00
Ben Cohen
9ee856f386 [stdlib][WIP] Eliminate (Closed)CountableRange using conditional conformance (#13342)
* Make Range conditionally a Collection

* Convert ClosedRange to conditionally a collection

* De-gyb Range/ClosedRange, refactoring some methods.

* Remove use of Countable{Closed}Range from stdlib

* Remove Countable use from Foundation

* Fix test errors and warnings resulting from Range/CountableRange collapse

* fix prespecialize test for new mangling

* Update CoreAudio use of CountableRange

* Update SwiftSyntax use of CountableRange

* Restore ClosedRange.Index: Hashable conformance

* Move fixed typechecker slowness test for array-of-ranges from slow to fast, yay

* Apply Doug's patch to loosen test to just check for error
2018-02-01 20:59:28 -08:00
Ben Cohen
ab8e3a7ebc Fix warnings in various benchmarks (#14333) 2018-02-01 19:48:35 -08:00
Ben Cohen
7b7ef56097 Fix some warnings about use of DefaultRandomAccessIndices 2018-01-13 19:49:39 -08:00
Max Moiseev
2aa3583e1f [tests] Remove unnecessary test output 2017-12-20 11:22:54 -08:00
Graydon Hoare
62a6b74ad1 Revert "[stdlib] Conditional conformances for Lazy[Filter|Map]Collection" 2017-12-10 12:48:36 -08:00
Max Moiseev
e4f94a318f [stdlib] Improve default implementation of Collection.distance(from:to:)
(cherry picked from commit 72948cae9a)
2017-12-08 13:07:07 -08:00
Ben Cohen
4ddac3fbbd [stdlib] Eradicate IndexDistance associated type (#12641)
* Eradicate IndexDistance associated type, replacing with Int everywhere

* Consistently use Int for ExistentialCollection’s IndexDistance type.

* Fix test for IndexDistance removal

* Remove a handful of no-longer-needed explicit types

* Add compatibility shims for non-Int index distances

* Test compatibility shim

* Move IndexDistance typealias into the Collection protocol
2017-12-08 12:00:23 -08:00