Commit da0d428
committed
[C++] Fix double pointers to foreign ref types
When a C++ type `ForeignTy` is imported as a foreign reference type, Swift should strip a level of indirection from parameters of that type, so e.g. `ForeignTy *` and `ForeignTy &` should be imported to Swift as just `ForeignTy`. However, it should only strip *one* level of indirection. importType() was instead stripping *all* levels, so things like `ForeignTy **` and `ForeignTy *&` were *also* being incorrectly imported as `ForeignTy`. Narrow this behavior so it only applies to a single level of indirection and add a few test cases to pin down the specifics.
Fixes rdar://123905345.1 parent 0bbe26d commit da0d428
File tree
2 files changed
+62
-7
lines changed- lib/ClangImporter
- test/Interop/Cxx/ergonomics
2 files changed
+62
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
204 | 211 | | |
205 | 212 | | |
206 | 213 | | |
| |||
494 | 501 | | |
495 | 502 | | |
496 | 503 | | |
497 | | - | |
498 | | - | |
499 | | - | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
500 | 508 | | |
501 | 509 | | |
502 | 510 | | |
| |||
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
595 | | - | |
| 603 | + | |
596 | 604 | | |
597 | 605 | | |
598 | 606 | | |
| |||
2531 | 2539 | | |
2532 | 2540 | | |
2533 | 2541 | | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
2534 | 2551 | | |
2535 | 2552 | | |
2536 | 2553 | | |
| |||
2611 | 2628 | | |
2612 | 2629 | | |
2613 | 2630 | | |
2614 | | - | |
2615 | | - | |
2616 | | - | |
| 2631 | + | |
| 2632 | + | |
2617 | 2633 | | |
2618 | 2634 | | |
2619 | 2635 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
30 | 43 | | |
31 | 44 | | |
32 | 45 | | |
| |||
71 | 84 | | |
72 | 85 | | |
73 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
74 | 93 | | |
75 | 94 | | |
76 | 95 | | |
| |||
110 | 129 | | |
111 | 130 | | |
112 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
113 | 152 | | |
114 | 153 | | |
115 | 154 | | |
| |||
0 commit comments