Commit Graph

164 Commits

Author SHA1 Message Date
Xi Ge
b2a159dbf9 swift-module-digester: diagnose adding variables with fixed binary order.
Removing these variables should be detected as API breakages already.
2018-09-19 13:17:08 -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
47228bc17b swift-module-digester: remove unnecessary node annotations. NFC (#18975) 2018-08-24 21:44:40 -07:00
Xi Ge
6adac7a1e3 DiagnosticEngine: require clients to explicitly specify source locations when emitting diagnostics. NFC (#18962) 2018-08-24 16:14:16 -07:00
Xi Ge
e4388af6be swift-module-digester: refactor the ABI/API diagnostics to use DiagnosticEngine. NFC (#18957)
Before this patch, we used to define tooling-specific diagnostics. With adding more
checking logics, we found this mechanism hard to extend. This patch
eliminates the home-made diagnostics model to use the one from compiler, which provides
several benefits: less boiler-templates, better integration with DiagnosticConsumer,
and easy ordering of detected issues.
2018-08-24 13:11:32 -07:00
Xi Ge
1b601f83fe swift-module-differ: refactor node definition to a separate file. NFC
The original implementation file contains both nodes definition and detection
logics. This patch splits the two parts.
2018-08-20 13:16:57 -07:00
Xi Ge
492a73c8e2 Merge branch 'apple-master' into api-digester-match-kind 2018-08-17 17:48:09 -07:00
Xi Ge
9138b0228b swift-api-digester: detect type to type alias change up-front to remove bogus dignostics. rdar://43425867 2018-08-17 17:46:26 -07:00
Xi Ge
697ba85dda swift-api-digester: add a new enum class describing why two SDKNodes are matched, NFC. 2018-08-17 17:32:55 -07:00
Xi Ge
37a7dce793 remove dead code.NFC 2018-08-17 17:00:21 -07:00
Xi Ge
c069090afe Merge pull request #18788 from brentdax/indigestion
Add some proper diagnostics to the API digester
2018-08-17 15:55:51 -07:00
Jordan Rose
537954fb93 [AST] Rename several DeclContext methods to be clearer and shorter (#18798)
- getAsDeclOrDeclExtensionContext -> getAsDecl

This is basically the same as a dyn_cast, so it should use a 'getAs'
name like TypeBase does.

- getAsNominalTypeOrNominalTypeExtensionContext -> getSelfNominalTypeDecl
- getAsClassOrClassExtensionContext -> getSelfClassDecl
- getAsEnumOrEnumExtensionContext -> getSelfEnumDecl
- getAsStructOrStructExtensionContext -> getSelfStructDecl
- getAsProtocolOrProtocolExtensionContext -> getSelfProtocolDecl
- getAsTypeOrTypeExtensionContext -> getSelfTypeDecl (private)

These do /not/ return some form of 'this'; instead, they get the
extended types when 'this' is an extension. They started off life with
'is' names, which makes sense, but changed to this at some point.  The
names I went with match up with getSelfInterfaceType and
getSelfTypeInContext, even though strictly speaking they're closer to
what getDeclaredInterfaceType does. But it didn't seem right to claim
that an extension "declares" the ClassDecl here.

- getAsProtocolExtensionContext -> getExtendedProtocolDecl

Like the above, this didn't return the ExtensionDecl; it returned its
extended type.

This entire commit is a mechanical change: find-and-replace, followed
by manual reformatted but no code changes.
2018-08-17 14:05:24 -07:00
Brent Royal-Gordon
004ada98bc Add errors for other invalid strings in digester
Specifically, TypeAttrKinds, DeclAttrKinds, and DeclKinds.
2018-08-17 04:16:20 -07:00
Brent Royal-Gordon
8a192eaaf7 Refactor away some digester diagnostic boilerplate 2018-08-17 00:29:21 -07:00
Brent Royal-Gordon
88ac6f11a2 Add error for invalid SDKNodeKind 2018-08-17 00:27:38 -07:00
Brent Royal-Gordon
ec87277e56 Add error for unknown API KeyKind 2018-08-16 23:52:06 -07:00
Brent Royal-Gordon
fbe05ea817 Use swift::SourceManager/DiagnosticEngine 2018-08-16 23:46:35 -07:00
Brent Royal-Gordon
55d54923d4 [NFC] Move SourceMgr into SDKContext 2018-08-16 19:24:31 -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
2152d0bde0 swift-api-digester: remove some dead code. NFC 2018-08-16 16:22:53 -07:00
Xi Ge
11cdd41bf0 swift-api-digester: simplify some code. NFC. 2018-08-16 13:16:57 -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
2ac57cf948 swift-api-digester: add a flag to diagnostics indicating whether it's abi-specific. 2018-08-15 12:02:22 -07:00
Xi Ge
45f9e4437d swift-api-digester: add a new flag to indicate whether the tool is checking ABI stability. (#18707)
When this flag turns on, all type nodes and generic signatures are canonicalized.
2018-08-14 14:10:59 -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
Slava Pestov
5213f80e7e IDE: Remove uses of AbstractFunctionDecl::getParameterLists() 2018-07-22 20:56:56 -07:00
Xi Ge
b78c9eb328 swift-api-digester: ensure the sdk-dump includes extensions from types of other modules. rdar://42266041 2018-07-20 17:26:22 -07:00
Xi Ge
c9746452ac swift-api-digester: avoid diagnosing reference ownership changes from unowned to weak. rdar://41260522 2018-07-09 11:21:45 -07:00
John McCall
34b0cbc11d Merge pull request #16237 from davezarzycki/metaprogram_ref_storage_types
[AST] NFC: Enable reference storage type meta-programming
2018-07-05 14:45:38 -04:00
David Zarzycki
b91bde4d14 [swift-api-digester] NFC: Adopt reference storage type meta-programming macros 2018-06-30 06:44:34 -04:00
Xi Ge
967beefffc swift-api-digester: teach the tool to detect member variables change to global ones. rdar://41658300 2018-06-29 16:33:22 -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
7312fea3b2 migrator: emit error messages when migration scripts are missing.
We used to assert migration scripts exist. This patch further
decouples these scripts and the compiler by treating missing scripts
as a regular compiler error.

Related: rdar://40538097
2018-05-25 11:25:32 -07:00
Xi Ge
b0084558a2 swift-api-digester: specify raw types when detecting the reversion of NS_TYPED_EXTENSIBLE_ENUM. 2018-05-24 13:01:21 -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
5212311cc0 swift-api-digester: sort migration scripts before serializing them. 2018-05-22 13:39:46 -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
d962656eed swift-api-digester: lessen some assertions. 2018-05-11 17:23:12 -07:00
Xi Ge
1556d62bce swift-api-digester: we should further detect if the declared type of a hoisted variable has been changed. rdar://40076924 2018-05-09 13:42:20 -07:00
Xi Ge
18f6c9c435 swift-api-digester: add an action to dump USRs for all decls in a header.
We need this for custom migration like rdar://39992329.
2018-05-04 17:19:24 -07:00
Xi Ge
82a2c2c644 migrator: ignore migration scripts with underscored new names. rdar://39877447
Updating something to underscored names is hardly correct. This patch
disallows picking up such migration scripts.
2018-05-01 16:06:06 -07:00
David Zarzycki
95473a10d7 [Misc] NFC: Fix random build warnings
Unused variables/methods, language extensions, extra semicolons, intentional
self assignment, platform specific quirks, etc.
2018-04-30 12:52:43 -04: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
53c9f1aaa9 swift-api-digester: add a new action to dump name correction template.
Rename detection in the tool may not reflect overlay additions; thus we
mistakes a new name to be an underscored one. This new action searches
migration scripts for suspicious ones and generates a template for us to
specify the correct names.
2018-04-19 18:01:01 -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
Xi Ge
3e00fda3e0 swift-api-digester: teach the tool to detect [String] changes to [StringRepresentable]. 2018-04-07 10:55:41 -07:00
Xi Ge
cd87f4142d swift-api-digester: add specific logic to detect optional dictionary's key changes.
We've also seen type changes in the frameworks from "[String: Any]?" to
"[StringRepresentable: Any]?". This patch adds specific logic and
attribute for this kind of change on the top of nonnull dictionary
changes.
2018-04-06 16:43:56 -07:00