Commit Graph

21492 Commits

Author SHA1 Message Date
Chris Lattner
ab3100230e restore DaveZ's r18786, which adds a .bytesSwapped property. Not all byte
swapping is about endianness.  This resolves rdar://17319884.


Swift SVN r18910
2014-06-15 19:57:37 +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
Doug Gregor
7acecc5457 Add a library entry point for Dictionary downcasting for bridged keys & values.
This is an inefficient, copying implementation of
_dictionaryBridgeToObjectiveC to aid progress on wiring up dictionary
downcasting <rdar://problem/16847470>. Making this implementation
efficient is tracked by <rdar://problem/16852016>.



Swift SVN r18897
2014-06-14 16:55:53 +00:00
Doug Gregor
2d4148796b Add a library entry point for Dictionary upcasting for object keys & values.
This is an inefficient, copying implementation of
_dictionaryCheckedDownCast to aid progress on wiring up dictionary
downcasting <rdar://problem/16847470>.  Making this implementation
efficient is tracked by <rdar://problem/16852016>.


Swift SVN r18896
2014-06-14 16:25:08 +00:00
Doug Gregor
47fbf0d166 Extend dictionary upcast support for handle mixed bridging/upcasting.
This allows dictionary upcasting where the key is bridged and the
value is not, or vice-versa. Finishes <rdar://problem/17289296>.


Swift SVN r18895
2014-06-14 15:48:12 +00:00
Doug Gregor
47748ba9aa Add stub implementations of the dictionary upcast entry points.
This introduces _dictionaryUpCast and _dictionaryBridgeToObjectiveC,
which will be used for upcasting for non-bridged and bridged key/value
types, respectively. _dictionaryUpCast is a horrible copying O(n)
implementation where we should be able to provide an O(1)
implementation, and _dictionaryBridgeToObjectiveC is similarly
awful. Hence, this is not for <rdar://problem/16852016>, but is merely
a stub to let us make progress on upcasting in the frontend
(<rdar://problem/17289296>).

Swift SVN r18867
2014-06-13 16:32:49 +00:00
Ted Kremenek
23d3ca2648 Fix 'charater' typo in documentation comment. <rdar://problem/17249044>
Swift SVN r18856
2014-06-13 05:43:05 +00:00
Doug Gregor
5ca3882b06 Rename array upcast/bridge expressions to "collection".
This is staging for dictionary bridging upcasts.


Swift SVN r18840
2014-06-12 21:41:55 +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
6aa83e9d01 Improve the error message when a nil Optional is unwrapped.
Swift SVN r18822
2014-06-12 03:34:07 +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
John McCall
9890d8bca0 Add swift_dynamicCast.
This is the most general dynamic cast operation, permitting
arbitary source and destination types and handling arbitrary
changes in representation.  A value of the destination type
is constructed in an address provided by the caller; flags
control the behavior w.r.t. the source value.

Not yet used; probably buggy in various particulars.

Swift SVN r18815
2014-06-12 00:13:13 +00:00
John McCall
a581511069 Permit LLVM's cast operators to be used on Metadata
instances, and add ExistentialTypeMetadata::isClassBounded().

Swift SVN r18814
2014-06-12 00:13:08 +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
Dmitri Hrybenko
363dfbee9b stdlib: add doc comments
Swift SVN r18794
2014-06-10 23:59:24 +00:00
Dave Zarzycki
152627896e stdlib: more byte swap feedback
Swift SVN r18790
2014-06-10 23:23:56 +00:00
Dave Zarzycki
59368b5711 stdlib: byte swap feedback
We only care about little-endian hosts at it shows. ;-)

Swift SVN r18787
2014-06-10 23:03:56 +00:00
Dave Zarzycki
9bdf3f6f6e stdlib: add .byteSwapped to integer types
This fixes: <rdar://problem/17085624>

Swift SVN r18786
2014-06-10 22:41:27 +00:00
Dave Zarzycki
588b91f982 Runtime: Swift is public, we can now stop hiding crash reports
This fixes: <rdar://problem/15489050>

Swift SVN r18784
2014-06-10 22:12:45 +00:00
Joe Groff
ac903bf943 IRGen: Make our use of spare bits in heap objects tagged-pointer-safe.
Don't use spare bits on platforms that use ObjC tagged pointers when an enum payload involves a class-constrained existential, archetype, or ObjC-defined class type. If a payload is of a Swift-defined class type, we can still assume it's a real pointer and use its spare bits. Add an @unsafe_no_objc_tagged_pointer attribute that can be applied to protocols to denote that existentials bounded by that protocol can use spare bits; this is necessary to preserve the layout of bridged Array and Dictionary types, which should not be bound to tagged pointer types in practice (fingers crossed). Fixes <rdar://problem/16270219>.

Swift SVN r18781
2014-06-10 17:07:47 +00:00
John McCall
0f0874bb4b Add variants of the checked-cast instructions that
put the result in a different place.

WIP: no IRGen support yet.

This will eventually be the required form when casting
to an address-only type; the existing instructions will
have only scalar outputs.

Swift SVN r18780
2014-06-10 07:43:22 +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
John McCall
5e1c15df93 Rationalize the class-instance dynamicCast runtime functions.
dynamicCastClass assumes that the destination type is a
Swift class type.

dynamicCastObjCClass assumes that the destination type is
an ObjC class type (represented as ObjC metadata, not type
metadata).

dynamicCastUnknownClass assumes only that the destination
type is some kind of class.

Swift SVN r18776
2014-06-10 02:11:24 +00:00
Manman Ren
e3517e8792 [stdlib] add two-operand version of min.
This corresponds to the change on max at r18767.


Swift SVN r18769
2014-06-10 00:57:08 +00:00
Manman Ren
4c284e48bd [stdlib] add two-operand version of max.
This helps array append's performance by ~ 2x. The generic max with a variadic
argument takes at least 3 arguments, it creates a temporary array then iterates
over the array.

This is an updated version of r18764.
rdar://17140639 rdar://17073827


Swift SVN r18767
2014-06-10 00:33:46 +00:00
Greg Parker
dc5f3c2090 <rdar://16878510> Add definitions of stdin/stdout/stderr to the Darwin overlay.
Swift SVN r18766
2014-06-10 00:33:02 +00:00
Manman Ren
aec78d0693 [stdlib] revert r18764.
Swift SVN r18765
2014-06-10 00:13:41 +00:00
Manman Ren
cc90c81239 [stdlib] add two-operand version of max and use max2 in stdlib when appropriate.
This helps array append's performance by ~ 2x. The generic max with a variadic
argument creates a temporary array then iterates over the array.

rdar://17140639 rdar://17073827


Swift SVN r18764
2014-06-09 23:56:40 +00:00
Joe Groff
cf20524271 Fix typo.
Swift SVN r18761
2014-06-09 22:19:12 +00:00
John McCall
1f5fa04724 Move the rest of the dynamic-cast code over to Casting.cpp.
Swift SVN r18759
2014-06-09 21:42:30 +00:00
John McCall
fd9778165b Split the dynamic-cast code out into its own file.
Swift SVN r18756
2014-06-09 21:16:09 +00:00
Doug Gregor
fa71c0d0bb Teach _dynamicCastToExistential to check conformance to Objective-C protocols.
Narrowly address the problem of downcasting an array to an array of
Objective-C existentials by checking conformance for Objective-C
protocols. Addresses <rdar://problem/17165071>, but this area still
needs a lot of work.


Swift SVN r18745
2014-06-09 15:13:58 +00:00
Dmitri Hrybenko
a69e341aa2 stdlib/NSString APIs on String: fix a bug and add tests for
rangeOfCharacterFromSet(_:options:range:)

The underlying Objective-C API could return an NSRange of NSNotFound.  Swift's
String.Index can not represent that, so change the API to return an optional
Swift Range<Index> instead.


Swift SVN r18679
2014-05-30 23:07:21 +00:00
Dmitri Hrybenko
df71a47fe4 stdlib/NSString APIs on String: fix two bugs and add more tests
stringWithBytes(_:length:encoding:) was passing an array to Objective-C
incorrectly, and a garbage NSString was being constructed as a result.

Unhide the initializer was accidentally hidden.


Swift SVN r18674
2014-05-30 20:30:57 +00:00
Dmitri Hrybenko
ea7758f40d stdlib/String: implement UTF-8 encoding for Strings that wrap NSStrings for
which Foundation can not give us a UTF-8 encoding in O(1)

rdar://17041741


Swift SVN r18660
2014-05-29 00:41:42 +00:00
Dmitri Hrybenko
eca9bd244c stdlib/runtime: don't leak filenames of users' code through calls to runtime
trap function for unimplemented initializers.

rdar://17054604


Swift SVN r18658
2014-05-28 22:42:15 +00:00
Dmitri Hrybenko
473ad2e1eb stdlib: don't use assert() in stdlib implementation
Swift SVN r18653
2014-05-28 20:43:56 +00:00
Argyrios Kyrtzidis
5718e5fe3d [stdlib] Re-expose 'nil' as a public symbol.
rdar://17053045

Swift SVN r18652
2014-05-28 17:57:41 +00:00
Enrico Granata
c44731ac31 B&I updated the builders to a new iOS SDK - the new SDK means that the Unmanaged<> is unwrapped automatically on our behalf
This patch is required to unbreak the build



Swift SVN r18651
2014-05-27 23:53:26 +00:00
Nadav Rotem
1dc6de3785 Add a comment that explains how we disable inlining. NFC.
Swift SVN r18646
2014-05-27 00:32:20 +00:00
Dmitri Hrybenko
470fee7838 stdlib: correct a comment to be more explicit that this is a hack
Swift SVN r18644
2014-05-26 23:49:50 +00:00
Enrico Granata
30341ed401 The B&I-sanctioned iOS SDK does not have the right annotations for this to be automatically unwrapped. The Graphics Context comes back to us as Unamanged<> and we need to manually extract the value out of it. Do so for now
Swift SVN r18643
2014-05-26 23:22:59 +00:00
Enrico Granata
3e1ed25aa7 Add a mirror for UIView
There are a couple caveats to this Mirror, discussed in detail in the radar

Fixes rdar://17029335



Swift SVN r18642
2014-05-26 20:26:57 +00:00
Nadav Rotem
dd4d9f5820 Make sure we don't inline the cold path by wrapping it with a closure.
Swift SVN r18641
2014-05-26 20:24:05 +00:00
Dave Zarzycki
b25eeec435 Runtime: automatically enable crash reporting after the announcement
We should have thought about this option earlier. This fixes:
<rdar://problem/16902160> Beta GM TASK: Enable crash tracing for WWDC (revert r10532)

Swift SVN r18639
2014-05-26 19:58:40 +00:00
Nadav Rotem
04b17cc63f Add comments. NFC.
Swift SVN r18637
2014-05-26 19:52:01 +00:00