Skip to content

Commit e14b948

Browse files
authored
Merge pull request #7764 from hughbe/extra-value-witnesstable-constexpr
Use initializer list instead of copy constructor in ExtraInhabitantsValueWitnessTable constructor
2 parents bb0ac20 + 9413922 commit e14b948

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

include/swift/Runtime/Metadata.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,8 @@ struct ExtraInhabitantsValueWitnessTable : ValueWitnessTable {
769769
value_witness_types::storeExtraInhabitant *storeExtraInhabitant;
770770
value_witness_types::getExtraInhabitantIndex *getExtraInhabitantIndex;
771771

772+
#define SET_WITNESS(NAME) base.NAME,
773+
772774
constexpr ExtraInhabitantsValueWitnessTable()
773775
: ValueWitnessTable{}, extraInhabitantFlags(),
774776
storeExtraInhabitant(nullptr),
@@ -778,9 +780,15 @@ struct ExtraInhabitantsValueWitnessTable : ValueWitnessTable {
778780
value_witness_types::extraInhabitantFlags eif,
779781
value_witness_types::storeExtraInhabitant *sei,
780782
value_witness_types::getExtraInhabitantIndex *geii)
781-
: ValueWitnessTable(base), extraInhabitantFlags(eif),
783+
: ValueWitnessTable{
784+
FOR_ALL_FUNCTION_VALUE_WITNESSES(SET_WITNESS)
785+
base.size,
786+
base.flags,
787+
base.stride
788+
}, extraInhabitantFlags(eif),
782789
storeExtraInhabitant(sei),
783790
getExtraInhabitantIndex(geii) {}
791+
#undef SET_WITNESS
784792

785793
static bool classof(const ValueWitnessTable *table) {
786794
return table->flags.hasExtraInhabitants();

0 commit comments

Comments
 (0)