Commit 7e168ab
committed
Fix potential memory corruption from CachedCompilation.Iterator
The new experimental compiler feature `CheckImplementationOnly` enables
type-checking the use of `@_implementationOnly` imports when
building without library-evolution. I tried enabling this check on the
driver project and it reported one potential issue that I hope to fix
here.
The issue is a property in a struct with the static type of
`CSwiftScan.swiftscan_cached_compilation_t` where `CSwiftScan` is
`@_implementationOnly` imported. This means that clients using this
structs wouldn't see the right memory layout information unless they
import `CSwiftScan` too. This may not have been an issue in practice if
the type was used only within the same module.
I'm suggesting a fix here. Keeping a reference to `CachedCompilation`
should be safe as it's a class that hides the memory layout from the
clients.
We should adopt `CheckImplementationOnly` in the driver once it's
completed, some early versions of it were too strict.1 parent 97ab531 commit 7e168ab
1 file changed
+4
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
| 81 | + | |
83 | 82 | | |
84 | 83 | | |
85 | 84 | | |
86 | | - | |
| 85 | + | |
87 | 86 | | |
88 | 87 | | |
89 | | - | |
| 88 | + | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
93 | | - | |
| 92 | + | |
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| |||
0 commit comments