Commit Graph

74 Commits

Author SHA1 Message Date
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
7d600eb27a ABI/API checker: teach the tool to emit diagnostics to serialized source location for decls 2019-10-17 16:31:56 -07: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
a7e8620582 ABI/API checker: include SDK version number when generating diagnostic baselines 2019-09-10 17:00:46 -07:00
Xi Ge
cc6a246deb Revert "Revert "swift-api-digester: teach the tool to find framework-specific baselines from relative path"" 2019-09-01 09:19:43 -07:00
eeckstein
63a3cee0bf Revert "swift-api-digester: teach the tool to find framework-specific baselines from relative path" 2019-09-01 09:51:06 +02:00
Xi Ge
178e5d5ecf swift-api-digester: teach the tool to find framework-specific baselines from relative path
The framework baselines are installed at 'lib/swift/FrameworkABIBaseline' and the
tool is inside 'bin'. This patch teaches the executable to locate baselines
from the relative path.

In addition, this patch moves the stdlib ABI/API baselines to the canonical
location so we don't have to check the stability of the stdlib using a
different mechanism from other Swift frameworks.
2019-08-30 23:14:03 -07:00
Xi Ge
1e173d8931 ABI/API checker: populate several lazily computed attributes to nodes
ABI/API checker should check semantic differences of two modules.
Adhering too strictly to the actual ASTs could yield false positives. This
patch populates ObjC, Dynamic and Final to the attribute list if AST
APIs say so.

rdar://50217247
2019-08-29 15:24:16 -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
4108beb92d ABI/API checker: always print fully qualified names for types when diagnosing module difference
This change introduces a Json format change where we always print fully
qualified type names everywhere. This is beneficial for diagnosing purposes but
may not be ideal for generating migrator scripts. To resolve this conflict, the
patch also introduces a flag -migrator to opt-out fully qualified type names.

After the format change, we need to update the ABI and API baselines for the
Swift stdlib.
2019-08-27 11:42:28 -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
1857a37e3b Merge pull request #26773 from nkcsgexi/abort-compiler-error
ABI/API checker: abort after error occurs while importing a module
2019-08-21 19:01:55 -07:00
Xi Ge
ce57492609 swift-api-digester: add an action to generate empty baselines 2019-08-21 17:44:53 -07:00
Xi Ge
c7978fa477 API/ABI checker: diagnose members in removed extensions rather than extensions themselves
"Extension A has been removed" isn't very informative, we should emit diagnostics for
each members in the extension.
2019-08-21 11:13:15 -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
2160f65283 [SR-10972] swift-api-digester: avoid diagnosing the removal of __derived_enum_equals and __derived_struct_equals
These functions are compiler implementation details and diagnosing
them is redundant and may be confusing to framework authors.
2019-06-20 16:14:43 -07:00
Xi Ge
d405fcd8ec swift-api-digester: teach the tool to directly compare two module interfaces
We used to use a Json format to capture the ABI/API detail of Swift modules to
walk-around module compatibility issues across different compiler versions. Since
Swift module now is in stable format, we can compare two swiftinterface files
directly without dumping the content into Json format.
2019-06-12 11:16:23 -07:00
Xi Ge
c9660106a7 swift-api-digester: remove some unused code. NFC 2019-06-12 11:02:47 -07:00
Xi Ge
31b46ee709 swift-api-digester: add a flag to disable OS related diagnostics
For frameworks not shipping with OSs, the users should specify this flag
to avoid diagnosing some changes, such as the missing of OS availability
attributes.
2019-05-28 17:03:03 -07:00
Xi Ge
f55d3ad029 ABI checker: diagnose the missing of @available attributes for added ABIs
New ABIs should have an @available attribute to describe the introducing
version. This patch teaches the tool to diagnose its missing.

Decls with @_AlwaysEmitIntoClient are excluded from the blaming lists since
they are essentially available all the time.

rdar://51089418
2019-05-28 16:38:59 -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
da442f4adc api-digester: remove node comparison cache because it may consume too much memory 2019-05-14 11:07:21 -07:00
dmcyk
1142b6037c [api-digester] Include USRs in conformances
SDK conformance nodes include only protocol
`name` and `printedName`, both are demangled.
USR field of the protocol type is added, to be able
to uniquely identify conformances.
2019-05-07 22:09:28 +02:00
Ben Langmuir
34da079aa6 Pass DynamicLookupInfo through VisibleDeclConsumers NFC
This commit adds a new type DynamicLookupInfo that provides information
about how a dynamic member lookup found a particular Decl. This is
needed to correctly handle KeyPath dynamic member lookups, but for now
just plumb it through everywhere.
2019-05-06 10:02:39 -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
350ed65def swift-api-digester: simplify the API to emit diagnostics. NFC
All diagnostics in the abi/api checker shares empty source location
and a screening info string as the first argument. This patch
adds a new forwarding function to avoid duplicating these common
logics.
2019-03-27 14:28:41 -07:00
Harlan Haskins
081b05a4b4 [api-digester] Don’t synthesize type nodes with no public members
Upon seeing an extension for a type outside the current module, the digester
creates a dummy type node and puts all the extensions’ members and conformances
in that type. This allows us to track new API endpoints that are retroactively
added.

Unfortunately, if there are no public members/conformances (only internal or
private ones), the type itself ends up in the SDK dump without any public
children. This causes an issue when you dump the SDK from a parseable
interface, where the internal extension was not printed.
2019-01-30 11:45:19 -08:00
Argyrios Kyrtzidis
0413358f25 [api-digester] Don't report as API breaking when an ObjC protocol gets a new optional method 2018-11-28 11:59:20 -08:00
Xi Ge
8c0495f467 swift-module-digester: drop isSDKPrivate() from node since filtering should happen at AST level. 2018-10-25 17:41:28 -07:00
Xi Ge
49c16922dd swift-module-digester: diagnose type witness type changes when checking ABI stability. 2018-10-25 16:40:23 -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
3f58f1e6d3 swift-module-digester: add a flag to include Swift decls specifically.
This flag allows us to diagnose the overlay part exclusively without digesting
the entire SDK framework.
2018-10-09 12:57:22 -07:00
Xi Ge
c8c7fb39b0 swift-module-digester: exclude fixed binary order when checking API stability. 2018-10-08 13:59:30 -07:00
Xi Ge
847aa9b327 swift-module-digester: avoid including private protocol conformances when checking API stability. 2018-10-08 13:30:30 -07:00
Xi Ge
382e27f4ab swift-module-digester: diagnose adding/removing final as ABI/API breakages. 2018-10-08 13:19:54 -07:00
Xi Ge
bfadd46d57 swift-module-digester: diagnose non-final function changes in non-resilient classes. 2018-10-08 12:15:55 -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
a1e66a0515 swift-module-digester: diagnose value ownership changes for parameters. 2018-10-04 18:02:45 -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
58b3c2173f swift-module-digester: use getEffectiveAccess() to get accessibility when checking ABI stability.
This allows us to include internal decls with @usableFromInline attribute, whose stored property
changes can effect ABI.
2018-10-03 14:06:53 -07:00
Xi Ge
c2c04875d0 swift-module-digester: diagnose operator *fix notation changes. 2018-10-02 15:04:23 -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
226811007b swift-module-digester: refactor diagnostics logic. NFC 2018-09-29 20:18:29 -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