Commit Graph

9 Commits

Author SHA1 Message Date
Nathan Hawes
43c2f27783 [Refactoring][Migrator] Fix rename of callsites with a trailing closure argument
A label range of 0 length was being reported as the label of trailing closure
arguments, just before the opening '{'.

For the rename refactoring, this meant that if the corresponding parameter had
an external label (e.g. 'a') the occurrence would be treated as not matching the
expected symbol name, and so not be updated at all.

For the migrator, when renaming a function with an unlabelled closure for its
last parameter to have a label, it would incorrectly insert the new label in
front of the opening '{' on all of that function's callsites with trailing
closures.

Resolves rdar://problem/42162571
2018-12-19 16:24:14 -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
Nathan Hawes
61d7193814 [migrator] Treat the top-level argument parens of function types as an index level in the ChildIndexFinder
The APIDiffMigrator pass was ignoring them in all cases, but function type
argument parens are significant and the API differ includes them as an index
level in the generated json. This was causing a segmentation fault when trying
to migrate anything inside a function type argument. E.g given the function
below:

func member(_ x: ([Any]?) -> Void) {}

to migrate Any to Int, the API differ produces an index into the signauture of
1:1:0:0:0, meant to indicate Any. The APIDiffMigratorPass was interpreting this
incorrectly, however:

1: The type of first parameter of member: ([Any]?) -> Void
   Migrator agreed.
1: The type of the function type's argument: ([Any]?)
   Migrator saw this as [Any]? due to the parens not being an index level
0: The 0th child of the paren type: [Any]?
   Migrator saw the 0th child of the optional, [Any]
0: the 0th child of the optional type, [Any]
   Migrator saw the 0th child of the array, Any
0: the 0th child of the array type, Any
  Migrator tried to look up the 0th child of Any, causing a crash.

Resolves rdar://problem/40225476.
2018-05-15 12:05:21 -07:00
David Ungar
c6b4e8bc2b Change tests to specify same number of -o's as primary inputs. 2018-02-01 13:41:00 -08:00
Xi Ge
f2ef42baed [migrator] When renaming a function decl, we should use underscore to represent empty external argument label. rdar://34569243 (#12221) 2017-10-02 12:31:09 -07:00
Robert Widmann
71bf312a25 Migrate the rest of the tests to %empty-directory 2017-06-04 11:08:39 -07:00
Xi Ge
fa78d9259e migrator/test: move all API diff data files to Inputs directory. NFC (#10074) 2017-06-02 14:20:35 -07:00
Ben Langmuir
257c1a6caf [migrator] Fix cities vs. Cities case consistency in tests 2017-05-19 10:41:15 -07:00
Xi Ge
39c550fc40 [Migrator] Handle function decl renames. rdar://31766131 (#9157) 2017-05-02 10:53:56 -07:00