@@ -2750,8 +2750,7 @@ void irgen::emitLazyTypeContextDescriptor(IRGenModule &IGM,
27502750 auto &ti = IGM.getTypeInfo (lowered);
27512751 auto *typeLayoutEntry =
27522752 ti.buildTypeLayoutEntry (IGM, lowered, /* useStructLayouts*/ true );
2753- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) &&
2754- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
2753+ if (layoutStringsEnabled (IGM)) {
27552754
27562755 auto genericSig =
27572756 lowered.getNominalOrBoundGenericNominal ()->getGenericSignature ();
@@ -3278,11 +3277,11 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
32783277 MetadataDependencyCollector *collector) {
32793278 auto &IGM = IGF.IGM ;
32803279 auto loweredTy = IGM.getLoweredType (nominalDecl->getDeclaredTypeInContext ());
3281- bool useLayoutStrings = IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses) &&
3282- IGM. Context . LangOpts . hasFeature (
3283- Feature::LayoutStringValueWitnessesInstantiation) &&
3284- IGM. getOptions (). EnableLayoutStringValueWitnesses &&
3285- IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ;
3280+ bool useLayoutStrings =
3281+ layoutStringsEnabled (IGM) &&
3282+ IGM. Context . LangOpts . hasFeature (
3283+ Feature::LayoutStringValueWitnessesInstantiation) &&
3284+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ;
32863285
32873286 if (auto sd = dyn_cast<StructDecl>(nominalDecl)) {
32883287 auto &fixedTI = IGM.getTypeInfo (loweredTy);
@@ -3433,8 +3432,7 @@ namespace {
34333432 Impl &asImpl () { return *static_cast <Impl*>(this ); }
34343433
34353434 llvm::Constant *emitLayoutString () {
3436- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3437- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3435+ if (!layoutStringsEnabled (IGM))
34383436 return nullptr ;
34393437 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
34403438 auto &ti = IGM.getTypeInfo (lowered);
@@ -3515,9 +3513,7 @@ namespace {
35153513 if (HasDependentMetadata)
35163514 asImpl ().emitInitializeMetadata (IGF, metadata, false , collector);
35173515
3518- if (IGM.Context .LangOpts .hasFeature (
3519- Feature::LayoutStringValueWitnesses) &&
3520- IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
3516+ if (layoutStringsEnabled (IGM)) {
35213517 if (auto *layoutString = getLayoutString ()) {
35223518 auto layoutStringCast = IGF.Builder .CreateBitCast (layoutString,
35233519 IGM.Int8PtrTy );
@@ -4112,8 +4108,7 @@ namespace {
41124108 }
41134109
41144110 llvm::Constant *emitLayoutString () {
4115- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
4116- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
4111+ if (!layoutStringsEnabled (IGM))
41174112 return nullptr ;
41184113 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
41194114 auto &ti = IGM.getTypeInfo (lowered);
@@ -4850,7 +4845,7 @@ namespace {
48504845 SILType getLoweredType () { return SILType::getPrimitiveObjectType (type); }
48514846
48524847 llvm::Constant *emitLayoutString () {
4853- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses ))
4848+ if (!layoutStringsEnabled (IGM ))
48544849 return nullptr ;
48554850 auto lowered = getLoweredType ();
48564851 auto &ti = IGM.getTypeInfo (lowered);
@@ -4877,7 +4872,7 @@ namespace {
48774872 }
48784873
48794874 bool hasLayoutString () {
4880- if (!IGM. Context . LangOpts . hasFeature (Feature::LayoutStringValueWitnesses )) {
4875+ if (!layoutStringsEnabled (IGM )) {
48814876 return false ;
48824877 }
48834878
@@ -5460,8 +5455,7 @@ namespace {
54605455 }
54615456
54625457 bool hasLayoutString () {
5463- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5464- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5458+ if (!layoutStringsEnabled (IGM)) {
54655459 return false ;
54665460 }
54675461
@@ -5505,8 +5499,7 @@ namespace {
55055499 }
55065500
55075501 llvm::Constant *emitLayoutString () {
5508- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5509- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5502+ if (!layoutStringsEnabled (IGM))
55105503 return nullptr ;
55115504 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
55125505 auto &ti = IGM.getTypeInfo (lowered);
@@ -5653,9 +5646,7 @@ namespace {
56535646 }
56545647
56555648 bool hasLayoutString () {
5656- if (!IGM.Context .LangOpts .hasFeature (
5657- Feature::LayoutStringValueWitnesses) ||
5658- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5649+ if (!layoutStringsEnabled (IGM)) {
56595650 return false ;
56605651 }
56615652 return !!getLayoutString () ||
@@ -5937,18 +5928,15 @@ namespace {
59375928 }
59385929
59395930 bool hasLayoutString () {
5940- if (!IGM.Context .LangOpts .hasFeature (
5941- Feature::LayoutStringValueWitnesses) ||
5942- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5931+ if (!layoutStringsEnabled (IGM)) {
59435932 return false ;
59445933 }
59455934
59465935 return hasInstantiatedLayoutString () || !!getLayoutString ();
59475936 }
59485937
59495938 llvm::Constant *emitLayoutString () {
5950- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5951- !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5939+ if (!layoutStringsEnabled (IGM))
59525940 return nullptr ;
59535941 auto lowered = getLoweredTypeInPrimaryContext (IGM, Target);
59545942 auto &ti = IGM.getTypeInfo (lowered);
@@ -6174,9 +6162,7 @@ namespace {
61746162 }
61756163
61766164 bool hasLayoutString () {
6177- if (!IGM.Context .LangOpts .hasFeature (
6178- Feature::LayoutStringValueWitnesses) ||
6179- !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
6165+ if (!layoutStringsEnabled (IGM)) {
61806166 return false ;
61816167 }
61826168
0 commit comments