Commit Graph

6693 Commits

Author SHA1 Message Date
NevinBR
a62bf48e68 [stdlib] [NFC] FloatingPointRandom.swift created (#33463)
* Moved `random` methods out of FloatingPoint.swift

* Added `random` methods to FloatingPointRandom.swift

* Added FloatingPointRandom.swift to CMakeLists.txt

* Added FloatingPointRandom.swift to GroupInfo.json

* Moved filename within CMakeLists.txt
2020-08-18 18:12:35 -04:00
Kuba (Brecka) Mracek
7a9f894c88 Avoid using -sil-inline-generics and -sil-partial-specialization when building MinSizeRel stdlib to save ~15% on codesize (#33444) 2020-08-17 20:58:54 -07:00
Stephen Canon
457b9990e9 Add checks that the endpoints of partial ranges are not-NaN. (#33378)
We can't actually check for NaN (because the notion doesn't exist for Comparable), but we can require that the endpoint is non-exceptional by checking if it equals itself.
2020-08-10 14:06:46 -04:00
Slava Pestov
3ae31d5173 Sema: Don't need to derive CaseIterable's AllCases associated type
Just declaring a default in the standard library works fine.
2020-08-07 16:48:40 -04:00
Ben Rimmington
d3f0de804d [SE-0163] Migrate from deprecated Unicode APIs (part 3) (#33175) 2020-08-06 23:44:55 +01:00
Erik Eckstein
e7efa6cb15 stdlib: Make Result methods inlinable
The "Result" type is expected to have no overhead when used.
This requires the member functions to be inlinable.
Which is probably okay for library evolution, because it's unlikely that those methods change in an incompatible way.
2020-07-29 21:57:51 +02:00
Vedant Kumar
2308bb18b1 Add _getMetadataSection{,Count,Name} to API digester allow list (#33138)
These APIs are needed to build SwiftReflectionTest.swift when testing
Release builds.

This rolls back 014918c0, which hid these APIs in non-asserts builds
causing a failure:

  https://ci-external.swift.org/job/oss-swift-RA-linux-ubuntu-16.04-android-arm64/5708/consoleText

rdar://66103895
2020-07-28 15:19:18 -07:00
eeckstein
5fffeb81fb Merge pull request #33128 from eeckstein/string-optimization
SIL optimizer: Add a new string optimization
2020-07-28 10:17:28 +02:00
Mishal Shah
3a50f93c60 Merge pull request #33142 from natecook1000/nate/stdlib-stability-abi
[stdlib] Only include _getMetadataSection functions in stdlib builds w/ assertions
2020-07-28 00:03:53 -07:00
Nate Cook
014918c0ca Only include _getMetadataSection functions in stdlib builds w/ assertions 2020-07-27 17:12:27 -05:00
Erik Eckstein
b42bce4ba4 stdlib: changes for the StringOptimization
To be able to constant fold string interpolation, the right semantic attributes must be in place.
Also, the interpolation's write function must be inlinable.
For the _typeName constant folding, a semantic attribute is required.
2020-07-27 21:32:56 +02:00
Robert Widmann
d1ae69383d Merge pull request #32312 from valeriyvan/RemoveRedundantBufferZeroingUnicodeScalarProperties
[stdlib] Eliminates redundant buffer zeroing in UnicodeScalarProperties
2020-07-26 12:53:23 -07:00
Augusto Noronha
3cb8f9b6fc Add entrypoints to the runtime that exposes metadata necessary for reflection tests on Linux (#32339) 2020-07-24 15:26:15 -07:00
Erik Eckstein
666c5e087c stdlib: enable COW sanity checks with an environment variable
Instead of doing the sanity checks by default (with an assert-build of the stdlib), only do the checks if the environment variable SWIFT_DEBUG_ENABLE_COW_SANITY_CHECKS is set to true.

The checks can give false alarms in case a binary is built against a no-assert stdlib but run with an assert-stdlib.
Therefore only do the checks if it's explicitly enabled at runtime.

rdar://problem/65475776
2020-07-20 11:23:42 +02:00
Brent Royal-Gordon
4394e92c3f Merge pull request #32700 from brentdax/magical-and-evolutionary
Revise #file changes from SE-0274
2020-07-17 01:57:23 -07:00
swift-ci
1224d8b2d3 Merge pull request #32915 from airspeedswift/transparent-stringpointer 2020-07-16 10:53:54 -07:00
Erik Eckstein
0102fe8b15 stdlib: remove some inlinable annotations from Substring's and String's subscript
Inlining those operations does not really give any benefit.
Those operations are complex and most likely, cannot be folded into simpler patterns after inlining, anyway.
Reduces some code size for cases where those functions were inlined (due to a not perfect inlining heuristics).
2020-07-16 12:46:42 +02:00
Ben Cohen
7adafcaaaa Make _convertConstStringToUTF8PointerArgument transparent 2020-07-15 17:27:33 -07:00
Stephen Canon
103961a7d5 Make Float16 unavailable on macOS and macCatalyst, mirroring Xcode's Swift. (#32868)
LLVM doesn't have a stable ABI for Float16 on x86 yet; we're working with Intel to get that fixed, but we don't want to make the type available on macOS until a stable ABI is actually available, because we'd break binaries compiled before any calling convention changes if we do.
2020-07-14 20:42:12 -04:00
Nate Cook
3af1deb447 [stdlib] Add _forEachField(of:options:body:) function (#32873)
This function walks all the fields of a struct, class, or tuple, and calls
`body` with the name, offset, and type of each field. `body` can perform
any required work or validation, returning `true` to continue walking fields
or `false` to stop immediately.
2020-07-14 16:31:32 -05:00
Karoy Lorentey
40d7da4fad Merge pull request #32019 from NevinBR/patch-1
[SR-12881] DefaultIndices dynamic dispatch
2020-07-14 12:05:12 -07:00
Brent Royal-Gordon
327ea8bce2 [Staging] Force stdlib into “Swift 6 mode” for #file
We ultimately want to explicitly change standard library uses of #file to #fileID, but once we do, previous compilers won’t be able to build the standard library. So instead, we will temporarily build the standard library with -enable-experimental-concise-pound-file, which should have the same effect, but will back-deploy to compilers going back several months.
2020-07-13 14:06:55 -07:00
Florian Friedrich
67073c7a67 Fix typo in comparison in comments and help text 2020-07-09 18:05:25 +02:00
swift-ci
cbe2dfc119 Merge pull request #32729 from valeriyvan/snippencharacter 2020-07-07 13:36:35 -07:00
Valeriy Van
adeb97a102 Fixes example snippet in Character.swift 2020-07-07 00:00:21 +02:00
Valeriy Van
b7076e4116 Fixes example snippets in Bool.swift 2020-07-06 23:45:31 +02:00
Erik Eckstein
bc27356d73 stdlib: enable runtime checking for COW support by default in assert builds.
This was blocked by an LLDB problem, which is now fixed (https://github.com/apple/llvm-project/pull/1333)
2020-07-03 15:56:50 +02:00
Varun Gandhi
cacfb01f97 Revert subset of "[Gardening] Clean Up OS-Test Patterns Across The Codebase"
Removes usage of #canImport(Darwin) from stdlib/public.

This reverts a subset of commit cddf73ecdb.
2020-07-01 15:47:18 -07:00
Robert Widmann
b766544327 Merge pull request #32642 from CodaFi/ossignpost
[Gardening] Clean Up OS Conditionals With canImport and Vendor=apple
2020-07-01 12:08:15 -07:00
Nate Cook
ba968d40e3 [stdlib] Fix removeLast(_:) performance for non-random-access collections (#32599)
This replaces the `count` comparison precondition with a limited index
offset, which converts the method from O(n) to O(k).
2020-07-01 03:06:32 -05:00
Robert Widmann
cddf73ecdb [Gardening] Clean Up OS-Test Patterns Across The Codebase
Clean up a few general patterns that are now obviated by canImport

This aligns more generally with the cleanup that the Swift Package
Manager has already done in their automated XCTest-plumbing tool in
apple/swift-package-manager#1826.
2020-06-30 22:55:58 -07:00
Stephen Canon
7985896949 Provide an implementation of init?<T:BinaryInteger>(exactly:T) on each stdlib FP type. (#32632)
Previously these always went through the FloatingPoint-provided default implementation, which is not particularly efficient. Also try removing inlinable from the generic _convert hooks, since we probably never want to actually inline them.
2020-06-30 20:59:31 -04:00
Károly Lőrentey
c579759aa7 [stdlib] Use a direct initializer for typed to raw pointer conversion 2020-06-29 19:16:23 -07:00
swift-ci
e25934fa4b Merge pull request #32451 from stephencelis/patch-1 2020-06-28 10:45:46 -07:00
Alex Martini
a3a20d923b Use a shorter example string. (#32557)
Fixes <rdar://problem/64180813>.
2020-06-26 14:18:27 -05:00
Ben Cohen
87df9961a5 Add fast string interpolation for metatypes (#32113) 2020-06-26 09:46:54 -07:00
Mishal Shah
272c466e47 Update master to build with Xcode 12 beta 2020-06-22 15:43:20 -07:00
Robert Widmann
a3b093a8bc Merge pull request #32486 from valeriyvan/FixExampleSnippetSequence
[stdlib] Fixes example snippet in Sequence.swift
2020-06-22 12:42:05 -07:00
Valeriy Van
1560d65561 Fixes example snippet in Sequence.swift 2020-06-21 22:54:00 +02:00
Stephen Celis
e150b377f9 Others 2020-06-19 08:07:25 -04:00
Stephen Celis
3b8d8b776e Update Collection.swift 2020-06-18 15:44:33 -04:00
Stephen Celis
0ce01d5dfe Update Collection.swift 2020-06-18 15:42:22 -04:00
Stephen Celis
ce78396eef Update stdlib/public/core/Collection.swift
Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>
2020-06-18 15:41:35 -04:00
Stephen Celis
099ecbe0b0 Improve performance of Collection.removeFirst(_:) where Self == SubSequence 2020-06-18 15:29:45 -04:00
Valeriy Van
dd237b984b Eliminates redundant buffer zeroing in internal func in UnicodeScalarProperties by using init(unsafeUninitializedCapacity:initializingWith:) 2020-06-11 12:51:18 +02:00
Brian Gontowski
0e7749bcde Fixed comment 2020-06-11 15:11:07 +09:00
Brian Gontowski
3425a6dbb1 Added protocol to support CVarArg objects that need to be retained 2020-06-11 14:45:00 +09:00
nate-chandler
7c5a5e5041 Merge pull request #32174 from nate-chandler/generic-metadata-prespecialization-components/classes-nongeneric-superclasses
[metadata prespecialization] Support classes with non-generic ancestors.
2020-06-09 09:25:21 -07:00
Xiaodi Wu
1888534d22 Merge pull request #30895 from valeriyvan/RemoveRedundantZeroingString
Removes redundant buffer zeroing in lowercased() and uppercased() by using `init(unsafeUninitializedCapacity:initializingWith:)
2020-06-09 09:42:51 -04:00
eeckstein
291373f82a Merge pull request #32134 from eeckstein/cow-support2
stdlib, SIL optimizer: use the SIL copy-on-write representation in the Array types.
2020-06-09 08:45:12 +02:00