[moveOnly] Add a frontend flag -enable-experimental-move-only to control usage of move only features.

These include _move and @_noImplicitCopy. I still need to wire up the parsing of
those behind this feature.

The reason that I am adding this now is that I am going to now need to make some
changes behind a feature flag and I have not yet needed to add one. The specific
reason I needed to add one here is to ensure that I properly guard inside _move
the call to Builtin.move so as to prevent a "cond_fail" incident.

P.S.: This work depends on experimental lexical lifetimes being enabled as well,
so I did that at the same time in this PR.
This commit is contained in:
Michael Gottesman
2021-10-27 17:40:07 -07:00
parent ac85770329
commit 44bd180d85
4 changed files with 26 additions and 0 deletions

View File

@@ -443,6 +443,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
Opts.EnableExperimentalDistributed |=
Args.hasArg(OPT_enable_experimental_distributed);
Opts.EnableExperimentalMoveOnly |=
Args.hasArg(OPT_enable_experimental_move_only);
Opts.EnableInferPublicSendable |=
Args.hasFlag(OPT_enable_infer_public_concurrent_value,
OPT_disable_infer_public_concurrent_value,
@@ -1399,6 +1402,11 @@ static bool ParseSILArgs(SILOptions &Opts, ArgList &Args,
Opts.EnableExperimentalLexicalLifetimes |=
Args.hasArg(OPT_enable_experimental_lexical_lifetimes);
// If experimental move only is enabled, always enable lexical lifetime as
// well. Move only depends on lexical lifetimes.
Opts.EnableExperimentalLexicalLifetimes |=
Args.hasArg(OPT_enable_experimental_move_only);
Opts.EnableCopyPropagation |= Args.hasArg(OPT_enable_copy_propagation);
Opts.DisableCopyPropagation |= Args.hasArg(OPT_disable_copy_propagation);
Opts.EnableARCOptimizations &= !Args.hasArg(OPT_disable_arc_opts);