@@ -2598,8 +2598,7 @@ void irgen::emitLazyTypeContextDescriptor(IRGenModule &IGM,
2598
2598
auto &ti = IGM.getTypeInfo (lowered);
2599
2599
auto *typeLayoutEntry =
2600
2600
ti.buildTypeLayoutEntry (IGM, lowered, /* useStructLayouts*/ true );
2601
- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) &&
2602
- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
2601
+ if (layoutStringsEnabled (IGM)) {
2603
2602
2604
2603
auto genericSig =
2605
2604
lowered.getNominalOrBoundGenericNominal ()->getGenericSignature ();
@@ -3126,11 +3125,11 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
3126
3125
MetadataDependencyCollector *collector) {
3127
3126
auto &IGM = IGF.IGM ;
3128
3127
auto loweredTy = IGM.getLoweredType (nominalDecl->getDeclaredTypeInContext ());
3129
- bool useLayoutStrings = IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses) &&
3130
- IGM. Context . LangOpts . hasFeature (
3131
- Feature::LayoutStringValueWitnessesInstantiation) &&
3132
- IGM. getOptions (). EnableLayoutStringValueWitnesses &&
3133
- IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ;
3128
+ bool useLayoutStrings =
3129
+ layoutStringsEnabled (IGM) &&
3130
+ IGM. Context . LangOpts . hasFeature (
3131
+ Feature::LayoutStringValueWitnessesInstantiation) &&
3132
+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ;
3134
3133
3135
3134
if (auto sd = dyn_cast<StructDecl>(nominalDecl)) {
3136
3135
auto &fixedTI = IGM.getTypeInfo (loweredTy);
@@ -3281,8 +3280,7 @@ namespace {
3281
3280
Impl &asImpl () { return *static_cast <Impl*>(this ); }
3282
3281
3283
3282
llvm::Constant *emitLayoutString () {
3284
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3285
- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3283
+ if (!layoutStringsEnabled (IGM))
3286
3284
return nullptr ;
3287
3285
auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
3288
3286
auto &ti = IGM.getTypeInfo (lowered);
@@ -3363,9 +3361,7 @@ namespace {
3363
3361
if (HasDependentMetadata)
3364
3362
asImpl ().emitInitializeMetadata (IGF, metadata, false , collector);
3365
3363
3366
- if (IGM.Context .LangOpts .hasFeature (
3367
- Feature::LayoutStringValueWitnesses) &&
3368
- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
3364
+ if (layoutStringsEnabled (IGM)) {
3369
3365
if (auto *layoutString = getLayoutString ()) {
3370
3366
auto layoutStringCast = IGF.Builder .CreateBitCast (layoutString,
3371
3367
IGM.Int8PtrTy );
@@ -3960,8 +3956,7 @@ namespace {
3960
3956
}
3961
3957
3962
3958
llvm::Constant *emitLayoutString () {
3963
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3964
- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3959
+ if (!layoutStringsEnabled (IGM))
3965
3960
return nullptr ;
3966
3961
auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
3967
3962
auto &ti = IGM.getTypeInfo (lowered);
@@ -4681,7 +4676,7 @@ namespace {
4681
4676
SILType getLoweredType () { return SILType::getPrimitiveObjectType (type); }
4682
4677
4683
4678
llvm::Constant *emitLayoutString () {
4684
- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses ))
4679
+ if (!layoutStringsEnabled (IGM ))
4685
4680
return nullptr ;
4686
4681
auto lowered = getLoweredType ();
4687
4682
auto &ti = IGM.getTypeInfo (lowered);
@@ -4708,7 +4703,7 @@ namespace {
4708
4703
}
4709
4704
4710
4705
bool hasLayoutString () {
4711
- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses )) {
4706
+ if (!layoutStringsEnabled (IGM )) {
4712
4707
return false ;
4713
4708
}
4714
4709
@@ -5291,8 +5286,7 @@ namespace {
5291
5286
}
5292
5287
5293
5288
bool hasLayoutString () {
5294
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5295
- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5289
+ if (!layoutStringsEnabled (IGM)) {
5296
5290
return false ;
5297
5291
}
5298
5292
@@ -5336,8 +5330,7 @@ namespace {
5336
5330
}
5337
5331
5338
5332
llvm::Constant *emitLayoutString () {
5339
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5340
- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5333
+ if (!layoutStringsEnabled (IGM))
5341
5334
return nullptr ;
5342
5335
auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
5343
5336
auto &ti = IGM.getTypeInfo (lowered);
@@ -5484,9 +5477,7 @@ namespace {
5484
5477
}
5485
5478
5486
5479
bool hasLayoutString () {
5487
- if (!IGM.Context .LangOpts .hasFeature (
5488
- Feature::LayoutStringValueWitnesses) ||
5489
- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5480
+ if (!layoutStringsEnabled (IGM)) {
5490
5481
return false ;
5491
5482
}
5492
5483
return !!getLayoutString () ||
@@ -5768,18 +5759,15 @@ namespace {
5768
5759
}
5769
5760
5770
5761
bool hasLayoutString () {
5771
- if (!IGM.Context .LangOpts .hasFeature (
5772
- Feature::LayoutStringValueWitnesses) ||
5773
- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5762
+ if (!layoutStringsEnabled (IGM)) {
5774
5763
return false ;
5775
5764
}
5776
5765
5777
5766
return hasInstantiatedLayoutString () || !!getLayoutString ();
5778
5767
}
5779
5768
5780
5769
llvm::Constant *emitLayoutString () {
5781
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5782
- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5770
+ if (!layoutStringsEnabled (IGM))
5783
5771
return nullptr ;
5784
5772
auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
5785
5773
auto &ti = IGM.getTypeInfo (lowered);
@@ -6005,9 +5993,7 @@ namespace {
6005
5993
}
6006
5994
6007
5995
bool hasLayoutString () {
6008
- if (!IGM.Context .LangOpts .hasFeature (
6009
- Feature::LayoutStringValueWitnesses) ||
6010
- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5996
+ if (!layoutStringsEnabled (IGM)) {
6011
5997
return false ;
6012
5998
}
6013
5999
0 commit comments