Skip to content

Commit 5e85500

Browse files
committed
[IRGen] Corrected size of trailing flags field.
The struct and enum metadata scanners were both adding a pointer for the trailing flags field. That was only correct for 64-bit platforms. Instead, add an Int64.
1 parent f2c6df3 commit 5e85500

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/IRGen/ConstantBuilder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class ConstantAggregateBuilderBase
7777
addInt(IGM().Int32Ty, value);
7878
}
7979

80+
void addInt64(uint64_t value) { addInt(IGM().Int64Ty, value); }
81+
8082
void addRelativeAddressOrNull(llvm::Constant *target) {
8183
if (target) {
8284
addRelativeAddress(target);

lib/IRGen/EnumMetadataVisitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,13 @@ class EnumMetadataScanner : public EnumMetadataVisitor<Impl> {
9494
void addGenericWitnessTable(GenericRequirement requirement) { addPointer(); }
9595
void addPayloadSize() { addPointer(); }
9696
void noteStartOfTypeSpecificMembers() {}
97-
void addTrailingFlags() { addPointer(); }
97+
void addTrailingFlags() { addInt64(); }
9898

9999
private:
100100
void addPointer() {
101101
NextOffset += super::IGM.getPointerSize();
102102
}
103+
void addInt64() { NextOffset += Size(8); }
103104
};
104105

105106
} // end namespace irgen

lib/IRGen/StructMetadataVisitor.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,14 @@ class StructMetadataScanner : public StructMetadataVisitor<Impl> {
104104
NextOffset = NextOffset.roundUpToAlignment(super::IGM.getPointerAlignment());
105105
}
106106

107-
void addTrailingFlags() { addPointer(); }
107+
void addTrailingFlags() { addInt64(); }
108108

109109
private:
110110
void addPointer() {
111111
NextOffset += super::IGM.getPointerSize();
112112
}
113113
void addInt32() { NextOffset += Size(4); }
114+
void addInt64() { NextOffset += Size(8); }
114115
};
115116

116117
} // end namespace irgen

0 commit comments

Comments
 (0)