Commit Graph

71 Commits

Author SHA1 Message Date
Xi Ge
87877bd95f ABI checker: avoid diagnosing missing availability info for decls that are only explicitly available on visionOS
Resolves: rdar://145061506
2025-02-18 09:56:42 -08:00
Doug Gregor
76e0d5e726 [Macro] API digester support for macro declarations 2023-01-02 21:22:05 -08:00
Xi Ge
0567a9b142 ABI checker: include SPI group names in ABI descriptor files 2022-06-04 21:45:14 -07:00
Xi Ge
26952f74de ABI checker: include a field to indicate whether a decl is from extension 2022-06-03 12:54:11 -07:00
Xi Ge
a870b06055 ABI Checker: include mangled names in ABI descriptor files
Previously, we use USR as a delegate for mangled name. However, USR won't incorporate name changes made
by attributes like @_silgen_name. Instead, we should add a dedicated field for canonical mangled names.

rdar://84202064
2021-10-20 20:58:00 -07:00
Xi Ge
3d8fcf20f3 ABIChecker: include import decls in the intermediate JSON file
Removing an import statement can be potentially source-breaking. We should
prepare for diagnosing such case.
2021-08-18 15:55:00 -07:00
Xi Ge
c5730beb42 API checker: only diagnose adding enum cases to exhaustive enums
Adding new cases to a non-exhaustive enum type isn't source-breaking
since it only triggers a warning.

rdar://63464929
2020-05-23 15:56:22 -07:00
Harlan Haskins
4d731735d2 [api-digester] Teach the api-digester about hasMissingDesignatedInitializers
Because we won’t be serializing this attribute, add custom diagnostics for the cases where:

- We add @_hasMissingDesignatedInits to an open class, which means subclasses won’t be able to inherit its inits
- We remove @_inheritsConvenienceInitializers, which means APIs are removed
2020-01-06 10:15:07 -08:00
Xi Ge
78bb298389 ABI/API checker: diagnose adding new designated initializers to open classes
If client's subclass provides an implementation of all of its superclass designated
initializers, it automatically inherits all of the superclass convenience initializers.
This means if a new designated init is added to the base class, the inherited
convenience init may be missing and cause breakage.

SR-11454
2019-09-12 15:46:45 -07:00
Xi Ge
6374d3676a ABI/API checker: diagnose ObjC name changes as breakages
rdar://54797695
2019-08-28 11:56:03 -07:00
Xi Ge
03bd23ebe0 ABI checker: prefer sugared version of generic signature while emitting diagnostics. 2019-08-25 13:28:47 -07:00
Xi Ge
3266fd53d9 ABI/API checker: add a version number for the json descriptors of APIs 2019-08-19 14:15:52 -07:00
Xi Ge
6a65a01e8a ABI/API checker: serialized json format should include all tool invocation arguments 2019-08-19 12:11:00 -07:00
Xi Ge
5c22fd50e2 ABI checker: include all kinds of accessors for abstract storage decl and diagnose their missing.
Removing accessors other than getter and setter can be ABI breaking. This
patch starts to formally include all accessor decls in the tree and diagnose
their removal. This change only applies to the ABI checker since we still
exclude accessors other than getter and setter when diagnosing source
compatibility.

Including accessors formally can also allow us to check the missing
of availability attributes for newly added accessors.

rdar://52063421
2019-06-26 18:04:28 -07:00
Xi Ge
92719d6f30 swift-api-digester: mark if a type declaration is pulled from an external module
To incorporate extensions to types from other modules, the tool sometimes needs
to pull type declaration from external modules even though these modules
are not under checking. We need a flag to explicitly mark such case.
2019-05-24 16:02:40 -07:00
Xi Ge
7b445c3c98 api-digester: keep track of the introduced platforms and language versions for all APIs
These fields will be used to diagnose the missing of available
attributes for newly added APIs.

rdar://51089418
2019-05-23 17:23:30 -07:00
Xi Ge
747d9dfe3b swift-api-digester: add a field to indicate whether a decl or a conformance is ABI placeholder.
ABI placeholders are decls with attribute '@available(macOS 9999, iOS
9999, tvOS 9999, watchOS 9999, *)'. The diagnostics phase could be
forgiving for ABI breakages on these decls since they are added
recently. This patch adds a new flag to the json file indicating whether
a declaration or a conformance is an ABI placeholder. The checking of
placeholder is transitive, meaning a decl is an ABI placeholder if its
decl context is one.

rdar://49502365
2019-04-02 10:45:27 -07:00
Xi Ge
f7406e6c3c swift-api-digester: diagnose changing of the necessity of new witness table entry as ABI breakage
Protocol requirements may not necessarily add new entries to the witness table if
it's inherited from super protocol. This patch teaches the json dump to
include a flag indicating whether a protocol requirement requires new
witness table entry and diagnoses the change of such flag as ABI
breakages.

rdar://47657204
2019-04-01 20:29:44 -07:00
Xi Ge
da4fc05a0e swift-module-digester: model ProcotolConformance as a standalone node.
Modeling ProtocolConformance as a standalone node allows us to keep
track of all type witnesses and re-use existing matching algorithm
to diagnose type witness changes.
2018-10-25 15:14:17 -07:00
Xi Ge
9cfc0dee79 swift-module-digester: keep track of whether a property/subscript has didSet and willSet. 2018-10-05 13:02:31 -07:00
Xi Ge
5bab518d5f swift-module-digester: include parameters' value ownership values in the digests. 2018-10-04 15:57:56 -07:00
Xi Ge
78271f19a0 swift-module-digester: diagnose self access kind changes for function decls. 2018-10-04 15:57:56 -07:00
Xi Ge
9fcc59bcaf swift-module-digester: include operator declarations in the module dump.
Their changes should have no impact on ABI, but can be source-breaking.
2018-10-01 12:28:54 -07:00
Xi Ge
6a198b151a swift-module-digester: keep track of whether a decl is internal. 2018-09-30 18:53:35 -07:00
Xi Ge
b9c1cdefed swift-module-digester: keep track of whether a property or subscript has storage. 2018-09-28 11:36:36 -07:00
Xi Ge
3dfe615d27 swift-module-digester: keep track of whether a class member is open. 2018-09-27 13:18:11 -07:00
Xi Ge
aa1ae1607a swift-module-digester: keep track of whether a VarDecl is let. 2018-09-27 12:52:58 -07:00
Xi Ge
ab8c1c7938 swift-module-digester: remove some boiler-template for classifying node kinds. 2018-09-26 12:56:51 -07:00
Xi Ge
d26883a8ca swift-module-digester: remove some boiler-template code for node serialization. NFC 2018-09-25 17:29:33 -07:00
Xi Ge
c0556cc4dd swift-module-digester: keep track of whether a decl overrides in the dump. 2018-09-25 11:04:55 -07:00
Xi Ge
0d9f92b1a7 swift-module-digester: include the entire class inheritance chain in module dump. 2018-09-24 16:56:10 -07:00
Xi Ge
2909c222dc swift-module-digester: keep track of super class names in the module dump 2018-09-24 12:33:33 -07:00
Xi Ge
a64ae05454 swift-module-digester: keep track of whether a protocol member is a requirement. 2018-09-23 08:25:07 -07:00
Xi Ge
01afc3395e swift-module-digester: include SubscriptDecl in the Json dump.
We model SubscriptDecl as an abstract function decl with a flag indicating
whether setter is defined.
2018-09-21 17:00:52 -07:00
Xi Ge
6500e321aa swift-module-digester: include AssociatedTypeDecl in module digests. 2018-09-21 14:04:21 -07:00
Xi Ge
05e15927a3 swift-module-digester: diagnose reordering of members in a fixed layout type under ABI mode. 2018-09-19 09:36:09 -07:00
Xi Ge
0eb756f2f4 swift-module-digester: serialize whether a declaration is implicit. 2018-09-18 12:59:16 -07:00
Xi Ge
47228bc17b swift-module-digester: remove unnecessary node annotations. NFC (#18975) 2018-08-24 21:44:40 -07:00
Xi Ge
bc79f3011a swift-api-digester: diagnose removal/addition of dynamic attribute under abi mode. 2018-08-16 16:50:10 -07:00
Xi Ge
07e002ce5e swift-api-digester: diagnose generic signature change for any declarations. 2018-08-16 11:32:43 -07:00
Xi Ge
17b9a4edf9 swift-api-digester: diagnose the addition and removal of @objc, @_fixed_layout and @_frozen under ABI mode. 2018-08-15 17:49:01 -07:00
Xi Ge
5ea6eae2a3 swift-api-digester: include generic signature printing in the module dump. (#18686) 2018-08-14 08:01:23 -07:00
Xi Ge
3121af26e1 swift-api-digester: keep track of all decl attribute kinds in module dump. (#18473)
The tool should use decl attribute kinds from AST rather than defining
its own list of attributes. Thus we can keep track of all attributes kinds
rather than the selected ones.
2018-08-02 13:39:32 -07:00
Nathan Hawes
50f9c94ac8 [migrator] Migrate UIApplicationMain
In Swift 4.2 the second parameter of UIApplicationMain exactly matches the type
of CommandLine.unsafeArgv so it can be called as below:

UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, ...)

This is how it was intended to be in Swift 4 as well, but the types had
optionality differences, so callers instead had to do something like the below
example from the Firefox-iOS project:

let pointer = UnsafeMutableRawPointer(CommandLine.unsafeArgv).bindMemory(
    to: UnsafeMutablePointer<Int8>.self, capacity: Int(CommandLine.argc))
UIApplicationMain(CommandLine.argc, pointer, ...)

This migration simply replaces the the second argument with
CommandLine.unsafeArgv if the first argument is CommandLine.argc.

There is an open issue for providing a deprecated version with the old type so
we simply leave as is any callers that don't pass argc for the first argument.

Resolves rdar://problem/40045693.
2018-06-28 18:46:41 -07:00
Xi Ge
42127d9f68 swift-api-digester: emit the diff items for changing from RawRepresentable struct to a type alias of raw type.
related: rdar://39498127
2018-06-15 11:55:09 -07:00
Xi Ge
82ca0a1891 swift-api-digester: detect type alias of raw types change to RawRepresentableStructs.
Related to: rdar://40076487
2018-05-23 12:23:47 -07:00
Xi Ge
b9517110f2 swift-api-digester: print raw type names for raw representable API changes. 2018-05-16 17:16:41 -07:00
Xi Ge
9b8cd0dc15 swift-api-digester: detect API changes due to undoing NS_TYPED_EXTENSIBLE_ENUM. rdar://39498127 2018-04-20 16:48:14 -07:00
Xi Ge
e405bab9bf swift-api-digester: separate migration kind from the other node annotation kind. NFC 2018-04-09 16:18:24 -07:00
Xi Ge
e15c197823 swift-api-digester: detect simple parameter/return type update from String to StringRepresentableStruct. 2018-04-08 13:24:12 -07:00