@@ -728,7 +728,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
728
728
switch (param->getDefaultArgumentKind ()) {
729
729
case DefaultArgumentKind::Normal: {
730
730
auto arg = param->getTypeCheckedDefaultExpr ();
731
- SGM.preEmitFunction (constant, arg, f, arg);
731
+ auto loc = RegularLocation::getAutoGeneratedLocation (arg);
732
+ SGM.preEmitFunction (constant, arg, f, loc);
732
733
PrettyStackTraceSILFunction X (" silgen emitDefaultArgGenerator " , f);
733
734
SILGenFunction SGF (SGM, *f, initDC);
734
735
SGF.emitGeneratorFunction (constant, arg);
@@ -738,7 +739,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
738
739
739
740
case DefaultArgumentKind::StoredProperty: {
740
741
auto arg = param->getStoredProperty ();
741
- SGM.preEmitFunction (constant, arg, f, arg);
742
+ auto loc = RegularLocation::getAutoGeneratedLocation (arg);
743
+ SGM.preEmitFunction (constant, arg, f, loc);
742
744
PrettyStackTraceSILFunction X (" silgen emitDefaultArgGenerator " , f);
743
745
SILGenFunction SGF (SGM, *f, initDC);
744
746
SGF.emitGeneratorFunction (constant, arg);
@@ -775,7 +777,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
775
777
}
776
778
}
777
779
778
- SGM.preEmitFunction (constant, init, f, init);
780
+ auto loc = RegularLocation::getAutoGeneratedLocation (init);
781
+ SGM.preEmitFunction (constant, init, f, loc);
779
782
PrettyStackTraceSILFunction X (" silgen emitStoredPropertyInitialization" , f);
780
783
f->createProfiler (init, constant, ForDefinition);
781
784
SILGenFunction SGF (SGM, *f, initDC);
@@ -798,7 +801,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
798
801
case SILDeclRef::Kind::PropertyWrapperBackingInitializer: {
799
802
auto *var = cast<VarDecl>(constant.getDecl ());
800
803
801
- SGM.preEmitFunction (constant, var, f, var);
804
+ auto loc = RegularLocation::getAutoGeneratedLocation (var);
805
+ SGM.preEmitFunction (constant, var, f, loc);
802
806
PrettyStackTraceSILFunction X (
803
807
" silgen emitPropertyWrapperBackingInitializer" , f);
804
808
auto wrapperInfo = var->getPropertyWrapperBackingPropertyInfo ();
@@ -820,7 +824,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
820
824
auto *onceToken = found->second .first ;
821
825
auto *onceFunc = found->second .second ;
822
826
823
- SGM.preEmitFunction (constant, global, f, global);
827
+ auto loc = RegularLocation::getAutoGeneratedLocation (global);
828
+ SGM.preEmitFunction (constant, global, f, loc);
824
829
PrettyStackTraceSILFunction X (" silgen emitGlobalAccessor" , f);
825
830
SILGenFunction (SGM, *f, global->getDeclContext ())
826
831
.emitGlobalAccessor (global, onceToken, onceFunc);
@@ -831,7 +836,8 @@ static void emitDelayedFunction(SILGenModule &SGM,
831
836
case SILDeclRef::Kind::EnumElement: {
832
837
auto *decl = cast<EnumElementDecl>(constant.getDecl ());
833
838
834
- SGM.preEmitFunction (constant, decl, f, decl);
839
+ auto loc = RegularLocation::getAutoGeneratedLocation (decl);
840
+ SGM.preEmitFunction (constant, decl, f, loc);
835
841
PrettyStackTraceSILFunction X (" silgen enum constructor" , f);
836
842
SILGenFunction (SGM, *f, decl->getDeclContext ()).emitEnumConstructor (decl);
837
843
SGM.postEmitFunction (constant, f);
@@ -1242,7 +1248,8 @@ void SILGenModule::emitObjCAllocatorDestructor(ClassDecl *cd,
1242
1248
auto ivarInitializer = SILDeclRef (cd, SILDeclRef::Kind::IVarInitializer)
1243
1249
.asForeign ();
1244
1250
SILFunction *f = getFunction (ivarInitializer, ForDefinition);
1245
- preEmitFunction (ivarInitializer, dd, f, dd);
1251
+ auto loc = RegularLocation::getAutoGeneratedLocation (dd);
1252
+ preEmitFunction (ivarInitializer, dd, f, loc);
1246
1253
PrettyStackTraceSILFunction X (" silgen emitDestructor ivar initializer" , f);
1247
1254
SILGenFunction (*this , *f, cd).emitIVarInitializer (ivarInitializer);
1248
1255
postEmitFunction (ivarInitializer, f);
@@ -1253,7 +1260,8 @@ void SILGenModule::emitObjCAllocatorDestructor(ClassDecl *cd,
1253
1260
auto ivarDestroyer = SILDeclRef (cd, SILDeclRef::Kind::IVarDestroyer)
1254
1261
.asForeign ();
1255
1262
SILFunction *f = getFunction (ivarDestroyer, ForDefinition);
1256
- preEmitFunction (ivarDestroyer, dd, f, dd);
1263
+ auto loc = RegularLocation::getAutoGeneratedLocation (dd);
1264
+ preEmitFunction (ivarDestroyer, dd, f, loc);
1257
1265
PrettyStackTraceSILFunction X (" silgen emitDestructor ivar destroyer" , f);
1258
1266
SILGenFunction (*this , *f, cd).emitIVarDestroyer (ivarDestroyer);
1259
1267
postEmitFunction (ivarDestroyer, f);
@@ -1267,7 +1275,8 @@ void SILGenModule::emitDestructor(ClassDecl *cd, DestructorDecl *dd) {
1267
1275
if (requiresIVarDestroyer (cd)) {
1268
1276
SILDeclRef ivarDestroyer (cd, SILDeclRef::Kind::IVarDestroyer);
1269
1277
SILFunction *f = getFunction (ivarDestroyer, ForDefinition);
1270
- preEmitFunction (ivarDestroyer, dd, f, dd);
1278
+ auto loc = RegularLocation::getAutoGeneratedLocation (dd);
1279
+ preEmitFunction (ivarDestroyer, dd, f, loc);
1271
1280
PrettyStackTraceSILFunction X (" silgen emitDestructor ivar destroyer" , f);
1272
1281
SILGenFunction (*this , *f, dd).emitIVarDestroyer (ivarDestroyer);
1273
1282
postEmitFunction (ivarDestroyer, f);
@@ -1284,22 +1293,22 @@ void SILGenModule::emitDestructor(ClassDecl *cd, DestructorDecl *dd) {
1284
1293
if (dd->hasBody ()) {
1285
1294
SILDeclRef destroyer (dd, SILDeclRef::Kind::Destroyer);
1286
1295
SILFunction *f = getFunction (destroyer, ForDefinition);
1287
- preEmitFunction (destroyer, dd, f, dd);
1296
+ RegularLocation loc (dd);
1297
+ preEmitFunction (destroyer, dd, f, loc);
1288
1298
PrettyStackTraceSILFunction X (" silgen emitDestroyingDestructor" , f);
1289
1299
SILGenFunction (*this , *f, dd).emitDestroyingDestructor (dd);
1290
- f->setDebugScope (new (M) SILDebugScope (dd, f));
1291
1300
postEmitFunction (destroyer, f);
1292
1301
}
1293
1302
1294
1303
// Emit the deallocating destructor.
1295
1304
{
1296
1305
SILDeclRef deallocator (dd, SILDeclRef::Kind::Deallocator);
1297
1306
SILFunction *f = getFunction (deallocator, ForDefinition);
1298
- preEmitFunction (deallocator, dd, f, dd);
1307
+ auto loc = RegularLocation::getAutoGeneratedLocation (dd);
1308
+ preEmitFunction (deallocator, dd, f, loc);
1299
1309
PrettyStackTraceSILFunction X (" silgen emitDeallocatingDestructor" , f);
1300
1310
f->createProfiler (dd, deallocator, ForDefinition);
1301
1311
SILGenFunction (*this , *f, dd).emitDeallocatingDestructor (dd);
1302
- f->setDebugScope (new (M) SILDebugScope (dd, f));
1303
1312
postEmitFunction (deallocator, f);
1304
1313
}
1305
1314
}
@@ -1415,13 +1424,12 @@ void SILGenModule::emitObjCPropertyMethodThunks(AbstractStorageDecl *prop) {
1415
1424
if (hasFunction (getterRef))
1416
1425
return ;
1417
1426
1418
- RegularLocation ThunkBodyLoc (prop);
1419
- ThunkBodyLoc.markAutoGenerated ();
1427
+ auto thunkBodyLoc = RegularLocation::getAutoGeneratedLocation (prop);
1420
1428
// ObjC entry points are always externally usable, so emitting can't be
1421
1429
// delayed.
1422
1430
{
1423
1431
SILFunction *f = getFunction (getterRef, ForDefinition);
1424
- preEmitFunction (getterRef, prop, f, ThunkBodyLoc );
1432
+ preEmitFunction (getterRef, prop, f, thunkBodyLoc );
1425
1433
PrettyStackTraceSILFunction X (" silgen objc property getter thunk" , f);
1426
1434
f->setBare (IsBare);
1427
1435
f->setThunk (IsThunk);
@@ -1437,7 +1445,7 @@ void SILGenModule::emitObjCPropertyMethodThunks(AbstractStorageDecl *prop) {
1437
1445
auto setterRef = SILDeclRef (setter, SILDeclRef::Kind::Func).asForeign ();
1438
1446
1439
1447
SILFunction *f = getFunction (setterRef, ForDefinition);
1440
- preEmitFunction (setterRef, prop, f, ThunkBodyLoc );
1448
+ preEmitFunction (setterRef, prop, f, thunkBodyLoc );
1441
1449
PrettyStackTraceSILFunction X (" silgen objc property setter thunk" , f);
1442
1450
f->setBare (IsBare);
1443
1451
f->setThunk (IsThunk);
@@ -1456,7 +1464,8 @@ void SILGenModule::emitObjCConstructorThunk(ConstructorDecl *constructor) {
1456
1464
// delayed.
1457
1465
1458
1466
SILFunction *f = getFunction (thunk, ForDefinition);
1459
- preEmitFunction (thunk, constructor, f, constructor);
1467
+ auto loc = RegularLocation::getAutoGeneratedLocation (constructor);
1468
+ preEmitFunction (thunk, constructor, f, loc);
1460
1469
PrettyStackTraceSILFunction X (" silgen objc constructor thunk" , f);
1461
1470
f->setBare (IsBare);
1462
1471
f->setThunk (IsThunk);
@@ -1472,7 +1481,8 @@ void SILGenModule::emitObjCDestructorThunk(DestructorDecl *destructor) {
1472
1481
if (hasFunction (thunk))
1473
1482
return ;
1474
1483
SILFunction *f = getFunction (thunk, ForDefinition);
1475
- preEmitFunction (thunk, destructor, f, destructor);
1484
+ auto loc = RegularLocation::getAutoGeneratedLocation (destructor);
1485
+ preEmitFunction (thunk, destructor, f, loc);
1476
1486
PrettyStackTraceSILFunction X (" silgen objc destructor thunk" , f);
1477
1487
f->setBare (IsBare);
1478
1488
f->setThunk (IsThunk);
0 commit comments