-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[ClangImporter] Handle diagnostics about cast types in macros #13972
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
[ClangImporter] Handle diagnostics about cast types in macros #13972
Conversation
The importer handles these by first trying to look up the type by name using Clang's Sema, but that lookup can cause diagnostics to be emitted (usually availability diagnostics). We could try to figure out how to propagate that to the macro when we import it, but for now just drop the macro instead if there are any diagnostics emitted when looking up the type. This will be a small source compatibility break if anyone was using a macro defined in terms of a type that's deprecated or that has partial availability; the macro will now silently not be imported instead of producing an unsilenceable warning. rdar://problem/36528212
Since this is a well-defined, isolated source compatibility break that's independent of already-discussed language features, the core team has to review it, right? @DougGregor, @rjmccall, how do you want to handle that? |
@swift-ci Please test |
@swift-ci Please test source compatibility |
I don't think we want a full review process, but it would be nice if these "mini tweaks" were at least documented somewhere. Perhaps CHANGELOG.md? |
Hey, it's the first Swift 5 changelog note.
(Both the regular test and the source compat suite passed already.) @swift-ci Please smoke test |
Merged ahead of any such discussion to clear out some warnings on internal Apple bots. We can revisit if the core team decides this is unacceptable. |
I think that's reasonable. |
[ClangImporter] Handle diagnostics about cast types in macros (cherry picked from commit 59ceb22)
[ClangImporter] Handle diagnostics about cast types in macros (cherry picked from commit 59ceb22)
The importer handles these by first trying to look up the type by name using Clang's Sema, but that lookup can cause diagnostics to be emitted (usually availability diagnostics). We could try to figure out how to propagate that to the macro when we import it, but for now just drop the macro instead if there are any diagnostics emitted when looking up the type.
This will be a small source compatibility break if anyone was using a macro defined in terms of a type that's deprecated or that has partial availability; the macro will now silently not be imported instead of producing an unsilenceable warning.
rdar://problem/36528212