Commit Graph

182 Commits

Author SHA1 Message Date
swift-ci
9633c91146 Merge pull request #13082 from glessard/patch-1 2017-12-12 10:14:53 -08:00
Ben Cohen
b31cb302fe Part the second 2017-12-01 11:49:10 -08:00
Guillaume Lessard
4427a66da8 [gardening] fix an inconsistency
This doc-comment's two paragraphs said in the first that the memory must be uninitialized before assignment, while in the second that it cannot be uninitialized.
2017-11-27 10:09:08 -07:00
taylor swift
c85880899d implement SE 184: add allocation methods to Unsafe buffer pointers, drop all parameters from deallocation, adjust namings, and add repeated-value assignment methods 2017-11-17 21:28:03 -08:00
Max Moiseev
53b8419279 [stdlib] Make all the stdlib APIs @_inlineable
This change in theory should allow us to remove a special stdlib-only
sil-serialize-all compilation mode.

<rdar://problem/34138683>
2017-09-29 11:26:56 -07:00
Arnold Schwaighofer
8a85a9efd5 Use array copy runtime implementation instead of the array value witnesses
And add builtins for the added runtime functions (assign-take, assign-copy).

rdar://27412867
SR-3376
2017-09-12 12:43:26 -07:00
Maxim Moiseev
ee5fb33656 [stdlib] Remove the Grand Renaming artifacts of Swift 3 era 2017-08-28 15:54:11 -07:00
Nate Cook
1698fd388b [stdlib] Manually propagate integer documentation 2017-08-01 15:17:20 -05:00
Ugur Unlu
f441f53e65 [stdlib] Correct UnsafeRawPointer.bindMemory example 2017-07-07 15:29:03 +02:00
Nate Cook
825e9d077d [stdlib] More documentation revisions / consistency fixes. 2017-06-13 14:08:00 -05:00
Nate Cook
b7af9bfe83 [stdlib] Remove SeeAlso tags 2017-06-13 11:23:51 -05:00
Ben Cohen
ea2f64cad2 [stdlib] Add Sequence.Element, change ExpressibleByArrayLiteral.Element to ArrayLiteralElement (#8990)
* Give Sequence a top-level Element, constrain Iterator to match

* Remove many instances of Iterator.

* Fixed various hard-coded tests

* XFAIL a few tests that need further investigation

* Change assoc type for arrayLiteralConvertible

* Mop up remaining "better expressed as a where clause" warnings

* Fix UnicodeDecoders prototype test

* Fix UIntBuffer

* Fix hard-coded Element identifier in CSDiag

* Fix up more tests

* Account for flatMap changes
2017-05-14 06:33:25 -07:00
Dave Abrahams
38b902d461 [stdlib] add Unsafe[Mutable]Pointer._max, unbounded buffer pointers 2017-05-08 07:58:18 -07:00
Nate Cook
8c15c72dfa [stdlib] Minor documentation fixes
* Revise `withExtendedLifetime(_:_:)`
* Correct method in UnsafeMutablePointer discussion
* `Sequence.filter(_:)` documentation fixes
2017-04-20 12:23:17 -05:00
Max Moiseev
b9fb3badc8 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-03-22 12:30:24 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
Max Moiseev
835b8809d2 Merge branch 'master' into new-integer-protocols 2017-03-07 16:18:54 -08:00
Nate Cook
c25bf40c26 [stdlib] Various documentation improvements
* Revise type(of:)
* Revise withoutActuallyEscaping(_:do:)
* Add slicing / index sharing to Collection
* Other cleanups
2017-02-07 23:02:41 -06:00
Max Moiseev
d128ed42b0 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-19 14:16:32 -08:00
Max Moiseev
195691523f [stdlib] Eliminating some 'unsafeBitcast' related warnings 2017-01-10 12:36:22 -08:00
Max Moiseev
aecccc7e48 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-09 17:38:04 -08:00
Ben Cohen
578a52627a Merge branch 'master' into se-147 2017-01-07 13:19:15 -08:00
Max Moiseev
27889c6376 Merge remote-tracking branch 'origin/master' into new-integer-protocols 2017-01-06 15:54:44 -08:00
practicalswift
30a88d38e6 [gardening] Fix recently introduced typos 2017-01-06 21:16:02 +01:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Ben Cohen
fefc2e40df Migrate _copyContents to be called from UnsafeMutableBufferPointer with checks for overrun. 2017-01-05 11:59:49 -08:00
Nate Cook
77fc4948cc [stdlib] Add note about pointer alignment for subtraction 2016-12-20 12:39:01 -06:00
Nate Cook
e070568078 [stdlib] Add documentation for pointer operators 2016-12-15 13:51:32 -06:00
Nate Cook
7494e2045e [stdlib] Revise unsafe pointers documentation
This revises and expands upon documentation for the standard library's
unsafe pointer types. This includes typed and raw pointers and buffers,
the MemoryLayout type, and some other top-level functions.
2016-12-14 14:58:24 -06:00
Max Moiseev
9b2f8858ec Merge branch 'master' into new-integer-protocols 2016-12-08 09:38:38 -08:00
Maxim Moiseev
bfae2471d6 [stdlib] operators on pointer types to static funcs (#6100) 2016-12-06 13:32:32 -08:00
Max Moiseev
356c15cb4a Merge remote-tracking branch 'origin/master' into new-integer-protocols 2016-12-06 10:35:27 -08:00
Alexis Beingessner
ff82c1e59f [docs] Change argument name to match docs. 2016-11-30 18:35:54 -05:00
Alexis Beingessner
8e4f98ff42 [docs] downgrade internal notes to normal comments. 2016-11-30 18:35:54 -05:00
Alexis Beingessner
3d0d3e17a9 [docs] Add GEP preconditions to UnsafePointer.
Offsets lower to GetElementPointer inbounds, which specifies that it's
Undefined Behaviour for the result to be out of bounds, regardless of if
the result is actually dereferenced.
2016-11-30 18:35:54 -05:00
Max Moiseev
70b2343626 Merge branch 'master' into new-integer-protocols 2016-11-28 15:25:01 -08:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Max Moiseev
ffc8a37811 Strideable for _Pointer is not necessary in Swift 4
All the necessary methods and operators are already implemented for
concrete pointer types more efficiently.
2016-11-16 14:45:33 -08:00
Max Moiseev
76e0a99a37 Merge branch 'master' into new-integer-protocols 2016-10-31 09:29:19 -07:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Max Moiseev
47ba2e9bd9 Turning more operators into static funcs 2016-10-20 13:53:18 -07:00
Max Moiseev
99837a47a5 Merge branch 'master' into new-integer-protocols 2016-10-05 15:26:37 -07:00
Nate Cook
68a307ed96 [stdlib] Revise documentation for integer types & protocols (#5083)
* [stdlib] Revise documentation for integer types & protocols

* Update with feedback

* [stdlib] Additional integer documentation revisions
2016-10-05 15:22:57 -07:00
Andrew Trick
d5642f731b Add descriptive doc comments to withMemoryRebound(to:capacity:_:) and… (#5072)
* Add descriptive doc comments to withMemoryRebound(to:capacity:_:) and bindMemory(to:capacity:).

SR-2480: Improve documentation for withMemoryRebound(to:capacity:_:)
rdar://problem/28440528

* Nate's feedback
2016-10-05 12:44:47 -07:00
Andrew Trick
2c9cde1c71 [stdlib] fix UnsafePointer.withMemoryRebound(to:capacity:) argument type.
SE-0107 states that UnsafePointer.withMemoryRebound(to:capacity:) should produce
a const UnsafePointer, but the implementation that I committed in Whitney
produces an UnsafeMutablePointer.

As a result Swift 3 accepts code, that we would like to reject:

func takesUInt(_: UnsafeMutablePointer<UInt>) {}
func takesConstUInt(_: UnsafePointer<UInt>) {}

func foo(p: UnsafePointer<Int>) {
  p.withMemoryRebound(to: UInt.self, capacity: 1) {
    takesUInt($0) // <========= implicitly converts to a mutable pointer
    takesConstUInt($0)
  }
}

We would like to reject this in favor of:

func takesUInt(_: UnsafeMutablePointer<UInt>) {}
func takesConstUInt(_: UnsafePointer<UInt>) {}

func foo(p: UnsafePointer<Int>) {
  p.withMemoryRebound(to: UInt.self, capacity: 1) {
    takesUInt(UnsafeMutablePointer(mutating: $0))
    takesConstUInt($0)
  }
}

This looks to me like an experimental change accidentally creeped onto my branch
and it was hard to spot in .gyb code. I needed to write the unit test
in terms of UnsafeMutablePointer in order to use expectType, so didn't
catch this.

rdar://28409842 UnsafePointer.withMemoryRebound(to:capacity:) incorrectly produces a mutable pointer argument
2016-09-21 13:58:51 -07:00
Erik Eckstein
d89a21460e Add builtins to generate instructions for tail-allocated arrays in SIL.
Those builtins are: allocWithTailElems_<n>, getTailAddr and projectTailElems
Also rename the "gep" builtin, which indexes raw bytes, to "gepRaw" and add a new "gep" builtin to index in a typed array.
2016-09-16 11:02:19 -07:00
Dmitri Gribenko
fbb3cf35a5 Revert "New SIL instructions to support tail-allocated arrays in SIL." 2016-09-15 00:25:25 -07:00
Erik Eckstein
2a92b84b54 Add builtins to generate instructions for tail-allocated arrays in SIL.
Those builtins are: allocWithTailElems_<n>, getTailAddr and projectTailElems
Also rename the "gep" builtin, which indexes raw bytes, to "gepRaw" and add a new "gep" builtin to index in a typed array.
2016-09-14 14:54:18 -07:00
Andrew Trick
83702cc2b0 Add an @available renamed attribute for initializeFrom<C : Collection>(_ : C). (#4444)
rdar:27941024 [3.0 migration] Missing fix-it for UnsafePointer<T>.initializeFrom<C : Collection>(_ C)
2016-08-21 17:58:32 -07:00
Andrew Trick
3f2655e3d0 Add a comment to UnsafePointer assignment. (#4070)
Initializing trivial types via assignment is allowed by convention,
so make it official.
2016-08-20 15:28:52 -07:00