Commit Graph

455 Commits

Author SHA1 Message Date
Doug Gregor
acbed44c36 CMake: Teach add_swift_library to handle libraries where the default configuration can’t be built.
Use this to build UIKit for iOS the iOS simulator without building it for the OS X host.

Swift SVN r19415
2014-07-01 17:11:37 +00:00
Doug Gregor
5ffb276c0c CMake: Give add_swift_library a TARGET_SDKS parameter to limit a particular library to a given set of SDKs.
Use it to make AppKit a target library, which will only be built against the OS X SDK.

Swift SVN r19414
2014-07-01 17:11:37 +00:00
Doug Gregor
99d4e0c8ed CMake: start building iOS variants for the CoreGraphics, Darwin, Dispatch, Foundation, ObjectiveC, and SpriteKit framework overlays
Swift SVN r19413
2014-07-01 17:11:36 +00:00
Doug Gregor
87c1198bcb Use build configurations to handle ObjCBool’s ‘signed char’ vs. ‘bool’ representation.
Swift SVN r19412
2014-07-01 17:11:35 +00:00
Greg Parker
3df563f233 [stdlib] Revert r19835 because it doesn't work on iOS.
Swift SVN r19387
2014-07-01 01:35:48 +00:00
Dave Abrahams
46d9d0d4df [stdlib] Bridge the types NSValue wraps explicitly
NSRange, NSPoint, NSSize, and NSRect

Fixes <rdar://problem/16973060>

Swift SVN r19385
2014-07-01 00:14:09 +00:00
Jordan Rose
748efed913 [Accessibility] Protocol witnesses must be as accessible as the protocol.
...unless the type has less accessibility than the protocol, in which case
they must be as accessible as the type.

This restriction applies even with access control checking disabled, but
shouldn't affect any decls not already marked with access control modifiers.

Swift SVN r19382
2014-06-30 23:38:35 +00:00
Dave Abrahams
8e7d45f2c0 [stdlib] Normalize .gyb files
- Follow LLVM conventions for emacs mode specification

- Use local variables suffix to make the output read-only (at least on
  Emacs)

- But drop the admonitions not to edit the generated files;
  line-directive mostly takes care of that problem now.

Swift SVN r19381
2014-06-30 23:24:17 +00:00
Fariborz Jahanian
bae70e6358 Add dependency on swiftFoundation so Foundation
overlay is built too. This is for // rdar://16726822


Swift SVN r19371
2014-06-30 21:53:30 +00:00
Fariborz Jahanian
30b995e09e Re-introduce SDK overlays for Core Image that I reverted
in r19361. Thank you Doug for pointing out that I did
not import Foundation. Sigh, that build systems have different
behavior in buildbot and elsewhere. Hope this fixes the buildbot failure.
// rdar://16726822


Swift SVN r19367
2014-06-30 20:50:06 +00:00
Enrico Granata
8e084a99b5 My editor was set up to produce tabs instead of spaces
Fix it and recommit



Swift SVN r19362
2014-06-30 20:08:27 +00:00
Fariborz Jahanian
ac96ad94d5 Revert r19357 (it fails on buildbot only).
Swift SVN r19361
2014-06-30 20:05:26 +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
Enrico Granata
c23d333890 Add Mirror support for ObjCBool and Selector types
Swift SVN r19347
2014-06-30 18:31:40 +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
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
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
cb48fbd24b Enable pointer conversions.
Swift SVN r19274
2014-06-26 23:26:31 +00:00
Doug Gregor
bea1d3d9b3 Use dictionary type sugar in the standard library.
Swift SVN r19264
2014-06-26 22:26:58 +00:00
Joe Groff
d1e7ff0590 Foundation: Add staging typealiases for C pointer types.
Swift SVN r19209
2014-06-26 01:30:50 +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
Doug Gregor
37df5c430c Update standard library to use [T] array syntax.
Swift SVN r19190
2014-06-25 23:39:20 +00:00
Dmitri Hrybenko
6bb6e1b0b4 stdlib/String: if we can not get a contiguous data buffer out of NSString,
don't call into CoreFoundation to perform UTF-8 transcoding.  CoreFoundation
can replace ill-formed sequences with a single byte, which is not good enough
to implement U+FFFD insertion.  Instead, use the same transcoding routine as
for contiguous buffer.

Pulled out the transcoding routine into a generic function that should be
specialized and simplified for the case when input is UnsafeArray; we should
not be losing efficiency here.

Fixes <rdar://problem/17297055> [unicode] println crashes when given string
with unpaired surrogate



Swift SVN r19157
2014-06-25 13:24:15 +00:00
Jordan Rose
cca27d02a0 Tag everything in the standard library with accessibility attributes.
Keep calm: remember that the standard library has many more public exports
than the average target, and that this contains ALL of them at once.
I also deliberately tried to tag nearly every top-level decl, even if that
was just to explicitly mark things @internal, to make sure I didn't miss
something.

This does export more than we might want to, mostly for protocol conformance
reasons, along with our simple-but-limiting typealias rule. I tried to also
mark things private where possible, but it's really going to be up to the
standard library owners to get this right. This is also only validated
against top-level access control; I haven't fully tested against member-level
access control yet, and none of our semantic restrictions are in place.

Along the way I also noticed bits of stdlib cruft; to keep this patch
understandable, I didn't change any of them.

Swift SVN r19145
2014-06-24 21:32:18 +00:00
Enrico Granata
2ab2e6c07b Change the very cryptic "don't ask" to something more informative
Fixes <rdar://problem/16922703>



Swift SVN r19123
2014-06-24 01:50:02 +00:00
Chris Hanson
5b9b67e900 Revert "Remove XCTest overlay"
We need to actually keep the XCTest support in an overlay for now.

This reverts commit 4a2726862634a553483943baf39a251ac8071e37.

Addresses <rdar://problem/17423669>.

Swift SVN r19101
2014-06-23 21:00:47 +00:00
Doug Gregor
22dc55058e Make bridgeFromObjectiveC return non-optional.
Now that we use bridgeFromObjectiveCConditional to perform conditional
bridging, make bridgeFromObjectiveC handle forced bridging. For the
latter, deferred checking is acceptable.

Almost all of <rdar://problem/17319154>.


Swift SVN r19046
2014-06-20 13:15:41 +00:00
Dmitri Hrybenko
f370ca0746 stdlib: fix a bunch of various Unicode issues, primarily in UTF-8 decoding
In UTF-8 decoder:
- implement U+FFFD insertion according to the recommendation given in the
  Unicode spec.  This required changing the decoder to become stateful, which
  significantly increased complexity due to the need to maintain an internal
  buffer.
- reject invalid code unit sequences properly instead of crashing rdar://16767868
- reject overlong sequences rdar://16767911

In stdlib:
- change APIs that assume that UTF decoding can never fail to account for
  possibility of errors
- fix a bug in UnicodeScalarView that could cause a crash during backward
  iteration if U+8000 is present in the string
- allow noncharacters in UnicodeScalar.  They are explicitly allowed in the
  definition of "Unicode scalar" in the specification.  Disallowing noncharacters
  in UnicodeScalar prevents actually using these scalar values as internal
  special values during string processing, which is exactly the reason why they
  are reserved in the first place.
- fix a crash in String.fromCString() that could happen if it was passed a null
  pointer

In Lexer:
- allow noncharacters in string literals.  These Unicode scalar values are not
  allowed to be exchanged externally, but it is totally reasonable to have them
  in literals as long as they don't escape the program.  For example, using
  U+FFFF as a delimiter and then calling str.split("\uffff") is completely
  reasonable.

This is a lot of changes in a single commit; the primary reason why they are
lumped together is the need to change stdlib APIs to account for the
possibility of UTF decoding failure, and this has long-reaching effects
throughout stdlib where these APIs are used.


Swift SVN r19045
2014-06-20 13:07:40 +00:00
Doug Gregor
fd62de4373 Use bridgeFromObjectiveCConditional where we want conditional bridging.
More of <rdar://problem/17319154>.


Swift SVN r19038
2014-06-20 07:41:50 +00:00
Chris Hanson
7d1cf3d107 Remove XCTest overlay
The XCTest support for Swift is now built as part of XCTest.framework
itself, so the overlay is no longer necessary.

Addresses <rdar://problem/17383462>.

Swift SVN r19016
2014-06-19 22:08:52 +00:00
Doug Gregor
2e3863b211 Introduce _ConditionallyBridgedToObjectiveC.bridgeFromObjectiveCConditional.
This entry point is used in conditional downcasts (as?) to attempt to
bridge from an Objective-C class down to a specific native type (e.g.,
array, dictionary), bridging all elements eagerly so that it can
produce nil if the bridging would fail.

This is the scaffolding for <rdar://problem/17319154>, and makes the
example there work, but there is much more cleanup and optimization to
do.



Swift SVN r18999
2014-06-19 14:48:00 +00:00
Chris Lattner
62cad3dce8 add a "..<" operator, which is an alias for ".." and switch the stdlib to use it.
Until I have a chance to update the testsuite, we'll accept both.



Swift SVN r18998
2014-06-19 05:42:29 +00:00
Pete Cooper
653a9d2d99 Create builtin's for math functions exposed as LLVM intrinsics. Use these builtin's in the wrappers for functions such as sqrt(Float) and cos(Double). rdar://problem/16709244
Swift SVN r18968
2014-06-18 00:27:13 +00:00
Ted Kremenek
7d5a8aa5cc Use 'NSColor' instead of 'AnyObject' in argument to 'init' with 'colorsAndLocations'.
Swift SVN r18950
2014-06-17 07:01:17 +00:00
Doug Gregor
c19b92e4b3 Rename array downcast entry points to have "conditional" in the name.
s/_arrayCheckedDownCast/_arrayDownCastConditional/g
s/_arrayBridgeFromObjectiveC/_arrayBridgeFromObjectiveCConditional/g



Swift SVN r18930
2014-06-16 15:06:04 +00:00
Chris Lattner
60fc0e6cd2 Implement <rdar://problem/16951729> nil should be a literal type
This is all goodness, and eliminates a major source of implicit conversions.
One thing this regresses on though, is that we now reject "x == nil" where
x is an option type and the element of the optional is not Equtatable.  If
this is important, there are ways to enable this, but directly testing it as
a logic value is more straight-forward.

This does not include support for pattern matching against nil, that will be
a follow on patch.



Swift SVN r18918
2014-06-15 22:59:03 +00:00
Chris Lattner
371efa74d7 r18747 (which changed how we import macros that expand to nil) regressed on some GCD macros that are widely
used.  Fix this by adding them to the GCD overlay.  A more general solution is tracked in rdar://17245039,
but that isn't on the critical path right now.


Swift SVN r18916
2014-06-15 20:44:57 +00:00
Doug Gregor
b039880a01 Revert r18906 "Make Dictionary bridgeFromObjectiveC return nil if bridging fails" while we discuss it.
Swift SVN r18908
2014-06-15 16:59:25 +00:00
Doug Gregor
dd8c668aa8 Import NSDictionary as Dictionary<NSObject, AnyObject>
Fixes <rdar://problem/16870626>.


Swift SVN r18907
2014-06-15 10:44:23 +00:00
Doug Gregor
d3d2092ac0 Make Dictionary bridgeFromObjectiveC return nil if bridging fails.
This allows conditional downcasting (e.g., via as? or is) to fail
without trapping. Noticed by inspection.


Swift SVN r18906
2014-06-15 08:53:22 +00:00
Jordan Rose
5f4db71fc5 Remove KVOContext from the Foundation overlay.
We're recommending people just go with a global variable.

<rdar://problem/17272837>

Swift SVN r18837
2014-06-12 19:55:45 +00:00
Greg Parker
fc3794d7e9 <rdar://16978397> Overlay most of the rest of math.h.
Swift SVN r18821
2014-06-12 01:48:00 +00:00
Greg Parker
8548760762 <rdar://16978397> Add overlays for most of tgmath.h.
Swift SVN r18808
2014-06-11 21:56:25 +00:00
Greg Parker
50404f6210 Fix build break in UIViewControllerAdditions.
Swift SVN r18779
2014-06-10 06:16:00 +00:00
Greg Parker
4f467b72f5 Fix build break in XCTest.
Swift SVN r18778
2014-06-10 05:36:31 +00:00
Greg Parker
4880bceda2 <rdar://17086151> Add overlays for open(), openat(), and struct stat.
Swift SVN r18777
2014-06-10 02:43:26 +00:00