Commit Graph

431 Commits

Author SHA1 Message Date
Doug Gregor
795f568898 Start diagnosing the use of '`' rather than '#', with a Fix-It.
<rdar://problem/16891828>.

Swift SVN r17982
2014-05-13 00:03:05 +00:00
Doug Gregor
1efd9fba5b Start accepting '#' in addition to '`' to mark a keyword argument <rdar://problem/16891828>.
Update the standard library, tests, diagnostics, and Fix-Its.

Swift SVN r17981
2014-05-13 00:03:04 +00:00
Doug Gregor
93f7ac2e48 Fix the name of the initializer for initWithObjectsAndKeys.
Swift SVN r17974
2014-05-12 23:21:44 +00:00
Doug Gregor
73528dc0e0 Enable importing factory methods as initializers by default.
Finishes <rdar://problem/16509024>.

Swift SVN r17972
2014-05-12 23:01:20 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Jordan Rose
d410bd0acd [CMake] Re-enable -autolink-force-load to cause the buildbot to fail.
I can't reproduce this locally, so I'll need to run this on the buildbot
and inspect the output.

Swift SVN r17795
2014-05-09 19:11:11 +00:00
Greg Parker
fba2e4bd7c Add overlay covers for DISPATCH_QUEUE_CONCURRENT and DISPATCH_SOURCE_TYPE_*.
Swift SVN r17766
2014-05-09 07:06:10 +00:00
Argyrios Kyrtzidis
786ab593dd Revert "[CMake] Build the SDK overlays with -autolink-force-load."
This reverts commit r17752, because it caused link failures of Interpreter and stdlib tests.

Swift SVN r17758
2014-05-09 04:02:54 +00:00
Jordan Rose
20fb4513e2 [CMake] Fix dependencies for swiftDispatch.
Without proper dependencies among the overlays, we may try to load an
outdated overlay module while building another overlay.

Swift SVN r17753
2014-05-09 01:20:34 +00:00
Jordan Rose
90c5fbe029 [CMake] Build the SDK overlays with -autolink-force-load.
Final part of <rdar://problem/16829587>

Swift SVN r17752
2014-05-09 01:20:33 +00:00
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