Commit 1601564
Gabor Horvath
[cxx-interop] Import rvalue references as consuming parameters
Unfortunately, importing them as is results in ambiguous call sites.
E.g., std::vector::push_back has overloads for lvalue reference and
rvalue reference and we have no way to distinguish them at the call site
in Swift. To overcome this issue, functions with rvalue reference
parameters are imported with 'consuming:' argument labels.
Note that, in general, move only types and consuming is not properly
supported in Swift yet. We do not invoke the dtor for the moved-from
objects. This is a preexisting problem that can be observed with move
only types before this PR, so the fix will be done in a separate PR.
Fortunately, for most types, the moved-from objects do not require
additional cleanups.
rdar://1258163541 parent b13544e commit 1601564
File tree
7 files changed
+55
-40
lines changed- lib
- ClangImporter
- SILOptimizer/Mandatory
- test/Interop/Cxx
- class/inheritance
- operators
- reference
7 files changed
+55
-40
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1478 | 1478 | | |
1479 | 1479 | | |
1480 | 1480 | | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
1485 | 1489 | | |
1486 | 1490 | | |
1487 | 1491 | | |
| |||
1863 | 1867 | | |
1864 | 1868 | | |
1865 | 1869 | | |
1866 | | - | |
| 1870 | + | |
1867 | 1871 | | |
1868 | 1872 | | |
1869 | 1873 | | |
| |||
1876 | 1880 | | |
1877 | 1881 | | |
1878 | 1882 | | |
1879 | | - | |
| 1883 | + | |
1880 | 1884 | | |
1881 | 1885 | | |
1882 | 1886 | | |
| |||
1928 | 1932 | | |
1929 | 1933 | | |
1930 | 1934 | | |
1931 | | - | |
| 1935 | + | |
1932 | 1936 | | |
1933 | 1937 | | |
1934 | 1938 | | |
| |||
1947 | 1951 | | |
1948 | 1952 | | |
1949 | 1953 | | |
1950 | | - | |
| 1954 | + | |
1951 | 1955 | | |
1952 | 1956 | | |
1953 | 1957 | | |
| |||
1965 | 1969 | | |
1966 | 1970 | | |
1967 | 1971 | | |
1968 | | - | |
| 1972 | + | |
1969 | 1973 | | |
1970 | 1974 | | |
1971 | 1975 | | |
| |||
1996 | 2000 | | |
1997 | 2001 | | |
1998 | 2002 | | |
1999 | | - | |
| 2003 | + | |
2000 | 2004 | | |
2001 | 2005 | | |
2002 | 2006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2415 | 2415 | | |
2416 | 2416 | | |
2417 | 2417 | | |
| 2418 | + | |
2418 | 2419 | | |
2419 | 2420 | | |
2420 | 2421 | | |
| |||
2448 | 2449 | | |
2449 | 2450 | | |
2450 | 2451 | | |
2451 | | - | |
| 2452 | + | |
2452 | 2453 | | |
2453 | 2454 | | |
2454 | 2455 | | |
| |||
2469 | 2470 | | |
2470 | 2471 | | |
2471 | 2472 | | |
2472 | | - | |
2473 | | - | |
2474 | | - | |
| 2473 | + | |
| 2474 | + | |
2475 | 2475 | | |
2476 | 2476 | | |
2477 | 2477 | | |
2478 | 2478 | | |
2479 | 2479 | | |
2480 | | - | |
2481 | | - | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
| 2480 | + | |
2486 | 2481 | | |
2487 | | - | |
2488 | | - | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
2489 | 2485 | | |
2490 | | - | |
2491 | | - | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
2492 | 2492 | | |
2493 | 2493 | | |
2494 | 2494 | | |
| |||
2552 | 2552 | | |
2553 | 2553 | | |
2554 | 2554 | | |
2555 | | - | |
| 2555 | + | |
2556 | 2556 | | |
2557 | 2557 | | |
2558 | 2558 | | |
| |||
2606 | 2606 | | |
2607 | 2607 | | |
2608 | 2608 | | |
2609 | | - | |
| 2609 | + | |
2610 | 2610 | | |
2611 | 2611 | | |
2612 | 2612 | | |
| |||
2632 | 2632 | | |
2633 | 2633 | | |
2634 | 2634 | | |
2635 | | - | |
2636 | | - | |
2637 | | - | |
2638 | | - | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
2639 | 2641 | | |
2640 | 2642 | | |
2641 | 2643 | | |
| |||
2702 | 2704 | | |
2703 | 2705 | | |
2704 | 2706 | | |
| 2707 | + | |
2705 | 2708 | | |
2706 | 2709 | | |
2707 | 2710 | | |
| |||
2710 | 2713 | | |
2711 | 2714 | | |
2712 | 2715 | | |
2713 | | - | |
2714 | | - | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
2715 | 2719 | | |
2716 | 2720 | | |
2717 | 2721 | | |
| |||
3296 | 3300 | | |
3297 | 3301 | | |
3298 | 3302 | | |
| 3303 | + | |
3299 | 3304 | | |
3300 | 3305 | | |
3301 | 3306 | | |
| |||
3345 | 3350 | | |
3346 | 3351 | | |
3347 | 3352 | | |
3348 | | - | |
3349 | | - | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
3350 | 3356 | | |
3351 | 3357 | | |
3352 | 3358 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1445 | 1445 | | |
1446 | 1446 | | |
1447 | 1447 | | |
| 1448 | + | |
| 1449 | + | |
1448 | 1450 | | |
1449 | 1451 | | |
1450 | 1452 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3347 | 3347 | | |
3348 | 3348 | | |
3349 | 3349 | | |
| 3350 | + | |
| 3351 | + | |
| 3352 | + | |
3350 | 3353 | | |
3351 | 3354 | | |
3352 | 3355 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
Lines changed: 1 addition & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
| 25 | + | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| |||
0 commit comments