Files
swift-mirror/test/Frontend/code-generation-model-feature.swift
Doug Gregor 7d48e98f5e Replace the DeferredCodeGen feature with CodeGenerationModel=<model>
The default code generation model for Embedded Swift is "inlinable".
DeferredCodeGen made the default code generation model
"implementation", and there was no spelling for "interface".

Introduce the experimental feature CodeGenerationModel=<model>, which
can be any of those three options. The default remains "inlinable", but
one can now specify "implementation" (which keeps most everything in
SIL) or "interface" (which only keeps the generic things in SIL). The
"interface" mode is more like non-embedded Swift for non-generic
declarations, emitting them into the IR (only) but not SIL. Generic
declarations would remain in SIL.

Implements rdar://172433062.
2026-05-20 08:35:13 -07:00

20 lines
1.6 KiB
Swift

// Errors when CodeGenerationModel is used outside of Embedded Swift.
// RUN: not %target-swift-frontend -typecheck %s -enable-experimental-feature CodeGenerationModel=interface 2>&1 | %FileCheck %s --check-prefix=NOT-EMBEDDED
// RUN: not %target-swift-frontend -typecheck %s -enable-experimental-feature CodeGenerationModel=implementation 2>&1 | %FileCheck %s --check-prefix=NOT-EMBEDDED
// RUN: not %target-swift-frontend -typecheck %s -enable-experimental-feature CodeGenerationModel=inlinable 2>&1 | %FileCheck %s --check-prefix=NOT-EMBEDDED
// NOT-EMBEDDED: error: experimental feature 'CodeGenerationModel' can only be used in Embedded Swift mode
// Errors on an unrecognized value, even in Embedded mode.
// RUN: not %target-swift-frontend -typecheck %s -enable-experimental-feature Embedded -enable-experimental-feature CodeGenerationModel=foo 2>&1 | %FileCheck %s --check-prefix=BAD-VALUE
// BAD-VALUE: error: invalid value 'foo' for experimental feature 'CodeGenerationModel'; expected 'interface', 'implementation', or 'inlinable'
// Accepted values typecheck cleanly in Embedded mode.
// RUN: %target-swift-frontend -typecheck -parse-stdlib %s -enable-experimental-feature Embedded -enable-experimental-feature CodeGenerationModel=interface
// RUN: %target-swift-frontend -typecheck -parse-stdlib %s -enable-experimental-feature Embedded -enable-experimental-feature CodeGenerationModel=implementation
// RUN: %target-swift-frontend -typecheck -parse-stdlib %s -enable-experimental-feature Embedded -enable-experimental-feature CodeGenerationModel=inlinable
// REQUIRES: swift_in_compiler
// REQUIRES: swift_feature_Embedded