[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 bf19481ab6)
This commit is contained in:
Pavel Yaskevich
2025-04-03 10:51:42 -07:00
parent bcf38a1aef
commit 4579afb71d
12 changed files with 5 additions and 56 deletions

View File

@@ -751,7 +751,7 @@ protected:
HasAnyUnavailableDuringLoweringValues : 1
);
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,
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,
/// If the module is compiled as static library.
StaticLibrary : 1,
@@ -820,10 +820,7 @@ protected:
SerializePackageEnabled : 1,
/// Whether this module has enabled strict memory safety checking.
StrictMemorySafety : 1,
/// Whether this module has enabled `ExtensibleEnums` feature.
ExtensibleEnums : 1
StrictMemorySafety : 1
);
SWIFT_INLINE_BITFIELD(PrecedenceGroupDecl, Decl, 1+2,

View File

@@ -835,14 +835,6 @@ public:
Bits.ModuleDecl.ObjCNameLookupCachePopulated = value;
}
bool supportsExtensibleEnums() const {
return Bits.ModuleDecl.ExtensibleEnums;
}
void setSupportsExtensibleEnums(bool value = true) {
Bits.ModuleDecl.ExtensibleEnums = value;
}
/// For the main module, retrieves the list of primary source files being
/// compiled, that is, the files we're generating code for.
ArrayRef<SourceFile *> getPrimarySourceFiles() const;

View File

@@ -505,11 +505,6 @@ SUPPRESSIBLE_EXPERIMENTAL_FEATURE(AddressableTypes, true)
/// Allow custom availability domains to be defined and referenced.
EXPERIMENTAL_FEATURE(CustomAvailability, true)
/// Allow public enumerations to be extensible by default
/// regardless of whether the module they are declared in
/// is resilient or not.
EXPERIMENTAL_FEATURE(ExtensibleEnums, true)
/// Syntax sugar features for concurrency.
EXPERIMENTAL_FEATURE(ConcurrencySyntaxSugar, true)

View File

@@ -150,7 +150,6 @@ class ExtendedValidationInfo {
unsigned AllowNonResilientAccess: 1;
unsigned SerializePackageEnabled: 1;
unsigned StrictMemorySafety: 1;
unsigned SupportsExtensibleEnums : 1;
} Bits;
public:
@@ -272,11 +271,6 @@ public:
version, SourceLoc(), /*Diags=*/nullptr))
SwiftInterfaceCompilerVersion = genericVersion.value();
}
bool supportsExtensibleEnums() const { return Bits.SupportsExtensibleEnums; }
void setSupportsExtensibleEnums(bool val) {
Bits.SupportsExtensibleEnums = val;
}
};
struct SearchPath {

View File

@@ -124,7 +124,6 @@ UNINTERESTING_FEATURE(Volatile)
UNINTERESTING_FEATURE(SuppressedAssociatedTypes)
UNINTERESTING_FEATURE(StructLetDestructuring)
UNINTERESTING_FEATURE(MacrosOnImports)
UNINTERESTING_FEATURE(ExtensibleEnums)
UNINTERESTING_FEATURE(NonisolatedNonsendingByDefault)
UNINTERESTING_FEATURE(KeyPathWithMethodMembers)
UNINTERESTING_FEATURE(NoExplicitNonIsolated)

View File

@@ -1501,8 +1501,6 @@ ModuleDecl *CompilerInstance::getMainModule() const {
MainModule->setSerializePackageEnabled();
if (Invocation.getLangOptions().hasFeature(Feature::StrictMemorySafety))
MainModule->setStrictMemorySafety(true);
if (Invocation.getLangOptions().hasFeature(Feature::ExtensibleEnums))
MainModule->setSupportsExtensibleEnums(true);
configureAvailabilityDomains(getASTContext(),
Invocation.getFrontendOptions(), MainModule);

View File

@@ -714,11 +714,6 @@ public:
/// \c true if this module was built with strict memory safety.
bool strictMemorySafety() const { return Core->strictMemorySafety(); }
/// \c true if this module was built with `ExtensibleEnums` feature enabled.
bool supportsExtensibleEnums() const {
return Core->supportsExtensibleEnums();
}
/// Associates this module file with the AST node representing it.
///
/// Checks that the file is compatible with the AST module it's being loaded

View File

@@ -225,9 +225,6 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
case options_block::STRICT_MEMORY_SAFETY:
extendedInfo.setStrictMemorySafety(true);
break;
case options_block::EXTENSIBLE_ENUMS:
extendedInfo.setSupportsExtensibleEnums(true);
break;
default:
// Unknown options record, possibly for use by a future version of the
// module format.
@@ -1507,7 +1504,6 @@ ModuleFileSharedCore::ModuleFileSharedCore(
Bits.AllowNonResilientAccess = extInfo.allowNonResilientAccess();
Bits.SerializePackageEnabled = extInfo.serializePackageEnabled();
Bits.StrictMemorySafety = extInfo.strictMemorySafety();
Bits.SupportsExtensibleEnums = extInfo.supportsExtensibleEnums();
MiscVersion = info.miscVersion;
SDKVersion = info.sdkVersion;
ModuleABIName = extInfo.getModuleABIName();

View File

@@ -421,11 +421,8 @@ private:
/// Whether this module enabled strict memory safety.
unsigned StrictMemorySafety : 1;
/// Whether this module enabled has `ExtensibleEnums` feature enabled.
unsigned SupportsExtensibleEnums : 1;
// Explicitly pad out to the next word boundary.
unsigned : 1;
unsigned : 2;
} Bits = {};
static_assert(sizeof(ModuleBits) <= 8, "The bit set should be small");
@@ -688,8 +685,6 @@ public:
bool strictMemorySafety() const { return Bits.StrictMemorySafety; }
bool supportsExtensibleEnums() const { return Bits.SupportsExtensibleEnums; }
/// How should \p dependency be loaded for a transitive import via \c this?
///
/// If \p importNonPublicDependencies, more transitive dependencies

View File

@@ -58,7 +58,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
/// describe what change you made. The content of this comment isn't important;
/// it just ensures a conflict if two people change the module format.
/// Don't worry about adhering to the 80-column limit for this line.
const uint16_t SWIFTMODULE_VERSION_MINOR = 945; // @extensible attribute
const uint16_t SWIFTMODULE_VERSION_MINOR = 946; // remove ExtensibleEnums feature
/// A standard hash seed used for all string hashes in a serialized module.
///
@@ -987,8 +987,7 @@ namespace options_block {
CXX_STDLIB_KIND,
PUBLIC_MODULE_NAME,
SWIFT_INTERFACE_COMPILER_VERSION,
STRICT_MEMORY_SAFETY,
EXTENSIBLE_ENUMS,
STRICT_MEMORY_SAFETY
};
using SDKPathLayout = BCRecordLayout<
@@ -1098,10 +1097,6 @@ namespace options_block {
SWIFT_INTERFACE_COMPILER_VERSION,
BCBlob // version tuple
>;
using ExtensibleEnumsLayout = BCRecordLayout<
EXTENSIBLE_ENUMS
>;
}
/// The record types within the input block.

View File

@@ -1187,11 +1187,6 @@ void Serializer::writeHeader() {
static_cast<uint8_t>(M->getCXXStdlibKind()));
}
if (M->supportsExtensibleEnums()) {
options_block::ExtensibleEnumsLayout ExtensibleEnums(Out);
ExtensibleEnums.emit(ScratchRecord);
}
if (Options.SerializeOptionsForDebugging) {
options_block::SDKPathLayout SDKPath(Out);
options_block::XCCLayout XCC(Out);

View File

@@ -1083,8 +1083,6 @@ LoadedFile *SerializedModuleLoaderBase::loadAST(
if (!loadedModuleFile->getModulePackageName().empty()) {
M.setPackageName(Ctx.getIdentifier(loadedModuleFile->getModulePackageName()));
}
if (loadedModuleFile->supportsExtensibleEnums())
M.setSupportsExtensibleEnums();
M.setUserModuleVersion(loadedModuleFile->getUserModuleVersion());
M.setSwiftInterfaceCompilerVersion(
loadedModuleFile->getSwiftInterfaceCompilerVersion());