Commit Graph

30 Commits

Author SHA1 Message Date
Maxim Moiseev
0e54467bfa Final bulk removal of Type suffix 2015-12-16 17:06:19 -08:00
Kevin Ballard
66369468aa Use new-style _Nullable keywords in obj-c header
Use the keywords `_Nullable`, `_Nonnull`, and `_Null_unspecified`
instead of the older compatibility forms `__nullable`, `__nonnull`, and
`__null_unspecified`.

Part of rdar://problem/23614638
2015-12-05 19:54:27 -08:00
Jordan Rose
fa2211d834 [PrintAsObjC] Print 'strong' on properties with class type.
...so that our headers can be imported into MRR code.

rdar://problem/17214904

Swift SVN r31230
2015-08-13 22:14:57 +00:00
Jordan Rose
8106a11dac Disallow @objc on non-ObjC-rooted classes.
These classes don't show up well in generated headers (rdar://problem/20855568),
can't actually be allocated from Objective-C (rdar://problem/17184317), and
make the story of "what is exposed to Objective-C" more complicated. Better
to just disallow them.

All classes are still "id-compatible" in that they can be converted to
AnyObject and passed to Objective-C, they secretly implement NSObjectProtocol
(via our SwiftObject root class), and their members can still be individually
exposed to Objective-C.

The frontend flag -disable-objc-attr-requires-foundation-module will disable
this requirement as well, which is still necessary for both the standard
library and a variety of tests I didn't feel like transforming.

Swift SVN r29760
2015-06-27 16:27:56 +00:00
Jordan Rose
b4d6a47899 [PrintAsObjC] Use @objc for compile-time names of classes and protocols.
This is half of rdar://problem/17469485. The other half will be
recognizing in the importer that the Objective-C declaration references
a Swift type; see next commit.

Swift SVN r29743
2015-06-26 18:28:48 +00:00
Doug Gregor
75617df37d PrintAsObjC: Stop printing SWIFT_NULLABILITY(keyword).
Everyone's Clang should support nullability qualifiers now.

Swift SVN r28649
2015-05-15 23:46:46 +00:00
Doug Gregor
5de47e93dd Remove uses of getProtocols() from serialization.
NFC except for having to work around the brokenness of
-enable-source-import in more places.

Swift SVN r27979
2015-04-30 16:13:45 +00:00
Doug Gregor
480b6e9af4 Start using DeclContext::getLocalConformances() to decide which conformances get recorded.
Swift SVN r26320
2015-03-19 22:10:04 +00:00
Dmitri Hrybenko
f43843f25c tests: use the new substitution for the mock SDK
This is required to correctly use the mock SDK when the SDK overlay is
built and tested separately.  (Otherwise, the mock SDK might not get
used, because the overlay SDK options would expand from the
%-substitution, appear first on the command line, and shadow the mock
SDK in the search path).

Swift SVN r25185
2015-02-11 18:57:29 +00:00
Graham Batty
83b4384fac Update test flags for linux failures and support.
Also removed the sdk 'feature' in favour of the more specific
objc_interop.

Swift SVN r24856
2015-01-30 21:31:48 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
David Farler
87c3d7421f Refine static func and var syntax
rdar://problem/17198298

- Allow 'static' in protocol property and func requirements, but not 'class'.
- Allow 'static' methods in classes - they are 'class final'.
- Only allow 'class' methods in classes (or extensions of classes)
- Remove now unneeded diagnostics related to finding 'static' in previously banned places.
- Update relevant diagnostics to make the new rules clear.

Swift SVN r24260
2015-01-08 03:03:29 +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
07740515c2 Emit nullability context-sensitive keywords for instancetype.
Swift SVN r23486
2014-11-20 21:16:00 +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
2f988f48d1 [PrintAsObjC] Don't use OBJC_DESIGNATED_INITIALIZER for protocol initializers.
<rdar://problem/17793674>

Swift SVN r20903
2014-08-01 18:06:33 +00:00
Doug Gregor
1cc28d4f80 An initializer requirement can only be satisfied by a required class initializer in a non-final class.
This is part of eliminating the notion of non-inheritable
conformances. Fixes <rdar://problem/17408284>.

Swift SVN r20430
2014-07-23 22:16:38 +00:00
Doug Gregor
a5c079af59 Replace the class_protocol attribute with a "class" requirement.
This only tackles the protocol case (<rdar://problem/17510790>); it
does not yet generalize to an arbitrary "class" requirement on either
existentials or generics.

Swift SVN r19896
2014-07-13 06:57:48 +00:00
Chris Lattner
fe95f81397 introduce a new 'DeclModifier' flag on attributes, which mark that the
attribute is a "modifier" of a decl, not an "attribute" and thus shouldn't
be spelt with an @ sign.  Teach the parser to parse "@foo" but reject it with
a nice diagnostic and a fixit if "foo" is a decl modifier.

Move 'dynamic' over to this (since it simplifies some code), and switch the
@optional and @required attributes to be declmodifiers (eliminating their @'s).



Swift SVN r19787
2014-07-10 05:49:10 +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
3e994a24cf [PrintAsObjC] Don't print private protocols in the generated header.
Swift SVN r19735
2014-07-09 19:01:34 +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
Jordan Rose
1b7a384252 Fix a multitude of issues with extensions exposed to Objective-C (r19116).
- Category names weren't unique.
- We were using an attribute to detect if something was a Swift category,
  but attributes can't be used on categories.
- The test that this was all working was failing in a way that wasn't caught.

To solve these problems:

- We're using a macro to generate category names based on __LINE__ in addition
  to the current module.
- The importer uses the macro to detect that the category comes from Swift
  (no attribute needed).
- The test now has a deliberate error for -verify to catch.

<rdar://problem/17342287&17538553>

Swift SVN r19479
2014-07-02 20:35: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
347f330d15 Don't import the ObjC representation of Swift extensions in frameworks.
Because extensions don't have any identity we can check against, we can't
tell when we see an Objective-C category if it came from a Swift extension.
Change PrintAsObjC to mark all such categories with SWIFT_EXTENSION, and
just skip them unilaterally when importing Objective-C code.

Also, actually give Swift extensions a name when writing them as Objective-C
categories. Previously, they were nameless categories ("class extensions"),
but methods in a class extension are supposed to be implemented in the class's
main @implementation, so people were getting unexpected warnings about missing
implementations.

<rdar://problem/17342287>

Swift SVN r19116
2014-06-24 01:23:00 +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