Commit Graph

13406 Commits

Author SHA1 Message Date
Dave Abrahams
52c01c9ee4 [stdlib] Give filter() the lazy() treatment
Swift SVN r19359
2014-06-30 19:32:34 +00:00
Joe Groff
e99fc08a36 stdlib: Add a _convertConstStringToUTF8PointerArgument entry point to assist string-to-pointer conversion.
Swift SVN r19358
2014-06-30 19:32:03 +00:00
Fariborz Jahanian
a4b945c486 Overlays for Core Image variadic methods.
// rdar://16726822


Swift SVN r19357
2014-06-30 19:23:03 +00:00
Jordan Rose
5e59d30c6f Update stdlib for memberwise access control.
As before, there may be more things marked @public than we actually want
public. Judicious use of the frontend option -disable-access-control may
help reduce the public surface area of the stdlib.

Swift SVN r19353
2014-06-30 18:50:50 +00:00
Jordan Rose
8c1fcfa055 Make some more stdlib things public.
Swift SVN r19351
2014-06-30 18:50:46 +00:00
Enrico Granata
c23d333890 Add Mirror support for ObjCBool and Selector types
Swift SVN r19347
2014-06-30 18:31:40 +00:00
Dmitri Hrybenko
68c7a45c9b stdlib/printing: change Optional<T> representation in print to be Optional(...)
Because we are adding text to show internal representation, change the
conformance from Printable to DebugPrintable.

rdar://16950055


Swift SVN r19341
2014-06-30 15:23:51 +00:00
Dmitri Hrybenko
4814e00fda stdlib/String: implement Unicode extended grapheme cluster segmentation
algorithm

The implementation uses a specialized trie that has not been tuned to the table
data.  I tried guessing parameter values that should work well, but did not do
any performance measurements.

There is no efficient way to initialize arrays with static data in Swift.  The
required tables are being generated as C++ code in the runtime library.

rdar://16013860


Swift SVN r19340
2014-06-30 14:38:53 +00:00
Dmitri Hrybenko
50a5b303a1 stdlib/String.UnicodeScalarView: rename _base to _core
NFC; improves readability of future commits.

Swift SVN r19337
2014-06-30 12:02:36 +00:00
Dmitri Hrybenko
450c21f4ec stdlib/String.UnicodeScalarView: fix out-of-bounds read of the
underlying NSString when it ends in a high-surrogate code unit

The tests did not catch this because they were creating CFString, which,
as it turns out, does not perform bounds checking.  Replaced the use of
CFString with a custom NSString subclass.

Swift SVN r19329
2014-06-30 11:54:51 +00:00
Chris Lattner
68be2902c2 remove some operator definitions that aren't implemented anywhere. We should add these
back when/if they are added to the stdlib.


Swift SVN r19326
2014-06-29 00:46:32 +00:00
Dave Abrahams
6b0d2f92f0 [stdlib] Give reverse() the lazy() treatment
This one shows the unfortunate consequence that we need
Lazy[Forward|Bidirectional|RandomAccess]Collection.  There's gonna be a
whole lotta gyb'bing going on...

Swift SVN r19316
2014-06-28 01:35:34 +00:00
Dave Abrahams
ab322aead3 [stdlib] Introduce/use a free array-yeilding map()
Some of the lazy() instances in the previous commit that were being
immediately array'd are now even simpler.

Swift SVN r19313
2014-06-28 00:35:43 +00:00
Dave Abrahams
a7f6b97222 [stdlib] Introduce lazy() and use it for mapping
Swift SVN r19312
2014-06-28 00:35:43 +00:00
Dave Abrahams
e18d8b02ba [stdlib] filter(x) never creates a Collection
It's both more rigorously correct and should prevent surprise when
constructing an Array from a filtered sequence.  See the comments
in-code for details.

Swift SVN r19304
2014-06-27 19:44:46 +00:00
Dave Abrahams
a4db36b6f4 Revert "Overlay for Core Image variadic methods."
It broke my RelWithDebInfo / -DSWIFT_OPTIMIZED=OFF build
This reverts r19297

Swift SVN r19302
2014-06-27 19:36:33 +00:00
Joe Groff
bf102f8ca4 IRGen: Fix extended method encoding for protocol members that take a single-parameter block parameter.
We were falling back to void(^)() encoding for block types whose input type was not a tuple.

Swift SVN r19299
2014-06-27 18:13:17 +00:00
Fariborz Jahanian
d7a7ec36aa Overlay for Core Image variadic methods.
With following caveat for iOS.
- In iOS CoreImage is main module.
- CISampler is not defined in iOS
- CoreImage.CIFilter's apply is not available
  in iOS.
// rdar://16726822


Swift SVN r19297
2014-06-27 17:35:06 +00:00
Joe Groff
47fde864e9 Remove UnsafePointer.withUnsafePointer.
This is no longer necessary for API parity with CMutablePointer now that pointer conversions are in.

Swift SVN r19296
2014-06-27 16:54:51 +00:00
Joe Groff
39dbb30b57 Remove staging typealiases from the stdlib.
Swift SVN r19287
2014-06-27 02:48:38 +00:00
Doug Gregor
f0159f40a1 Ban the "new" syntax for creating an array <rdar://problem/16951969>.
We haven't been advertising this syntax much, and it's closure form
was completely broken anyway, so don't jump through hoops to provide
great Fix-Its here. 


Swift SVN r19277
2014-06-26 23:51:47 +00:00
Joe Groff
e47a4e2e5a Missed a #if. Unbreak the build for people who don't have -DENABLE_POINTER_CONVERSIONS set.
Swift SVN r19276
2014-06-26 23:49:03 +00:00
Joe Groff
cb48fbd24b Enable pointer conversions.
Swift SVN r19274
2014-06-26 23:26:31 +00:00
Joe Groff
d064fd7307 stdlib: Disable AutoreleasingUnsafePointer's inout conversion when building with intrinsic pointer conversions.
Swift SVN r19269
2014-06-26 22:37:26 +00:00
Joe Groff
7717b30d99 stdlib: Add a default initializer for AutoreleasingUnsafePointer.
Swift SVN r19268
2014-06-26 22:37:26 +00:00
Doug Gregor
bea1d3d9b3 Use dictionary type sugar in the standard library.
Swift SVN r19264
2014-06-26 22:26:58 +00:00
Chris Lattner
4ac0f31852 add an 'overflow' label to the second result of the "withoverflow" aritmetic operations,
as suggested by Dmitri



Swift SVN r19251
2014-06-26 21:00:32 +00:00
Chris Lattner
4dcd6cf4d1 implement <rdar://problem/17101613> standard library should provide a way to test for overflow
This just renames the existing "uncheckedAdd" (and related) functions to addWithOverflow.  These
were already "checked" and return the partial result + bool that we want.


Swift SVN r19246
2014-06-26 20:33:17 +00:00
Dave Abrahams
c1539b3e5d [stdlib] Put the "unsafe" in withUnsafeMutableStorage
This API exposes unmediated access to memory, and most users will never
see the UnsafeArray argument that's passed to the closure, so best to be
explicit.

Swift SVN r19243
2014-06-26 18:22:54 +00:00
Dmitri Hrybenko
108ab1a83e stdlib/Unicode: restore the comment that explains why the function is
@noinline; it might be useful for someone reading the code


Swift SVN r19233
2014-06-26 14:07:20 +00:00
Dmitri Hrybenko
0e8d76f13b stdlib/Unicode: add @noinline to a large error handling function
Swift SVN r19232
2014-06-26 14:04:37 +00:00
Dmitri Hrybenko
612e1a8700 stdlib/unittest/checkSliceable: check the empty slice endIndex..<endIndex
Swift SVN r19231
2014-06-26 14:02:41 +00:00
Dmitri Hrybenko
4671211ce3 stdlib/String: fix two bugs in UnicodeScalarView
If underlying NSString contained isolated surrogates, then we were crashing in
following ways:

- subscripting by index could crash;

- index pointing to the second code unit sequence was not moved backwards
  correctly.  Instead of moving it to pointing to the beginning of the view it
  could be moved to point to the code unit before the beginning of the view.



Swift SVN r19230
2014-06-26 13:47:00 +00:00
Dmitri Hrybenko
990960850f stdlib, tests: fix some more 'predecessor' names that should have been
changed to 'predicate' instead


Swift SVN r19229
2014-06-26 09:13:02 +00:00
Dave Abrahams
1fb11d623b [stdlib] Remove _buffer requirement from ArrayType
Until we get an optimizer pass to remove get/set pairs, passing a
property that is a protocol requirement as inout from generic code is
always going to cause an extra retain, causing many unintended Array
copies.

Because this dropped reference counts to 1 in some cases, it exercised
previously-untested code paths and uncovered bugs, particularly in the
handling of subrange replacement on Slice<T>.

There are still differences in speed for short arrays of CGPoint that bear
investigation, but at least as things scale up, the ratio of time goes
to 1.

Fixes <rdar://problem/17040913> append and += on an array have
completely different performance

Swift SVN r19228
2014-06-26 08:54:07 +00:00
Dave Abrahams
321d608935 [stdlib] 80-column / endline layout fix
Swift SVN r19227
2014-06-26 08:53:50 +00:00
Joe Groff
687e1c5174 stdlib: Migrate some stdlib convenience APIs to UnsafePointer.
Give UnsafePointer versions of CMutablePointer._setIfNonNil and _withBridgeObject/Value. Also provide a version of 'withUnsafePointer' as a staging aid so that UnsafePointer can be used in place of CMutablePointer.

Swift SVN r19215
2014-06-26 01:51:45 +00:00
Dave Abrahams
d1aa6fe2b8 [stdlib] Rename Array internals for clarity
Because _demandUniqueMutableBuffer returns nil if the buffer already
exists, rename to _createUniqueMutableBuffer.

Because _requestUniqueMutableBuffer may return native backing storage
for a slice whose bounds don't exactly match the backing storage, rename
to _requestUniqueMutableBackingBuffer

Swift SVN r19214
2014-06-26 01:49:54 +00:00
Dave Abrahams
f146b40401 [stdlib] 80-column fix
Swift SVN r19213
2014-06-26 01:49:53 +00:00
Joe Groff
d1e7ff0590 Foundation: Add staging typealiases for C pointer types.
Swift SVN r19209
2014-06-26 01:30:50 +00:00
Enrico Granata
c696acfefb Add mirrors for Range and related objects. The format of the output is clearly not final; Also, test case
Swift SVN r19208
2014-06-26 01:15:32 +00:00
Joe Groff
a87e9fa40c Make the diagnostic for unsupported existentials more accurate and helpful.
Better to describe how the protocol can be used than how it can't. Also include a mention of Self type requirements as a source of non-existentiability.

Swift SVN r19207
2014-06-26 01:02:03 +00:00
Joe Groff
e2f632589a stdlib: Add subscript and .null() interfaces to AutoreleasingUnsafePointer.
To make it more UnsafePointer-like.

Swift SVN r19206
2014-06-26 01:02:01 +00:00
Joe Groff
8eec49e50c stdlib: Introduce a staging typealias for the itemsPtr of fast enumeration states.
We (correctly) import this as AutoreleasingUnsafePointer instead of UnsafePointer in the new regime, but need to stage out the old regime fully before switching over.

Swift SVN r19200
2014-06-26 00:21:20 +00:00
Joe Groff
cd418a944c stdlib: Add explicit AutoreleasingUnsafePointer(*UnsafePointer) constructors.
Allow these explicit conversions by constructor, the same way we do between UnsafePointer and ConstUnsafePointer.

Swift SVN r19199
2014-06-26 00:21:20 +00:00
Manman Ren
0501da8f54 [stdlib] use noinline to get rid of closure.
Remove wrapping the callee in a closure to disable inlining, instead mark callee
as noinline.

No performance change is observed.


Swift SVN r19194
2014-06-25 23:50:14 +00:00
Doug Gregor
37df5c430c Update standard library to use [T] array syntax.
Swift SVN r19190
2014-06-25 23:39:20 +00:00
Enrico Granata
1860612161 Add reflection support for Swift.Character. Testing will follow
Swift SVN r19189
2014-06-25 23:36:52 +00:00
Dmitri Hrybenko
6b2c727850 stdlib/String: change UTF-16/UTF-16 transcoder in UTF16View to replace
ill-formed code unit sequences with U+FFFD

rdar://17451259


Swift SVN r19187
2014-06-25 22:28:33 +00:00
Manman Ren
544cd15eb9 [stdlib] add noinline on makeUnique.
Swift SVN r19174
2014-06-25 18:39:49 +00:00