Skip to content

Commit 94e30a8

Browse files
committed
Revert "Add -async-main flag to favor asynchronous main"
This reverts commit da0a331.
1 parent 9e54917 commit 94e30a8

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
@@ -1535,7 +1535,7 @@ enum class ConstraintSystemFlags {
15351535
/// Note that this flag is automatically applied to all constraint systems,
15361536
/// when \c DebugConstraintSolver is set in \c TypeCheckerOptions. It can be
15371537
/// automatically enabled for select constraint solving attempts by setting
1538-
/// \c DebugConstraintSolverAttempt. Finally, it can also be automatically
1538+
/// \c DebugConstraintSolverAttempt. Finally, it can also be automatically
15391539
/// enabled for a pre-configured set of expressions on line numbers by setting
15401540
/// \c DebugConstraintSolverOnLines.
15411541
DebugConstraints = 0x10,
@@ -1559,10 +1559,6 @@ enum class ConstraintSystemFlags {
15591559
/// calling conventions, say due to Clang attributes such as
15601560
/// `__attribute__((ns_consumed))`.
15611561
UseClangFunctionTypes = 0x80,
1562-
1563-
/// When set, nominal typedecl contexts are asynchronous contexts.
1564-
/// This is set while searching for the main function
1565-
ConsiderNominalTypeContextsAsync = 0x100,
15661562
};
15671563

15681564
/// 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
@@ -497,8 +497,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
497497
Diags.diagnose(SourceLoc(), diag::warn_flag_deprecated,
498498
"-enable-experimental-async-top-level");
499499

500-
Opts.EnableAsyncMainResolution = Args.hasArg(OPT_async_main);
501-
502500
Opts.DiagnoseInvalidEphemeralnessAsError |=
503501
Args.hasArg(OPT_enable_invalid_ephemeralness_as_error);
504502

lib/Sema/CSGen.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4417,11 +4417,10 @@ getMemberDecls(InterestedMemberKind Kind) {
44174417
llvm_unreachable("unhandled kind");
44184418
}
44194419

4420-
ResolvedMemberResult
4421-
swift::resolveValueMember(DeclContext &DC, Type BaseTy, DeclName Name,
4422-
ConstraintSystemOptions Options) {
4420+
ResolvedMemberResult swift::resolveValueMember(DeclContext &DC, Type BaseTy,
4421+
DeclName Name) {
44234422
ResolvedMemberResult Result;
4424-
ConstraintSystem CS(&DC, Options);
4423+
ConstraintSystem CS(&DC, None);
44254424

44264425
// Look up all members of BaseTy with the given Name.
44274426
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)