Commit Graph

445 Commits

Author SHA1 Message Date
Xi Ge
140a151de1 ABI-checker: diagnose missing available attributes for members of extensions instead of the extensions themselves
rdar://61644469
2020-04-11 19:00:49 -07:00
Mishal Shah
e7cd5ab17f Update master to build with Xcode 11.4 2020-03-24 11:30:45 -07:00
Xi Ge
cec45195a2 APIChecker: adding enum cases are source breaking changes
rdar://60041622
2020-03-05 16:23:49 -08:00
Xi Ge
0aea09fa14 ABI checker: remove assert-only decls from the generated stdlib ABI baseline
rdar://59772479
2020-03-02 14:01:53 -08:00
Nathan Hawes
71e21c476c [test] Disable test/api-digester/stability-stdlib-abi-without-asserts.swift
It's failing CI at the moment:
https://ci.swift.org/job/oss-swift_tools-RA_stdlib-RD_test-simulator/2871

rdar://problem/59812778
2020-02-27 11:50:55 -08:00
Xi Ge
71a73a9551 test: update ABI/API baselines for stdlib 2020-02-24 12:23:24 -08:00
Xi Ge
c585fd6748 ABIChecker: contains only opaque accessors for ABI/API checking
rdar://53776566
2020-02-24 12:23:03 -08:00
Slava Pestov
305620b354 ClangImporter: Reconcile Clang declaration hidden-ness between loadAllMembers() and lazy loading
Lazy loading checked if the ClangDecl was hidden, but loading all
members did not. Let's make loadAllMembers() behave like the lazy
path, and fix some of the mock SDKs in the test suite.
2020-01-24 17:07:08 -05: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
Azoy
e3a440186a Reorder conformances in cake test 2019-12-07 14:53:13 -05:00
Xi Ge
c8ce5b304c ABI/API checker: don't complain about changing var to let or vice versa
The tool diagnoses the removal of getter/setter for properties, so complaining about the keyword change can be redundant.

rdar://problem/57201030
2019-11-14 13:59:26 -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
Andrew Trick
f07f5b3de3 Add SwiftNSMutableArray expected failures to stability-stdlib-abi.asserts.
These symbols were introduced in the following commit, but the
expected ABI test output was not updated accordingly.

commit 0967783170
Merge: c6d51a975c 1cce12f20c
Author: David Smith <david_smith@apple.com>
Date:   Thu Sep 26 15:20:45 2019

    Merge pull request #27341 from Catfish-Man/mutant-arrays

    Add an Array-based NSMutableArray subclass
2019-09-26 21:39:41 -07:00
David Smith
1cce12f20c Add an Array-based NSMutableArray subclass 2019-09-24 18:15:33 -07:00
Harlan Haskins
d3b8ce7ae2 [test] Update ParseableInterface to ModuleInterface
Also remove uses of -emit-parseable-module-interface from tests
2019-09-13 14:55:48 -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
4189b6c99b AST: promote API/ABI impact bit of decl attributes to AST, NFC
ABI/API checker used to hard-code whether adding or removing of a
decl attribute could break the existing ABI/API. This is not ideal because
new attributes may be added to AST without updating the checker. After this
change, new decl attribute could be specified whether it has ABI/API
impact and the checker could pick up the knowledge instantly.
2019-09-11 17:58:36 -07:00
Xi Ge
d8b611d060 ABI/API checker: teach the tool to diagnose against a builtin empty baseline
Framework authors may be interested in comparing the current framework build
against an empty baseline to find public APIs without @available attributes. This
change makes such exercise easier.
2019-09-04 11:07:39 -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
6dd41f44db ABI checker: exclude unavailable decls from ABI descriptors
Framework authors usually have different schemes for different deployment
targets. We should exclude platform-unavailable ABIs from the Json file so
developers will only be warned of the breakages that are relevant to the current
scheme.

rdar://54273296
2019-08-28 16:02:03 -07:00
Xi Ge
03bd71ce26 Merge pull request #26910 from nkcsgexi/diagnose-objc-name-change
ABI/API checker: diagnose ObjC name changes as breakages
2019-08-28 14:11:03 -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
e7fdd67d4d test: enable -enable-library-evolution in compare-dump-interface-vs-binary.swift
Under `-enable-library-evolution`, a slight AST difference is still found when importing
from .swiftinterface and from .swiftmodule. The difference is whether @objc attribute
is inherited by a Swift class subclassing an Objc class.
2019-08-28 10:41:37 -07:00
Xi Ge
1e656662d9 Frontend: add a front-end option to specify module names for which we prefer to loading via interfaces
ABI checker imports Swift frameworks by using Swift interfaces for various
reasons. The existing way of controlling preferred importing mechanism is by
setting an environment variable (SWIFT_FORCE_MODULE_LOADING), which may lead
to performance issues because the stdlib could also be loaded in this way.

This patch adds a new front-end option to specify module names for
which we prefer to importing via Swift interface. The option currently is only
accessible via swift-api-digester.

rdar://54559888
2019-08-27 19:40:58 -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
Stephen Canon
d80b1d39a3 Backout SE-0246 (#26809)
* Revert "Add availability information to the new Math function protocols (#24187)"

This reverts commit d2f695935f.

* Revert "SE-0246: Protocols and static functions (#23824)"

This reverts commit 57a4553832.

* Expected abi changes.
2019-08-23 16:41:17 -04: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
4b8abdf852 swift-api-digester: use qualified type names for generic signatures
There could be cases where several modules having types of the same name.
Using fully qualified names could help us detect changing from using
one of them to another.

The commit also updates the existing ABI/API baselines to incorporate such change.
2019-08-14 09:54:55 -07:00
Xi Ge
dfcfdf726b ABI/API checker: avoid printing fully qualified names in generic signature
The heuristics to decide whether fully qualified type names should be printed may
work differently when generating the baseline and when importing from just built
frameworks. This patch makes it consistent so that such false positives won't happen.

rdar://54276347
2019-08-13 15:16:25 -07:00
Xi Ge
a79b1ff73d ABI checker: report any printed name changes for type nodes
Under ABI checking mode where we don't have sugar types, any printed name
changes of type nodes worth raising an alert.

rdar://45567621
2019-08-09 17:24:45 -07:00
Slava Pestov
24b20a3604 Update stability-stdlib-abi.asserts.additional.swift.expected
This is a false positive, since the '_read' accessor is synthesized
on demand and emitted with shared linkage. See <rdar://problem/53776566>.
2019-08-02 19:34:44 -04:00
David Smith
48266a6f56 Remove unused Foundation subclasses 2019-07-26 14:47:43 -07:00
Stephen Canon
ca1e808bde Replace all 9999 availability in non-stdlib tests. (#26109)
Replace all 9999 availability in non-stdlib tests with the appropriate platform availability.
2019-07-12 14:48:37 -04:00
Xi Ge
e99fac01ed ABI Checker: diagnose underlying type changes of opaque result types from inlinable decls.
Inlinable decls from swift interface files allow us to construct the underlying types
of opaque result types, whose changes can break ABI.

rdar://52273137
2019-07-01 12:06:02 -07:00
Xi Ge
abfc2bc10a test: regenerate baseline for stdlib ABI after recent format changes 2019-06-26 18:04:28 -07:00
Xi Ge
436aad3510 test: re-baseline source compatibility test after format changes 2019-06-26 18:04:28 -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
b10527796f test: add a mock Swift framework into the ABI checker test suite 2019-06-17 12:42:55 -07:00
Xi Ge
ec3678c486 swift-api-digester: teach the tool to compare two SDKs directly
With module stability from the compiler, we can now use an earlier version
of the SDK as the baseline and compare the new SDK with it. This patch
adds a new -bsdk flag to the tool to specify the baseline SDK path.
2019-06-16 13:00:25 -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
Michael Gottesman
c99c69ddbb Disable failing test api-digester/stability-stdlib-abi-without-asserts.swift.
rdar://51332842
2019-06-01 14:11:34 -07:00