Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -3056,9 +3056,8 @@ bool TypeSystemSwiftTypeRef::IsFunctionType(opaque_compiler_type_t type) {
using namespace swift::Demangle;
Demangler dem;
NodePointer node = DemangleCanonicalOutermostType(dem, type);
// Note: There are a number of other candidates, and this list may need
// updating. Ex: `NoEscapeFunctionType`, `ThinFunctionType`, etc.
return node && (node->getKind() == Node::Kind::FunctionType ||
node->getKind() == Node::Kind::ThinFunctionType ||
node->getKind() == Node::Kind::NoEscapeFunctionType ||
node->getKind() == Node::Kind::ImplFunctionType);
};
Expand Down
12 changes: 12 additions & 0 deletions lldb/unittests/Symbol/TestTypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ TEST_F(TestTypeSystemSwiftTypeRef, Function) {
ASSERT_TRUE(void_void.IsFunctionPointerType());
ASSERT_EQ(void_void.GetNumberOfFunctionArguments(), 0UL);
}
{
NodePointer n = b.GlobalType(
b.Node(Node::Kind::ThinFunctionType,
b.Node(Node::Kind::ArgumentTuple,
b.Node(Node::Kind::Type, b.Node(Node::Kind::Tuple))),
b.Node(Node::Kind::ReturnType,
b.Node(Node::Kind::Type, b.Node(Node::Kind::Tuple)))));
CompilerType void_void = GetCompilerType(b.Mangle(n));
ASSERT_TRUE(void_void.IsFunctionType());
ASSERT_TRUE(void_void.IsFunctionPointerType());
ASSERT_EQ(void_void.GetNumberOfFunctionArguments(), 0UL);
}
{
NodePointer n = b.GlobalType(
b.Node(Node::Kind::ImplFunctionType, b.Node(Node::Kind::ImplEscaping),
Expand Down