Skip to content

Commit a9e1ff3

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 e6df6b4 commit a9e1ff3

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
@@ -1050,7 +1050,6 @@ ASTUnitRef ASTBuildOperation::buildASTUnit(std::string &Error) {
10501050
Error = "compilation setup failed";
10511051
return nullptr;
10521052
}
1053-
CompIns.getASTContext().CancellationFlag = CancellationFlag;
10541053
if (CompIns.loadStdlibIfNeeded()) {
10551054
LOG_WARN_FUNC("Loading the stdlib failed");
10561055
Error = "Loading the stdlib failed";

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)