mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add an -enforce-exclusivity=... flag to control enforcement of the law of exclusivity. The flag takes one of four options: "checked": Perform both static (compile-time) and dynamic (run-time) checks. "unchecked": Perform only static enforcement. This is analogous to -Ounchecked. "dynamic-only": Perform only dynamic checks. This is for staging purposes. "none": Perform no checks at all. This is also for staging purposes. The default, for now, is "none". The intent is that in the fullness of time, "checked" and "unchecked" will be the only legal options with "checked" the default. That is, static enforcement will always be enabled and dynamic enforcement will be enabled by default.
12 lines
588 B
Swift
12 lines
588 B
Swift
// Test command-line flags for enforcement of the law of exclusivity.
|
|
|
|
// RUN: %swift -enforce-exclusivity=checked %s -emit-silgen
|
|
// RUN: %swift -enforce-exclusivity=unchecked %s -emit-silgen
|
|
|
|
// Staging flags; eventually these will not be accepted.
|
|
// RUN: %swift -enforce-exclusivity=dynamic-only %s -emit-silgen
|
|
// RUN: %swift -enforce-exclusivity=none %s -emit-silgen
|
|
|
|
// RUN: not %swift -enforce-exclusivity=other %s -emit-silgen 2>&1 | %FileCheck -check-prefix=EXCLUSIVITY_UNRECOGNIZED %s
|
|
// EXCLUSIVITY_UNRECOGNIZED: unsupported argument 'other' to option '-enforce-exclusivity='
|