[ClangImporter] Skip importing values for CGFloat typedefs on top of CGFloats direct #83238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This solves a compiler crasher, for which a reproducer is in the attached lit test. The existing logic tries to skip CGFloat from getting their constant values imported -- this is because importing CGFloats is special cased and needs more work to work correctly. However, we were failing to skip importing a CGFloat if it was used under a typedef with a different name. In this case, the code in
VisitVarDeclattempted to recognize a CGFloat throughtype->isCGFloat()which is not enough (the type is not a CGFloat directly, it's a typedef instead). Let's instead ask the SwiftDeclSynthesizer directly if it's going to import the type as a CGFloat.I have also added a frontend flag to disable value importing, this might be useful to quickly workaround situations like this in the future.
Also see #80749 for reference.
rdar://155657342