Commit Graph

137 Commits

Author SHA1 Message Date
Chris Willmore
43e112cdb0 Add Set->NSSet bridging to PrintAsObjC.
Swift SVN r23757
2014-12-06 04:44:10 +00:00
Dmitri Hrybenko
1eea220932 Use one module cache directory for all the lit tests to speed them up
Doing so is safe even though we have mock SDK.  The include paths for
modules with the same name in the real and mock SDKs are different, and
the module files will be distinct (because they will have a different
hash).

This reduces test runtime on OS X by 30% and brings it under a minute on
a 16-core machine.

This also uncovered some problems with some tests -- even when run for
iOS configurations, some tests would still run with macosx triple.  I
fixed the tests where I noticed this issue.

rdar://problem/19125022

Swift SVN r23683
2014-12-04 11:21:48 +00:00
Graham Batty
83f27a8af7 Revert "Mark tests that don't pass on linux as XFAIL."
This reverts commit 2711ca86de7bf6a7885ccea24219a48a590b1e95.

Swift SVN r23577
2014-11-24 17:42:13 +00:00
Graham Batty
198402dcfe Mark tests that don't pass on linux as XFAIL.
Swift SVN r23573
2014-11-24 17:40:37 +00:00
Doug Gregor
267f0ff756 Wrap context-sensitive nullability keywords in SWIFT_NULLABILITY.
Swift SVN r23533
2014-11-21 21:28:17 +00:00
Doug Gregor
96bdf90fcc Stop printing __null_unspecified per rdar://problem/18383574.
Swift SVN r23510
2014-11-21 05:06:53 +00:00
Doug Gregor
07740515c2 Emit nullability context-sensitive keywords for instancetype.
Swift SVN r23486
2014-11-20 21:16:00 +00:00
Joe Groff
944860adb0 PrintAsObjC: Handle forward declarations of @objc enums.
If enums are used as parameters or returns of @objc methods, we may need to forward declare those enums when printing the class @interface.

Swift SVN r23445
2014-11-19 22:27:48 +00:00
Doug Gregor
96a9751372 PrintAsObjC: Print nullability type specifiers to capture optionality.
Part of rdar://problem/19005653. There is still some work to do to
produce pretty output here, but the current output is correct.

Swift SVN r23444
2014-11-19 21:08:23 +00:00
Jordan Rose
b3dc2280a2 [PrintAsObjC] Only print inner classes if they are explicitly marked @objc.
This reduces the chances of conflict among inner class names. It's too easy
for a class to be implicitly marked @objc in Swift.

To make this work, correctly preserve the implicitness of @objc through
serialization. (We were probably intending to do this all along, since we
were serializing the flag but not doing anything with it at the other end.)

Swift SVN r21678
2014-09-03 18:19:00 +00:00
Jordan Rose
1c7b8f2972 [PrintAsObjC] Don't print nested classes as nested in Objective-C.
There are still problems with nested classes:
- They're much more likely to have colliding compile-time names
  (since the outer class's name is dropped).
- They're only picked up if the outer class is also @objc.

But at least now we won't generate invalid Objective-C. Unless the inner
classes have the same name.

rdar://problem/18187877

Swift SVN r21677
2014-09-03 18:18:59 +00:00
Doug Gregor
28866251b0 Clang importer SDK: separate out CoreFoundation.h so we can build it up.
Swift SVN r21375
2014-08-21 21:36:02 +00:00
Dave Abrahams
1438d617cd [stdlib] Rename ConstUnsafePointer=>UnsafePointer
Swift SVN r20318
2014-07-22 17:10:54 +00:00
Dave Abrahams
21669b3aee [stdlib] Add "Mutable" to [Autoreleasing]UnsafePointer
UnsafePointer becomes UnsafeMutablePointer
AutoreleasingUnsafePointer becomes AutoreleasingUnsafeMutablePointer

Swift SVN r20316
2014-07-22 16:56:23 +00:00
Jordan Rose
a419138a7a [PrintAsObjC] Print 'struct Foo' or 'enum Foo' instead of 'Foo' when necessary.
To do this, we keep track of decls with superfluous typedefs (rather than
just the typedefs), and check for that. Tag decls without typedefs are
printed with the tag.

<rdar://problem/17569385>

Swift SVN r20221
2014-07-20 17:26:20 +00:00
Jordan Rose
52f7cd48b0 [PrintAsObjC] Print ownership qualifiers on properties.
weak => 'weak', unless the type is a CF type. I'm not sure weak references to
        CF types work anyway, but until we have that cleared up this works.

unowned => 'assign'. In Objective-C, use of 'assign' for object properties is
           largely deprecated in favor of 'unsafe_unretained', but unowned
           properties behave more like a 'safe_unretained'. Since they don't
           auto-update like 'weak', though, this should hint to clients to
           be careful about lifetimes.

unowned(unsafe) => 'unsafe_unretained'

As before, Arrays, Dictionaries, and Strings are considered 'copy' properties;
blocks are now considered 'copy' properties as well.

All other types get their (implied)  default: 'strong' for objects, 'assign'
for primitives.

<rdar://problem/17346846>

Swift SVN r20112
2014-07-17 20:59:53 +00:00
Doug Gregor
b29192fe54 Diagnose non-optional @IBOutlets <rdar://problem/17654693>.
A while back we decided to require @IBOutlets to be optional (via ! or
?); we got as far as ripping out the implicit !'ification of
@IBOutlets, but never added the diagnostic. Diagnose this restriction
with Fix-Its.

Swift SVN r19981
2014-07-15 19:52:01 +00:00
Jordan Rose
f35e50e017 [PrintAsObjC] Include IBOutlet/IBAction/IBOutletCollection in the header.
Also, fix a bug where value properties weren't getting marked as "copy"
if wrapped in IUOs, and replace some identifier-based comparisons with
pointer comparisons against ASTContext-cached decls.

<rdar://problem/17007235>

Swift SVN r19874
2014-07-12 01:52:01 +00:00
Chris Lattner
5b49d59c57 Remove the @ from @final and @lazy, the last major piece of
rdar://17168115.

Also, reinstate the ARM driver change and testcase that I removed
in my last patch.


Swift SVN r19790
2014-07-10 06:23:27 +00:00
Jordan Rose
c90cd11aff [PrintAsObjC] Only include internal decls if we have a bridging header.
The upshot of this is that internal decls in an app target will be in the
generated header but internal decls in a framework target will not. This
is important since the generated header is part of a framework's public
interface. Users always have the option to add members via category to an
internal framework type they need to use from Objective-C, or to write the
@interface themselves if the entire type is missing. Only internal protocols
are left out by this.

The presence of the bridging header isn't a /perfect/ way to decide this,
but it's close enough. In an app target without a bridging header, it's
unlikely that there will be ObjC sources depending on the generated header.

Swift SVN r19763
2014-07-09 23:58:57 +00:00
Jordan Rose
9e970f313e [PrintAsObjC] Handle dictionary sugar syntax.
<rdar://problem/17594798>

Swift SVN r19734
2014-07-09 18:44:47 +00:00
Jordan Rose
cf53b747d0 Don't infer @objc on private members.
You can still mark them @objc explicitly (or @IBOutlet, or anything else that
would require ObjC interop).

Also, don't print private decls in the generated header, whether @objc or not.
not.

Swift SVN r19733
2014-07-09 18:44:46 +00:00
Doug Gregor
3f4a07ffde Remove accidental commit: we don't need to annotate this as @objc
Swift SVN r19709
2014-07-08 23:02:46 +00:00
Doug Gregor
9e2b68c4f9 Introduce CGFloat as a distinct struct type.
CGFloat is 32-bit on 32-bit architectures and 64-bit on 64-bit
architectures for historical reasons. Rather than having it alias
either Float (32-bit) or Double (64-bit), introduce a distinct struct
type for CGFloat. CGFloat provides a complete set of comparisons and
arithmetic operators (including tgmath functions), initializers allows
explicit conversion between it an Int, UInt, Float, and Double, as
well as conforming to all of the protocols that Float/Double do.

This formulation of CGFloat makes use of CGFloat
architecture-independent, although it still requires a number of casts.
Fixes <rdar://problem/17224725>

Swift SVN r19689
2014-07-08 19:00:18 +00:00
Jordan Rose
e9f6fba434 Update tests for memberwise accessibility.
Swift SVN r19354
2014-06-30 18:50:51 +00:00
Chris Lattner
f241c66cd7 implement <rdar://problem/17473876> @IBOutlet attribute shouldn't make properties implicitly optional or weak
Now the @IBOutlet attribute has no implicit effect on the type or storage of a property.  It still performs
validity checks of course.


Swift SVN r19344
2014-06-30 15:54:24 +00:00
Joe Groff
17d27e6529 PrintAsObjC: Print ConstUnsafePointer as a const pointer.
Swift SVN r19266
2014-06-26 22:37:25 +00:00
Doug Gregor
e064416c8f Update the rest of the testsuite for the array syntax change.
Swift SVN r19223
2014-06-26 05:39:25 +00:00
Jordan Rose
7fc8ecd919 [PrintAsObjC] Mark String, Array, and Dictionary properties as 'copy'.
<rdar://problem/17012159>

Swift SVN r19118
2014-06-24 01:23:03 +00:00
Jordan Rose
c6226159c5 Allow class properties to be @objc, and expose them as class methods.
<rdar://problem/17164696>

Swift SVN r19117
2014-06-24 01:23:02 +00:00
Chris Lattner
228389490f stop marking implicit decls as @objc if they lack the objc attribute. This
prevents synthesized stuff from being reflected back to the runtime, and prevents
PrintAsObjC from reflecting it into the generated ObjC header.

This fixes:
<rdar://problem/17165953> Swift: @lazy property reflects back into Objective-C with two properties, one for underlying storage

which caused us to print a decl for a lazy property's storage, which is useless
but also syntactically incorrect, causing clang to fail to parse the header.



Swift SVN r19054
2014-06-20 22:29:09 +00:00
Jordan Rose
03eacc2931 [PrintAsObjC] Forward-declare things for the generated header when possible...
...and just outright import the bridging header if that's what's needed.

This means we'll use @class and @protocol whenever we're just using a class
or protocol in a type, but still import the enclosing module when we need
the definition. We'll also fall back to the module (or bridging header) if
we need something /else/ from C: a struct, a typedef, whatever.

<rdar://problem/17183425>

Swift SVN r18795
2014-06-11 00:01:58 +00:00
Jordan Rose
6afb4df544 [PrintAsObjC] Handle properties with weak/unowned storage.
We don't do this quite as well as we could (we don't list the storage
type in the @property), but previously we just failed on these types.

<rdar://problem/16992990>

Swift SVN r18528
2014-05-21 22:38:04 +00:00
Joe Groff
e8f71c12a2 Rename ObjCMutablePointer to AutoreleasingUnsafePointer.
This relates its interface and behavior to that of UnsafePointer, and draws an analogy to '__autoreleasing *' in ARC.

Swift SVN r18236
2014-05-17 04:44:44 +00:00
Doug Gregor
ad18ed81fb Start importing NSArray* as (AnyObject[])! by default <rdar://problem/16535097>.
Swift SVN r18157
2014-05-16 01:10:13 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Jordan Rose
8b9dfb017a Move test/Swift2ObjC to test/PrintAsObjC to match the library name.
Swift SVN r13799
2014-02-12 01:19:12 +00:00