[SE-0296] Enable async/await by default.

Always parse `async` and `await`, allowing the definition and use of
asynchronous functions without the "experimental concurrency" flag.

Note that, at present, use of asynchronous functions requires one to
explicitly import or link against the `_Concurrency` library. We'll
sort this out in a follow-up change.

Tracked by rdar://73455330.
This commit is contained in:
Doug Gregor
2021-02-05 09:45:13 -08:00
parent edcc3a2704
commit 238290cdc4
10 changed files with 64 additions and 141 deletions

View File

@@ -5219,9 +5219,6 @@ bool RefactoringActionConvertCallToAsyncAlternative::isApplicable(
const ResolvedCursorInfo &CursorInfo, DiagnosticEngine &Diag) {
using namespace asyncrefactorings;
if (!CursorInfo.SF->getASTContext().LangOpts.EnableExperimentalConcurrency)
return false;
// Currently doesn't check that the call is in an async context. This seems
// possibly useful in some situations, so we'll see what the feedback is.
// May need to change in the future
@@ -5263,9 +5260,6 @@ bool RefactoringActionConvertToAsync::isApplicable(
const ResolvedCursorInfo &CursorInfo, DiagnosticEngine &Diag) {
using namespace asyncrefactorings;
if (!CursorInfo.SF->getASTContext().LangOpts.EnableExperimentalConcurrency)
return false;
// As with the call refactoring, should possibly only apply if there's
// actually calls to async alternatives. At the moment this will just add
// `async` if there are no calls, which is probably fine.
@@ -5295,9 +5289,6 @@ bool RefactoringActionAddAsyncAlternative::isApplicable(
const ResolvedCursorInfo &CursorInfo, DiagnosticEngine &Diag) {
using namespace asyncrefactorings;
if (!CursorInfo.SF->getASTContext().LangOpts.EnableExperimentalConcurrency)
return false;
auto *FD = findFunction(CursorInfo);
if (!FD)
return false;