Skip to content

[lldb] Fix desugaring of dicts on TypeSystemSwiftTypeRef #3592

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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,12 @@ Desugar(swift::Demangle::Demangler &dem, swift::Demangle::NodePointer node,
type->addChild(concrete, dem);
}
NodePointer type_list = dem.createNode(Node::Kind::TypeList);
{

assert(node->getNumChildren() >= 1 && node->getNumChildren() <= 2 &&
"Sugared types should only have 1 or 2 children");
for (NodePointer child : *node) {
NodePointer type = dem.createNode(Node::Kind::Type);
type->addChild(node->getFirstChild(), dem);
type->addChild(child, dem);
type_list->addChild(type, dem);
}
desugared->addChild(type, dem);
Expand Down Expand Up @@ -969,7 +972,7 @@ swift::Demangle::NodePointer TypeSystemSwiftTypeRef::GetNodeForPrintingImpl(
}
return node;
case Node::Kind::SugaredDictionary:
if (node->getNumChildren() == 1) {
if (node->getNumChildren() == 2) {
return Desugar(dem, node, Node::Kind::BoundGenericStructure,
Node::Kind::Structure, "Dictionary");
}
Expand Down Expand Up @@ -2011,8 +2014,7 @@ bool TypeSystemSwiftTypeRef::IsPossibleDynamicType(opaque_compiler_type_t type,
NodePointer type_list = node->getLastChild();
if (type_list->getKind() != Node::Kind::TypeList)
return false;
for (size_t i = 0; i < type_list->getNumChildren(); ++i) {
NodePointer child = type_list->getChild(i);
for (NodePointer child : *type_list) {
if (child->getKind() == Node::Kind::Type) {
child = child->getFirstChild();
if (is_possible_dynamic(child))
Expand Down