Skip to content

Commit a9cdd8b

Browse files
authored
Merge pull request #3008 from augusto2112/next-tss-typeref-generic-typealias
[lldb] Make TypeSystemSwiftTypeRef typedef functions consider BoundGenericTypeAlias nodes (swift/next)
2 parents c87abd7 + 767f587 commit a9cdd8b

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3186,7 +3186,8 @@ bool TypeSystemSwiftTypeRef::IsTypedefType(opaque_compiler_type_t type) {
31863186
using namespace swift::Demangle;
31873187
Demangler dem;
31883188
NodePointer node = GetDemangledType(dem, AsMangledName(type));
3189-
return node && node->getKind() == Node::Kind::TypeAlias;
3189+
return node && (node->getKind() == Node::Kind::TypeAlias ||
3190+
node->getKind() == Node::Kind::BoundGenericTypeAlias);
31903191
};
31913192

31923193
#ifndef NDEBUG
@@ -3221,7 +3222,8 @@ TypeSystemSwiftTypeRef::GetTypedefedType(opaque_compiler_type_t type) {
32213222
using namespace swift::Demangle;
32223223
Demangler dem;
32233224
NodePointer node = GetDemangledType(dem, AsMangledName(type));
3224-
if (!node || node->getKind() != Node::Kind::TypeAlias)
3225+
if (!node || (node->getKind() != Node::Kind::TypeAlias &&
3226+
node->getKind() != Node::Kind::BoundGenericTypeAlias))
32253227
return {};
32263228
auto pair = ResolveTypeAlias(m_swift_ast_context, dem, node);
32273229
if (NodePointer resolved = std::get<swift::Demangle::NodePointer>(pair)) {

lldb/unittests/Symbol/TestTypeSystemSwiftTypeRef.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,5 +688,20 @@ TEST_F(TestTypeSystemSwiftTypeRef, IsTypedefType) {
688688
CompilerType t = GetCompilerType(b.Mangle(n));
689689
ASSERT_FALSE(t.IsTypedefType());
690690
};
691-
};
691+
{
692+
NodePointer n = b.GlobalType(
693+
b.Node(Node::Kind::BoundGenericTypeAlias,
694+
b.Node(Node::Kind::Type,
695+
b.Node(Node::Kind::TypeAlias,
696+
b.Node(Node::Kind::Module, "module"),
697+
b.Node(Node::Kind::Identifier, "SomeType"))),
698+
b.Node(Node::Kind::TypeList,
699+
b.Node(Node::Kind::Type,
700+
b.Node(Node::Kind::Structure,
701+
b.Node(Node::Kind::Module, "Swift"),
702+
b.Node(Node::Kind::Identifier, "Int"))))));
703+
CompilerType t = GetCompilerType(b.Mangle(n));
704+
ASSERT_TRUE(t.IsTypedefType());
705+
};
706+
}
692707

0 commit comments

Comments
 (0)