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 {
273
273
// / Diags - The diagnostics engine.
274
274
DiagnosticEngine &Diags;
275
275
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
+
276
285
TypeCheckCompletionCallback *CompletionCallback = nullptr ;
277
286
278
287
// / 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 {
606
606
// / than this many seconds.
607
607
unsigned ExpressionTimeoutThreshold = 600 ;
608
608
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
-
615
609
// / If non-zero, abort the switch statement exhaustiveness checker if
616
610
// / the Space::minus function is called more than this many times.
617
611
// /
Original file line number Diff line number Diff line change @@ -5176,7 +5176,7 @@ class ConstraintSystem {
5176
5176
if (isExpressionAlreadyTooComplex)
5177
5177
return true ;
5178
5178
5179
- auto CancellationFlag = getASTContext ().TypeCheckerOpts . CancellationFlag ;
5179
+ auto CancellationFlag = getASTContext ().CancellationFlag ;
5180
5180
if (CancellationFlag && CancellationFlag->load (std::memory_order_relaxed))
5181
5181
return true ;
5182
5182
Original file line number Diff line number Diff line change @@ -1079,7 +1079,6 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
1079
1079
Invocation, convertFileContentsToInputs (Contents));
1080
1080
1081
1081
Invocation.getLangOptions ().CollectParsedToken = true ;
1082
- Invocation.getTypeCheckerOptions ().CancellationFlag = CancellationFlag;
1083
1082
1084
1083
if (FileSystem != llvm::vfs::getRealFileSystem ()) {
1085
1084
CompIns.getSourceMgr ().setFileSystem (FileSystem);
@@ -1091,6 +1090,7 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
1091
1090
Error = " compilation setup failed" ;
1092
1091
return nullptr ;
1093
1092
}
1093
+ CompIns.getASTContext ().CancellationFlag = CancellationFlag;
1094
1094
if (CompIns.loadStdlibIfNeeded ()) {
1095
1095
LOG_WARN_FUNC (" Loading the stdlib failed" );
1096
1096
Error = " Loading the stdlib failed" ;
You can’t perform that action at this time.
0 commit comments