Commit ff42f2e
Gabor Horvath
[cxx-interop] Fix a regression making std::string unsafe
Currently, we only get warnings for using unsafe types in expressions
but not in the function signature. The tests did not use the std::string
object in the function body. As a result, we regressed and std::string
was considered unsafe.
The reason is that the annotation only mode for calculating escapability
of a type did not do what we intended. std::basic_string is
conditionally escapable if the template argument is escapable. We
considered 'char' to have unknown escapability in annotation only mode.
The annotation only mode was introduced to avoid suddenly importing
certain types as not escapable when they have pointer fields and break
backward compatibility.
The solution is to make annotation only mode to still consider char and
co as escapable types and only fall back to unknown when the inference
otherwise would have deduced non-escapable (for unannotated typed).1 parent c89cb49 commit ff42f2e
File tree
3 files changed
+11
-4
lines changed- include/swift/ClangImporter
- lib/ClangImporter
- test/Interop/Cxx/class
3 files changed
+11
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
540 | 543 | | |
541 | 544 | | |
542 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
5348 | 5349 | | |
5349 | 5350 | | |
5350 | 5351 | | |
5351 | | - | |
5352 | | - | |
5353 | 5352 | | |
5354 | 5353 | | |
5355 | 5354 | | |
| |||
5363 | 5362 | | |
5364 | 5363 | | |
5365 | 5364 | | |
5366 | | - | |
| 5365 | + | |
| 5366 | + | |
5367 | 5367 | | |
5368 | 5368 | | |
5369 | 5369 | | |
| |||
8508 | 8508 | | |
8509 | 8509 | | |
8510 | 8510 | | |
8511 | | - | |
| 8511 | + | |
8512 | 8512 | | |
8513 | 8513 | | |
8514 | 8514 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
94 | 95 | | |
95 | 96 | | |
96 | 97 | | |
| 98 | + | |
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
| 107 | + | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
| 111 | + | |
108 | 112 | | |
109 | 113 | | |
110 | 114 | | |
| |||
0 commit comments