Commit Graph

25 Commits

Author SHA1 Message Date
Dave Abrahams
7e9d91161c [stdlib] CMutablePointer: manual bridging support
When manually writing overlays, it's not uncommon to need to present an
interface that allows nil or an inout object to be passed, and
CMutablePointer allows that, but up to now it's been hard to work with
CMutablePointer on the inside of the manually-created thunks in the
overlay.  These small tweaks make that a bit more tolerable.

Swift SVN r18510
2014-05-21 20:30:20 +00:00
Dave Abrahams
f5f15b33e9 [stdlib] ReST comment fixups
Swift SVN r18509
2014-05-21 20:30:19 +00:00
Joe Groff
38130ca9db Remove uniqueness forcing from CMutablePointer array conversion.
Arrays aren't value types anymore, so this is no longer correct. Fixes <rdar://problem/16970879>.

Swift SVN r18455
2014-05-20 17:21:21 +00:00
Dmitri Hrybenko
785aabd53e stdlib/Dictionary: start removing the assumption that keys and values are
bridged back from Objective-C verbatim

Fixes subscript(Index) API.


Swift SVN r18408
2014-05-19 10:03:59 +00:00
Dave Abrahams
68abebdffb [stdlib] withUnsafePointerToElements for Array
Also privatize ArrayType's elementStorage. Per Array API review.

Swift SVN r18330
2014-05-18 16:59:46 +00:00
Dave Abrahams
35d22e9ffb [stdlib] Array API Review: owner -> _owner
Swift SVN r18326
2014-05-18 15:58:15 +00:00
Ted Kremenek
074150571f Rename isNull() to _isNull() (making them private), and make pointers
conform to LogicValue.

This approach was taken to keep _isNull because I first tried
to just use comparisons to nil instead of isNull().  Apparently
that led to some circular definitions, so it was easier to just
stage it this way.

Swift SVN r18301
2014-05-18 03:42:40 +00:00
Doug Gregor
0aba627a86 Reinstate "Drive a wedge between array upcasts and array bridged
upcasts." 
Reinstate "Restrict the array-bridged conversion to non-verbatim
bridging." 
Reinstate "[stdlib] Fix T[].bridgeFromObjectiveC" 
Reinstate "[stdlib] Fix T[].bridgeFromObjectiveC" 
Reinstate "[stdlib] Move _arrayBridgedDownCast to Foundation"
 Reinstate "Replace "can" with "cannot" in a message." 
Reinstate "Implement support for non-verbatim T[] -> AnyObject[]
upcasts."  

This reinstates commit r18291. 
This reinstates commit r18290. 
This reinstates commit r18288. 
This reinstates commit r18287. 
This reinstates commit r18286. 
This reinstates commit r18293. 
This reinstates commit r18283.

John fixed the issue in r18294.


Swift SVN r18299
2014-05-18 03:36:09 +00:00
Michael Gottesman
263dca4b47 Revert "Drive a wedge between array upcasts and array bridged upcasts."
Revert "Restrict the array-bridged conversion to non-verbatim bridging."
Revert "[stdlib] Fix T[].bridgeFromObjectiveC"
Revert "[stdlib] Fix T[].bridgeFromObjectiveC"
Revert "[stdlib] Move _arrayBridgedDownCast to Foundation"
Revert "Replace "can" with "cannot" in a message."
Revert "Implement support for non-verbatim T[] -> AnyObject[] upcasts."

This reverts commit r18291.
This reverts commit r18290.
This reverts commit r18288.
This reverts commit r18287.
This reverts commit r18286.
This reverts commit r18293.
This reverts commit r18283.

Sorry for the number of reverts, but I needed to do this many to get a clean
revert to r18283.

Swift SVN r18296
2014-05-18 02:42:56 +00:00
Dave Abrahams
30c170606c [stdlib] Fix T[].bridgeFromObjectiveC
Make the new test pass, and make the tests more robust

Swift SVN r18288
2014-05-18 00:38:37 +00:00
Ted Kremenek
26320dc0ed Per API review, rename 'reserve' to 'reserveCapacity'.
Swift SVN r18272
2014-05-17 21:00:28 +00:00
Ted Kremenek
eab7f90a81 Per design discussion today, rename UnsafePointer ".pointee" to ".memory".
Swift SVN r18269
2014-05-17 20:35:16 +00:00
Dmitri Hrybenko
a4d9dcf1a7 stdlib: extinguish \brief and \c
Swift SVN r18261
2014-05-17 18:10:51 +00:00
Doug Gregor
bed81488c1 Revert r18232, r18220: we're not doing T* now.
Swift SVN r18250
2014-05-17 16:36:02 +00:00
Dave Abrahams
bbbf548a28 [stdlib] Do verbatim bridging entirely in Swift
This not only removes some code, but should allow more optimization and
inlining in the common case where the Swift type is a class or @objc
existential such as AnyObject

Swift SVN r18237
2014-05-17 05:01:04 +00:00
Joe Groff
e8f71c12a2 Rename ObjCMutablePointer to AutoreleasingUnsafePointer.
This relates its interface and behavior to that of UnsafePointer, and draws an analogy to '__autoreleasing *' in ARC.

Swift SVN r18236
2014-05-17 04:44:44 +00:00
Doug Gregor
73f02d1a69 Switch a bunch of UnsafePointer<T>'s over to T*
Swift SVN r18220
2014-05-16 22:32:01 +00:00
Arnold Schwaighofer
da6d9152b6 Differentiate between user assertion and preconditions and the like
assert() and fatalError()
These functions are meant to be used in user code. They are enabled in debug
mode and disabled in release or fast mode.

_precondition() and _preconditionFailure()
These functions are meant to be used in library code to check preconditions at
the api boundry. They are enabled in debug mode (with a verbose message) and
release mode (trap). In fast mode they are disabled.

_debugPrecondition() and _debugPreconditionFailure()
These functions are meant to be used in library code to check preconditions that
are not neccesarily comprehensive for safety (UnsafePointer can be null or an
invalid pointer but we can't check both). They are enabled only in debug mode.

_sanityCheck() and _fatalError()
These are meant to be used for internal consistency checks. They are only
enabled when the library is build with -DSWIFT_STDLIB_INTERNAL_CHECKS=ON.

I modified the code in the standard library to the best of my judgement.

rdar://16477198

Swift SVN r18212
2014-05-16 20:49:54 +00:00
Dmitri Hrybenko
522f332703 stdlib/bridging: update comments according to runtime function updates.
Swift SVN r18186
2014-05-16 07:59:40 +00:00
Ted Kremenek
4bb475a1c8 Rename UnsafePointer.get/set to a "ptr.pointee" property.
Implements <rdar://problem/16531067>.

Swift SVN r18178
2014-05-16 05:48:05 +00:00
Doug Gregor
87904b8228 Make ImplicitlyUnwrappedOptional conform to _ConditionallyBridgedToObjectiveC.
This is a better solution to <rdar://problem/16899681> because the
runtime magic is limited to implementing the witnesses of this
conformance.

The type checker fixes are because we can end up using unchecked
optionals in more places, via bridging, than we could before.


Swift SVN r18120
2014-05-15 19:00:52 +00:00
Dmitri Hrybenko
f183e493bf stdlib/bridging: bridgeFromObjectiveC() can fail to bridge the Objective-C
object to the desired type.  Model this with an optional return type.


Swift SVN r18077
2014-05-14 19:49:22 +00:00
Dmitri Hrybenko
eb9c3a406d stdlib/runtime: implement bridgeFromObjectiveC()
Swift SVN r18070
2014-05-14 13:40:46 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dave Abrahams
4c98b501a6 [stdlib] Expose NSString.stringWithContentsOfFile on String
Along the way created bridging utilities for ObjectiveC functions that
take "out" arguments and added an fmap for operating on Optionals

Swift SVN r11123
2013-12-11 07:24:05 +00:00