File tree Expand file tree Collapse file tree 4 files changed +11
-8
lines changed
tools/SourceKit/lib/SwiftLang Expand file tree Collapse file tree 4 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,15 @@ class ASTContext final {
273273 // / Diags - The diagnostics engine.
274274 DiagnosticEngine &Diags;
275275
276+ // / If the shared pointer is not a \c nullptr and the pointee is \c true,
277+ // / all operations working on this ASTContext should be aborted at the next
278+ // / possible opportunity.
279+ // / This is used by SourceKit to cancel requests for which the result is no
280+ // / longer of interest.
281+ // / The returned result will be discarded, so the operation that acknowledges
282+ // / the cancellation might return with any result.
283+ std::shared_ptr<std::atomic<bool >> CancellationFlag = nullptr ;
284+
276285 TypeCheckCompletionCallback *CompletionCallback = nullptr ;
277286
278287 // / The request-evaluator that is used to process various requests.
Original file line number Diff line number Diff line change @@ -606,12 +606,6 @@ namespace swift {
606606 // / than this many seconds.
607607 unsigned ExpressionTimeoutThreshold = 600 ;
608608
609- // / If the shared pointer is not a \c nullptr and the pointee is \c true,
610- // / typechecking should be aborted at the next possible opportunity.
611- // / This is used by SourceKit to cancel requests for which the result is no
612- // / longer of interest.
613- std::shared_ptr<std::atomic<bool >> CancellationFlag = nullptr ;
614-
615609 // / If non-zero, abort the switch statement exhaustiveness checker if
616610 // / the Space::minus function is called more than this many times.
617611 // /
Original file line number Diff line number Diff line change @@ -5176,7 +5176,7 @@ class ConstraintSystem {
51765176 if (isExpressionAlreadyTooComplex)
51775177 return true ;
51785178
5179- auto CancellationFlag = getASTContext ().TypeCheckerOpts . CancellationFlag ;
5179+ auto CancellationFlag = getASTContext ().CancellationFlag ;
51805180 if (CancellationFlag && CancellationFlag->load (std::memory_order_relaxed))
51815181 return true ;
51825182
Original file line number Diff line number Diff line change @@ -1079,7 +1079,6 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
10791079 Invocation, convertFileContentsToInputs (Contents));
10801080
10811081 Invocation.getLangOptions ().CollectParsedToken = true ;
1082- Invocation.getTypeCheckerOptions ().CancellationFlag = CancellationFlag;
10831082
10841083 if (FileSystem != llvm::vfs::getRealFileSystem ()) {
10851084 CompIns.getSourceMgr ().setFileSystem (FileSystem);
@@ -1091,6 +1090,7 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
10911090 Error = " compilation setup failed" ;
10921091 return nullptr ;
10931092 }
1093+ CompIns.getASTContext ().CancellationFlag = CancellationFlag;
10941094 if (CompIns.loadStdlibIfNeeded ()) {
10951095 LOG_WARN_FUNC (" Loading the stdlib failed" );
10961096 Error = " Loading the stdlib failed" ;
You can’t perform that action at this time.
0 commit comments