Skip to content

Commit e997110

Browse files
committed
Add TypeExpansionContext to SIL serialization and parsing
1 parent 9ecda0c commit e997110

File tree

3 files changed

+346
-313
lines changed

3 files changed

+346
-313
lines changed

lib/ParseSIL/ParseSIL.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4082,8 +4082,9 @@ bool SILParser::parseSILInstruction(SILBuilder &B) {
40824082
return true;
40834083

40844084
EnumElementDecl *Elt = cast<EnumElementDecl>(EltRef.getDecl());
4085-
auto ResultTy = Operand->getType().getEnumElementType(Elt, SILMod);
4086-
4085+
auto ResultTy = Operand->getType().getEnumElementType(
4086+
Elt, SILMod, B.getTypeExpansionContext());
4087+
40874088
switch (Opcode) {
40884089
case swift::SILInstructionKind::InitEnumDataAddrInst:
40894090
ResultVal = B.createInitEnumDataAddr(InstLoc, Operand, Elt, ResultTy);
@@ -4431,7 +4432,8 @@ bool SILParser::parseSILInstruction(SILBuilder &B) {
44314432

44324433
// FIXME: substitution means this type should be explicit to improve
44334434
// performance.
4434-
auto ResultTy = Val->getType().getFieldType(Field, SILMod);
4435+
auto ResultTy =
4436+
Val->getType().getFieldType(Field, SILMod, B.getTypeExpansionContext());
44354437
if (Opcode == SILInstructionKind::StructElementAddrInst)
44364438
ResultVal = B.createStructElementAddr(InstLoc, Val, Field,
44374439
ResultTy.getAddressType());
@@ -4453,7 +4455,8 @@ bool SILParser::parseSILInstruction(SILBuilder &B) {
44534455
return true;
44544456
}
44554457
VarDecl *Field = cast<VarDecl>(FieldV);
4456-
auto ResultTy = Val->getType().getFieldType(Field, SILMod);
4458+
auto ResultTy =
4459+
Val->getType().getFieldType(Field, SILMod, B.getTypeExpansionContext());
44574460
ResultVal = B.createRefElementAddr(InstLoc, Val, Field, ResultTy);
44584461
break;
44594462
}
@@ -5136,8 +5139,8 @@ bool SILParser::parseCallInstruction(SILLocation InstLoc,
51365139
CanSILFunctionType substFTI = FTI;
51375140
if (!subs.empty()) {
51385141
auto silFnTy = FnTy.castTo<SILFunctionType>();
5139-
substFTI
5140-
= silFnTy->substGenericArgs(SILMod, subs);
5142+
substFTI =
5143+
silFnTy->substGenericArgs(SILMod, subs, B.getTypeExpansionContext());
51415144
FnTy = SILType::getPrimitiveObjectType(substFTI);
51425145
}
51435146
SILFunctionConventions substConv(substFTI, B.getModule());

0 commit comments

Comments
 (0)