@@ -3954,6 +3954,7 @@ namespace {
3954
3954
3955
3955
public:
3956
3956
const ClassLayout &getFieldLayout () const { return FieldLayout; }
3957
+ using super::isPureObjC;
3957
3958
3958
3959
SILType getLoweredType () {
3959
3960
return IGM.getLoweredType (Target->getDeclaredTypeInContext ());
@@ -3967,9 +3968,7 @@ namespace {
3967
3968
ClassFlags getClassFlags () { return ::getClassFlags (Target); }
3968
3969
3969
3970
void addClassFlags () {
3970
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
3971
- return ;
3972
-
3971
+ assert (!isPureObjC ());
3973
3972
B.addInt32 ((uint32_t )asImpl ().getClassFlags ());
3974
3973
}
3975
3974
@@ -4005,9 +4004,7 @@ namespace {
4005
4004
}
4006
4005
4007
4006
void addValueWitnessTable () {
4008
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4009
- return ;
4010
-
4007
+ assert (!isPureObjC ());
4011
4008
B.add (asImpl ().getValueWitnessTable (false ).getValue ());
4012
4009
}
4013
4010
@@ -4125,9 +4122,7 @@ namespace {
4125
4122
}
4126
4123
4127
4124
void addLayoutStringPointer () {
4128
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4129
- return ;
4130
-
4125
+ assert (!isPureObjC ());
4131
4126
if (auto *layoutString = getLayoutString ()) {
4132
4127
B.addSignedPointer (layoutString,
4133
4128
IGM.getOptions ().PointerAuth .TypeLayoutString ,
@@ -4152,8 +4147,7 @@ namespace {
4152
4147
return ;
4153
4148
}
4154
4149
4155
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4156
- return ;
4150
+ assert (!isPureObjC ());
4157
4151
4158
4152
if (auto ptr = getAddrOfDestructorFunction (IGM, Target)) {
4159
4153
B.addSignedPointer (*ptr,
@@ -4184,8 +4178,7 @@ namespace {
4184
4178
return ;
4185
4179
}
4186
4180
4187
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4188
- return ;
4181
+ assert (!isPureObjC ());
4189
4182
4190
4183
auto dtorFunc = IGM.getAddrOfIVarInitDestroy (Target,
4191
4184
/* isDestroyer=*/ true ,
@@ -4209,9 +4202,7 @@ namespace {
4209
4202
}
4210
4203
4211
4204
void addNominalTypeDescriptor () {
4212
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4213
- return ;
4214
-
4205
+ assert (!isPureObjC ());
4215
4206
B.addSignedPointer (asImpl ().getNominalTypeDescriptor (),
4216
4207
IGM.getOptions ().PointerAuth .TypeDescriptors ,
4217
4208
PointerAuthEntity::Special::TypeDescriptor);
@@ -4226,9 +4217,7 @@ namespace {
4226
4217
}
4227
4218
4228
4219
void addInstanceAddressPoint () {
4229
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4230
- return ;
4231
-
4220
+ assert (!isPureObjC ());
4232
4221
// Right now, we never allocate fields before the address point.
4233
4222
B.addInt32 (0 );
4234
4223
}
@@ -4238,9 +4227,7 @@ namespace {
4238
4227
const ClassLayout &getFieldLayout () { return FieldLayout; }
4239
4228
4240
4229
void addInstanceSize () {
4241
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4242
- return ;
4243
-
4230
+ assert (!isPureObjC ());
4244
4231
if (asImpl ().hasFixedLayout ()) {
4245
4232
B.addInt32 (asImpl ().getFieldLayout ().getSize ().getValue ());
4246
4233
} else {
@@ -4250,9 +4237,7 @@ namespace {
4250
4237
}
4251
4238
4252
4239
void addInstanceAlignMask () {
4253
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4254
- return ;
4255
-
4240
+ assert (!isPureObjC ());
4256
4241
if (asImpl ().hasFixedLayout ()) {
4257
4242
B.addInt16 (asImpl ().getFieldLayout ().getAlignMask ().getValue ());
4258
4243
} else {
@@ -4262,24 +4247,18 @@ namespace {
4262
4247
}
4263
4248
4264
4249
void addRuntimeReservedBits () {
4265
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4266
- return ;
4267
-
4250
+ assert (!isPureObjC ());
4268
4251
B.addInt16 (0 );
4269
4252
}
4270
4253
4271
4254
void addClassSize () {
4272
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4273
- return ;
4274
-
4255
+ assert (!isPureObjC ());
4275
4256
auto size = MetadataLayout.getSize ();
4276
4257
B.addInt32 (size.FullSize .getValue ());
4277
4258
}
4278
4259
4279
4260
void addClassAddressPoint () {
4280
- if (asImpl ().getFieldLayout ().hasObjCImplementation ())
4281
- return ;
4282
-
4261
+ assert (!isPureObjC ());
4283
4262
// FIXME: Wrong
4284
4263
auto size = MetadataLayout.getSize ();
4285
4264
B.addInt32 (size.AddressPoint .getValue ());
@@ -4516,12 +4495,12 @@ namespace {
4516
4495
: IGM(IGM), Target(theClass), B(builder), FieldLayout(fieldLayout) {}
4517
4496
4518
4497
llvm::Constant *emitNominalTypeDescriptor () {
4519
- if (FieldLayout.hasObjCImplementation ())
4520
- return nullptr ;
4521
4498
return ClassContextDescriptorBuilder (IGM, Target, RequireMetadata).emit ();
4522
4499
}
4523
4500
4524
4501
void layout () {
4502
+ assert (!FieldLayout.hasObjCImplementation ()
4503
+ && " Resilient class metadata not supported for @objcImpl" );
4525
4504
emitNominalTypeDescriptor ();
4526
4505
4527
4506
addRelocationFunction ();
@@ -4544,17 +4523,11 @@ namespace {
4544
4523
}
4545
4524
4546
4525
void addDestructorFunction () {
4547
- if (FieldLayout.hasObjCImplementation ())
4548
- return ;
4549
-
4550
4526
auto function = getAddrOfDestructorFunction (IGM, Target);
4551
4527
B.addCompactFunctionReferenceOrNull (function ? *function : nullptr );
4552
4528
}
4553
4529
4554
4530
void addIVarDestroyer () {
4555
- if (FieldLayout.hasObjCImplementation ())
4556
- return ;
4557
-
4558
4531
auto function = IGM.getAddrOfIVarInitDestroy (Target,
4559
4532
/* isDestroyer=*/ true ,
4560
4533
/* isForeign=*/ false ,
@@ -4563,9 +4536,6 @@ namespace {
4563
4536
}
4564
4537
4565
4538
void addClassFlags () {
4566
- if (FieldLayout.hasObjCImplementation ())
4567
- return ;
4568
-
4569
4539
B.addInt32 ((uint32_t ) getClassFlags (Target));
4570
4540
}
4571
4541
@@ -4628,7 +4598,7 @@ namespace {
4628
4598
// @_objcImplementation on true (non-ObjC) generic classes doesn't make
4629
4599
// much sense, and we haven't updated this builder to handle it.
4630
4600
assert (!FieldLayout.hasObjCImplementation ()
4631
- && " @_objcImplementation class with generic metadata? " );
4601
+ && " Generic metadata not supported for @objcImpl " );
4632
4602
4633
4603
super::layoutHeader ();
4634
4604
0 commit comments