Skip to content

Commit a22de31

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.
1 parent da3fa78 commit a22de31

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
@@ -735,7 +735,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
735735
HasAnyUnavailableDuringLoweringValues : 1
736736
);
737737

738-
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,
738+
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,
739739
/// If the module is compiled as static library.
740740
StaticLibrary : 1,
741741

@@ -804,10 +804,7 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl>, public Swi
804804
SerializePackageEnabled : 1,
805805

806806
/// Whether this module has enabled strict memory safety checking.
807-
StrictMemorySafety : 1,
808-
809-
/// Whether this module has enabled `ExtensibleEnums` feature.
810-
ExtensibleEnums : 1
807+
StrictMemorySafety : 1
811808
);
812809

813810
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
@@ -840,14 +840,6 @@ class ModuleDecl
840840
Bits.ModuleDecl.ObjCNameLookupCachePopulated = value;
841841
}
842842

843-
bool supportsExtensibleEnums() const {
844-
return Bits.ModuleDecl.ExtensibleEnums;
845-
}
846-
847-
void setSupportsExtensibleEnums(bool value = true) {
848-
Bits.ModuleDecl.ExtensibleEnums = value;
849-
}
850-
851843
/// For the main module, retrieves the list of primary source files being
852844
/// compiled, that is, the files we're generating code for.
853845
ArrayRef<SourceFile *> getPrimarySourceFiles() const;

include/swift/Basic/Features.def

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -492,11 +492,6 @@ ADOPTABLE_EXPERIMENTAL_FEATURE(AsyncCallerExecution, false)
492492
/// Allow custom availability domains to be defined and referenced.
493493
SUPPRESSIBLE_EXPERIMENTAL_FEATURE(CustomAvailability, true)
494494

495-
/// Allow public enumerations to be extensible by default
496-
/// regardless of whether the module they are declared in
497-
/// is resilient or not.
498-
EXPERIMENTAL_FEATURE(ExtensibleEnums, true)
499-
500495
/// Allow isolated conformances.
501496
EXPERIMENTAL_FEATURE(IsolatedConformances, true)
502497

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(SuppressedAssociatedTypes)
124124
UNINTERESTING_FEATURE(StructLetDestructuring)
125125
UNINTERESTING_FEATURE(MacrosOnImports)
126126
UNINTERESTING_FEATURE(AsyncCallerExecution)
127-
UNINTERESTING_FEATURE(ExtensibleEnums)
128127
UNINTERESTING_FEATURE(KeyPathWithMethodMembers)
129128

130129
static bool usesFeatureNonescapableTypes(Decl *decl) {

lib/Frontend/Frontend.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,8 +1469,6 @@ ModuleDecl *CompilerInstance::getMainModule() const {
14691469
MainModule->setSerializePackageEnabled();
14701470
if (Invocation.getLangOptions().hasFeature(Feature::StrictMemorySafety))
14711471
MainModule->setStrictMemorySafety(true);
1472-
if (Invocation.getLangOptions().hasFeature(Feature::ExtensibleEnums))
1473-
MainModule->setSupportsExtensibleEnums(true);
14741472

14751473
configureAvailabilityDomains(getASTContext(),
14761474
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
@@ -224,9 +224,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
224224
case options_block::STRICT_MEMORY_SAFETY:
225225
extendedInfo.setStrictMemorySafety(true);
226226
break;
227-
case options_block::EXTENSIBLE_ENUMS:
228-
extendedInfo.setSupportsExtensibleEnums(true);
229-
break;
230227
default:
231228
// Unknown options record, possibly for use by a future version of the
232229
// module format.
@@ -1508,7 +1505,6 @@ ModuleFileSharedCore::ModuleFileSharedCore(
15081505
Bits.AllowNonResilientAccess = extInfo.allowNonResilientAccess();
15091506
Bits.SerializePackageEnabled = extInfo.serializePackageEnabled();
15101507
Bits.StrictMemorySafety = extInfo.strictMemorySafety();
1511-
Bits.SupportsExtensibleEnums = extInfo.supportsExtensibleEnums();
15121508
MiscVersion = info.miscVersion;
15131509
SDKVersion = info.sdkVersion;
15141510
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

@@ -684,8 +681,6 @@ class ModuleFileSharedCore {
684681

685682
bool strictMemorySafety() const { return Bits.StrictMemorySafety; }
686683

687-
bool supportsExtensibleEnums() const { return Bits.SupportsExtensibleEnums; }
688-
689684
/// How should \p dependency be loaded for a transitive import via \c this?
690685
///
691686
/// 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 = 934; // @extensible attribute
61+
const uint16_t SWIFTMODULE_VERSION_MINOR = 935; // remove ExtensibleEnums feature
6262

6363
/// A standard hash seed used for all string hashes in a serialized module.
6464
///
@@ -974,8 +974,7 @@ namespace options_block {
974974
CXX_STDLIB_KIND,
975975
PUBLIC_MODULE_NAME,
976976
SWIFT_INTERFACE_COMPILER_VERSION,
977-
STRICT_MEMORY_SAFETY,
978-
EXTENSIBLE_ENUMS,
977+
STRICT_MEMORY_SAFETY
979978
};
980979

981980
using SDKPathLayout = BCRecordLayout<
@@ -1085,10 +1084,6 @@ namespace options_block {
10851084
SWIFT_INTERFACE_COMPILER_VERSION,
10861085
BCBlob // version tuple
10871086
>;
1088-
1089-
using ExtensibleEnumsLayout = BCRecordLayout<
1090-
EXTENSIBLE_ENUMS
1091-
>;
10921087
}
10931088

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

lib/Serialization/Serialization.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,11 +1186,6 @@ void Serializer::writeHeader() {
11861186
static_cast<uint8_t>(M->getCXXStdlibKind()));
11871187
}
11881188

1189-
if (M->supportsExtensibleEnums()) {
1190-
options_block::ExtensibleEnumsLayout ExtensibleEnums(Out);
1191-
ExtensibleEnums.emit(ScratchRecord);
1192-
}
1193-
11941189
if (Options.SerializeOptionsForDebugging) {
11951190
options_block::SDKPathLayout SDKPath(Out);
11961191
options_block::XCCLayout XCC(Out);

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,8 +1100,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
11001100
if (!loadedModuleFile->getModulePackageName().empty()) {
11011101
M.setPackageName(Ctx.getIdentifier(loadedModuleFile->getModulePackageName()));
11021102
}
1103-
if (loadedModuleFile->supportsExtensibleEnums())
1104-
M.setSupportsExtensibleEnums();
11051103
M.setUserModuleVersion(loadedModuleFile->getUserModuleVersion());
11061104
M.setSwiftInterfaceCompilerVersion(
11071105
loadedModuleFile->getSwiftInterfaceCompilerVersion());

0 commit comments

Comments
 (0)