Commit Graph

2351 Commits

Author SHA1 Message Date
Dmitri Hrybenko
b158753ae4 stdlib: coding style: add parentheses to one-argument closures for
consistency with the rest of the library

Swift SVN r25036
2015-02-06 05:38:15 +00:00
Dmitri Hrybenko
46302bd305 stdlib: mark more closures with @noescape
Swift SVN r25035
2015-02-06 05:26:03 +00:00
Dmitri Hrybenko
33379954c3 Clang-format the new shims header, CoreFoundationShims.h
Swift SVN r25033
2015-02-06 03:55:37 +00:00
Dmitri Hrybenko
fa539e8533 stdlib/shims: declare CoreFoundation APIs only when we have ObjC interop
Swift SVN r25021
2015-02-06 01:10:53 +00:00
Dave Abrahams
b4c4b30f27 [stdlib] Don't leak CF dependency from core stdlib
Carefully track the functions that inject these dependencies, so all
functions that use them can be protected with

  @inline(never) @semantics("stdlib_binary_only")

To do this, we introduce a naming convention: the _stdlib_binary_ prefix
distinguishes functions dependent on external frameworks.  All callers
of such functions must adopt either the naming convention, or the
attributes above.

This change should unbreak the build.

Swift SVN r25020
2015-02-06 00:48:16 +00:00
Maxwell Swadling
4535d51593 [stdlib] Added initializeFrom to array functions
Added to all functions that don't use _expectEnd.

Swift SVN r25017
2015-02-05 21:31:19 +00:00
Joe Groff
1d9d153136 IRGen: Consistently mangle protocol names in protocol descriptors with the _Tt prefix.
Since protocol descriptors look like ObjC Protocol objects, we want to mangle the type prefix into their names to make them obviously Swift mangled names, but we were only doing this for @objc protocols, not native protocols. For consistency, do the same thing with native descriptors, and update the runtime type display code to match. Fixes rdar://problem/19691574.

Swift SVN r25014
2015-02-05 20:04:20 +00:00
Dave Abrahams
94965036d5 [stdlib] Move ObjC Mirrors out of Foundation
These mirrors are the default mirrors that get used for all objective-C
object, including some that aren't defined in Foundation:

  import Dispatch
  println(dispatch_get_global_queue(0,0))

This example isn't fixed yet, because we need to pull all the string
bridging goop out of Foundation and into the core standard library.

Swift SVN r25012
2015-02-05 19:18:33 +00:00
Dave Abrahams
97ec182ba7 [stdlib] Move String bridging into Core stdlib
This change allows us to drop an egregious table-of-function-pointers
hack in favor of a much cleaner hack using SwiftShims.  It also allows
us to move the ObjC mirrors out of Foundation in an upcoming commit.

Swift SVN r25011
2015-02-05 19:18:32 +00:00
Dave Abrahams
a89c2e11ae [stdlib] Create shims for CFString access in core
...and use these shims in place of our previous inelegant dispatch
through 'C' code.

Swift SVN r25010
2015-02-05 19:18:31 +00:00
Dave Abrahams
96c6c8d519 [stdlib] Fix doc comment formatting
Swift SVN r25009
2015-02-05 19:18:30 +00:00
Dave Abrahams
f7000ce3cb [stdlib] Add unsafeUnwrap(x)
Also the internal version, _unsafeUnwrap, for more-efficiently
unwrapping non-empty optionals.

Swift SVN r25008
2015-02-05 19:18:30 +00:00
Maxwell Swadling
7ba5e6a575 [stdlib] added @noescape to Array functions
rdar://problem/19389247

Swift SVN r24970
2015-02-04 19:49:06 +00:00
Maxwell Swadling
8e95156b0b [stdlib] added @noescape to withUnsafeBufferPointer functions
rdar://problem/19389247

Swift SVN r24969
2015-02-04 19:49:05 +00:00
Maxwell Swadling
6cbf069a2b [stdlib] added @noescape to StaticString methods
rdar://problem/19389247

Swift SVN r24968
2015-02-04 19:49:04 +00:00
Maxwell Swadling
8a24395a48 [stdlib] added @noescape to StaticString methods
rdar://problem/19389247

Swift SVN r24967
2015-02-04 19:48:57 +00:00
Dmitri Hrybenko
e4b1cbeb64 stdlib: remove .null() static factories on unsafe pointers
These APIs are redundant with nil literals and the default initializer.

rdar://19159145

Swift SVN r24957
2015-02-04 11:17:55 +00:00
Dmitri Hrybenko
65cee50274 stdlib: stop using COpaquePointer.null()
Swift SVN r24955
2015-02-04 11:17:54 +00:00
Dmitri Hrybenko
ebdb7616b2 stdlib: add conformances to CVarArgType to unsafe pointer types
Patch by Jordan.

rdar://19541479

Swift SVN r24947
2015-02-04 06:41:31 +00:00
Dmitri Hrybenko
f7a9b18d62 stdlib: fix comment for ExtensibleCollectionType.extend()
rdar://19679159

Swift SVN r24941
2015-02-04 05:13:28 +00:00
Maxwell Swadling
2eb96bafee [stdlib] reverted removal of mixed string type operators
Fixes rdar://problem/19656287

This reverts changes from r24931, r24911, r24760 and r24536.

Swift SVN r24938
2015-02-04 04:01:32 +00:00
Dave Abrahams
644c5650c3 [stdlib] Re-enable disabled tests and fix the bugs
...that crept in because they weren't being run

Swift SVN r24933
2015-02-04 01:53:13 +00:00
Dave Abrahams
0c17537602 Revert "[stdlib] use initializeTo instead of loops"
This reverts r24743, because it broke some of the tests that Chris
disabled.

Swift SVN r24932
2015-02-04 01:53:11 +00:00
Maxwell Swadling
a0cad601e1 [stdlib] removed mixed string type operators
Fixes rdar://problem/19656287

Swift SVN r24931
2015-02-04 00:56:36 +00:00
Joe Groff
8e1e6665a7 IRGen: Start a type verifier to fuzz static type info against runtime type info.
We've had a rash of bugs due to inconsistencies between how IRGen and the runtime think types are laid out. Add a '-verify-type-layout' mode to the frontend that causes IRGen to emit a bunch of code that compares its static assumptions against what the runtime value witness does.

Swift SVN r24918
2015-02-03 16:47:25 +00:00
Maxwell Swadling
56026ee9f1 [stdlib] fixed ambiguous overloads
This fixes rdar://problem/19656287. This is a work around while we do
not have a way to remove implicit bridging conversions.
This means comparing a String and an NSString will use NSString
comparison.

Swift SVN r24911
2015-02-03 00:54:19 +00:00
Doug Gregor
6a1b7348e0 Make trailing closure syntax match the last parameter, always.
Previously, trailing closures would try to match the first parameter
of (possibly optional) function type that didn't seem to have an
argument already, but in practice this broke when there were
parameters with default arguments before the function parameter.

The new rule is far simpler: a trailing closure matches the last
parameter. Fixes rdar://problem/17965209.

Swift SVN r24898
2015-02-02 19:47:31 +00:00
Maxwell Swadling
16bad7f7d3 [stdlib] improved a unittest error backtrace
Swift SVN r24895
2015-02-02 18:47:46 +00:00
Dave Abrahams
0d383f28a9 [stdlib] CGFloat : CVarArgType
Along the way, had to generalize the mechanism for detecting that a type
is handled as a Double by C's varargs.

Swift SVN r24859
2015-01-30 23:23:57 +00:00
Dmitri Hrybenko
1ca5bc414e stdlib: add an overlay for AudioBufferList
AudioBufferList contains a fake flexible array member, and is not
imported in a useable way.

rdar://18536929

Swift SVN r24843
2015-01-30 04:17:49 +00:00
Dmitri Hrybenko
6a9f1561eb CMake: sort directories
Swift SVN r24842
2015-01-30 04:17:47 +00:00
Dmitri Hrybenko
203175909d StdlibUnittest: add a command line option to run specific tests
rdar://19572835

Swift SVN r24841
2015-01-30 04:17:44 +00:00
Joe Groff
7191b87759 Runtime: Don't touch potentially ObjC unowned-referenced objects to determine their species.
ObjC unowned references are backed by an ObjC weak reference which will eagerly deallocate the object when it's strongly released, so in an unknown-refcount situation, we can't safely dereference the object pointer to determine its Swiftness. We can, however, look at the side table of weak references; if there's an entry for this object, then it's reliably an ObjC object (or it's some other object that got allocated in the reclaimed space for the dead object, but that's a race we fundamentally can't win with this broken design). Fixes rdar://problem/18091547 (modulo the aforementioned reallocation race).

Swift SVN r24825
2015-01-29 22:49:45 +00:00
Graham Batty
625ddfdd97 Correct scope change of objc id var and explain.
Swift SVN r24821
2015-01-29 20:58:19 +00:00
Graham Batty
383dd5d6c4 Moves dangling objc variable declaration into #if.
Swift SVN r24820
2015-01-29 20:24:02 +00:00
Joe Pamer
4ec18171f7 Remove the extra level of closure nesting from r24752.
Swift SVN r24818
2015-01-29 18:48:41 +00:00
Joe Pamer
6a70bd085e These changes implement some oft-requested tweaks and fixes to our closure implementation:
- Closures that are comprised of only a single return statement are now considered to be "single expression" closures. (rdar://problem/17550847)
- Unannotated single expression closures with non-void return types can now be used in void contexts. (rdar://problem/17228969)
- Situations where a multi-statement closure's type could not be inferred because of the lack of a return-type annotation are now properly diagnosed. (rdar://problem/17212107)

I also encountered a number of crashers along the way, which should now be fixed.

Swift SVN r24817
2015-01-29 18:48:39 +00:00
Joe Groff
f02ba53d97 Reenable the weak reference runtime tests in weak.mm.
Instead of directly referencing a long-dead constructor from the standard library, put a purpose-built function in StdlibUnittest to feed a Swift object reference to the test C code. rdar://problem/18498737

Swift SVN r24816
2015-01-29 17:49:08 +00:00
Dave Abrahams
574bd0a58d StdlibUnitTest: add pair equality expectation
Swift SVN r24812
2015-01-29 02:05:45 +00:00
Joe Groff
7e78ff68d1 IRGen/Runtime: Make dynamic metatype-to-AnyObject casts work.
Bonus fix for rdar://problem/19624697.

Swift SVN r24808
2015-01-28 23:06:45 +00:00
Dave Abrahams
6506068262 [stdlib] Update a comment
We have Builtin.BridgeObject now, so eliminate the "someday..." phrasing

Swift SVN r24806
2015-01-28 21:55:04 +00:00
Dmitri Hrybenko
f4e35f90eb stdlib: remove Unsafe[Mutable]Pointer.null()
This API is redundant with nil literals and the default initializer.

rdar://19159145

Swift SVN r24796
2015-01-28 08:42:28 +00:00
Dmitri Hrybenko
311957061a Stop using Unsafe[Mutable]Pointer.null()
This API will be removed per rdar://19159145 (it is redundant with nil
literals and the default initializer).

Swift SVN r24795
2015-01-28 08:42:26 +00:00
Dmitri Hrybenko
2d4892881e stdlib: fix a typo in doc comments
rdar://19280027

Swift SVN r24793
2015-01-28 06:36:59 +00:00
Dmitri Hrybenko
ff771d0984 stdlib: use fixed-width Builtin.IntXX types for Swift.Int and UInt
Using the unknown-sized Builtin.Word types complicates producing
compile-time overflow diagnostics.  If we don't know the target Word
size, we don't know if there is an overflow.  But SIL optimizer does not
know the size of Word, this is the point of having the Word type in the
first place.

Also, this opens up more possibilities for optimizations.

rdar://17604532

Swift SVN r24788
2015-01-28 05:22:42 +00:00
Maxwell Swadling
2dc8175f86 Removed work around now that rdar://problem/19591983 is fixed
Swift SVN r24762
2015-01-27 22:45:04 +00:00
Maxwell Swadling
6cea1939e2 removed @transparent from unavailable functions
Swift SVN r24760
2015-01-27 22:18:37 +00:00
Joe Pamer
d3910dade6 Reduce standard library build times by 10s by adding a couple of type annotations to 'join'.
Swift SVN r24752
2015-01-27 20:56:02 +00:00
Maxwell Swadling
4ef99c0de5 [stdlib] Added fixmes for missing _expectEnds
Swift SVN r24745
2015-01-27 02:12:26 +00:00
Maxwell Swadling
b2a672e748 [stdlib] Changed loop to initializeFrom
To improve array performance with POD types.

Swift SVN r24744
2015-01-27 02:12:26 +00:00