Commit Graph

200 Commits

Author SHA1 Message Date
Alex Langford
3d9a28925b [CMake] Modify swift_install_in_component to support cmake install components
CMake supports the notion of installation components. Right now we have some
custom code for supporting swift components. I think that for installation
purposes, it would be nice to use the CMake component system.

This should be a non-functional change. We should still only be generating
install rules for targets and files in components we want to install, and we
still use the install ninja target to install everything.
2019-04-19 14:06:11 -07:00
Ben Langmuir
effab8c522 Handle dynamic member lookup in annotation and cursor info
Ensure the various entity walkers handle the implicit subscript
reference correctly (usually by ignoring it) and fall through to the
underlying declarations.

rdar://49028895
2019-04-16 15:37:32 -07:00
David Ungar
44daa88ebd Format 2019-04-03 12:53:31 -07:00
David Ungar
9cc3a4a9d8 Rename defaultDiagnosticLoc to bufferIndirectlyCausingDiagnostic. 2019-04-03 12:52:49 -07:00
David Ungar
c139c5909a Pass defaultDiagnosticLoc to handleDiagnostic, not currentPrimaryInput. 2019-04-02 22:27:55 -07:00
David Ungar
c90d9e69b6 Format 2019-04-02 00:43:59 -07:00
David Ungar
7a0e0ffc8a Store current primary in diagnostic engine, pass it down via handleDiagnostic. Unformmated. 2019-04-02 00:43:28 -07:00
Saleem Abdulrasool
9934532e07 cmake: switch host libraries to use target_link_libraries
This is a follow up to the discussion on #22740 to switch the host
libraries to use the `target_link_libraries` rather than the
`LINK_LIBRARIES` special handling.  This allows the dependency to be
properly tracked by CMake and allows us to use the more modern syntax.
2019-02-22 15:28:07 -08:00
Xi Ge
2be1ca0c8a migrator: add ! to property access whose definition changes from nonnull to nullable. rdar://48090648 2019-02-14 15:28:52 -08:00
Argyrios Kyrtzidis
c472c90df2 Merge pull request #21888 from akyrtzi/migrate-index-where
[migrator] Migrate '.index(where:)' to '.firstIndex(where:)'
2019-01-15 15:36:45 -08:00
Argyrios Kyrtzidis
90f2207b70 [migrator] Migrate '.index(where:)' to '.firstIndex(where:)'
rdar://47296913
2019-01-15 14:32:51 -08:00
Xi Ge
c6a64a9a21 migrator: handle function's return type changes from nonnull to nullable. rdar://47265255
Adding exclamation brings an optional type back to its original nonnull
version.
2019-01-14 14:15:07 -08:00
Parker Schuh
f5859ff46e Rename NameAliasType to TypeAliasType. 2019-01-09 16:47:13 -08:00
swift-ci
fad03f690f Merge pull request #21437 from nkcsgexi/mig-enhance 2018-12-19 13:44:16 -08:00
Xi Ge
83382c5f94 migrator: rename a property declaration if the framework property it overrides has been renamed. 2018-12-19 11:58:22 -08:00
Xi Ge
4164600bed migrator: set up placeholder migration scripts for swift 4.2 2018-12-18 11:49:14 -08:00
Xi Ge
c4bf8fd92e Merge pull request #21390 from nkcsgexi/rename-index
migrator: rename index(of:) to firstIndex(of:) for swift 5.
2018-12-18 10:53:40 -08:00
Xi Ge
97257c5d16 migrator: rename index(of:) to firstIndex(of:) for swift 5. 2018-12-17 15:38:16 -08:00
Xi Ge
74ef5ebe86 migrator: run try? migration pass only when migrating from swift<5.
This migration pass is version specific, so we should add an option
controlling whether we should perform it.
2018-12-17 14:54:34 -08:00
BJ Homer
f166b0da3d Make the try? migration simpler and more reliable.
We were trying to get fancy rewriting cases where multiple 'if let' clauses were
used to unwrap a double optional, but in testing that turned out to be too
unreliable. Now we simply detect any 'try?' expressions whose behavior will change,
and add an explicit 'as OldType' to the expression, in order to preserve the original
behavior.
2018-11-14 01:10:00 -07:00
BJ Homer
812c821366 Add a migration for the Swift 5 'try?' changes.
This migrates anything using the following pattern:

```swift
if let optX = try? someOptional(),
    let x = optX,
    ...
```

to this:

```swift
if let x = try? someOptional(),
    ...
```
2018-11-06 23:31:02 -07:00
Michael Gottesman
a761d7c0ba Revert "Revert "Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library"""
This reverts commit 121f5b64be.

Sorry to revert this again. This commit makes some pretty big changes. After
messing with the merge-conflict created by this internally, I did not feel
comfortable landing this now. I talked with Saleem and he agreed with me that
this was the right thing to do.
2018-11-06 13:24:00 -08:00
Saleem Abdulrasool
121f5b64be Revert "Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library""
This reverts commit 103f9a8246.
2018-11-05 14:37:40 -08:00
Xi Ge
103f9a8246 Revert "[Build System: CMake] make add_swift_library a wrapper to add_llvm_library" 2018-11-02 12:49:07 -07:00
Saleem Abdulrasool
39dde93c88 add_swift_host_library: rename LINK_LIBRARIES to LINK_LIBS 2018-10-31 12:46:31 -07:00
Slava Pestov
8f3379c7c0 Migrator: Remove Swift 3 @objc migration 2018-10-30 16:46:08 -04:00
Michael Gottesman
3f17bb6ddf Carefully split the build's invocation of add_swift_library into host/target variants.
The key thing here is that all of the underlying code is exactly the same. I
purposely did not debride anything. This is to ensure that I am not touching too
much and increasing the probability of weird errors from occurring. Thus the
exact same code should be executed... just the routing changed.
2018-10-27 12:58:51 -07:00
Xi Ge
63bfbb5ec6 migrator: remove migration scripts for migrating from Swift 3. 2018-10-10 11:48:02 -07:00
Saleem Abdulrasool
d281b98220 litter the tree with llvm_unreachable
This silences the instances of the warning from Visual Studio about not all
codepaths returning a value.  This makes the output more readable and less
likely to lose useful warnings.  NFC.
2018-09-13 15:26:14 -07:00
Xi Ge
1310ffc83f migrator: remove Swift 3 specific migration pass. (#18580) 2018-08-08 16:00:38 -07:00
Rintaro Ishizaki
203a253687 [Parse/Migrator] Drop Swift3 migration support for type(of:) (#17932)
In Swift3, shadowning type(of:) was impossible, because it was a parser
magic. In Swift4, type(of:) is resolved as normal function in stdlib so
it can be shadowed. 'TypeOfMigratorPass' was a targeted migrator pass
that prepend 'Swift.' to 'type(of:)' so that it refers Swift.type(of:)
stdlib builtin function.
2018-08-01 08:22:28 -07:00
Mishal Shah
13f5118a92 Update master to build with Xcode 10 beta 5, macOS 10.14, iOS 12, tvOS 12, and watchOS 5 SDKs 2018-07-31 13:05:42 -07:00
Argyrios Kyrtzidis
7d1d0950cb [migrator] Handle AppKit protocol migrations
This is https://github.com/apple/swift/pull/18226 but with a fix for the test to be macos specific.
rdar://42480588
2018-07-27 15:43:29 -07:00
Pavel Yaskevich
f0d1f0bc66 Revert "migrator: handle AppKit protocol migrations. rdar://42480588" 2018-07-27 00:04:23 -07:00
Xi Ge
a8d43cc344 migrator: handle AppKit protocol migrations. rdar://42480588 2018-07-26 16:57:48 -07:00
Slava Pestov
5213f80e7e IDE: Remove uses of AbstractFunctionDecl::getParameterLists() 2018-07-22 20:56:56 -07:00
Xi Ge
c738e90a5b migrator: ensure we collect post-migration fixits from the compiler. rdar://40925061 2018-07-18 13:11:17 -07:00
Xi Ge
f83ccd6438 migrator: handle changed parameter declarations by introducing bridging local variables.
When users override a SDK function whose parameter types have been changed,
we should introduce a local variable in the body of the function definition
to shadow the changed parameter. Also, a proper conversion function should
be applied to bridge the parameter to the local variable.

rdar://41828411
2018-07-11 13:41:37 -07:00
Xi Ge
c40ebd1d2d migrator: support migration of raw representable initializer calls without explicit labels. rdar://41740103
Some raw representable struct from SDK can be initialized without
explicit labels (rawValue:). When their types have been changed to type
alias, we should migrate the initializer calls to the argument alone.
2018-07-03 11:44:21 -07:00
Xi Ge
8e0e779cc2 migrator: handle the composite change of updating type alias to raw-representable and rename the referenced variables simultaneously. rdar://41732485 2018-07-02 12:13:20 -07:00
Xi Ge
46a1142b7f Merge pull request #17644 from nkcsgexi/global-name
migrator: handle member variables change to global ones. rdar://41658300
2018-07-02 09:25:44 -07:00
Xi Ge
c23d1a89a4 migrator: ensure we update unresolved member access correctly to global names. rdar://41658300 2018-06-29 17:29:53 -07:00
Xi Ge
4ed9f9a9a6 migrator: support the migration from member variables to global ones. rdar://41658300 2018-06-29 16:35:51 -07:00
Nathan Hawes
50f9c94ac8 [migrator] Migrate UIApplicationMain
In Swift 4.2 the second parameter of UIApplicationMain exactly matches the type
of CommandLine.unsafeArgv so it can be called as below:

UIApplicationMain(CommandLine.argc, CommandLine.unsafeArgv, ...)

This is how it was intended to be in Swift 4 as well, but the types had
optionality differences, so callers instead had to do something like the below
example from the Firefox-iOS project:

let pointer = UnsafeMutableRawPointer(CommandLine.unsafeArgv).bindMemory(
    to: UnsafeMutablePointer<Int8>.self, capacity: Int(CommandLine.argc))
UIApplicationMain(CommandLine.argc, pointer, ...)

This migration simply replaces the the second argument with
CommandLine.unsafeArgv if the first argument is CommandLine.argc.

There is an open issue for providing a deprecated version with the old type so
we simply leave as is any callers that don't pass argc for the first argument.

Resolves rdar://problem/40045693.
2018-06-28 18:46:41 -07:00
Xi Ge
9a0196e991 migrator: avoid adding conversion functions when expression types change as well.
When inserting conversion functions around expressions, we should check
whether the type of the expression is a recognized name alias that is
known to be changed to raw-value representable type. We should avoid
inserting conversion functions in this case because doing so causes
build errors.

resolves: rdar://40463990
2018-06-25 14:44:58 -07:00
Nathan Hawes
f76c87acf8 [migrator] Upstream overlay3/4.json and associated tests.
These being downstream only made them easy to break (and they did).

Resolves rdar://problem/41353459
2018-06-22 18:36:31 -07:00
Xi Ge
859d918a78 Re-apply "[migrator] migrator: avoid inserting base name while renaming
if users' member access doesn't specify the base name. rdar://40373279"

Previously, we saw that unconditionally omitting type names can lead to
build errors (rdar://40458118). This revised fix omits type names only when
the new member name is identical to the old one.
2018-06-19 12:46:02 -07:00
Xi Ge
90303d12a6 migrator: handle the reversion of raw representable changes. rdar://39498127 2018-06-15 16:51:57 -07:00
Xi Ge
6433bc59e7 migrator: avoid migrating synthesized initializer calls. rdar://40860228 2018-06-11 15:30:38 -07:00
Xi Ge
55495ec267 migrator: avoid inserting round-trip conversion functions.
By postponing the insertion of conversion function calls, we can filter
out the expressions that require more than one helper function wrapper.

resolves: rdar://40979943
2018-06-11 15:08:26 -07:00