Commit Graph

54 Commits

Author SHA1 Message Date
Doug Gregor
c1cc39accc [Clang importer] Rely on Clang's mapping of API notes to attributes directly.
Rather than managing API notes directly in the Clang importer, tell
Clang where to find the API notes files and let it map them directly
to attributes. Then, use the existing attribute-mapping
mechanisms---with minor extensions for cases where Clang previously
didn't map some Swift-specific API notes---to get at that information.

There is a minor regression where we can no longer apply API notes to
declarations that don't have a specific Clang declaration. The
specific example (NSError's inherited init()) comes from
rdar://problem/21042412; we've regressed here, but the correct fix is
(and has always been) on the Objective-C side
(rdar://problem/19977891).

Finishes rdar://problem/24447420.
2016-02-18 16:48:02 -08:00
yyx290799684
b829926d95 Update README.md 2015-12-05 15:24:42 +08:00
Pascal Welsch
e8009daa31 converted ApiNotes Readme.txt to markdown
makes the apinotes Readme more readable on github
2015-12-03 18:20:55 +01:00
David Farler
4ac9c80809 Add back remaining files for building and testing in Open Source 2015-10-31 00:19:20 -07:00
Jordan Rose
ff7b6b74fe Foundation overlay: Add a generic NSCoder.decodeObjectOfClass(_:forKey:).
Like decodeTopLevelObjectOfClass(_:forKey:), this API works very nicely
as a generic method in Swift, and this one is actually the one we expect
to be commonly used. One thing to note here is that these methods are
stricter than their ObjC counterparts: they will do a forced checked cast
even when the unarchiver does not use "secure" coding.

This depends on the previous commit; without it, we do not actually
enforce type safety for these methods.

The API notes change is to make the non-generic version of this method
unavailable so that it does not participate in overload resolution.
Without this we prefer the non-generic method unless there's a contextual
type for the result. I've filed rdar://problem/22243198 to track taking
this out once Foundation has updated their headers.

rdar://problem/17060110 (again)

Swift SVN r31154
2015-08-12 01:36:08 +00:00
Ben Langmuir
0fa6d7b65f Revert "Move GameKit overlay to GameCenter."
The headers went back to GameKit in a new SDK.

This reverts commit r30322.

Swift SVN r31015
2015-08-04 22:27:47 +00:00
Jordan Rose
965285f13d Move GameKit overlay to GameCenter.
In iOS 9 and OS X 10.11 the old GameKit was effectively renamed GameCenter, while
the new GameKit is a sort of umbrella framework like Cocoa. We need to support
backwards deployment, though, so the GameCenter overlay links to GameKit.framework.
(This is essentially the same solution implemented for CoreImage moving out of
QuartzCore in r28449)

rdar://problem/21340738

Swift SVN r30322
2015-07-17 19:54:38 +00:00
Jordan Rose
5619b5dd44 [apinotes] Remove information that has been migrated into the SDKs.
I'll be filing Radars for the rest of these. (Some of them already have them.)

rdar://problem/19003559&19756368&20276854

Swift SVN r29324
2015-06-05 23:02:17 +00:00
Jordan Rose
fa5bd4c6c8 [ClangImporter] Allow apinotes to affect inherited initializers.
Then use that to ban NSError.init(), because it doesn't create a valid
NSError. In the long run Foundation will hopefully add this to their
headers, but they can't yet (rdar://problem/19977891).

rdar://problem/21042412

Swift SVN r28881
2015-05-21 18:11:17 +00:00
Anna Zaks
57cac6a9fd [apinotes] Mark UIView's motionEffects as optional for backward compatibility.
Swift SVN r25016
2015-02-05 21:11:50 +00:00
Anna Zaks
8e8425a3ce [apinotes] Update nullability info for WatchKit
Swift SVN r24963
2015-02-04 18:15:57 +00:00
Argyrios Kyrtzidis
dfe9a2de57 [apinotes] Change to nullable parameter for NSZoneName.
Documentation for NSZoneName says:
"If zone is nil, the default zone is used".

Swift SVN r24731
2015-01-26 19:44:04 +00:00
Anna Zaks
7af94af837 [API Notes] Fix inconsistency between NSURLCredential's init and the factory method.
Swift SVN r24632
2015-01-22 03:48:46 +00:00
Anna Zaks
c2a7613612 [API Notes] Address outstanding nullability issues + new audited pieces
<rdar://problem/17902944> UIView's motionEffects property should never return 'nil'
<rdar://problem/17971360> [factor-init] SKPhysicsJointPin's factory method is not converted to a Swift API initializer
<rdar://problem/18553910> #IUO UICollectionViewUpdateItem properties
<rdar://problem/18875692> NSEntityDescription subentities/subentitiesByName should be marked optional
<rdar://problem/18919879> Swift: NSTableView's preparedCellAtColumn(_:row:) should return an optional
<rdar://problem/18940072> NSPredicate's init(format:) should not be optional
<rdar://problem/18987481> NSURLRequest without NSURL crashes Swift
<rdar://problem/19034448> UIPrintInfo’s -init is banned, should use +printInfo
<rdar://problem/19147412> NSUserInterfaceItemIdentification declares identifier as a non-optional String and it should be optional or IUO
<rdar://problem/19347931> Declaration of a parameter in Cocoa API in Swift is wrong (NSDateFormatter)
+ additions to the WatchKit audit

+ additions to HealthKit and HomeKit.

Swift SVN r24630
2015-01-22 03:29:07 +00:00
Greg Parker
bf88270ff8 Remove literal tab characters from an apinotes file.
Swift SVN r24565
2015-01-20 21:06:55 +00:00
Jordan Rose
09fb741f17 Prevent +[UIPrintInfo printInfo] from being imported as an initializer.
...because -[UIPrintInfo init] throws an exception saying not to call it
directly.

rdar://problem/19034448

Swift SVN r24561
2015-01-20 20:41:58 +00:00
Anna Zaks
474eeb2aef [apinotes] Audit WKInterfaceController's awakeWithContext.
See radar://19129934

Swift SVN r23710
2014-12-05 01:02:06 +00:00
Anna Zaks
9064df226a [apinotes] Add fresh API audit drop.
Here, we mark the null_resettable properties as explicit "U".
Fixed UIColor and NSColor's initWithCGColor as returning an optional (radar://18420272)
Fixed fontDescriptorWithSymbolicTraits (rdar://problem/18812268)
Contains audit for NSXMLParserDelegate (rdar://problem/18227344)
+ a few other newly audited APIs

Swift SVN r23698
2014-12-05 00:16:08 +00:00
Anna Zaks
ed9a765d43 [API Notes] Commit the WatchKit audit.
Swift SVN r23252
2014-11-11 23:29:43 +00:00
Anna Zaks
9c8f0df56d [API Notes] Mark window in supportedInterfaceOrientationsForWindow as optional.
Swift SVN r23160
2014-11-07 18:45:16 +00:00
Anna Zaks
e7e455a74a [API Notes] Fix several mis-audits.
See radar://18903832

Swift SVN r23155
2014-11-07 02:53:00 +00:00
Anna Zaks
4bd1dbd6bd API Notes: correct more mis-audits
radar://18240916 (NSFetchedResultsSectionInfo : name)
  radar://18495314 (UITableViewController  initWithStyle)
  radar://18406277 (UIViewController transitionFromViewController:toViewController:duration:options:animations:completion:)
  radar://18480210 (UITableViewCell textLabel, UITableViewCell imageView)
  radar://18481291 (NSManagedObjectModel mergedModelFromBundles:forStoreMetadata:)
  radar://18508088 (UICollectionView indexPathsForSelectedItems)
  radar://18447872 (NSDocumentController closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:
                    NSDocument
                       autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:
                       duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:
                    NSViewController
                       commitEditingWithDelegate:didCommitSelector:contextInfo:)
   UIViewController
     segueForUnwindingToViewController:fromViewController:identifier:

Swift SVN r22633
2014-10-09 20:23:26 +00:00
Anna Zaks
27116c7aad API Notes: Correct audit errors
- Mark more initializers as non-optional.
    <rdar://problem/18559511> Audit the list of UIKit symbols that marked as returning optional
    <rdar://problem/18559660> Audit the list of AppKit symbols that marked as returning optional
    <rdar://problem/18559676> Audit the list of Foundation symbols that marked as returning optional
    <rdar://problem/18559730> Audit the list of Scenekit symbols that marked as returning optional
 - NSMenu.popUpMenuPositioningItem (radar://18505688)
 - Remove NSXMLParserDelegate audit since it leads to crashes (radar://18227344)
 - UICollectionViewController collectionView should not be optional (radar://18508177)

Swift SVN r22570
2014-10-07 21:24:16 +00:00
Anna Zaks
1952296547 API Notes: Add WebKit audit
Swift SVN r22569
2014-10-07 21:24:11 +00:00
Anna Zaks
505257ae9b API Notes: This contains audit for most of AppKit!
Plus, smaller enhancements on the other frameworks.
Removes the need for _PrintableNSObjectType hack (rdar://problem/16883288)

Swift SVN r22185
2014-09-22 21:47:22 +00:00
Anna Zaks
9e5003e668 API Notes: Mark dispatch_retain and dispatch_release as unavailable.
Swift SVN r22091
2014-09-18 18:51:52 +00:00
Anna Zaks
c61280cf35 API Notes: Mark several APIs as unavailable.
- Make NSZone functions unavailable radar://16688847
 - Distributed Objects subsystem should not be imported into Swift radar://16689104
 - NSCalendarDate is available in Swift, but deprecated radar://16689207
 - Do not import NSMethodSignature class and related methods radar://16689329
 - NSInvocationOperation should be unavailble in Swift radar://17921785

Swift SVN r22090
2014-09-18 18:51:51 +00:00
Anna Zaks
61df57ea77 API Notes: Corrections to Foundation and UIKit
Swift SVN r21795
2014-09-09 01:47:04 +00:00
Doug Gregor
37db85ae8f -[NSData initWithBase64EncodedString:options:] can return nil
Swift SVN r21727
2014-09-04 23:06:57 +00:00
Doug Gregor
eaefb5e2b0 String's NSString API: Replace factory methods with failable initializers.
Addresses rdar://problem/18225788.


Swift SVN r21710
2014-09-04 17:21:33 +00:00
Doug Gregor
cc31f9bae0 Temporarily fix nullability of -[NSData initWithBase64EncodedString:options].
This keeps our own test cases running; the actual fix is tracked by
rdar://problem/18230185.


Swift SVN r21708
2014-09-04 16:10:41 +00:00
Anna Zaks
3997db5349 API Notes: Commit API Notes v13 (with copyWithZone returning N)
This drop adds 3 new frameworks: Metal, SceneKit, and SpriteKit.
The other frameworks (Foundation, CoreData, ObjectiveC, UIKit) have been refined:
 - conflicting items went to unknowns,
 - bugs got fixed,
 - more auditing has been performed.

Swift SVN r21443
2014-08-25 20:31:21 +00:00
Anna Zaks
14355baf7f API Notes File: 3d drop of Foundation, CoreData, UIKit
At this point, most of these frameworks have been fully audited.

Swift SVN r21318
2014-08-20 21:15:31 +00:00
Anna Zaks
fa6c359842 API Notes File: Add notes fro Objective C framework
Note that isEqual: has been audited to take an optional parameter.

Swift SVN r21317
2014-08-20 21:15:25 +00:00
Anna Zaks
c519ecfe4f API Notes File: The product of the 2d nullability audit of Foundation.
As well as the required test/stdlib modifications.

Swift SVN r21181
2014-08-13 19:39:59 +00:00
Anna Zaks
ca03e527c3 API Notes File: Add the notes generated as the product of the first nullability audit of Foundation
As well as the required test modifications.

Swift SVN r21126
2014-08-09 01:40:48 +00:00
Jordan Rose
73cce9702e [CMake] Remove the CMakeLists file from apinotes/.
Also, move the ObjectiveC overlay into its own directory, so that we can
use the directory name as an indicator of what overlays exist.

This is in preparation for DevPubs providing the contents of the apinotes/
directory. The downside here is that adding new apinotes files doesn't
automatically trigger a rebuild; I intend to mitigate that somewhat by at
least triggering one when the revision number of the DevPubs repo changes.

Swift SVN r21078
2014-08-06 23:07:24 +00:00
Anna Zaks
c17fd1a586 API Notes: Add availability info to global variables and global functions.
Swift SVN r21029
2014-08-04 23:49:14 +00:00
Jordan Rose
9b07f35cc0 Audit NSDictionary's subscript.
This requires a bit of special handling because we override the getter's type
in the importer, to make sure it's compatible with the setter, but other than
that we just use the information from the apinotes file.

<rdar://problem/17891179>

Swift SVN r21027
2014-08-04 23:16:53 +00:00
Doug Gregor
cf09436166 Keep +[GKLocalPlayer localPlayer] as a factory method.
The -init initializer does something different. <rdar://problem/17167589>

Swift SVN r21010
2014-08-04 15:14:13 +00:00
Dmitri Hrybenko
edc664c36f stdlib/NSString APIs on String: change return type of
stringByAddingPercentEncodingWithAllowedCharacters() and
stringByAddingPercentEscapesUsingEncoding() to String?, and add API notes for
NSString to the same effect


Swift SVN r21007
2014-08-04 14:13:46 +00:00
Anna Zaks
782ecab50a API Notes: Teach Clang Importer about nullability of globals and functions
Swift SVN r20941
2014-08-02 01:55:18 +00:00
Anna Zaks
b0ec16397f API Notes: Mark UIView's notionEffects as optional.
The getter can return 'nil'. Though, it is not clear if that is a bug in UIKit or not.

Swift SVN r20857
2014-07-31 22:38:25 +00:00
Anna Zaks
14542a7919 API Notes: Incorporate framework authors' feedback on UIFont
radar://17833719

Swift SVN r20806
2014-07-31 02:48:26 +00:00
Anna Zaks
77f28379b0 API Notes: incorporate Kuba's feedback on UIView
Swift SVN r20805
2014-07-31 02:48:26 +00:00
Anna Zaks
5a05388cc1 API Notes: incorporate feedback from DevPubs.
A couple of corrections + several disambiguations.

Swift SVN r20775
2014-07-30 21:05:47 +00:00
Anna Zaks
a8cb45a269 API Notes: add UIView + a couple of corrections to UIKit audit.
The corrections are:
 - Change the UIFont's API from '?' to '!'. These APIs are almost never get checked.
 - Change the "options" array parameter to being optional.

Swift SVN r20723
2014-07-29 23:47:11 +00:00
Doug Gregor
413ded0f30 Update apinotes README with the -target option.
Swift SVN r20512
2014-07-24 20:17:46 +00:00
Doug Gregor
0ad6ad65c8 API notes: add a "Required" field for Objective-C methods.
This allows us to express required initializers in the API notes. Use
it to smooth over NSString differences in the various SDKs even more.

Swift SVN r20511
2014-07-24 20:14:48 +00:00
Doug Gregor
64e73744bd Mark NSString's designated initializers.
Different SDKs have different beliefs on what NSString's designated
initializers are. Use API notes to smooth over the differences.


Swift SVN r20498
2014-07-24 17:16:36 +00:00