Skip to content

Commit 837af34

Browse files
authored
Merge pull request #64436 from mikeash/fix-too-small-empty-typeinfo
[RemoteMirror] Fix getEmptyTypeInfo() not allocating a BuiltinTypeInfo.
2 parents b01568a + ae926bd commit 837af34

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

include/swift/RemoteInspection/TypeLowering.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ class BuiltinTypeInfo : public TypeInfo {
176176
explicit BuiltinTypeInfo(TypeRefBuilder &builder,
177177
RemoteRef<BuiltinTypeDescriptor> descriptor);
178178

179+
/// Construct an empty builtin type info.
180+
BuiltinTypeInfo()
181+
: TypeInfo(TypeInfoKind::Builtin,
182+
/*Size=*/0,
183+
/*Alignment=*/1,
184+
/*Stride=*/1,
185+
/*ExtraInhabitants=*/0,
186+
/*BitwiseTakable=*/true),
187+
Name("") {}
188+
179189
const std::string &getMangledTypeName() const {
180190
return Name;
181191
}

stdlib/public/RemoteInspection/TypeLowering.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,12 +1683,7 @@ const TypeInfo *TypeConverter::getEmptyTypeInfo() {
16831683
if (EmptyTI != nullptr)
16841684
return EmptyTI;
16851685

1686-
EmptyTI = makeTypeInfo<TypeInfo>(TypeInfoKind::Builtin,
1687-
/*Size=*/0,
1688-
/*Alignment=*/1,
1689-
/*Stride=*/1,
1690-
/*ExtraInhabitants=*/0,
1691-
/*BitwiseTakable=*/true);
1686+
EmptyTI = makeTypeInfo<BuiltinTypeInfo>();
16921687
return EmptyTI;
16931688
}
16941689

0 commit comments

Comments
 (0)