Skip to content

Commit c20ed75

Browse files
committed
ManualOwnership: imply MandatoryCopyPropagation
The usability of the feature depends on running MandatoryCopyProp, which is in development.
1 parent 80a61dd commit c20ed75

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

lib/Frontend/CompilerInvocation.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2892,6 +2892,17 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
28922892
A->getAsString(Args));
28932893
}
28942894
}
2895+
// Have ManualOwnership imply MandatoryCopyPropagation.
2896+
// Once that pass becomes enabled by default, we don't need this.
2897+
if (LangOpts.hasFeature(ManualOwnership)) {
2898+
specifiedCopyPropagationOption = CopyPropagationOption::Always;
2899+
2900+
if (auto *Flag = Args.getLastArg(OPT_copy_propagation_state_EQ)) {
2901+
Diags.diagnose(SourceLoc(), diag::error_invalid_arg_combination,
2902+
Flag->getAsString(Args),
2903+
"-enable-experimental-feature ManualOwnership");
2904+
}
2905+
}
28952906
if (Args.hasArg(OPT_enable_copy_propagation)) {
28962907
specifiedCopyPropagationOption = CopyPropagationOption::Always;
28972908
}

test/SIL/manual_ownership.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// RUN: %target-swift-frontend %s -emit-sil -verify \
2-
// RUN: -enable-experimental-feature ManualOwnership \
3-
// RUN: -enable-copy-propagation=always
2+
// RUN: -enable-experimental-feature ManualOwnership
43

54
// REQUIRES: swift_feature_ManualOwnership
65

0 commit comments

Comments
 (0)