Skip to content

[lldb] Use reflection metadata to find the value type of an existential #3508

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

Merged

Conversation

augusto2112
Copy link

No description provided.

@augusto2112
Copy link
Author

Please test with following pull request:
swiftlang/swift#40053

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is generally good, just a few stylistic suggestions inside!

lldb::addr_t existential_address;
bool use_local_buffer = false;

if (in_value.GetValueType() == eValueTypeConstResult &&

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could do with a few comments explaining what's happening here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, what does use_local_buffer mean?

if (use_local_buffer)
PopLocalBuffer();

if (maybe_is_inlined) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit confusing because maybe_is_inlined is both a bool and an optional and both the value and wrapper behave like a bool, and the "maybe" sounds like it's part of the value rather than the wrapper. How about:

if (!is_inlined.HasValue()) {
// An error occurred, default to address.
return Value::ValueType::LoadAddress;
}

if (*is_inlined) {
// Inlined data, same as static data.
return static_value_type;
}

HasValue makes it more obvious that we are checking the optional container. What do you think?

@augusto2112
Copy link
Author

Please test with following pull request:
swiftlang/swift#40053

@swift-ci test

@augusto2112
Copy link
Author

@swift-ci test

Copy link

@adrian-prantl adrian-prantl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@augusto2112 augusto2112 merged commit 9405180 into swiftlang:stable/20210726 Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants