Skip to content

Commit 1858878

Browse files
committed
Revert "Add -async-main flag to favor asynchronous main"
This reverts commit da0a331.
1 parent c1fcf45 commit 1858878

File tree

9 files changed

+7
-37
lines changed

9 files changed

+7
-37
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ namespace swift {
223223
/// Emit a remark after loading a module.
224224
bool EnableModuleLoadingRemarks = false;
225225

226-
/// Resolve main function as though it were called from an async context
227-
bool EnableAsyncMainResolution = false;
228-
229226
///
230227
/// Support for alternate usage modes
231228
///

include/swift/Option/Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,6 @@ def pch_output_dir: Separate<["-"], "pch-output-dir">,
270270
Flags<[FrontendOption, HelpHidden, ArgumentIsPath]>,
271271
HelpText<"Directory to persist automatically created precompiled bridging headers">;
272272

273-
def async_main: Flag<["-"], "async-main">,
274-
Flags<[FrontendOption]>,
275-
HelpText<"Resolve main function as if it were called from an asynchronous context">;
276-
277273
// FIXME: Unhide this once it doesn't depend on an output file map.
278274
def incremental : Flag<["-"], "incremental">,
279275
Flags<[NoInteractiveOption, HelpHidden, DoesNotAffectIncrementalBuild]>,

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ enum class ConstraintSystemFlags {
14911491
/// Note that this flag is automatically applied to all constraint systems,
14921492
/// when \c DebugConstraintSolver is set in \c TypeCheckerOptions. It can be
14931493
/// automatically enabled for select constraint solving attempts by setting
1494-
/// \c DebugConstraintSolverAttempt. Finally, it can also be automatically
1494+
/// \c DebugConstraintSolverAttempt. Finally, it can also be automatically
14951495
/// enabled for a pre-configured set of expressions on line numbers by setting
14961496
/// \c DebugConstraintSolverOnLines.
14971497
DebugConstraints = 0x10,
@@ -1515,10 +1515,6 @@ enum class ConstraintSystemFlags {
15151515
/// calling conventions, say due to Clang attributes such as
15161516
/// `__attribute__((ns_consumed))`.
15171517
UseClangFunctionTypes = 0x80,
1518-
1519-
/// When set, nominal typedecl contexts are asynchronous contexts.
1520-
/// This is set while searching for the main function
1521-
ConsiderNominalTypeContextsAsync = 0x100,
15221518
};
15231519

15241520
/// Options that affect the constraint system as a whole.

include/swift/Sema/IDETypeChecking.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#include "swift/AST/Identifier.h"
2323
#include "swift/Basic/SourceLoc.h"
24-
#include "swift/Basic/OptionSet.h"
2524
#include <memory>
2625
#include <tuple>
2726

@@ -51,8 +50,6 @@ namespace swift {
5150
class ConstraintSystem;
5251
class Solution;
5352
class SolutionApplicationTarget;
54-
enum class ConstraintSystemFlags;
55-
using ConstraintSystemOptions = OptionSet<ConstraintSystemFlags>;
5653
}
5754

5855
/// Typecheck binding initializer at \p bindingIndex.
@@ -96,9 +93,8 @@ namespace swift {
9693
/// Unlike other member lookup functions, \c swift::resolveValueMember()
9794
/// should be used when you want to look up declarations with the same name as
9895
/// one you already have.
99-
ResolvedMemberResult
100-
resolveValueMember(DeclContext &DC, Type BaseTy, DeclName Name,
101-
constraints::ConstraintSystemOptions Options = {});
96+
ResolvedMemberResult resolveValueMember(DeclContext &DC, Type BaseTy,
97+
DeclName Name);
10298

10399
/// Given a type and an extension to the original type decl of that type,
104100
/// decide if the extension has been applied, i.e. if the requirements of the

lib/Driver/ToolChains.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ void ToolChain::addCommonFrontendArgs(const OutputInfo &OI,
300300
inputArgs.AddLastArg(arguments, options::OPT_access_notes_path);
301301
inputArgs.AddLastArg(arguments, options::OPT_library_level);
302302
inputArgs.AddLastArg(arguments, options::OPT_enable_bare_slash_regex);
303-
inputArgs.AddLastArg(arguments, options::OPT_async_main);
304303

305304
// Pass on any build config options
306305
inputArgs.AddAllArgs(arguments, options::OPT_D);

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
489489
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
490490
"-enable-experimental-async-top-level");
491491

492-
Opts.EnableAsyncMainResolution = Args.hasArg(OPT_async_main);
493-
494492
Opts.DiagnoseInvalidEphemeralnessAsError |=
495493
Args.hasArg(OPT_enable_invalid_ephemeralness_as_error);
496494

lib/Sema/CSGen.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4424,11 +4424,10 @@ getMemberDecls(InterestedMemberKind Kind) {
44244424
llvm_unreachable("unhandled kind");
44254425
}
44264426

4427-
ResolvedMemberResult
4428-
swift::resolveValueMember(DeclContext &DC, Type BaseTy, DeclName Name,
4429-
ConstraintSystemOptions Options) {
4427+
ResolvedMemberResult swift::resolveValueMember(DeclContext &DC, Type BaseTy,
4428+
DeclName Name) {
44304429
ResolvedMemberResult Result;
4431-
ConstraintSystem CS(&DC, Options);
4430+
ConstraintSystem CS(&DC, None);
44324431

44334432
// Look up all members of BaseTy with the given Name.
44344433
MemberLookupResult LookupResult = CS.performMemberLookup(

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,11 +2900,6 @@ bool ConstraintSystem::isAsynchronousContext(DeclContext *dc) {
29002900
FunctionType::ExtInfo()).isAsync();
29012901
}
29022902

2903-
if (Options.contains(
2904-
ConstraintSystemFlags::ConsiderNominalTypeContextsAsync) &&
2905-
isa<NominalTypeDecl>(dc))
2906-
return true;
2907-
29082903
return false;
29092904
}
29102905

lib/Sema/TypeCheckAttr.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,14 +2171,8 @@ SynthesizeMainFunctionRequest::evaluate(Evaluator &evaluator,
21712171
// mainType.main() from the entry point, and that would require fully
21722172
// type-checking the call to mainType.main().
21732173

2174-
constraints::ConstraintSystemOptions lookupOptions;
2175-
if (context.LangOpts.EnableAsyncMainResolution)
2176-
lookupOptions |=
2177-
constraints::ConstraintSystemFlags::ConsiderNominalTypeContextsAsync;
2178-
21792174
auto resolution = resolveValueMember(
2180-
*declContext, nominal->getInterfaceType(), context.Id_main,
2181-
lookupOptions);
2175+
*declContext, nominal->getInterfaceType(), context.Id_main);
21822176
FuncDecl *mainFunction =
21832177
resolveMainFunctionDecl(declContext, resolution, context);
21842178
if (!mainFunction) {

0 commit comments

Comments
 (0)