-
Notifications
You must be signed in to change notification settings - Fork 339
[lldb/formatter] Add Swift.UnsafeRawBufferPointer data formatter #1314
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
[lldb/formatter] Add Swift.UnsafeRawBufferPointer data formatter #1314
Conversation
@swift-ci test |
@swift-ci test Linux 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.
This looks pretty good. The synthetic provider is leaking its SwiftUnsafeBufferPointer object, and I think you can isolate the choice to make the raw vrs. not raw difference. Once you've made the right object only call base class methods so you should always handle the base class and let a factory make the right one for you.
Thanks for the feedbacks @jimingham ! Indeed the factory approach would be a good way to manage both types. I'll wait to see if @dcci and @fredriss could think of other improvements I could make then update the PR. |
Merge pull requested |
bb260e0
to
4337d2f
Compare
I updated the patch addressing @jimingham comments:
|
4337d2f
to
26f32e1
Compare
@swift-ci test |
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.
That looks better to me.
You have to handle the case where the valobj is a typedef to UnsafeBufferPointer or UnsafeRawBufferPointer. Just strip off typedef's before looking for the "Raw" in the typename.
You might also want to think a bit about "if this were to fail in the field, where would I wish I had put in logging to help me figure out what went wrong" and if there are any obvious places add some "formatter" channel logging
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.
A round of comments.
lldb/test/API/functionalities/data-formatter/swift-unsafe/main.swift
Outdated
Show resolved
Hide resolved
26f32e1
to
9739b14
Compare
@swift-ci test |
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.
A few nits and one annoyance w.r.t. typedef's.
Addressed final round of comments:
|
9739b14
to
2f360e2
Compare
This patch adds support for Swift's UnsafeRawBufferPointer and UnsafeMutableRawBufferPointer data formatting. This commit also introduces a new SwiftUnsafeType factory to adapt and use both Unsafe{,Raw}BufferPointer with the pre-existing data formatter. rdar://63946760 Signed-off-by: Med Ismail Bennani <[email protected]>
2f360e2
to
1d47e8b
Compare
@swift-ci test |
This patch adds support for Swift's UnsafeRawBufferPointer and
UnsafeMutableRawBufferPointer data formatting.
This commit also introduces a new SwiftUnsafeType factory to adapt and
use both Unsafe{,Raw}BufferPointer with the pre-existing data formatter.
rdar://63946760
Signed-off-by: Med Ismail Bennani [email protected]