Skip to content

Commit 4579afb

Browse files
committed
[Frontend/Serialization] Remove ExtensibleEnums experimental flag
For now the semantics provided by `@extensible` keyword on per-enum basis. We might return this as an upcoming feature in the future with a way to opt-out. (cherry picked from commit bf19481)
1 parent bcf38a1 commit 4579afb

File tree

12 files changed

+5
-56
lines changed

12 files changed

+5
-56
lines changed

include/swift/AST/Decl.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
751751
HasAnyUnavailableDuringLoweringValues : 1
752752
);
753753

754-
SWIFT_INLINE_BITFIELD(ModuleDecl, TypeDecl, 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+8,
754+
SWIFT_INLINE_BITFIELD(ModuleDecl, TypeDecl, 1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+1+8,
755755
/// If the module is compiled as static library.
756756
StaticLibrary : 1,
757757

@@ -820,10 +820,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
820820
SerializePackageEnabled : 1,
821821

822822
/// Whether this module has enabled strict memory safety checking.
823-
StrictMemorySafety : 1,
824-
825-
/// Whether this module has enabled `ExtensibleEnums` feature.
826-
ExtensibleEnums : 1
823+
StrictMemorySafety : 1
827824
);
828825

829826
SWIFT_INLINE_BITFIELD(PrecedenceGroupDecl, Decl, 1+2,

include/swift/AST/Module.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -835,14 +835,6 @@ class ModuleDecl
835835
Bits.ModuleDecl.ObjCNameLookupCachePopulated = value;
836836
}
837837

838-
bool supportsExtensibleEnums() const {
839-
return Bits.ModuleDecl.ExtensibleEnums;
840-
}
841-
842-
void setSupportsExtensibleEnums(bool value = true) {
843-
Bits.ModuleDecl.ExtensibleEnums = value;
844-
}
845-
846838
/// For the main module, retrieves the list of primary source files being
847839
/// compiled, that is, the files we're generating code for.
848840
ArrayRef<SourceFile *> getPrimarySourceFiles() const;

include/swift/Basic/Features.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -505,11 +505,6 @@ SUPPRESSIBLE_EXPERIMENTAL_FEATURE(AddressableTypes, true)
505505
/// Allow custom availability domains to be defined and referenced.
506506
EXPERIMENTAL_FEATURE(CustomAvailability, true)
507507

508-
/// Allow public enumerations to be extensible by default
509-
/// regardless of whether the module they are declared in
510-
/// is resilient or not.
511-
EXPERIMENTAL_FEATURE(ExtensibleEnums, true)
512-
513508
/// Syntax sugar features for concurrency.
514509
EXPERIMENTAL_FEATURE(ConcurrencySyntaxSugar, true)
515510

include/swift/Serialization/Validation.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ class ExtendedValidationInfo {
150150
unsigned AllowNonResilientAccess: 1;
151151
unsigned SerializePackageEnabled: 1;
152152
unsigned StrictMemorySafety: 1;
153-
unsigned SupportsExtensibleEnums : 1;
154153
} Bits;
155154

156155
public:
@@ -272,11 +271,6 @@ class ExtendedValidationInfo {
272271
version, SourceLoc(), /*Diags=*/nullptr))
273272
SwiftInterfaceCompilerVersion = genericVersion.value();
274273
}
275-
276-
bool supportsExtensibleEnums() const { return Bits.SupportsExtensibleEnums; }
277-
void setSupportsExtensibleEnums(bool val) {
278-
Bits.SupportsExtensibleEnums = val;
279-
}
280274
};
281275

282276
struct SearchPath {

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ UNINTERESTING_FEATURE(Volatile)
124124
UNINTERESTING_FEATURE(SuppressedAssociatedTypes)
125125
UNINTERESTING_FEATURE(StructLetDestructuring)
126126
UNINTERESTING_FEATURE(MacrosOnImports)
127-
UNINTERESTING_FEATURE(ExtensibleEnums)
128127
UNINTERESTING_FEATURE(NonisolatedNonsendingByDefault)
129128
UNINTERESTING_FEATURE(KeyPathWithMethodMembers)
130129
UNINTERESTING_FEATURE(NoExplicitNonIsolated)

lib/Frontend/Frontend.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,8 +1501,6 @@ ModuleDecl *CompilerInstance::getMainModule() const {
15011501
MainModule->setSerializePackageEnabled();
15021502
if (Invocation.getLangOptions().hasFeature(Feature::StrictMemorySafety))
15031503
MainModule->setStrictMemorySafety(true);
1504-
if (Invocation.getLangOptions().hasFeature(Feature::ExtensibleEnums))
1505-
MainModule->setSupportsExtensibleEnums(true);
15061504

15071505
configureAvailabilityDomains(getASTContext(),
15081506
Invocation.getFrontendOptions(), MainModule);

lib/Serialization/ModuleFile.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -714,11 +714,6 @@ class ModuleFile
714714
/// \c true if this module was built with strict memory safety.
715715
bool strictMemorySafety() const { return Core->strictMemorySafety(); }
716716

717-
/// \c true if this module was built with `ExtensibleEnums` feature enabled.
718-
bool supportsExtensibleEnums() const {
719-
return Core->supportsExtensibleEnums();
720-
}
721-
722717
/// Associates this module file with the AST node representing it.
723718
///
724719
/// Checks that the file is compatible with the AST module it's being loaded

lib/Serialization/ModuleFileSharedCore.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
225225
case options_block::STRICT_MEMORY_SAFETY:
226226
extendedInfo.setStrictMemorySafety(true);
227227
break;
228-
case options_block::EXTENSIBLE_ENUMS:
229-
extendedInfo.setSupportsExtensibleEnums(true);
230-
break;
231228
default:
232229
// Unknown options record, possibly for use by a future version of the
233230
// module format.
@@ -1507,7 +1504,6 @@ ModuleFileSharedCore::ModuleFileSharedCore(
15071504
Bits.AllowNonResilientAccess = extInfo.allowNonResilientAccess();
15081505
Bits.SerializePackageEnabled = extInfo.serializePackageEnabled();
15091506
Bits.StrictMemorySafety = extInfo.strictMemorySafety();
1510-
Bits.SupportsExtensibleEnums = extInfo.supportsExtensibleEnums();
15111507
MiscVersion = info.miscVersion;
15121508
SDKVersion = info.sdkVersion;
15131509
ModuleABIName = extInfo.getModuleABIName();

lib/Serialization/ModuleFileSharedCore.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -421,11 +421,8 @@ class ModuleFileSharedCore {
421421
/// Whether this module enabled strict memory safety.
422422
unsigned StrictMemorySafety : 1;
423423

424-
/// Whether this module enabled has `ExtensibleEnums` feature enabled.
425-
unsigned SupportsExtensibleEnums : 1;
426-
427424
// Explicitly pad out to the next word boundary.
428-
unsigned : 1;
425+
unsigned : 2;
429426
} Bits = {};
430427
static_assert(sizeof(ModuleBits) <= 8, "The bit set should be small");
431428

@@ -688,8 +685,6 @@ class ModuleFileSharedCore {
688685

689686
bool strictMemorySafety() const { return Bits.StrictMemorySafety; }
690687

691-
bool supportsExtensibleEnums() const { return Bits.SupportsExtensibleEnums; }
692-
693688
/// How should \p dependency be loaded for a transitive import via \c this?
694689
///
695690
/// If \p importNonPublicDependencies, more transitive dependencies

lib/Serialization/ModuleFormat.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5858
/// describe what change you made. The content of this comment isn't important;
5959
/// it just ensures a conflict if two people change the module format.
6060
/// Don't worry about adhering to the 80-column limit for this line.
61-
const uint16_t SWIFTMODULE_VERSION_MINOR = 945; // @extensible attribute
61+
const uint16_t SWIFTMODULE_VERSION_MINOR = 946; // remove ExtensibleEnums feature
6262

6363
/// A standard hash seed used for all string hashes in a serialized module.
6464
///
@@ -987,8 +987,7 @@ namespace options_block {
987987
CXX_STDLIB_KIND,
988988
PUBLIC_MODULE_NAME,
989989
SWIFT_INTERFACE_COMPILER_VERSION,
990-
STRICT_MEMORY_SAFETY,
991-
EXTENSIBLE_ENUMS,
990+
STRICT_MEMORY_SAFETY
992991
};
993992

994993
using SDKPathLayout = BCRecordLayout<
@@ -1098,10 +1097,6 @@ namespace options_block {
10981097
SWIFT_INTERFACE_COMPILER_VERSION,
10991098
BCBlob // version tuple
11001099
>;
1101-
1102-
using ExtensibleEnumsLayout = BCRecordLayout<
1103-
EXTENSIBLE_ENUMS
1104-
>;
11051100
}
11061101

11071102
/// The record types within the input block.

0 commit comments

Comments
 (0)