Commit Graph

76 Commits

Author SHA1 Message Date
Xi Ge
ce17eae939 swift-api-digester: detected getter/setter function to property updates should be explicit about the new property names instead of inferring them from old function name. 2017-06-12 15:10:41 -07:00
Xi Ge
9d0f24a1ee swift-api-digester: move NodeUpdateMap to the context instead of creating it locally. NFC 2017-06-09 10:30:14 -07:00
Xi Ge
935c85fca1 swift-api-digester: simplify some code. NFC 2017-06-05 15:05:28 -07:00
Xi Ge
d20f4a8a3e swift-api-digester: simplify some code. NFC (#10023) 2017-05-31 21:47:53 -07:00
Xi Ge
824aaa11e2 swift-api-digester: detect the move of static members only.
This patch restricts the detection of moved members to be static members,
since only in this case we need to update qualified access to
them. The move of instance members will be either handled by rename or
we don't need to update anything at all.

Additionally, this patch introduces a sub-kind of type member diff item
called qualified replacement to describe the aforementioned case. However,
the migrator part has not started to honor this sub-kind yet.

rdar://32466196
2017-05-31 11:47:27 -07:00
Xi Ge
d1b0e67620 swift-api-digester: teach the tool do detect APINotes' moving one member variable/method to another type. (#9985)
Different from type hoist that moves global variables to static member
variables, we've also seen member variables being moved among different
types via apinotes. Swift-api-digester should be able to detect such
case so that migrator can handle them properly.

rdar://32466196
2017-05-30 14:23:32 -07:00
Alex Hoppen
58c956a29a [Misc] Preparations for removal of getName on ValueDecl
With the introduction of special decl names, `Identifier getName()` on
`ValueDecl` will be removed and pushed down to nominal declarations
whose name is guaranteed not to be special. Prepare for this by calling
to `DeclBaseName getBaseName()` instead where appropriate.
2017-05-28 19:13:24 -07:00
Jordan Rose
c0ccdb1626 Change getBaseName to return DeclBaseName instead of Identifier (#9968)
This changes `getBaseName()` on `DeclName` to return a `DeclBaseName`
instead of an `Identifier`. All places that will continue to be
expecting an `Identifier` are changed to call `getBaseIdentifier` which
will later assert that the `DeclName` is actually backed by an
identifier and not a special name.

For transitional purposes, a conversion operator from `DeclBaseName` to
`Identifier` has been added that will be removed again once migration
to DeclBaseName has been completed in other parts of the compiler.

Unify approach to printing declaration names

Printing a declaration's name using `<<` and `getBaseName()` is be
independent of the return type of `getBaseName()` which will change in
the future from `Identifier` to `DeclBaseName`
2017-05-28 17:55:03 -07:00
Xi Ge
65b9043eb1 migrator: handle function hoist API changes and several its varieties. rdar://31234806 (#9544) 2017-05-12 21:34:06 -07:00
practicalswift
492f5cd35a [gardening] Remove redundant repetition of type names (DRY): RepeatedTypeName foo = dyn_cast<RepeatedTypeName>(bar)
Replace `NameOfType foo = dyn_cast<NameOfType>(bar)` with DRY version `auto foo = dyn_cast<NameOfType>(bar)`.

The DRY auto version is by far the dominant form already used in the repo, so this PR merely brings the exceptional cases (redundant repetition form) in line with the dominant form (auto form).

See the [C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es11-use-auto-to-avoid-redundant-repetition-of-type-names) for a general discussion on why to use `auto` to avoid redundant repetition of type names.
2017-05-05 09:45:53 +02:00
Xi Ge
a644ab33a0 swift-api-digester: fix recently found false positives. (#8899)
* swift-api-digester: ensure constructors are detected as removed if not moved. rdar://31694119

* swift-api-digester: types with the same printed name are considered behavior-preserving. rdar://31694085

* [test] Using tmp directory from build.
2017-04-20 18:34:52 -07:00
Xi Ge
b089bab40e swift-api-digester: avoid reporting moved constructors. rdar://31694119 (#8885)
They don't make more sense than renamed decls.
2017-04-20 12:48:17 -07:00
Xi Ge
ba33fd6236 swift-api-digester: Add a data structure APIDiffItemStore. (#8794)
This structure serves multiple purposes:
	a. Allow migrator to speak in the same language with swift-api-digester in terms of API changes.
	b. Serialize/Deserialize detected API change items in JSON format.
	c. Manage memory after deserializing API change items.
	d. Facilitate look up by USRs of APIs under migration.
The structure is tested by round-trip serialization and deserialization.
2017-04-17 13:04:02 -07:00
practicalswift
40cf4d183d [gardening] Use consistent spacing after if, for and while 2017-04-14 17:35:36 +02:00
Xi Ge
dbb71698e9 swift-api-digester: Extract/Expose API change descriptors to libIDE to allow visibility from libMigrator. NFC (#8766) 2017-04-13 18:31:41 -07:00
Xi Ge
8b26dd000f swift-api-digester: Various improvements for migrator script generation. (#8745)
* swift-api-digester: Add a test for generating migrator script.

* swift-api-digester: Add #ifndef guard before each macro category.

* swift-api-digester: Avoid printing macro categories with empty content.

* swift-api-digester: Add test for multiple type changes in a single decl.

* swift-api-digester: simplify some code. NFC
2017-04-13 15:02:04 -07:00
Xi Ge
7ccef06aa8 Swift-api-digester: check self-parameter explicitly instead of using its context. NFC (#8660) 2017-04-10 13:53:48 -07:00
Xi Ge
6a44e67b8c swift-api-digester: simplify some Twine API calls. NFC (#8604) 2017-04-06 17:00:52 -07:00
Jordan Rose
3456d04925 "-swift-version 3" means Swift 3.1, not 3.0. (#7883)
Put in a general mechanism for mapping user-specified "compatibility
versions" to proper "effective versions" (what #if and @available
checking should respect). This may still be different from the
intrinsic "language version"; right now master is considered a "3.1"
compiler with a "Swift 4 mode", and we plan to ship a "4.0" compiler
with a "Swift 3 mode" that will have a version number of something
like "3.2".

rdar://problem/29884401 / SR-3791
2017-03-03 13:28:01 -08:00
Xi Ge
f4e478e93f swift-api-digester: use 0-based parameter index. rdar://30763215 2017-03-02 16:48:19 -08:00
Argyrios Kyrtzidis
ca906d1e99 Add '-Fsystem' framework search option to indicate path for frameworks that should be treated as 'system'
This has the effect of propagating the search path to the clang importer as '-iframework'.
It doesn't affect whether a swift module is treated as system or not, this can be done as follow-up enhancement.
2017-02-14 16:13:25 -08:00
Hugh Bellamy
f001b7562b Use relatively new LLVM_FALLLTHROUGH instead of our own SWIFT_FALLTHROUGH 2017-02-12 10:47:03 +07:00
Bob Wilson
37e7d1c627 Merge remote-tracking branch 'origin/master' into master-next 2017-01-08 17:07:46 -08:00
Brian Gesiak
663b92ece9 [AST] Completely replace Module with ModuleDecl
The typedef `swift::Module` was a temporary solution that allowed
`swift::Module` to be renamed to `swift::ModuleDecl` without requiring
every single callsite to be modified.

Modify all the callsites, and get rid of the typedef.
2017-01-08 00:36:08 -05:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
Bob Wilson
78b28243ff Merge remote-tracking branch 'origin/master' into master-next 2017-01-03 14:22:59 -08:00
practicalswift
9d0b2abfc2 [gardening] Normalize end-of-namespace comments 2016-12-17 22:29:07 +01:00
practicalswift
38be6125e5 [gardening] C++ gardening: Terminate namespaces, fix argument names, ...
Changes:
* Terminate all namespaces with the correct closing comment.
* Make sure argument names in comments match the corresponding parameter name.
* Remove redundant get() calls on smart pointers.
* Prefer using "override" or "final" instead of "virtual". Remove "virtual" where appropriate.
2016-12-17 00:32:42 +01:00
Slava Pestov
2c6b9f71b6 AST: Change TypeAliasDecls to store an interface type as their underlying type
- TypeAliasDecl::getAliasType() is gone. Now, getDeclaredInterfaceType()
  always returns the NameAliasType.

- NameAliasTypes now always desugar to the underlying type as an
  interface type.

- The NameAliasType of a generic type alias no longer desugars to an
  UnboundGenericType; call TypeAliasDecl::getUnboundGenericType() if you
  want that.

- The "lazy mapTypeOutOfContext()" hack for deserialized TypeAliasDecls
  is gone.

- The process of constructing a synthesized TypeAliasDecl is much simpler
  now; instead of calling computeType(), setInterfaceType() and then
  setting the recursive properties in the right order, just call
  setUnderlyingType(), passing it either an interface type or a
  contextual type.

  In particular, many places weren't setting the recursive properties,
  such as the ClangImporter and deserialization. This meant that queries
  such as hasArchetype() or hasTypeParameter() would return incorrect
  results on NameAliasTypes, which caused various subtle problems.

- Finally, add some more tests for generic typealiases, most of which
  fail because they're still pretty broken.
2016-12-15 22:46:15 -08:00
Xi Ge
583da52348 swift-api-digester: re-enable swift-api-digester tests after fixing a release-only failure. rdar://29591753 (#6276) 2016-12-14 17:00:24 -08:00
Bob Wilson
deddf19aae Merge remote-tracking branch 'origin/master' into master-next 2016-12-13 10:23:03 -08:00
Hugh Bellamy
0f1ffc85bb Fix warnings build swift-api-digester with MSVC 2016-12-11 12:09:37 +00:00
Xi Ge
d3b5dfa8d9 Revert "swift-api-digester: initialize vector with a reasonable capacity." (#6184)
This did not resolve the test failure.
2016-12-09 18:39:29 -08:00
Xi Ge
e6dcd443eb swift-api-digester: initialize vector with a reasonable capacity.
In Jenkins bot, we've seen "exception std::length_error: vector" for
api-digester tests. Tentatively, this patch initializes a major vector with a
reasonably large size, which may avoid its wild capacity growth.
2016-12-09 16:45:18 -08:00
Bob Wilson
13da3fa8b1 Merge remote-tracking branch 'origin/master' into master-next 2016-12-04 18:16:09 -08:00
Xi Ge
3b68ca2936 [IDE][Utils] Elevate a decl name viewer utility from swift-api-digester.
This utility parses a given StringRef to a base name and several argument
names and provides a convenient view on them.
2016-12-01 16:29:08 -08:00
Slava Pestov
f6e692198c AST: Remove FuncDecl::getResultType() 2016-11-29 03:05:23 -07:00
Slava Pestov
69e7cca64f AST: Remove ConstructorDecl::getResultType() 2016-11-29 03:05:22 -07:00
Graydon Hoare
7c1dc18b64 Revert "Give all declarations an explicit interface type" 2016-11-24 09:55:27 -08:00
Slava Pestov
5b8524a9d1 AST: Remove FuncDecl::getResultType() 2016-11-24 02:35:35 -05:00
Slava Pestov
6db43138fa AST: Remove ConstructorDecl::getResultType() 2016-11-24 02:35:30 -05:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Xi Ge
2db243723a swift-api-digester: fix a crash when an SDKNode matches a null node. rdar://29312301 2016-11-17 11:28:19 -08:00
Bob Wilson
6ca7872ba5 Merge remote-tracking branch 'origin/master' into master-next 2016-11-16 22:12:23 -08:00
Xi Ge
527482cc16 swift-api-digester: simplify some APIs by centralizing memory management. NFC (#5827) 2016-11-16 17:34:31 -08:00
Bob Wilson
f10ae47b9f Merge remote-tracking branch 'origin/master' into master-next 2016-11-15 17:32:28 -08:00
practicalswift
38351faefc [gardening] Fix recently introduced typos 2016-11-11 18:35:01 +01:00
Xi Ge
adf0408cad swift-api-digester: perform deep comparison to ensure type alias are considered equivalent. rdar://29182045 2016-11-10 12:22:06 -08:00
Xi Ge
f3a13e3989 swift-api-digester: when comparing name alias, comparing the underlying types. rdar://29182045 2016-11-09 16:59:49 -08:00
Xi Ge
368247604f swift-api-digester: consider name alias type as a standalone node kind. (#5701)
* swift-api-digester: consider name alias type as a standalone node kind.

* [test] Update the swift-api-digester dump for stdlib to honor new name alias node.
2016-11-09 16:44:27 -08:00