@@ -1158,42 +1158,40 @@ void SILGenModule::emitFunctionDefinition(SILDeclRef constant, SILFunction *f) {
1158
1158
}
1159
1159
}
1160
1160
1161
- // / Emit a function now, if it's externally usable or has been referenced in
1162
- // / the current TU, or remember how to emit it later if not.
1163
- static void emitOrDelayFunction (SILGenModule &SGM, SILDeclRef constant) {
1161
+ void SILGenModule::emitOrDelayFunction (SILDeclRef constant) {
1164
1162
assert (!constant.isThunk ());
1165
1163
assert (!constant.isClangImported ());
1166
1164
1167
- auto emitAfter = SGM. lastEmittedFunction ;
1165
+ auto emitAfter = lastEmittedFunction;
1168
1166
1169
1167
// Implicit decls may be delayed if they can't be used externally.
1170
1168
auto linkage = constant.getLinkage (ForDefinition);
1171
1169
bool mayDelay = !constant.hasUserWrittenCode () &&
1172
1170
!constant.isDynamicallyReplaceable () &&
1173
- !isPossiblyUsedExternally (linkage, SGM. M .isWholeModule ());
1171
+ !isPossiblyUsedExternally (linkage, M.isWholeModule ());
1174
1172
1175
1173
if (!mayDelay) {
1176
- SGM. emitFunctionDefinition (constant, SGM. getFunction (constant, ForDefinition));
1174
+ emitFunctionDefinition (constant, getFunction (constant, ForDefinition));
1177
1175
return ;
1178
1176
}
1179
1177
1180
1178
// If the function is already forced then it was previously delayed and then
1181
1179
// referenced. We don't need to emit or delay it again.
1182
- if (SGM. forcedFunctions .contains (constant))
1180
+ if (forcedFunctions.contains (constant))
1183
1181
return ;
1184
1182
1185
- if (auto *f = SGM. getEmittedFunction (constant, ForDefinition)) {
1186
- SGM. emitFunctionDefinition (constant, f);
1183
+ if (auto *f = getEmittedFunction (constant, ForDefinition)) {
1184
+ emitFunctionDefinition (constant, f);
1187
1185
return ;
1188
1186
}
1189
1187
1190
1188
// This is a delayable function so remember how to emit it in case it gets
1191
1189
// referenced later.
1192
- SGM. delayedFunctions .insert ({constant, emitAfter});
1190
+ delayedFunctions.insert ({constant, emitAfter});
1193
1191
// Even though we didn't emit the function now, update the
1194
1192
// lastEmittedFunction so that we preserve the original ordering that
1195
1193
// the symbols would have been emitted in.
1196
- SGM. lastEmittedFunction = constant;
1194
+ lastEmittedFunction = constant;
1197
1195
}
1198
1196
1199
1197
void SILGenModule::preEmitFunction (SILDeclRef constant, SILFunction *F,
@@ -1432,7 +1430,7 @@ void SILGenModule::emitFunction(FuncDecl *fd) {
1432
1430
emitAbstractFuncDecl (fd);
1433
1431
1434
1432
if (fd->hasBody ())
1435
- emitOrDelayFunction (* this , SILDeclRef (decl));
1433
+ emitOrDelayFunction (SILDeclRef (decl));
1436
1434
}
1437
1435
1438
1436
void SILGenModule::addGlobalVariable (VarDecl *global) {
@@ -1457,11 +1455,11 @@ void SILGenModule::emitConstructor(ConstructorDecl *decl) {
1457
1455
// initializers, have separate entry points for allocation and
1458
1456
// initialization.
1459
1457
if (decl->isDesignatedInit () || decl->isObjC ()) {
1460
- emitOrDelayFunction (* this , constant);
1458
+ emitOrDelayFunction (constant);
1461
1459
1462
1460
if (decl->hasBody ()) {
1463
1461
SILDeclRef initConstant (decl, SILDeclRef::Kind::Initializer);
1464
- emitOrDelayFunction (* this , initConstant);
1462
+ emitOrDelayFunction (initConstant);
1465
1463
}
1466
1464
1467
1465
return ;
@@ -1471,7 +1469,7 @@ void SILGenModule::emitConstructor(ConstructorDecl *decl) {
1471
1469
// Struct and enum constructors do everything in a single function, as do
1472
1470
// non-@objc convenience initializers for classes.
1473
1471
if (decl->hasBody ()) {
1474
- emitOrDelayFunction (* this , constant);
1472
+ emitOrDelayFunction (constant);
1475
1473
}
1476
1474
}
1477
1475
@@ -1620,7 +1618,7 @@ void SILGenModule::emitDefaultArgGenerator(SILDeclRef constant,
1620
1618
1621
1619
case DefaultArgumentKind::Normal:
1622
1620
case DefaultArgumentKind::StoredProperty:
1623
- emitOrDelayFunction (* this , constant);
1621
+ emitOrDelayFunction (constant);
1624
1622
break ;
1625
1623
1626
1624
case DefaultArgumentKind::Inherited:
@@ -1638,7 +1636,7 @@ void SILGenModule::
1638
1636
emitStoredPropertyInitialization (PatternBindingDecl *pbd, unsigned i) {
1639
1637
auto *var = pbd->getAnchoringVarDecl (i);
1640
1638
SILDeclRef constant (var, SILDeclRef::Kind::StoredPropertyInitializer);
1641
- emitOrDelayFunction (* this , constant);
1639
+ emitOrDelayFunction (constant);
1642
1640
}
1643
1641
1644
1642
void SILGenModule::
@@ -1647,12 +1645,12 @@ emitPropertyWrapperBackingInitializer(VarDecl *var) {
1647
1645
1648
1646
if (initInfo.hasInitFromWrappedValue ()) {
1649
1647
SILDeclRef constant (var, SILDeclRef::Kind::PropertyWrapperBackingInitializer);
1650
- emitOrDelayFunction (* this , constant);
1648
+ emitOrDelayFunction (constant);
1651
1649
}
1652
1650
1653
1651
if (initInfo.hasInitFromProjectedValue ()) {
1654
1652
SILDeclRef constant (var, SILDeclRef::Kind::PropertyWrapperInitFromProjectedValue);
1655
- emitOrDelayFunction (* this , constant);
1653
+ emitOrDelayFunction (constant);
1656
1654
}
1657
1655
}
1658
1656
@@ -1687,7 +1685,7 @@ void SILGenModule::emitGlobalAccessor(VarDecl *global,
1687
1685
SILFunction *onceFunc) {
1688
1686
SILDeclRef accessor (global, SILDeclRef::Kind::GlobalAccessor);
1689
1687
delayedGlobals[global] = std::make_pair (onceToken, onceFunc);
1690
- emitOrDelayFunction (* this , accessor);
1688
+ emitOrDelayFunction (accessor);
1691
1689
}
1692
1690
1693
1691
void SILGenModule::emitArgumentGenerators (SILDeclRef::Loc decl,
0 commit comments