[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:
Pavel Yaskevich
2025-02-24 10:17:12 -08:00
parent 9e4859b302
commit 3cc24f7c19
10 changed files with 50 additions and 4 deletions

View File

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