Commit Graph

362 Commits

Author SHA1 Message Date
Ben Langmuir
784a05faf2 [cmake] Replace a bunch of OSX checks with Darwin checks
These should all apply to any Darwin platform, and the current behaviour
was breaking cross-compilation.

Introduces a SWIFT_DARWIN_VARIANTS pattern, to be used as follows:
    if(SWIFT_HOST_VARIANT MATCHES "${SWIFT_DARWIN_VARIANTS}")

Also fix one place where I checked the CMAKE_SYSTEM_NAME instead of the
host variant that I recently introduced.  I haven't attempted to find
the rest of the places we're doing this though.

Swift SVN r26554
2015-03-25 21:15:30 +00:00
Dmitri Hrybenko
ab408d4dc3 Update the compiler and SDK overlay for nullability and generics in Foundation
We have an SPI between the Swift compiler and Foundation based on the
SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH preprocessor macro that allows us to
request the new API.  rdar://20270080 tracks removing it.

Swift SVN r26475
2015-03-24 02:18:06 +00:00
Dmitri Hrybenko
759b2f07e3 Add a cast that would allow us to build using old and new SDKs
Swift SVN r26398
2015-03-21 23:07:28 +00:00
Dmitri Hrybenko
c421c51a42 StdlibUnittest: add facilities to replace NSLocale.currentLocale()
Will use this API to write tests for rdar://20171815.

Swift SVN r26391
2015-03-21 05:41:46 +00:00
Graham Batty
c01f032512 Take more unnecessary things out of glibc modulemap.
This also takes out the last /usr/include/sys that isn't
present on ubuntu 14.04.

Swift SVN r26281
2015-03-18 22:43:54 +00:00
David Farler
544ef4002d Merge tvOS and watchOS Support
- Add frontend and standard library build support for tvOS.
- Add frontend support for watchOS.

watchOS standard library builds are still disabled during SDK bring-up.

To build for TVOS, specify --tvos to build-script.
To build for watchOS, specify --watchos to build-script (not yet supported).

This patch does not include turning on full tests for TVOS or watchOS, and
will be included in a follow-up patch.

Swift SVN r26278
2015-03-18 21:35:07 +00:00
Chris Lattner
20f8f09ea8 Land: <rdar://problem/19382905> improve 'if let' to support refutable patterns and untie it from optionals
This changes 'if let' conditions to take general refutable patterns, instead of
taking a irrefutable pattern and implicitly matching against an optional.

Where before you might have written:
  if let x = foo() {

you now need to write:
  if let x? = foo() {
    
The upshot of this is that you can write anything in an 'if let' that you can
write in a 'case let' in a switch statement, which is pretty general.

To aid with migration, this special cases certain really common patterns like
the above (and any other irrefutable cases, like "if let (a,b) = foo()", and
tells you where to insert the ?.  It also special cases type annotations like
"if let x : AnyObject = " since they are no longer allowed.

For transitional purposes, I have intentionally downgraded the most common
diagnostic into a warning instead of an error.  This means that you'll get:

t.swift:26:10: warning: condition requires a refutable pattern match; did you mean to match an optional?
if let a = f() {
       ^
        ?

I think this is important to stage in, because this is a pretty significant
source breaking change and not everyone internally may want to deal with it
at the same time.  I filed 20166013 to remember to upgrade this to an error.

In addition to being a nice user feature, this is a nice cleanup of the guts
of the compiler, since it eliminates the "isConditional()" bit from
PatternBindingDecl, along with the special case logic in the compiler to handle
it (which variously added and removed Optional around these things).




Swift SVN r26150
2015-03-15 07:06:22 +00:00
Graham Batty
477becd359 Remove unnecessary parts of glibc modulemap.
This should hopefully make it more portable to different
versions of glibc-using platforms.

Swift SVN r25964
2015-03-10 22:35:50 +00:00
Dmitri Hrybenko
e460eb6264 Revert "[stdlib] Replace aString.toInt() with Int(aString)"
This reverts commit r25636.  It depends on integer parsing APIs, which
are being moved to SwiftExperimental.

Swift SVN r25889
2015-03-09 19:04:18 +00:00
Dmitri Hrybenko
abd0b72638 SwiftPrivateSerialization: refuse to deserialize extremely large arrays
and dictionaries on 32-bit platforms, where size does not fit into an
Int

Swift SVN r25886
2015-03-09 17:10:07 +00:00
Dmitri Hrybenko
b7498a1efd stdlib: add a private serialization API
These APIs will be used for writing automation tools in Swift.  Just
like other private APIs, this module is not exposed to extrenal users.

The primary motivation for doing instead of using NSCoder this is that
NSCoder does not work with structs and Swift containers.  Using classes
for everything just to satisfy NSCoder forces unnatural code.

This API requires two times (!) less boilerplate than NSCoding, since
the same method is used for serialization and deserialization.  This API
is also more type-safe, it does not require the user to write 'as' type
casts, unlike NSCoding.

Please take a look at
validation-test/stdlib/SwiftPrivateSerialization.swift to see the
intended use pattern.

The performance of the underlying implementation is already decent, and
there's a lot of room for improvement.

This is a re-commit of r25678, with a fix for 32-bit platforms.

Swift SVN r25877
2015-03-09 06:55:19 +00:00
Dmitri Hrybenko
350248dae5 Reorganize the directory structure under 'stdlib'
The standard library has grown significantly, and we need a new
directory structure that clearly reflects the role of the APIs, and
allows future growth.

See stdlib/{public,internal,private}/README.txt for more information.

Swift SVN r25876
2015-03-09 05:26:05 +00:00