Skip to content

[lldb] Improve handling of artificial subclasses #7423

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
merged 1 commit into from
Sep 12, 2023

Conversation

augusto2112
Copy link

An artificial subclass is a subclass which was registered at runtime, which is possible to do when Obj-C interop is enabled. Fix variables of these types being printed incorrectly.

rdar://101519300

@augusto2112
Copy link
Author

@swift-ci test

@augusto2112
Copy link
Author

swiftlang/swift#68404

@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.

LGTM with minor comment inline

@@ -1080,6 +1080,10 @@ CompilerType SwiftLanguageRuntimeImpl::GetChildCompilerTypeAtIndex(
LLDBTypeInfoProvider tip(*this, *instance_ts);
reflection_ctx->ForEachSuperClassType(
&tip, pointer, [&](SuperClassType sc) -> bool {
// If the typeref is invalid, we don't want to process it.
if (!sc.get_typeref())
return false;

Choose a reason for hiding this comment

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

Is this an error, or expected? We might want to log it if it's an error.

Choose a reason for hiding this comment

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

If it's expected, because this is normal for artificial base classes, maybe the comment could be more explicit about that?

Copy link
Author

Choose a reason for hiding this comment

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

It's expected if the current class is artificial, I'll add a comment

Choose a reason for hiding this comment

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

is there a way we can know that the current class is artificial? In the case where the current class is not artificial, then we'd want a log or better.

Copy link
Author

Choose a reason for hiding this comment

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

Remote Mirrors doesn't really tell us why getting the typeref failed (it could be an artificial class or conceivably something else). It'd be pretty straight forward to add an API asking if the class is artificial or not, if we want that.

An artificial subclass is a subclass which was registered at runtime,
which is possible to do when Obj-C interop is enabled. Fix variables of
these types being printed incorrectly.

rdar://101519300
@augusto2112
Copy link
Author

@swift-ci test

@adrian-prantl
Copy link

@augusto2112 Can you rebase this on swift/release/5.10?

@augusto2112 augusto2112 merged commit 02d3200 into swiftlang:stable/20221013 Sep 12, 2023
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.

3 participants