-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ClangImporter] Handle NS_TYPED_ENUMs of NSUIntegers in non-system headers #24316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The special rule for NSUInteger in system headers was colliding with the behavior of NS_TYPED_ENUM (swift_newtype/swift_wrapper). Let NS_TYPED_ENUM take precedence here. (I also future-proofed this for BOOL and Boolean, but those don't NS_TYPED_ENUM correctly right now for another reason: Bool is bridged to Objective-C via NSNumber, but ObjCBool is not, even though it could be.) rdar://problem/50076612
At least as far as ImportHint was concerned, these two mapped types were being treated the same. No functionality change.
@swift-ci Please test |
@swift-ci Please test source compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable.
Build failed |
@swift-ci Please test Linux |
Build failed |
@swift-ci Please test Linux |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me as well. The cleanup is nice.
[ClangImporter] Handle NS_TYPED_ENUMs of NSUIntegers in non-system headers (cherry picked from commit 6060557)
Hi @jrose-apple – How was this tested on Linux? I'm seeing lots of crashes in the test suite in |
Hm. I wouldn't expect it to affect Linux at all—it's supposed to be a no-functionality-change change for everything except NSUInteger. How'd you pinpoint this PR as the cause? |
I have a script that runs every 12h that does a clean [unified] build. If that succeeds, then a local “branch” is updated to the mark the last known good commits. This makes bisecting fairly painless when something doesn’t work. In this case, and because of the weekend, only two pull requests existed between the “last good” commit and the “first known bad” commit (this pull request). I did a clean build / test of the PR merge before this PR and that succeeded, therefore this PR is to “blame”. |
@jrose-apple – For reference: http://znu.io/4jordan.txt |
FWIW – This appears to only happen with optimized builds. Maybe garbage is being passed to |
Hi @jrose-apple – My sincerest apologies. The problem commit is on the clang side: apple/swift-clang#304 |
Whew! I was set to do a lot of headscratching debugging here, since I can certainly believe that a seemingly-NFC change would cause problems. I reverted the Clang commit, since it's a change that matches the backtrace. |
Ya, sorry, the swift-llvm/swift-clang stable branches tend to be um, stable, and updated infrequently, so I didn’t even think about the fact that my script would reset swift-clang back to a known good state too. |
[ClangImporter] Handle NS_TYPED_ENUMs of NSUIntegers in non-system headers rdar://problem/50076612 (cherry picked from commit 6060557)
The special rule for NSUInteger in system headers was colliding with the behavior of
NS_TYPED_ENUM
(swift_newtype
/swift_wrapper
). LetNS_TYPED_ENUM
take precedence here.(I also future-proofed this for BOOL and Boolean, but those don't
NS_TYPED_ENUM
correctly right now for another reason: Bool is bridged to Objective-C via NSNumber, but ObjCBool is not, even though it could be.)rdar://problem/50076612