Commit Graph

15 Commits

Author SHA1 Message Date
Dave Abrahams
4d4a7e9622 [stdlib] Add UnsafePointer precondition checks
We had array code attempting to do things with negative element counts;
let's catch those errors!

Swift SVN r18428
2014-05-19 21:20:47 +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
Ted Kremenek
eab7f90a81 Per design discussion today, rename UnsafePointer ".pointee" to ".memory".
Swift SVN r18269
2014-05-17 20:35:16 +00:00
Joe Groff
0540da70e2 Replace an 'as T' hack with a 'reinterpretCast' hack.
The runtime implementation of 'as T' freaks out in cases involving protocols. This is an expedient workaround that fixes <rdar://problem/16950035>.

Swift SVN r18263
2014-05-17 19:23:52 +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
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
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
John McCall
059ed4cd10 Propagate alignment arguments around through the
slow allocation/deallocation APIs.

Swift SVN r18160
2014-05-16 01:40:36 +00:00
Dmitri Hrybenko
b966c9583f stdlib/{Array, Dictionary}: make debugDescription forward to debugDescription
of container elements

rdar://16929672


Swift SVN r18132
2014-05-15 22:08:07 +00:00
Ted Kremenek
9eea282719 Switch range operators ".." and "...".
- 1..3 now means 1,2
- 1...3 now means 1,2,3

Implements <rdar://problem/16839891>

Swift SVN r18066
2014-05-14 07:36:00 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Dmitri Hrybenko
29cebdf797 Splitting the standard library: step 1: move stdlib -> stdlib/core
Swift SVN r5864
2013-06-28 02:31:01 +00:00