Skip to content
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

[SR-5614] 'NS_EXTENSIBLE_STRING_ENUM' on a typedef NSString crashes the compiler / source editor #48184

Closed
belkadan opened this issue Aug 1, 2017 · 7 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software good first issue Good for newcomers

Comments

@belkadan
Copy link
Contributor

belkadan commented Aug 1, 2017

Previous ID SR-5614
Radar rdar://problem/33254386
Original Reporter @belkadan
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, ClangImporter, CompilerCrash, StarterBug
Assignee @JGiola
Priority Medium

md5: 33a70857ae6c904b290f3da46b6bc3e1

Issue Description:

Putting this code in a bridging header:

@import Foundation;
typedef NSString MyString NS_EXTENSIBLE_STRING_ENUM;
extern MyString * const MyStringOne;

will crash the compiler if MyString is mentioned. The problem is that SwiftDeclConverter::importSwiftNewtype doesn't check that importType succeeds. If it fails, we can just drop the whole typedef by returning nullptr.

@JGiola
Copy link
Contributor

JGiola commented Aug 29, 2017

Is this issue already taken by someone?

@belkadan
Copy link
Contributor Author

I don't think so! Let me know if you have questions about this. You can add a test to one of the files in the test/ClangImporter/ directory.

@JGiola
Copy link
Contributor

JGiola commented Aug 30, 2017

I have a question about the test, the snippet inside the descroption will go in a .h file inside the Input folder right? And then I have to put the RUN: comment in the header of a swift file inside the main folder?

@belkadan
Copy link
Contributor Author

Yep, that's the general strategy. You could also find a test that's already using a bridging header and just add to that, if it makes sense with the other things the test is doing.

@JGiola
Copy link
Contributor

JGiola commented Aug 30, 2017

Ok I think I got it 🙂

#11698

@marcelofabri
Copy link
Contributor

I think this can be closed now, as #11698 was merged.

@belkadan
Copy link
Contributor Author

Yep, thanks, Marcelo. And thanks Jacopo for the implementation!

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants