mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Serialization] Serialize a flag that indicates whether ExtensibleEnum feature is supported by a module
When `ExtensibleEnums` flag is set, it's going to be reflected in the module file produced by the compiler to make sure that consumers know that non-`@frozen` enumerations can gain new cases in the future and switching cannot be exhaustive.
This commit is contained in:
@@ -418,8 +418,11 @@ 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 : 2;
|
||||
unsigned : 1;
|
||||
} Bits = {};
|
||||
static_assert(sizeof(ModuleBits) <= 8, "The bit set should be small");
|
||||
|
||||
@@ -678,6 +681,8 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user