Commit ae95986
committed
[cxx-interop] Cache empty lifetime dependencies for methods
If we could not infer lifetime dependencies for a C++ method, let's cache the empty result. This prevents the compiler from trying to evaluate this request using Swift Sema's algorithm.
This change is meant to fix the following issue:
With AddressableParameters enabled, instantiations of `std::optional<T>` lack the conformance to `protocol CxxOptional`, despite the synthesized conformance being added correctly to each instantiation.
This happens because when importing `operator*()` of each instantiation, ClangImporter spins up a LifetimeDependenceInfoRequest for the incompletely imported C++ type. In particular, the synthesized protocol conformances aren't yet added at that point, since the conformance logic relies on type's members already being imported. The LifetimeDependenceInfoRequest triggers a ConformanceTable to be built and cached for the instantiation. Later, by the time the conformance synthesis logic runs, the ConformanceTable for the instantiation had already been populated, and won't be updated to add the new conformance.1 parent cecf19d commit ae95986
1 file changed
+8
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4326 | 4326 | | |
4327 | 4327 | | |
4328 | 4328 | | |
4329 | | - | |
4330 | | - | |
4331 | | - | |
4332 | | - | |
4333 | 4329 | | |
| 4330 | + | |
| 4331 | + | |
| 4332 | + | |
| 4333 | + | |
| 4334 | + | |
| 4335 | + | |
| 4336 | + | |
| 4337 | + | |
4334 | 4338 | | |
4335 | 4339 | | |
4336 | 4340 | | |
| |||
0 commit comments