Skip to content

Commit 7cd4937

Browse files
committed
[SourceKit] Disable cancellation of in-flight non-completion requests
We need to run SILGen for diagnostics (to actually get all diagnostics). All non-completion requests share an AST and thus they too run SILGen. Any lazy typechecking run in SILGen assumes that it succeeds. Cancellation can cause typechecking to fail here though, since we simply check the flag and error if it's set. This unfortunately has the ability to cause any any number of crashes since various invariants in SILGen are then broken. Disable cancellation of in-flight non-completion requests for now until we have a proper fix in place. Resolves rdar://91251017.
1 parent 128d6e1 commit 7cd4937

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

tools/SourceKit/lib/SwiftLang/SwiftASTManager.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,6 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
10541054
Error = "compilation setup failed";
10551055
return nullptr;
10561056
}
1057-
CompIns.getASTContext().CancellationFlag = CancellationFlag;
10581057
registerIDERequestFunctions(CompIns.getASTContext().evaluator);
10591058
if (TracedOp.enabled()) {
10601059
TracedOp.start(TraceInfo);

unittests/SourceKit/SwiftLang/CursorInfoTest.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ TEST_F(CursorInfoTest, CursorInfoMustWaitDueTokenRace) {
417417
EXPECT_EQ(strlen("fog"), Info.Length);
418418
}
419419

420-
TEST_F(CursorInfoTest, CursorInfoCancelsPreviousRequest) {
420+
// Disabled until we re-enable cancellation (rdar://91251055)
421+
TEST_F(CursorInfoTest, DISABLED_CursorInfoCancelsPreviousRequest) {
421422
// TODO: This test case relies on the following snippet being slow to type
422423
// check so that the first cursor info request takes longer to execute than it
423424
// takes time to schedule the second request. If that is fixed, we need to
@@ -467,7 +468,8 @@ TEST_F(CursorInfoTest, CursorInfoCancelsPreviousRequest) {
467468
llvm::report_fatal_error("Did not receive a resonse for the first request");
468469
}
469470

470-
TEST_F(CursorInfoTest, CursorInfoCancellation) {
471+
// Disabled until we re-enable cancellation (rdar://91251055)
472+
TEST_F(CursorInfoTest, DISABLED_CursorInfoCancellation) {
471473
// TODO: This test case relies on the following snippet being slow to type
472474
// check so that the first cursor info request takes longer to execute than it
473475
// takes time to schedule the second request. If that is fixed, we need to

0 commit comments

Comments
 (0)