Commit Graph

361 Commits

Author SHA1 Message Date
Valeriy Van
9821976c69 Removes redundant buffer zeroing in CGColorSpace.swift by using `init(unsafeUninitializedCapacity:initializingWith:) (#30134)
* Removes redundant buffer zeroing

* Fix compile error
2020-04-13 19:49:17 -07:00
Karoy Lorentey
0344f0830e Merge branch 'master' into foundation-no-inlinable-shim-calls 2020-03-31 18:24:59 -07:00
Karoy Lorentey
3e8509df08 [XCTest] Add a note explaining that this is not the real XCTest overlay 2020-03-26 16:30:45 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
Luciano Almeida
d0af9eee96 [NFC] Fixing redundant discard assign void type warn on stdlib (#30397) 2020-03-13 09:51:41 +00:00
Xiaodi Wu
1d7ec4c129 [NFC][Foundation] Remove or replace unnecessary uses of 'fileprivate' 2020-02-23 13:45:13 -05:00
Alexis Laferrière
4055c94d6d [stdlib] Update one String initializer and client to use @_spi 2020-02-19 16:38:51 -08:00
Doug Gregor
660d124cda Revert accidental change that removed the Network overlay 2020-01-23 22:05:41 -08:00
Doug Gregor
6238923e15 [Function builders] Support multiple Boolean conditions in 'if' statements
Generalize support for function builders to allow 'if' statements that
include multiple Boolean conditions, e.g., "if a, b, c, { ... }".
2020-01-23 17:04:17 -08:00
Karoy Lorentey
846e957278 [Foundation] Switch to private imports of CoreFoundation shims 2020-01-22 13:26:27 -08:00
Karoy Lorentey
cdd99564e3 [Foundation] Fix potential backdeployment regression in append
Data.append now calls Data.count’s setter, which used to have a bug in previously shipped versions of the Foundation overlay (#28918).

To prevent working code from breaking when recompiled with the current version, avoid calling Data.count’s setter directly. Instead, extract its implementation (conveniently already packaged into a nested function) into a named method, marking it @_alwaysEmitIntoClient.
2020-01-08 18:39:40 -08:00
Karoy Lorentey
5c2095e93d Merge pull request #28919 from lorentey/fix-Data.count-setter
[Foundation] Fix Data.count’s setter
2020-01-08 17:48:58 -08:00
Xi Ge
7a1ac6b5a4 cmake: add SDK library search path for overlays unavailable in the source
When force linking auto-linked libraries, an overlay will fail to link if the dependence
libraries are missing from the source. This change provides linker flags
to search overlay libraries from the SDK.
2020-01-06 21:17:02 -08:00
Karoy Lorentey
a6d7ee5eba Merge branch 'fix-Data.count-setter' into foundation-no-inlinable-shim-calls 2019-12-20 23:48:34 -08:00
Karoy Lorentey
1a9f7afdec [Foundation] Fix Data.count’s setter
Data provides a settable `count` property. Its expected behavior is undocumented, but based on the implementation, it is intended to zero-extend (or truncate) the collection to the specified length.

This does not work correctly if we start with an empty Data and we try to increase the count by a small integer:

```
import Foundation

var d = Data()
d.count = 2
print(d.count) // ⟹ 0 ⁉️

d.count = 100
print(d.count) // ⟹ 100 ✓
```

It looks like this bug was introduced with the Data overhaul that shipped in Swift 5.

(This issue was uncovered by https://github.com/apple/swift/pull/28918.)

rdar://58134026
2019-12-20 23:35:05 -08:00
Karoy Lorentey
c9058f0946 [Foundation] Switch to private imports of Foundation shims 2019-12-20 20:50:18 -08:00
Karoy Lorentey
15e865f0b5 [Foundation] Remove inlinable shim calls
We want to enable overlays to import their shims as @_implementationOnly, so that the shims disappear from the public interface.

However, this isn’t possible when a shim is called from an @inlinable func, because then the existence (and definition) of the shim needs to be available to all callers of it.

Unfortunately Foundation’s Data has three instances where it calls  _SwiftFoundationOverlayShims._withStackOrHeapBuffer within @inlinable code:

- Data.init<S: Sequence>(_: S)
- Data.append<S: Sequence>(contentsOf: S)
- Data.replaceSubrange<C: Collection>(_: Range<Int>, with: C)

Rewrite the first two to write sequence contents directly into the target Data instance (saving a memcpy and possibly a memory allocation).

In replaceSubrange, add fast paths for contiguous collection cases, falling back to a Swift version of _withStackOrHeapBuffer with a 32-byte inline buffer.

The expectation is that this will be an overall speedup in most cases, with the possible exception of replaceSubrange invocations with a large non-contiguous collection.

rdar://58132561
2019-12-20 20:45:02 -08:00
Karoy Lorentey
4c3c3355f0 Merge pull request #28685 from lorentey/i-heard-you-like-runtime-so-i-put-a-runtime-in-your-foundation-overlay-so-you-can-run-while-you-found
[Foundation][runtime] Remove swift_errorBridgingInfo
2019-12-11 10:54:40 -08:00
Luciano Almeida
392baefc47 [stdlib][Qol] SR-11295 Removing stdlib unnecessary coercions (#27165)
* Removing unnecessary casts from stdlib

* Minor adjustments

* [stdlib][qol] Clean up error variable assign NSError

* Removing unnecessary coercions after removing DeclRefExpr restriction.
2019-12-11 07:30:25 -08:00
Karoy Lorentey
c34389ce72 [Foundation][runtime] Remove swift_errorBridgingInfo
To implement swift_errorBridgingInfo, the Foundation overlay needs to import private runtime headers. Now that we cannot statically link the Foundation overlay, there is no point to keeping this workaround in the overlay any more.

This effectively reverts https://github.com/apple/swift/pull/16677.

rdar://problem/57809306
2019-12-10 15:33:24 -08:00
swift-ci
9905c44509 Merge pull request #28327 from CodaFi/do-it-for-the-datagrams 2019-11-18 13:38:21 -08:00
Philippe Hausler
498a240a98 [Foundation] Reorder _DataStorage to save 14 bytes of overhead 2019-11-18 10:52:35 -08:00
Robert Pieta
cda5676525 IndexSet.union performance improvement 2019-11-18 09:50:05 -08:00
Sergo Beruashvili
62a75d762d Use precondition instead of fatalError in DateInterval initializer 2019-11-17 15:15:55 -08:00
Luca Torella
e6992d35cd Fix reference to range(of:) in the contains doc
Signed-off-by: Luca Torella <luca@scandit.com>
2019-11-14 10:44:05 -08:00
Saleem Abdulrasool
7e050d14e6 stdlib: remove usage of GNU extensions in the Darwin os module
Remove the gratuitous use of the GNU extensions to implement the OS logging
module.  This allows us to enable `-Werror=gnu` globally, even on macOS builds.
2019-10-30 08:38:46 -07:00
Karoy Lorentey
6bc4c85005 [doc] Avoid use of “iff” in public API documentation 2019-09-10 18:52:01 -07:00
Austin Rude
76a649d224 [AppKit] Fix incorrect rawValue for NSEvent.SpecialKey.deleteForward
Update the rawValue to match NSDeleteFunctionKey.
2019-08-26 15:39:09 -06:00
Stephen Canon
d80b1d39a3 Backout SE-0246 (#26809)
* Revert "Add availability information to the new Math function protocols (#24187)"

This reverts commit d2f695935f.

* Revert "SE-0246: Protocols and static functions (#23824)"

This reverts commit 57a4553832.

* Expected abi changes.
2019-08-23 16:41:17 -04:00
David Smith
f559a94f1b Redo CFStringCreateWithBytes shim 2019-08-12 15:15:10 -07:00
Alex Langford
184d942ba0 [CMake] add_swift_target_library shouldn't implicitly set INSTALL_IN_TARGET
This makes it more explicit what the install component of a target
library is if you don't see one (and its marked as IS_SDK_OVERLAY).
Explicit in this case makes more sense, as you don't have to rely on
knowledge of how `add_swift_target_library` is implemented to understand
what component is used to install the target.
2019-08-02 13:51:52 -07:00
swift-ci
f34ef5db85 Merge pull request #24356 from zetasq/zetasq-fix-KVO 2019-07-25 15:14:18 -07:00
Saleem Abdulrasool
9fb525006c stdlib: prevent static builds on Darwin
Static builds of the standard library and the SDK overlay are
unsupported post ABI stability.  Disallow building of the standard
library and SDK overlay statically for Darwin platforms.
2019-07-19 08:05:57 -07:00
swift-ci
70d4630690 Merge pull request #26194 from Catfish-Man/if-it-quacks-like-a-key 2019-07-17 20:39:55 -07:00
David Smith
5e83f80d6f Let NSMutableDictionary check for -copy on keys, rather than doing it ourselves with a full (slow) conformance check 2019-07-17 15:50:03 -07:00
Michael Gottesman
eb9b24104e Merge pull request #26158 from gottesmm/pr-ed0fb2c51d1ce701156c957f511f6ee3b57f1e7a
[ast] Refactor Builtin printing logic from ASTPrinter -> BuiltinInst.
2019-07-17 11:24:56 -07:00
Michael Gottesman
f952ff0ee4 [ast] Move printing code from ASTPrinter onto a helper on BuiltinType and have ASTPrinter call that instead. 2019-07-16 23:26:01 -07:00
Stephen Canon
dc5915cdb5 Replace stdlib and test/stdlib 9999 availability. (#26108)
* Replace stdlib and test/stdlib 9999 availability.

macOS 9999 -> macOS 10.15
iOS 9999 -> iOS 13
tvOS 9999 -> tvOS 13
watchOS 9999 -> watchOS 6

* Restore the pre-10.15 version of public init?(_: NSRange, in: __shared String)

We need this to allow master to work on 10.14 systems (in particular, to allow PR testing to work correctly without disabling back-deployment tests).
2019-07-12 16:30:36 -04:00
Karoy Lorentey
315e865d9f [Darwin] Fix ABI breaks introduced since 5.1
rdar://problem/52847498
(cherry picked from commit 9e94afdf83)
2019-07-09 12:48:34 -07:00
Xiaodi Wu
dfb90b7e1c Merge pull request #25745 from xwu/sync-decimal
[Foundation] Synchronize Decimal overlay with swift-corelibs-foundation
2019-07-05 14:42:16 -04:00
swift-ci
9ee3c0eab1 Merge pull request #25503 from stevebrun/stevebrun/NSLocalizedString-docs 2019-07-05 09:40:46 -07:00
Nate Cook
d0db904811 Revert "Capitalize the w in with"
This was my error — with should be lowercase in titles.
2019-07-03 11:52:22 -05:00
Saleem Abdulrasool
88f8a3c597 Merge pull request #25846 from plotfi/master2
Appending SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS to SWIFT_COMPILE_FLAGS.
2019-07-01 16:34:40 -07:00
Scott Perry
f994fc3f80 Merge pull request #25808 from numist/numist/diffing-performance-master
Performance improvements and availability updates for Collection.difference(from:using:)
2019-07-01 14:20:07 -07: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
Steven Brunwasser
e7746b0eba Capitalize the w in with 2019-06-28 21:36:17 -07:00
Steven Brunwasser
2e22f57d79 Fix wording for manual string management header 2019-06-28 21:32:40 -07:00
Steven Brunwasser
c93b18d8b3 "Must" must not be used outside a precondition 2019-06-28 21:13:09 -07:00
Steven Brunwasser
23d40e7e6d Correct spelling mistakes and typos 2019-06-28 20:58:28 -07:00
Steven Brunwasser
707697c53f Fix verb tense disagreement 2019-06-28 20:54:20 -07:00