@@ -2598,8 +2598,7 @@ void irgen::emitLazyTypeContextDescriptor(IRGenModule &IGM,
25982598 auto &ti = IGM.getTypeInfo (lowered);
25992599 auto *typeLayoutEntry =
26002600 ti.buildTypeLayoutEntry (IGM, lowered, /* useStructLayouts*/ true );
2601- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) &&
2602- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
2601+ if (layoutStringsEnabled (IGM)) {
26032602
26042603 auto genericSig =
26052604 lowered.getNominalOrBoundGenericNominal ()->getGenericSignature ();
@@ -3126,11 +3125,11 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
31263125 MetadataDependencyCollector *collector) {
31273126 auto &IGM = IGF.IGM ;
31283127 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 ;
31343133
31353134 if (auto sd = dyn_cast<StructDecl>(nominalDecl)) {
31363135 auto &fixedTI = IGM.getTypeInfo (loweredTy);
@@ -3281,8 +3280,7 @@ namespace {
32813280 Impl &asImpl () { return *static_cast <Impl*>(this ); }
32823281
32833282 llvm::Constant *emitLayoutString () {
3284- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3285- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3283+ if (!layoutStringsEnabled (IGM))
32863284 return nullptr ;
32873285 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
32883286 auto &ti = IGM.getTypeInfo (lowered);
@@ -3363,9 +3361,7 @@ namespace {
33633361 if (HasDependentMetadata)
33643362 asImpl ().emitInitializeMetadata (IGF, metadata, false , collector);
33653363
3366- if (IGM.Context .LangOpts .hasFeature (
3367- Feature::LayoutStringValueWitnesses) &&
3368- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
3364+ if (layoutStringsEnabled (IGM)) {
33693365 if (auto *layoutString = getLayoutString ()) {
33703366 auto layoutStringCast = IGF.Builder .CreateBitCast (layoutString,
33713367 IGM.Int8PtrTy );
@@ -3960,8 +3956,7 @@ namespace {
39603956 }
39613957
39623958 llvm::Constant *emitLayoutString () {
3963- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3964- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3959+ if (!layoutStringsEnabled (IGM))
39653960 return nullptr ;
39663961 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
39673962 auto &ti = IGM.getTypeInfo (lowered);
@@ -4681,7 +4676,7 @@ namespace {
46814676 SILType getLoweredType () { return SILType::getPrimitiveObjectType (type); }
46824677
46834678 llvm::Constant *emitLayoutString () {
4684- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses ))
4679+ if (!layoutStringsEnabled (IGM ))
46854680 return nullptr ;
46864681 auto lowered = getLoweredType ();
46874682 auto &ti = IGM.getTypeInfo (lowered);
@@ -4708,7 +4703,7 @@ namespace {
47084703 }
47094704
47104705 bool hasLayoutString () {
4711- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses )) {
4706+ if (!layoutStringsEnabled (IGM )) {
47124707 return false ;
47134708 }
47144709
@@ -5291,8 +5286,7 @@ namespace {
52915286 }
52925287
52935288 bool hasLayoutString () {
5294- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5295- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5289+ if (!layoutStringsEnabled (IGM)) {
52965290 return false ;
52975291 }
52985292
@@ -5336,8 +5330,7 @@ namespace {
53365330 }
53375331
53385332 llvm::Constant *emitLayoutString () {
5339- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5340- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5333+ if (!layoutStringsEnabled (IGM))
53415334 return nullptr ;
53425335 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
53435336 auto &ti = IGM.getTypeInfo (lowered);
@@ -5484,9 +5477,7 @@ namespace {
54845477 }
54855478
54865479 bool hasLayoutString () {
5487- if (!IGM.Context .LangOpts .hasFeature (
5488- Feature::LayoutStringValueWitnesses) ||
5489- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5480+ if (!layoutStringsEnabled (IGM)) {
54905481 return false ;
54915482 }
54925483 return !!getLayoutString () ||
@@ -5768,18 +5759,15 @@ namespace {
57685759 }
57695760
57705761 bool hasLayoutString () {
5771- if (!IGM.Context .LangOpts .hasFeature (
5772- Feature::LayoutStringValueWitnesses) ||
5773- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5762+ if (!layoutStringsEnabled (IGM)) {
57745763 return false ;
57755764 }
57765765
57775766 return hasInstantiatedLayoutString () || !!getLayoutString ();
57785767 }
57795768
57805769 llvm::Constant *emitLayoutString () {
5781- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5782- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5770+ if (!layoutStringsEnabled (IGM))
57835771 return nullptr ;
57845772 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
57855773 auto &ti = IGM.getTypeInfo (lowered);
@@ -6005,9 +5993,7 @@ namespace {
60055993 }
60065994
60075995 bool hasLayoutString () {
6008- if (!IGM.Context .LangOpts .hasFeature (
6009- Feature::LayoutStringValueWitnesses) ||
6010- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5996+ if (!layoutStringsEnabled (IGM)) {
60115997 return false ;
60125998 }
60135999
0 commit comments