-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Allow identification of OSLogMessage by a @_semantics attribute instead of just name #39455
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
09792be
to
ab1647d
Compare
@kubamracek Thanks Kuba for making the PR. Is semantics attributes now possible on types? |
I wonder if it may be better to rename the OSLogMessage type in the |
Semantics attributes on types were added via 454dd00, yes. |
ab1647d
to
3a74ea5
Compare
I tried that, and it ended being a bit invasive on the code OSLogTestHelper. Let's see if you prefer that, but I can also perhaps revert and switch only the AnimationFormatString.OSLogMessage type, which can be done as a minimally invasive change. |
@swift-ci please test |
Build failed |
3a74ea5
to
b273ec8
Compare
@swift-ci please test |
@ravikandhadai This is what only changing the type name on AnimationFormatString.OSLogMessage looks like: kubamracek@668b204 Let me know if you'd prefer that. |
Yes. Changing AnimationFormatString.OSLogMessage instead of the OSLogMessage type sounds great. Thanks Kuba! On a slightly different note, if you are only interested in converting a string interpolation to a static format string and not very concerned about optimizing varargs lmk. There is a very small design change possible on the client side, compared to the current implementation of OSLogMessage and os_log, that would enable creating a very general custom string interpolation type that can be used in any context and create a static format string. |
b273ec8
to
b2ab4f1
Compare
@swift-ci please test |
I'm not sure, TBH. Maybe @Catfish-Man does? |
I'm not sure either tbh. It sounds interesting at least! |
@swift-ci please test Windows platform |
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.
LGTM!
No worries. Feel free to cc me on the PR you create for that. |
OSLogOptimization currently special-cases the type name "OSLogMessage" and applies special treatment to it (skips over synthesized witness methods). Let's allow explicitly annotating types with
@_semantics("oslog.message.type")
to trigger the same treatment. This will be useful for custom implementations of OSLog-like APIs.rdar://83325012