swift
8dc9edb7 - [DebugInfo] Don't leave null entries in the type caches (#94306)

Commit
3 days ago
[DebugInfo] Don't leave null entries in the type caches (#94306) When the compiler builds debug info for a type, it first puts a temporary placeholder in two caches, so that a type that refers to itself can find something to point at. Normally the placeholder is later replaced by the finished type, and the caches follow along. But when a struct, class or enum can't be described fully (for example, a field has a resilient type from another module), the code returned a plain forward declaration and threw the placeholder away. That left the cache keys in place with empty values. The next request for the same type found nothing usable, built the placeholder again, and hit the "type is already cached" assertion. To keep this from happening again, wrap every placeholder in a small type that asserts it was replaced before it is destroyed. The assertion now fires at the code that dropped the placeholder, instead of at a later, unrelated request for the same type. Assisted-by: claude <!-- If this pull request is targeting a release branch, please fill out the following form: https://github.com/swiftlang/.github/blob/main/PULL_REQUEST_TEMPLATE/release.md?plain=1 Otherwise, replace this comment with a description of your changes and rationale. Provide links to external references/discussions if appropriate. If this pull request resolves any GitHub issues, link them like so: Resolves <link to issue>, resolves <link to another issue>. For more information about linking a pull request to an issue, see: https://docs.github.com/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue --> <!-- Before merging this pull request, you must run the Swift continuous integration tests. For information about triggering CI builds via @swift-ci, see: https://github.com/apple/swift/blob/main/docs/ContinuousIntegration.md#swift-ci Thank you for your contribution to Swift! -->
Author
Parents
Loading