Commit Graph

812 Commits

Author SHA1 Message Date
Rintaro Ishizaki
091506315b [SE-0101] Implement: Reconfiguring sizeof and related functions into MemoryLayout struct
As of now:

* old APIs are just marked as `deprecated` not `unavaiable`. To make it
  easier to co-operate with other toolchain repos.
* Value variant of API is implemented as public @private
  `_ofInstance(_:)`.
2016-07-30 03:09:28 +09:00
Maxim Moiseev
d42743f985 removing IntegerArithmetic.swift 2016-07-29 13:31:21 +03:00
Maxim Moiseev
e2e032bc20 core and overlays build 2016-07-29 13:31:21 +03:00
Dmitri Gribenko
e5db796212 Merge pull request #3843 from atrick/rawptr-convert
Remove "illegal" UnsafePointer casts from the stdlib.
2016-07-28 22:40:16 -07:00
Dmitri Gribenko
4bed3391f7 Merge pull request #3849 from kballard/data_iterator
Implement a custom Data.Iterator
2016-07-28 22:27:36 -07:00
Andrew Trick
0b75ee975e Remove "illegal" UnsafePointer casts from the stdlib.
Update for SE-0107: UnsafeRawPointer

This adds a "mutating" initialize to UnsafePointer to make
Immutable -> Mutable conversions explicit.

These are quick fixes to stdlib, overlays, and test cases that are necessary
in order to remove arbitrary UnsafePointer conversions.

Many cases can be expressed better up by reworking the surrounding
code, but we first need a working starting point.
2016-07-28 20:42:23 -07:00
Tony Parker
d0720163ee Merge pull request #3769 from parkera/indexset_optional_find
IndexSet's find family of methods should have optional returns
2016-07-28 20:42:14 -07:00
Kevin Ballard
a021c89236 Implement a custom Data.Iterator
This iterator uses an inline 32-byte buffer so it doesn't have to call
copyBytes(to:count:) for every single byte. It results in an approximate
6x speedup on my computer.
2016-07-28 18:45:40 -07:00
Ted Kremenek
4a872ed636 Revert "Implement a custom Data.Iterator" (#3848) 2016-07-28 18:33:31 -07:00
Dmitri Gribenko
69255f02cb Merge pull request #3831 from kballard/data_iterator
Implement a custom Data.Iterator
2016-07-28 18:11:16 -07:00
Jordan Rose
805e06ef01 Flip the switch on 'private' and 'fileprivate'.
Merge pull request #3767 from jrose-apple/private-and-fileprivate
2016-07-28 15:40:02 -07:00
Kevin Ballard
69c3d71ba3 Implement a custom Data.Iterator
This iterator uses an inline 32-byte buffer so it doesn't have to call
copyBytes(to:count:) for every single byte. It results in an approximate
6x speedup on my computer.
2016-07-28 13:27:31 -07:00
Tony Parker
ef99d39d3b Adapt to UnsafeRawPointer changes in Data initializer and deallocator API 2016-07-28 13:21:50 -07:00
Mishal Shah
185618f9ec Merge pull request #3803 from jckarter/id-as-any-stdlib-spot-fixes
Id as any stdlib spot fixes
2016-07-28 12:07:26 -07:00
Tony Parker
57e184a072 IndexSet's find family of methods should have optional returns 2016-07-28 10:37:42 -07:00
Jordan Rose
3a792f7382 One more 'fileprivate' in newly-added Foundation code. 2016-07-28 09:55:23 -07:00
Joe Groff
84f8becfc3 Initialize dictionaries with expected capacities. 2016-07-27 13:34:28 -07:00
Joe Groff
4b9e49827d Make all _toAnyHashable() implements @nonobjc. 2016-07-27 09:25:30 -07:00
Dmitri Gribenko
c0b183a208 Merge pull request #3781 from apple/stdlib-AnyHashable-for-Foundation.NSDecimalNumber
Add AnyHashable support for Foundation.Decimal
2016-07-27 09:22:48 -07:00
Dmitri Gribenko
168b563315 Foundation: stop exporting certain overlay methods to Objective-C 2016-07-27 01:14:56 -07:00
Dmitri Gribenko
ea693dd8d1 Add AnyHashable support for Foundation.Decimal
Add a custom AnyHashable representation to Foundation.Decimal, so that
it behaves like all other bridged types.
2016-07-27 01:14:16 -07:00
Bob Wilson
58395b3b2f [SE-0127] Add "to:" argument label to withUnsafe[Mutable]Pointer.
rdar://problem/26529498
2016-07-26 17:44:33 -07:00
Bob Wilson
112451c44a [SE-0127] Remove withUnsafePointers and withUnsafeMutablePointers APIs.
These provide the same functionality as the one-argument versions for both
2 and 3 argument closures. Since these are less common, the same thing can be
achieved by composing the one-argument version. rdar://problem/26529498
2016-07-26 17:43:33 -07:00
Xin Tong
9709b0e510 Merge pull request #3662 from trentxintong/unicodescalar
SE-0128 - Change unicodescalar initializer to failable
2016-07-26 16:44:14 -07:00
Joe Groff
5b3f2af297 Merge pull request #3756 from jckarter/turn-on-anyhashable
Turn on AnyHashable
2016-07-26 15:45:13 -07:00
Andrew Trick
a18d490d6a Migrate from UnsafePointer<Void> to UnsafeRawPointer. (#3773)
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.

As proposed in SE-0107: UnsafeRawPointer.

`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.

Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.

* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.

This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.

* Fix a bunch of test cases for Void->Raw migration.

* qsort takes IUO values

* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.

* Parse #dsohandle as UnsafeMutableRawPointer

* Update a bunch of test cases for Void->Raw migration.

* Trivial fix for the SceneKit test case.

* Add an UnsafeRawPointer self initializer.

This is unfortunately necessary for assignment between types imported from C.

* Tiny simplification of the initializer.
2016-07-26 14:21:15 -07:00
Tony Parker
19998457d3 Merge pull request #3607 from phausler/UndoManager_registerUndo_naming_update
[Foundation] Update UndoManager registerUndo to adopt new naming rules
2016-07-26 14:15:02 -07:00
Tony Parker
0a8c6ba190 Merge pull request #3766 from mjmdavis/master
Correct Swift Decimal.divide to call NSDecimalDivide.
2016-07-26 14:01:49 -07:00
Joe Groff
1e8dd0e34b ClangImporter: Import unbounded NSSets and NSDictionaries using AnyHashable. 2016-07-26 13:36:05 -07:00
Joe Groff
e884ab737d Foundation: Make AnyHashable bridge to NSObject. 2016-07-26 13:36:05 -07:00
Tony Parker
a0470750bb Merge pull request #3609 from phausler/CharacterSet_naming_changes
[Foundation] Update CharacterSet and NSCharacterSet punctuationCharac…
2016-07-26 09:41:47 -07:00
David Farler
4a57e647e6 Merge pull request #3762 from bitjammer/se-0081-diagnostic-and-crashes
[SE-0081] Warn on deprecated where clause inside angle brackets
2016-07-26 09:09:30 -07:00
Michael Davis
6c03c553aa Correct Swift Decimal.divide to call NSDecimalDivide. 2016-07-26 17:02:11 +02:00
Arnold Schwaighofer
39389b9c09 [SE-0125] Remove isUniquelyReferenced and the NonObjectiveCBase class
We can express the same using the `isUniquelyReferencedNonObjC` API.

- Rename `isUniquelyReferencedNonObjC` to `isKnownUniquelyReferenced`.
- Cleanup `ManagedBufferPointer` by removing holdsUniqueOrPinnedReference` and
  renaming `holdsUniqueReference` to `isUniqueReference`.
- No longer promise to return false from `isKnownUniquelyReferenced` for @objc
  class instances.

SR-1962
rdar://21886410
2016-07-26 07:09:29 -07:00
Dmitri Gribenko
e9f1bccd37 Foundation: add commented out custom AnyHashable representation to Measurement
It is disabled because bridging of Measurement instances does not actually work now.
2016-07-26 03:10:52 -07:00
Dmitri Gribenko
34f6eb1438 Foundation: add custom AnyHashable representations to new value types 2016-07-26 03:10:52 -07:00
Dmitri Gribenko
a3254b7990 Foundation: add custom AnyHashable representations to NSNumber and NSString
We want NSNumbers bridged from Swift types to bridge back to the same
Swift type.
2016-07-26 03:10:52 -07:00
Andrew Trick
0ed9ee8dee Revert "Migrate from UnsafePointer<Void> to UnsafeRawPointer. (#3724)"
This reverts commit ece0951924.

This results in lldb failues on linux that I can't readily debug.
Backing out until they can be resolved.
2016-07-26 02:50:57 -07:00
Andrew Trick
ece0951924 Migrate from UnsafePointer<Void> to UnsafeRawPointer. (#3724)
* Migrate from `UnsafePointer<Void>` to `UnsafeRawPointer`.

As proposed in SE-0107: UnsafeRawPointer.

`void*` imports as `UnsafeMutableRawPointer`.
`const void*` imports as `UnsafeRawPointer`.

Occurrences of `UnsafePointer<Void>` are replaced with UnsafeRawPointer.

* Migrate overlays from UnsafePointer<Void> to UnsafeRawPointer.

This requires explicit memory binding in several places,
particularly in NSData and CoreAudio.

* Fix a bunch of test cases for Void->Raw migration.

* qsort takes IUO values

* Bridge `Unsafe[Mutable]RawPointer as `void [const] *`.

* Parse #dsohandle as UnsafeMutableRawPointer

* Update a bunch of test cases for Void->Raw migration.

* Trivial fix for the SceneKit test case.

* Add an UnsafeRawPointer self initializer.

This is unfortunately necessary for assignment between types imported from C.

* Tiny simplification of the initializer.
2016-07-26 02:18:21 -07:00
David Farler
7bfaeb57f1 [SE-0081] Warn on deprecated where clause inside angle brackets
and provide a fix-it to move it to the new location as referenced
in SE-0081.

Fix up a few stray places in the standard library that is still using
the old syntax.

Update any ./test files that aren't expecting the new warning/fix-it
in -verify mode.

While investigating what I thought was a new crash due to this new
diagnostic, I discovered two sources of quite a few compiler crashers
related to unterminated generic parameter lists, where the right
angle bracket source location was getting unconditionally set to
the current token, even though it wasn't actually a '>'.
2016-07-26 01:41:10 -07:00
swift-ci
3cfcb55bfc Merge pull request #3752 from parkera/foundation_reflection 2016-07-25 22:29:48 -07:00
Jordan Rose
0712ffcb07 Convert the Dispatch and Foundation overlays to 'fileprivate'. (#3753)
Similar to the work in apple/swift-corelibs-foundation#445.

Groundwork for SE-0025 ('private' and 'fileprivate').
No intended functionality change.
2016-07-25 20:58:06 -07:00
Joe Groff
10a0eb1c13 Merge pull request #3710 from jckarter/turn-on-id-as-any
Turn on id as any
2016-07-25 18:58:27 -07:00
Tony Parker
dab81e8674 Add CustomReflectable implementation to most Foundation value types.
Also improves the basic debugDescription and description methods.

rdar://26580762
2016-07-25 17:05:51 -07:00
swift-ci
2c6ac01d28 Merge pull request #3660 from parkera/url_resource_fixits 2016-07-25 13:39:46 -07:00
Joe Groff
32b50c624d stdlib: Remove _isBridgedToObjectiveC from _ObjectiveCBridgeable.
All generic bridgeable types can bridge for all their instantiations now. Removing this ferrets out some now-unnecessary traps that check for unbridgeable parameter types.
2016-07-25 06:01:21 -07:00
Joe Groff
95e462022d Update Foundation overlay for id-as-Any. 2016-07-25 06:01:21 -07:00
Dmitri Gribenko
d82682ec6c Merge pull request #3733 from practicalswift/typo-fixes-20160724
[gardening] Fix recently introduced typos.
2016-07-24 15:43:03 -07:00
Michael Gottesman
dea6dd1e3b Merge pull request #3729 from practicalswift/a-vs-an-fixes-ii
[gardening] "a" vs. "an"-fixes
2016-07-24 14:18:22 -07:00
practicalswift
7e89679404 [gardening] Fix recently introduced typos. 2016-07-24 22:32:40 +02:00