@@ -2590,15 +2590,17 @@ void irgen::emitLazyTypeContextDescriptor(IRGenModule &IGM,
2590
2590
auto &ti = IGM.getTypeInfo (lowered);
2591
2591
auto *typeLayoutEntry =
2592
2592
ti.buildTypeLayoutEntry (IGM, lowered, /* useStructLayouts*/ true );
2593
- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses)) {
2593
+ if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) &&
2594
+ IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
2594
2595
2595
2596
auto genericSig =
2596
2597
lowered.getNominalOrBoundGenericNominal ()->getGenericSignature ();
2597
2598
hasLayoutString = !!typeLayoutEntry->layoutString (IGM, genericSig);
2598
2599
}
2599
2600
2600
2601
if (auto sd = dyn_cast<StructDecl>(type)) {
2601
- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnessesInstantiation)) {
2602
+ if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnessesInstantiation) &&
2603
+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ) {
2602
2604
hasLayoutString |= requiresForeignTypeMetadata (type) ||
2603
2605
needsSingletonMetadataInitialization (IGM, type) ||
2604
2606
(type->isGenericContext () && !isa<FixedTypeInfo>(ti));
@@ -2895,7 +2897,8 @@ static void emitInitializeFieldOffsetVectorWithLayoutString(
2895
2897
bool isVWTMutable, MetadataDependencyCollector *collector) {
2896
2898
auto &IGM = IGF.IGM ;
2897
2899
assert (IGM.Context .LangOpts .hasFeature (
2898
- Feature::LayoutStringValueWitnessesInstantiation));
2900
+ Feature::LayoutStringValueWitnessesInstantiation) &&
2901
+ IGM.getOptions ().EnableLayoutStringValueWitnesses );
2899
2902
2900
2903
auto *target = T.getStructOrBoundGenericStruct ();
2901
2904
@@ -3007,7 +3010,9 @@ static void emitInitializeValueMetadata(IRGenFunction &IGF,
3007
3010
3008
3011
if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) &&
3009
3012
IGM.Context .LangOpts .hasFeature (
3010
- Feature::LayoutStringValueWitnessesInstantiation)) {
3013
+ Feature::LayoutStringValueWitnessesInstantiation) &&
3014
+ IGM.getOptions ().EnableLayoutStringValueWitnesses &&
3015
+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ) {
3011
3016
emitInitializeFieldOffsetVectorWithLayoutString (IGF, loweredTy, metadata,
3012
3017
isVWTMutable, collector);
3013
3018
} else {
@@ -3122,7 +3127,8 @@ namespace {
3122
3127
Impl &asImpl () { return *static_cast <Impl*>(this ); }
3123
3128
3124
3129
llvm::Constant *emitLayoutString () {
3125
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses))
3130
+ if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3131
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3126
3132
return nullptr ;
3127
3133
auto lowered = getLoweredTypeInPrimaryContext (
3128
3134
IGM, Target->getDeclaredType ()->getCanonicalType ());
@@ -3205,7 +3211,8 @@ namespace {
3205
3211
asImpl ().emitInitializeMetadata (IGF, metadata, false , collector);
3206
3212
3207
3213
if (IGM.Context .LangOpts .hasFeature (
3208
- Feature::LayoutStringValueWitnesses)) {
3214
+ Feature::LayoutStringValueWitnesses) &&
3215
+ IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
3209
3216
if (auto *layoutString = getLayoutString ()) {
3210
3217
auto layoutStringCast = IGF.Builder .CreateBitCast (layoutString,
3211
3218
IGM.Int8PtrTy );
@@ -3781,7 +3788,8 @@ namespace {
3781
3788
}
3782
3789
3783
3790
llvm::Constant *emitLayoutString () {
3784
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses))
3791
+ if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
3792
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses )
3785
3793
return nullptr ;
3786
3794
auto lowered = getLoweredTypeInPrimaryContext (
3787
3795
IGM, Target->getDeclaredType ()->getCanonicalType ());
@@ -4985,11 +4993,13 @@ namespace {
4985
4993
}
4986
4994
4987
4995
bool hasLayoutString () {
4988
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses)) {
4996
+ if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
4997
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
4989
4998
return false ;
4990
4999
}
4991
5000
4992
- if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnessesInstantiation)) {
5001
+ if (IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnessesInstantiation) &&
5002
+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation ) {
4993
5003
return !!getLayoutString () || needsSingletonMetadataInitialization (IGM, Target);
4994
5004
}
4995
5005
@@ -5028,7 +5038,8 @@ namespace {
5028
5038
}
5029
5039
5030
5040
llvm::Constant *emitLayoutString () {
5031
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses))
5041
+ if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5042
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5032
5043
return nullptr ;
5033
5044
auto lowered = getLoweredTypeInPrimaryContext (
5034
5045
IGM, Target->getDeclaredType ()->getCanonicalType ());
@@ -5179,12 +5190,14 @@ namespace {
5179
5190
5180
5191
bool hasLayoutString () {
5181
5192
if (!IGM.Context .LangOpts .hasFeature (
5182
- Feature::LayoutStringValueWitnesses)) {
5193
+ Feature::LayoutStringValueWitnesses) ||
5194
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses ) {
5183
5195
return false ;
5184
5196
}
5185
5197
return !!getLayoutString () ||
5186
5198
(IGM.Context .LangOpts .hasFeature (
5187
5199
Feature::LayoutStringValueWitnessesInstantiation) &&
5200
+ IGM.getOptions ().EnableLayoutStringValueWitnessesInstantiation &&
5188
5201
(HasDependentVWT || HasDependentMetadata) &&
5189
5202
!isa<FixedTypeInfo>(IGM.getTypeInfo (getLoweredType ())));
5190
5203
}
@@ -5444,7 +5457,8 @@ namespace {
5444
5457
}
5445
5458
5446
5459
llvm::Constant *emitLayoutString () {
5447
- if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses))
5460
+ if (!IGM.Context .LangOpts .hasFeature (Feature::LayoutStringValueWitnesses) ||
5461
+ !IGM.getOptions ().EnableLayoutStringValueWitnesses )
5448
5462
return nullptr ;
5449
5463
auto lowered = getLoweredTypeInPrimaryContext (
5450
5464
IGM, Target->getDeclaredType ()->getCanonicalType ());
0 commit comments