Commit 1142fa3
committed
[Strict memory safety] Eliminate spurious warnings with synthesized Codable
When synthesizing code for Codable conformances involving unsafe types,
make sure to wrap the resulting expressions in "unsafe" when strict memory safety is enabled.
Tweak the warning-emission logic to suppress warnings about spurious
"unsafe" expressions when the compiler generated the "unsafe" itself,
so we don't spam the developer with warnings they can't fix. Also make
the checking for other suppression considerations safe when there are
no source locations, eliminating a potential assertion.
Fixes rdar://153665692.1 parent 35628cb commit 1142fa3
File tree
6 files changed
+92
-28
lines changed- lib/Sema
- DerivedConformance
- test/Unsafe
6 files changed
+92
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4734 | 4734 | | |
4735 | 4735 | | |
4736 | 4736 | | |
| 4737 | + | |
4737 | 4738 | | |
4738 | 4739 | | |
4739 | | - | |
| 4740 | + | |
4740 | 4741 | | |
4741 | 4742 | | |
4742 | 4743 | | |
| |||
Lines changed: 30 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
772 | 772 | | |
773 | 773 | | |
774 | 774 | | |
775 | | - | |
776 | | - | |
777 | | - | |
778 | | - | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
779 | 789 | | |
780 | 790 | | |
781 | 791 | | |
| |||
794 | 804 | | |
795 | 805 | | |
796 | 806 | | |
797 | | - | |
| 807 | + | |
798 | 808 | | |
799 | 809 | | |
800 | 810 | | |
| |||
929 | 939 | | |
930 | 940 | | |
931 | 941 | | |
932 | | - | |
| 942 | + | |
933 | 943 | | |
934 | 944 | | |
935 | 945 | | |
| |||
1112 | 1122 | | |
1113 | 1123 | | |
1114 | 1124 | | |
1115 | | - | |
1116 | | - | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1117 | 1129 | | |
1118 | 1130 | | |
1119 | 1131 | | |
| |||
1276 | 1288 | | |
1277 | 1289 | | |
1278 | 1290 | | |
1279 | | - | |
1280 | | - | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
1284 | 1296 | | |
1285 | 1297 | | |
1286 | 1298 | | |
| |||
1470 | 1482 | | |
1471 | 1483 | | |
1472 | 1484 | | |
1473 | | - | |
| 1485 | + | |
1474 | 1486 | | |
1475 | 1487 | | |
1476 | 1488 | | |
| |||
1506 | 1518 | | |
1507 | 1519 | | |
1508 | 1520 | | |
1509 | | - | |
| 1521 | + | |
1510 | 1522 | | |
1511 | 1523 | | |
1512 | 1524 | | |
| |||
1538 | 1550 | | |
1539 | 1551 | | |
1540 | 1552 | | |
1541 | | - | |
| 1553 | + | |
1542 | 1554 | | |
1543 | 1555 | | |
1544 | 1556 | | |
| |||
1827 | 1839 | | |
1828 | 1840 | | |
1829 | 1841 | | |
1830 | | - | |
| 1842 | + | |
1831 | 1843 | | |
1832 | 1844 | | |
1833 | 1845 | | |
| |||
1845 | 1857 | | |
1846 | 1858 | | |
1847 | 1859 | | |
1848 | | - | |
| 1860 | + | |
1849 | 1861 | | |
1850 | 1862 | | |
1851 | 1863 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4667 | 4667 | | |
4668 | 4668 | | |
4669 | 4669 | | |
4670 | | - | |
4671 | | - | |
4672 | | - | |
4673 | | - | |
4674 | | - | |
4675 | | - | |
4676 | | - | |
| 4670 | + | |
| 4671 | + | |
| 4672 | + | |
| 4673 | + | |
| 4674 | + | |
| 4675 | + | |
| 4676 | + | |
| 4677 | + | |
| 4678 | + | |
| 4679 | + | |
| 4680 | + | |
| 4681 | + | |
| 4682 | + | |
| 4683 | + | |
4677 | 4684 | | |
4678 | 4685 | | |
4679 | 4686 | | |
4680 | 4687 | | |
4681 | | - | |
| 4688 | + | |
4682 | 4689 | | |
4683 | 4690 | | |
4684 | 4691 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
794 | | - | |
| 794 | + | |
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments