mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[SE-0458] Enable unsafe expressions / attributes / for..in effects by default
With the acceptance of SE-0458, allow the use of unsafe expressions, the @safe and @unsafe attributes, and the `unsafe` effect on the for..in loop in all Swift code. Introduce the `-strict-memory-safety` flag detailed in the proposal to enable strict memory safety checking. This enables a new class of feature, an optional feature (that is *not* upcoming or experimental), and which can be detected via `hasFeature(StrictMemorySafety)`.
This commit is contained in:
@@ -878,6 +878,9 @@ static bool ParseEnabledFeatureArgs(LangOptions &Opts, ArgList &Args,
|
||||
|
||||
Opts.enableFeature(Feature::LayoutPrespecialization);
|
||||
|
||||
if (Args.hasArg(OPT_strict_memory_safety))
|
||||
Opts.enableFeature(Feature::StrictMemorySafety);
|
||||
|
||||
return HadError;
|
||||
}
|
||||
|
||||
@@ -3909,7 +3912,7 @@ bool CompilerInvocation::parseArgs(
|
||||
}
|
||||
}
|
||||
|
||||
if (LangOpts.hasFeature(Feature::WarnUnsafe)) {
|
||||
if (LangOpts.hasFeature(Feature::StrictMemorySafety)) {
|
||||
if (SILOpts.RemoveRuntimeAsserts ||
|
||||
SILOpts.AssertConfig == SILOptions::Unchecked) {
|
||||
Diags.diagnose(SourceLoc(),
|
||||
|
||||
Reference in New Issue
Block a user