Commit Graph

245 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
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
Xi Ge
8912ef9fd0 ABI/API checker: move node mapping information from under -v to under -debug. NFC 2019-09-16 15:30:02 -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
a7e8620582 ABI/API checker: include SDK version number when generating diagnostic baselines 2019-09-10 17:00:46 -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
6374d3676a ABI/API checker: diagnose ObjC name changes as breakages
rdar://54797695
2019-08-28 11:56:03 -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
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
6a65a01e8a ABI/API checker: serialized json format should include all tool invocation arguments 2019-08-19 12:11:00 -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
Xi Ge
83eda55ea4 ABI/API checker: tool's return value should indicate whether error occurred 2019-08-05 11:40:15 -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
47d205ab96 swift-api-digester: add a flag to print compiler-style diagnostics to stderr 2019-06-24 14:42:06 -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
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
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
bfed404c7c api-digester: rename argument -compare-sdk to -generate-migration-script. SR-10489 2019-05-17 12:54:13 -07:00
Xi Ge
99caadf794 api-digester: avoid looking up node update table to collect renamed declarations
We could simply get the new name from the node annotation of the decl before renaming.
2019-05-15 17:20:48 -07:00
Xi Ge
ae16a74af9 api-digester: diagnose adding conformances to existing protocols. rdar://48131686 2019-05-14 15:40:04 -07:00
Xi Ge
23cd5f037d api-digester: use target triple to check platform info 2019-05-14 14:12:14 -07:00
Xi Ge
b0005a5bdc api-digester: disable objc interop when building on linux. SR-10539 2019-05-14 11:13:58 -07:00
Harlan Haskins
0785fd797b [swift-api-digester] Put command-line flags in their own category (#24178)
Previously, swift-api-digester -help would print a bunch of unrelated
LLVM and SIL command-line flags. Putting these in their own category
limits the help output to the specific set of flags swift-api-digester
recognizes.
2019-04-22 09:58:01 -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
Xi Ge
33c0b4f4b2 swift-module-digester: test -v mode when diagnosing ABI/API changes. 2018-12-07 14:23:19 -08:00
swift-ci
7f121bf2f7 Merge pull request #20843 from akyrtzi/api-checker-protocol-whitelist 2018-11-28 15:57:10 -08:00
Argyrios Kyrtzidis
2358c8944f [api-digester] For readFileLineByLine() ignore lines that are comments
Allows us to add informational comments in the text files that are used as inputs for the digester.
2018-11-28 15:34:36 -08:00
Argyrios Kyrtzidis
5e7327714f [api-digester] Add '-protocol-requirement-white-list' option to the digester for when diagnosing API breakage in SDKs
This option access a file that lists protocol names that are 'whitelisted' for getting new protocol requirements.
This allows the SDK checker to avoid flagging protocol method additions for protocols that we know are not intended
for user classes to conform to.
2018-11-28 15:01:39 -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
Slava Pestov
8954e5f3c8 Merge pull request #19891 from slavapestov/unqualified-lookup-fixes-part-2
Unqualified lookup fixes, part 2
2018-10-15 23:02:19 -07:00
swift-ci
7cd273e777 Merge pull request #19904 from nkcsgexi/redirect-diags 2018-10-15 20:06:13 -07:00
Slava Pestov
7c6a6bd724 swift-api-digester: Minor typos 2018-10-15 19:24:27 -07:00
Xi Ge
70118d4db0 swift-module-digester: output ABI/API diagnostics to a path instead of stdout.
This is handy for scripts.
2018-10-15 19:12:34 -07:00
Xi Ge
715d481333 swift-module-digester: remove unused clang importer flag specialization. 2018-10-14 23:10:28 -07:00