IDETool: Register SourceFile for replaced function body.

This prevents a nullptr dereference in `ASTScope::unqualifiedLookup()` after
querying for the `SourceFile` containing a give source location.

Fixes rdar://137652856 and https://github.com/swiftlang/swift/issues/76944.
This commit is contained in:
Allan Shortlidge
2024-10-10 14:26:56 -07:00
parent 3d40a8c9f2
commit af84818e5c
2 changed files with 24 additions and 0 deletions

View File

@@ -354,6 +354,7 @@ bool IDEInspectionInstance::performCachedOperationIfPossible(
nullptr
}
);
SM.recordSourceFile(newBufferID, AFD->getParentSourceFile());
AFD->setBodyToBeReparsed(newBodyRange);
oldSF->clearScope();