Skip to content

[lldb] Correct fallback condition in GetChildCompilerTypeAtIndex #2230

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

kastiglione
Copy link

Fix the condition to compare GetNumChildren implementations. Comparing GetNumChildren to GetNumFields will not always be correct.

@@ -2264,7 +2264,8 @@ CompilerType TypeSystemSwiftTypeRef::GetChildCompilerTypeAtIndex(
// Because the API deals out an index into a list of children we
// can't mix&match between the two typesystems if there is such a
// divergence. We'll need to replace all calls at once.
if (m_swift_ast_context->GetNumFields(ReconstructType(type)) <
if (m_swift_ast_context->GetNumChildren(ReconstructType(type),
Copy link
Author

Choose a reason for hiding this comment

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

is ReconstructType needed here? Why can't this call be passed type directly.

Choose a reason for hiding this comment

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

type is an opaque pointer in TypeSystemSwiftTypeRef (a mangled name). If we want something to pass to SwiftASTContext we need to convert it to an AST type first.

@kastiglione
Copy link
Author

@adrian-prantl is my assessment correct?

@kastiglione
Copy link
Author

@swift-ci test

@kastiglione kastiglione merged commit 41f316f into swift/main Dec 14, 2020
@kastiglione kastiglione deleted the lldb-Correct-fallback-condition-in-GetChildCompilerTypeAtIndex branch December 14, 2020 18:17
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