mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[SourceKit] Move the cancellation flag from TypeCheckerOptions to ASTContext
We need to modify the pointer pointing to the cancellation flag when reusing an ASTContext for code completion. This is not possible by the previous design because `TypeCheckerOptions` was `const`. Moving the cancellation flag to `ASTContext` will also allow other stages of the compiler to honor a cancellation request.
This commit is contained in:
@@ -1079,7 +1079,6 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
|
||||
Invocation, convertFileContentsToInputs(Contents));
|
||||
|
||||
Invocation.getLangOptions().CollectParsedToken = true;
|
||||
Invocation.getTypeCheckerOptions().CancellationFlag = CancellationFlag;
|
||||
|
||||
if (FileSystem != llvm::vfs::getRealFileSystem()) {
|
||||
CompIns.getSourceMgr().setFileSystem(FileSystem);
|
||||
@@ -1091,6 +1090,7 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
|
||||
Error = "compilation setup failed";
|
||||
return nullptr;
|
||||
}
|
||||
CompIns.getASTContext().CancellationFlag = CancellationFlag;
|
||||
if (CompIns.loadStdlibIfNeeded()) {
|
||||
LOG_WARN_FUNC("Loading the stdlib failed");
|
||||
Error = "Loading the stdlib failed";
|
||||
|
||||
Reference in New Issue
Block a user