Skip to content

Commit 0e7b04a

Browse files
committed
[field-pruned-liveness] Add two helper constructors to TypeTreeLeafTypeRange.
The first is a default constructor that initializes both startEltOffset and endEltOffset to 0. This is used to ensure that we can use certain standard algorithms that expect to be able to perform a default constructor when inserting an initial value into a collection. The second adds the ability to construct a TypeTreeLeafTypeRange for a SILType/SILFunction if one has a type without an actual value.
1 parent c2adaa9 commit 0e7b04a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

include/swift/SIL/FieldSensitivePrunedLiveness.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,15 +213,20 @@ struct TypeTreeLeafTypeRange {
213213
SubElementNumber startEltOffset;
214214
SubElementNumber endEltOffset;
215215

216-
private:
216+
public:
217+
TypeTreeLeafTypeRange() : startEltOffset(0), endEltOffset(0) {}
218+
217219
TypeTreeLeafTypeRange(SubElementNumber start, SubElementNumber end)
218220
: startEltOffset(start), endEltOffset(end) {}
219221

220-
public:
221222
/// The leaf type range for the entire type tree.
222223
TypeTreeLeafTypeRange(SILValue rootAddress)
223224
: startEltOffset(0), endEltOffset(TypeSubElementCount(rootAddress)) {}
224225

226+
/// The leaf type range for the entire type tree.
227+
TypeTreeLeafTypeRange(SILType rootType, SILFunction *fn)
228+
: startEltOffset(0), endEltOffset(TypeSubElementCount(rootType, fn)) {}
229+
225230
/// The leaf type sub-range of the type tree of \p rootAddress, consisting of
226231
/// \p projectedAddress and all of \p projectedAddress's descendent fields in
227232
/// the type tree.

0 commit comments

Comments
 (0)