[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:
Alex Hoppen
2021-12-02 12:57:34 +01:00
parent 237338b504
commit 9042536323
4 changed files with 11 additions and 8 deletions

View File

@@ -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";