Commit Graph

71 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis
4f0776936a [stdlib] Dispatch depends on Darwin.
Swift SVN r17749
2014-05-09 01:04:44 +00:00
Greg Parker
f1d020e11a <rdar://16848707> Add Dispatch overlay with covers for some libdispatch macros.
Swift SVN r17693
2014-05-08 09:47:00 +00:00
Ted Kremenek
05e9efb093 Don't compile XCTest overlay as being Application Extension safe.
Swift SVN r17682
2014-05-08 04:49:00 +00:00
Ted Kremenek
3d248270ca Add prototype for KVO API overlay ("KVOContext") to NSObject, and provide test case.
This change adds a new variant of "addObserver:forKeyPath:options:context:"
that takes a "KVOContext" instead of an unsafe void*.  The variant
delegates to the original method, but first 'retain's the object
before turning it into an unsafe pointer.  The API is then matched
with a variant of 'removeObserver:forKeyPath:context:' which
delegates to the original method and then 'release's it.

This vision here is that Swift clients of this API will use this
variant, and not the unsafe one.  A refinement (later) is to
not expose the original methods at all, and provide a new method
'observeValueForKeyPath:ofObject:change:kvoContext:' that implements
a thunk that delegates to 'observeValueForKeyPath:ofObject:change:context:'
and does the void* cast (which the code in the test case does).

This needs to go through API review; names are strawman names.

Swift SVN r17325
2014-05-03 20:06:28 +00:00
Joe Groff
5ea0a0734e UIKit overlay: Add our own designated initializers for UIActionSheet and UIAlertView.
The true designated initializers take a variadic argument, which we can't directly support in Swift, so we'll map those definitions to refer to versions that drop the variadic parameters altogether, and reimplement the variadic interface in the overlay.

Swift SVN r16711
2014-04-23 19:52:39 +00:00
Argyrios Kyrtzidis
65971bc7f4 [CMake] ObjectiveC module depends on the Darwin one.
Swift SVN r16675
2014-04-22 23:48:26 +00:00
Dmitri Hrybenko
b94b1bcc65 Un-disable XCTest build that I accidentally disabled
Swift SVN r16202
2014-04-11 06:33:01 +00:00
Dmitri Hrybenko
110f85bc16 Move @exported to use new attribute infrastructure
Swift SVN r16158
2014-04-10 13:35:35 +00:00
Dave Zarzycki
d5452d84c4 SDK Overlay: Add Darwin overlay
Swift SVN r16140
2014-04-10 00:04:03 +00:00
Dmitri Hrybenko
98c429ee2b Untabify
Swift SVN r16104
2014-04-09 07:28:59 +00:00
Chris Hanson
8ff35e9c23 Check for a proper XCTest.framework in the platform
Check whether the XCTest.framework in the platform has headers before deciding whether to look there or in the SDK for it.

Swift SVN r16084
2014-04-08 23:55:34 +00:00
Chris Hanson
0e2e76ad03 Start building XCTest overlay for all platforms again.
Swift SVN r16083
2014-04-08 23:55:33 +00:00
Greg Parker
0275393c6d [stdlib] Add a CoreGraphics overlay with additions to CGPoint/CGSize/CGRect.
Swift SVN r16029
2014-04-07 22:54:14 +00:00
Doug Gregor
ba67a09362 Allow one to disable building the XCTest overlay via the CMake option SWIFT_BUILD_XCTEST.
Swift SVN r15922
2014-04-04 04:07:03 +00:00
Chris Hanson
42f36febd6 Build the XCTest overlay only for OS X for now.
Once the iOS pieces are in place we'll re-enable building for all platforms.

Swift SVN r15918
2014-04-04 02:50:25 +00:00
Chris Hanson
190c5c8477 Implement an XCTest overlay with basic assertions
Adds an overlay for Xcode's XCTest testing framework.

It implements most of the familiar test assertion macros as equivalent
Swift functions. The assertion macros that aren't currently implemented
are only those that deal specifically with floating-point equality and
Objective-C exceptions. Additionally, the implemented assertions don't
currently handle Objective-C exceptions thrown out of some code called
during an assertion as test failures.

Swift SVN r15917
2014-04-04 01:55:08 +00:00
Greg Parker
dc237675b8 [build] Fix SpriteKit linkage.
Swift SVN r15892
2014-04-03 20:31:39 +00:00
Greg Parker
82b8247a21 [build] SpriteKit depends on AppKit or UIKit.
Swift SVN r15889
2014-04-03 18:14:24 +00:00
Greg Parker
6d6d6896d2 Add SpriteKit overlay with a typealias for SKColor.
Swift SVN r15849
2014-04-02 23:46:56 +00:00
Jordan Rose
dbf3c64b28 Revert "[CMake] Clear the Clang module cache before building the ObjectiveC overlay."
This broke systems where it isn't appropriate to clear the module cache.
The build script already does this when you do a full build; for other
cases, we should just deal with it. (You can still specify a custom
MODULE_CACHE_PATH to make it easier to delete, rather than relying on the
system one.)

This reverts commit r14364.

<rdar://problem/16232176>

Swift SVN r14872
2014-03-10 18:01:01 +00:00
Joe Groff
da7880b0e4 Drop unnecessary 'swift_compareObjects' and 'swift_hashObject' stubs.
Swift SVN r14769
2014-03-07 03:21:32 +00:00
Dave Abrahams
b0b08887e1 [stdlib] Remove unused BridgeObjectiveC.mm
Swift SVN r14652
2014-03-04 21:19:53 +00:00
Joe Groff
c572cc222c Revert "stdlib: Push '===' for AnyObject into stdlib/core."
This reverts commit r14646. It exposes an optimizer bug.

Swift SVN r14649
2014-03-04 17:39:15 +00:00
Joe Groff
5634ff5e67 stdlib: Push '===' for AnyObject into stdlib/core.
And drop the 'Identifiable' protocol.

Swift SVN r14646
2014-03-04 17:04:50 +00:00
Ted Kremenek
028f9d0561 Remove rest of Makefile build except for 'docs' and 'www'.
For 'docs' and 'www' it is possible these are still being used,
as they work independent of the Makefile build.  Keeping them for now.

Swift SVN r14418
2014-02-26 22:21:25 +00:00
Jordan Rose
90f90c7fdd [CMake] Clear the Clang module cache before building the ObjectiveC overlay.
This will catch almost all module cache errors during compiler / stdlib
development, at the cost of slowing down rebuilds of the overlay modules
a bit.

Swift SVN r14364
2014-02-26 01:12:19 +00:00
Jordan Rose
335ceb2f57 Re-enable the new Swift driver.
This re-applies r13380, reverted in r13406. I don't think this actually
caused any harm (r13400 was the primary culprit), but if it did I'd
like to actually see the buildbots or someone else's machine fail on it.

Swift SVN r13456
2014-02-05 00:09:00 +00:00
Dave Abrahams
01e9139944 Revert "Enable the new Swift driver!"
This reverts r13380, which broke the build

Swift SVN r13406
2014-02-04 06:13:58 +00:00
Jordan Rose
16b5a57838 Enable the new Swift driver!
This substitutes swift_driver in as the new "swift". Tests that currently
test "%swift" will invoke "swift -frontend", much like "clang -cc1".
Most command-line interaction will look the same, except that Swift can
now emit linked libraries (using -emit-library) and executables (using
-emit-executable, or by not passing a mode option at all).

If you are working with @transparent functions, note that they will not be
properly inlined across file boundaries unless you use
-force-single-frontend-invocation, which emulates the old swift binary.
There are Radars for this already: <rdar://problem/15366167&15693042>

The name 'swift_driver' is now a symlink for 'swift'. This will be removed
next week.

The old 'swift' is still available as 'swift_old', though it is not being
tested at all. This will be removed in two weeks.

Clean CMake builds will get this immediately.

Incremental CMake builds will not get the new driver unless you explicitly
enable the SWIFT_NEW_DRIVER option (-DSWIFT_NEW_DRIVER=ON on the command line).
This option will go away in a week.

Makefile builds will get this immediately because I didn't want to work out
how to maintain both modes.

Much credit to Connor for bringing up the entire driver and for doing much
of the work in ensuring that all the tests continue to pass.

Swift SVN r13380
2014-02-03 22:48:39 +00:00
Greg Parker
95c2fc43f8 Clena up some 32/64 mismatches. Remove some dead posix stubs.
Swift SVN r13144
2014-01-30 09:34:26 +00:00
Doug Gregor
eaf3e5c68d Move nil/_Nil into the core library and add UnsafePointer<T> support.
Fixes <rdar://problem/15933510>.


Swift SVN r13094
2014-01-29 06:30:28 +00:00
Greg Parker
d9fbea1eff [stdlib] Commit file deletions that were left out of r12732.
Swift SVN r12734
2014-01-22 08:43:27 +00:00
Greg Parker
71c3beb7af [stdlib] Fix ObjCBool definition selection: 32-bit iOS uses BOOL=char.
Swift SVN r12732
2014-01-22 08:28:04 +00:00
Greg Parker
5d12af1b8e [stdlib] Speculatively fix Makefile build of ObjectiveC.swiftmodule.
Swift SVN r12728
2014-01-22 07:34:19 +00:00
Greg Parker
eea5037662 [stdlib] Make definition of ObjCBool platform-specific. NFC on OS X.
Swift SVN r12703
2014-01-22 05:49:03 +00:00
Dave Abrahams
586ccabbb0 [stdlib] Rework String bridging
Going through an @objc protocol for bridging Cocoa strings to Swift
String was working, but it had several disadvantages, including the cost
of invoking objc_msgsend and the need to viciously cast away type-safety
to get past swift's ObjC bridging restrictions.

Instead, Swift's core stdlib now contains a couple of "function
pointers" (variables of Optional<some-Swift-function-type>) that are set
when Foundation is loaded.  We use C++ dynamic initialization to set up
these variables, which is probably not the right long-term answer, but
works for now.

These functions, instead of invoking objc methods on NSString, go
through CFStringXXX functions, which have a fast path that avoids
objc_msgsend in Cocoa's common cases, and since they're not @objc
methods, they can use Swift's full type vocabulary.

It would still be nice to avoid any dynamic dispatch and checking
overheads for going through these optional function variables, but this
ought to be a lot better than where we were, and it keeps Foundation
decoupled from the core standard library.

Along the way, a fair amount of needless code bulk was shed.  Shedding
FTW!

Swift SVN r12327
2014-01-15 11:29:23 +00:00
Dave Abrahams
8eb7129b9c [stdlib] Replace String with NewString
This change is as minimal as possible, which means leaving obsolete
functionality in place (e.g. StringByteData) and even keeping the
"NewString" name in many places.  The obsolete functionality was useful
for testing my changes, but expect immediate cleanup commits
addressing all those issues to follow.

* All String bridging now happens in pure Swift code.

* Because String no longer owns an array of UInt8, some assumptions and
  assertions are no longer valid.  As a result, some code was deleted
  and all the code that produces null-terminated strings had to be
  rewritten

* test/Constraints/construction.swift had to have one test commented out
  because it relied on an element of the String interface that I did not
  port forward.  It seems to me that this test should declare its own
  types and not rely on the stdlib, if it's still valid.

* One test in /test/stdlib/Algorithm.swift had to be disabled pending
  <rdar://problem/15736729> and <rdar://problem/15733855>

* This change revealed that test/Interpreter/repl.swift is sensitive to
  type-alias names; I had to change a "NewString" to "String" there.
  This may indicate a bug somewhere?

Swift SVN r11830
2014-01-02 20:16:59 +00:00
Chris Lattner
4f4c698ed6 Change 'self' to be an rvalue instead of an lvalue in non-@mutating
struct methods.  This does not including properties and subscripts,
but covers the bulk of the change.  The implication of this is that
the compiler now rejects mutations of self in a non-@mutating method,
and rejects attempts to call a @mutating method from a non-@mutating
method.

Along with this:
 - Fix a refcounting bug in SILGenExpr where I emitted multiple releases
   in the rvalue member_ref_expr case, which was exposed by the 
   testsuite now that rvalues are being used a lot more.
 - Change a few native binding things in objc/Foundation to understand
   that String is passed by value now when calling size() and that
   you can't take the address of self in a non-mutating method (this
   should probably pass the components by value instead of passing
   &self, for better performance).  I filed rdar://15726720 to track
   this.
 - Update a ton of testcases.  We now don't materialize nearly as much
   as we used to.
 - Brutalize the test/stdlib/Getopt.swift testcase to work, now that
   the "GetoptLongOptions().noArgument("foo")" builder pattern doesn't
   work anymore (noArgument is a @mutating method, which isn't allowed
   on an rvalue temporary).



Swift SVN r11662
2013-12-26 17:38:03 +00:00
Joe Groff
3e30cbcfef SILGen/IRGen: Don't emit top_level_code for libraries.
If there's no script-mode file in a module, don't produce a top_level_code SILFunction for it, and don't consider emitting an LLVM global_ctor for it. We should never emit static constructors from user code anymore.

Swift SVN r11644
2013-12-26 00:18:29 +00:00
John McCall
c5aa41ffd1 Change around some manglings to make them carry more
information and be easier to demangle.

Swift SVN r11423
2013-12-18 08:33:52 +00:00
Dave Abrahams
85511c09b1 Remove mistakenly-committed file
Swift SVN r11329
2013-12-15 03:18:08 +00:00
Dave Abrahams
90f13d55b4 [stdlib] NSStringAPI: add a couple of missing .AutoReleased annotations
Swift SVN r11328
2013-12-15 03:13:10 +00:00
Jordan Rose
b4fe56eb1c Actually fix the Makefile build for multi-file Swift libraries.
The hack to get the LLVM build system to do what we want is to define a
custom build rule for "XYZ.o" and then add "XYZ" as a dummy source file
to the SOURCES variable, which the LLVM Makefile system uses. To make it
clear that something unusual is going on here, I've changed all existing
instances of this to use "XYZ.o" in SOURCES, rather than having that name
be derived from "XYZ.swift" or whatever.

The actual Swift source files go in SWIFT_SOURCES for the time being
(and possibly forever, since Swift sources will always be built together).

Swift SVN r11058
2013-12-10 00:23:43 +00:00
Dave Abrahams
2293ac8d2e Fix the Makefile build
Since our build system isn't really set up to cope with
multi-sourcefile-modules, dump all Foundation support directly into
Foundation.swift

Swift SVN r11049
2013-12-09 23:17:29 +00:00
Dave Abrahams
00e4a84b74 [stdlib] Begin exposing the NSString API directly on String
Because we're using a "brute-force" combination of conversion to
NSString and forwarding, this code will continue to work when String
is replaced by NewString.  It may not be fast yet, but at least it
will flesh out the experience for Cocoa programmers

Swift SVN r11034
2013-12-09 18:44:58 +00:00
John McCall
b1bbbac19b Correct the mangling of SIL results to include the
ownership convention.

Swift SVN r10598
2013-11-20 18:05:05 +00:00
John McCall
20e58dcf93 Change the type of function values in SIL to SILFunctionType.
Perform major abstraction remappings in SILGen.  Introduce
thunking functions as necessary to map between abstraction
patterns.

Swift SVN r10562
2013-11-19 22:55:09 +00:00
Dave Abrahams
3a09877034 [stdlib] Remove unintended flotsam
Swift SVN r9508
2013-10-19 00:17:36 +00:00
Dave Abrahams
f3053a8bea [stdlib] WIP: prototype the basic data structure of the new string design.
Nothing is tested yet, but it all compiles

Swift SVN r9507
2013-10-19 00:10:02 +00:00
Greg Parker
fbd1c95292 Add support for iOS builds using cmake.
Swift SVN r9499
2013-10-18 21:52:37 +00:00