Skip to content

Commit cbb8ce9

Browse files
committed
Fix GetTypeInfo for arbitrarily-sized floats
(cherry picked from commit 419c205)
1 parent b44aa5e commit cbb8ce9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ static uint32_t collectTypeInfo(SwiftASTContext *module_holder,
818818
node->getText() == swift::BUILTIN_TYPE_NAME_UNKNOWNOBJECT)
819819
swift_flags |=
820820
eTypeHasChildren | eTypeIsPointer | eTypeIsScalar | eTypeIsObjC;
821-
else if (node->getText() == swift::BUILTIN_TYPE_NAME_FLOAT ||
822-
node->getText() == swift::BUILTIN_TYPE_NAME_FLOAT_PPC)
821+
else if (node->getText().startswith(swift::BUILTIN_TYPE_NAME_FLOAT) ||
822+
node->getText().startswith(swift::BUILTIN_TYPE_NAME_FLOAT_PPC))
823823
swift_flags |= eTypeIsFloat | eTypeIsScalar;
824824
else if (node->getText().startswith(swift::BUILTIN_TYPE_NAME_VEC))
825825
swift_flags |= eTypeHasChildren | eTypeIsVector;

lldb/unittests/Symbol/TestTypeSystemSwiftTypeRef.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,20 @@ TEST_F(TestTypeSystemSwiftTypeRef, Function) {
196196
}
197197
}
198198

199+
TEST_F(TestTypeSystemSwiftTypeRef, GetTypeInfo) {
200+
using namespace swift::Demangle;
201+
Demangler dem;
202+
NodeBuilder b(dem);
203+
{
204+
std::string float32;
205+
llvm::raw_string_ostream(float32) << swift::BUILTIN_TYPE_NAME_FLOAT << "32";
206+
NodePointer n = b.GlobalType(b.Node(Node::Kind::BuiltinTypeName, float32));
207+
CompilerType p = GetCompilerType(b.Mangle(n));
208+
ASSERT_EQ(p.GetTypeInfo() & (eTypeIsFloat | eTypeIsScalar),
209+
eTypeIsFloat | eTypeIsScalar);
210+
}
211+
}
212+
199213
TEST_F(TestTypeSystemSwiftTypeRef, Pointer) {
200214
using namespace swift::Demangle;
201215
Demangler dem;

0 commit comments

Comments
 (0)