Skip to content

Commit f7e6aa5

Browse files
committed
[silgenpattern] Rename an EnumElementDecl value from elt -> eltDecl.
Since we are working with values here, it can be confusing when reading the code that elt is an EnumElementDecl. The rename to eltDecl will make it much clearer.
1 parent 8dec996 commit f7e6aa5

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

lib/SILGen/SILGenPattern.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ void PatternMatchEmission::emitEnumElementDispatch(
20702070
defaultCaseCount);
20712071

20722072
// Okay, now emit all the cases.
2073-
blocks.forEachCase([&](EnumElementDecl *elt, SILBasicBlock *caseBB,
2073+
blocks.forEachCase([&](EnumElementDecl *eltDecl, SILBasicBlock *caseBB,
20742074
const CaseInfo &caseInfo) {
20752075
SILLocation loc = caseInfo.FirstMatcher;
20762076
auto &specializedRows = caseInfo.SpecializedRows;
@@ -2085,8 +2085,8 @@ void PatternMatchEmission::emitEnumElementDispatch(
20852085

20862086
SILType eltTy;
20872087
bool hasElt = false;
2088-
if (elt->hasAssociatedValues()) {
2089-
eltTy = src.getType().getEnumElementType(elt, SGF.SGM.M,
2088+
if (eltDecl->hasAssociatedValues()) {
2089+
eltTy = src.getType().getEnumElementType(eltDecl, SGF.SGM.M,
20902090
SGF.getTypeExpansionContext());
20912091
hasElt = !eltTy.getASTType()->isVoid();
20922092
}
@@ -2140,7 +2140,7 @@ void PatternMatchEmission::emitEnumElementDispatch(
21402140
switch (eltConsumption) {
21412141
case CastConsumptionKind::TakeAlways:
21422142
eltValue =
2143-
SGF.B.createUncheckedTakeEnumDataAddr(loc, srcValue, elt, eltTy);
2143+
SGF.B.createUncheckedTakeEnumDataAddr(loc, srcValue, eltDecl, eltTy);
21442144
break;
21452145
case CastConsumptionKind::BorrowAlways:
21462146
// If we reach this point, we know that we have a loadable
@@ -2154,7 +2154,7 @@ void PatternMatchEmission::emitEnumElementDispatch(
21542154
SGF.B.createCopyAddr(loc, srcValue, copy, IsNotTake, IsInitialization);
21552155
// We can always take from the copy.
21562156
eltConsumption = CastConsumptionKind::TakeAlways;
2157-
eltValue = SGF.B.createUncheckedTakeEnumDataAddr(loc, copy, elt, eltTy);
2157+
eltValue = SGF.B.createUncheckedTakeEnumDataAddr(loc, copy, eltDecl, eltTy);
21582158
break;
21592159
}
21602160

@@ -2186,7 +2186,7 @@ void PatternMatchEmission::emitEnumElementDispatch(
21862186
eltCMV = origCMV;
21872187

21882188
// If the payload is boxed, project it.
2189-
if (elt->isIndirect() || elt->getParentEnum()->isIndirect()) {
2189+
if (eltDecl->isIndirect() || eltDecl->getParentEnum()->isIndirect()) {
21902190
ManagedValue boxedValue =
21912191
SGF.B.createProjectBox(loc, origCMV.getFinalManagedValue(), 0);
21922192
eltTL = &SGF.getTypeLowering(boxedValue.getType());
@@ -2202,14 +2202,14 @@ void PatternMatchEmission::emitEnumElementDispatch(
22022202

22032203
// Reabstract to the substituted type, if needed.
22042204
CanType substEltTy =
2205-
sourceType->getTypeOfMember(SGF.SGM.M.getSwiftModule(), elt,
2206-
elt->getArgumentInterfaceType())
2205+
sourceType->getTypeOfMember(SGF.SGM.M.getSwiftModule(), eltDecl,
2206+
eltDecl->getArgumentInterfaceType())
22072207
->getCanonicalType();
22082208

22092209
AbstractionPattern origEltTy =
2210-
(elt->getParentEnum()->isOptionalDecl()
2210+
(eltDecl->getParentEnum()->isOptionalDecl()
22112211
? AbstractionPattern(substEltTy)
2212-
: SGF.SGM.M.Types.getAbstractionPattern(elt));
2212+
: SGF.SGM.M.Types.getAbstractionPattern(eltDecl));
22132213

22142214
eltCMV = emitReabstractedSubobject(SGF, loc, eltCMV, *eltTL,
22152215
origEltTy, substEltTy);

0 commit comments

Comments
 (0)