Skip to content

Conversation

@Xazax-hun
Copy link
Contributor

Some fields in the AST are cached values that are populated lazily. We should not use those values directly as in case they are not yet computed we get back null pointers. Use ASTContext instead which can call the slow path if the cache is not yet populated.

rdar://132746445

@Xazax-hun Xazax-hun added the c++ interop Feature: Interoperability with C++ label Aug 6, 2024
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@egorzhdan egorzhdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Just one small comment.

Some fields in the AST are cached values that are populated lazily. We
should not use those values directly as in case they are not yet
computed we get back null pointers. Use ASTContext instead which can
call the slow path if the cache is not yet populated.

rdar://132746445
@Xazax-hun Xazax-hun force-pushed the gaborh/raw-module-crash branch from f935855 to 0276d46 Compare August 6, 2024 16:50
@Xazax-hun
Copy link
Contributor Author

@swift-ci please smoke test

@Xazax-hun Xazax-hun merged commit 01d4035 into main Aug 7, 2024
@Xazax-hun Xazax-hun deleted the gaborh/raw-module-crash branch August 7, 2024 08:58
Xazax-hun added a commit that referenced this pull request Sep 3, 2024
Explanation: A low-level clang API was used that relies on a cached
value being present. This fix is changing that API call to another that
calculates the value if the cache is not yet populated.
Scope: C++ reverse interop.
Risk: Low, replacing an API call with a different that has the same
semantics (other than calculating the value when the cache is empty).
Testing: Regression test added.
Issue: rdar://132746445
Reviewer: @egorzhdan
Original PR: #75714
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ interop Feature: Interoperability with C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants