Skip to content

Commit 54df0a4

Browse files
committed
[Frontend] Add flag to enable new operator lookup
For now disabled by default, but once we get a new language mode, we should flip it on by default.
1 parent 917c937 commit 54df0a4

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ namespace swift {
267267
/// Build the ASTScope tree lazily
268268
bool LazyASTScopes = true;
269269

270+
/// Whether to enable the new operator decl and precedencegroup lookup
271+
/// behavior. This is a staging flag, and will be removed in the future.
272+
bool EnableNewOperatorLookup = false;
273+
270274
/// Use Clang function types for computing canonical types.
271275
/// If this option is false, the clang function types will still be computed
272276
/// but will not be used for checking type equality.

include/swift/Option/FrontendOptions.td

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,14 @@ def disable_invalid_ephemeralness_as_error :
483483
def switch_checking_invocation_threshold_EQ : Joined<["-"],
484484
"switch-checking-invocation-threshold=">;
485485

486+
def enable_new_operator_lookup :
487+
Flag<["-"], "enable-new-operator-lookup">,
488+
HelpText<"Enable the new operator decl and precedencegroup lookup behavior">;
489+
490+
def disable_new_operator_lookup :
491+
Flag<["-"], "disable-new-operator-lookup">,
492+
HelpText<"Disable the new operator decl and precedencegroup lookup behavior">;
493+
486494
def enable_source_import : Flag<["-"], "enable-source-import">,
487495
HelpText<"Enable importing of Swift source files">;
488496

lib/Frontend/CompilerInvocation.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
409409
Opts.StressASTScopeLookup |= Args.hasArg(OPT_stress_astscope_lookup);
410410
Opts.WarnIfASTScopeLookup |= Args.hasArg(OPT_warn_if_astscope_lookup);
411411
Opts.LazyASTScopes |= Args.hasArg(OPT_lazy_astscopes);
412+
Opts.EnableNewOperatorLookup = Args.hasFlag(OPT_enable_new_operator_lookup,
413+
OPT_disable_new_operator_lookup,
414+
/*default*/ false);
412415
Opts.UseClangFunctionTypes |= Args.hasArg(OPT_use_clang_function_types);
413416

414417
Opts.NamedLazyMemberLoading &= !Args.hasArg(OPT_disable_named_lazy_member_loading);

0 commit comments

Comments
 (0)