[SourceKit] Run SwiftParser on a deep stack for the related identifiers request

We ran SwiftParser in `handlePrimaryAST` for related identifiers. That function is called on a dispatch queue with reduced stack size and could cause the parser to stack overflow if the program is very nested.

Run `handlePrimaryAST` on a deep stack for this request to fix the issue.

rdar://129960285
This commit is contained in:
Alex Hoppen
2024-07-25 16:57:08 -07:00
parent 3ee8272c42
commit 3bffa7970d
4 changed files with 320 additions and 6 deletions

View File

@@ -2537,6 +2537,8 @@ void SwiftLangSupport::findRelatedIdentifiersInFile(
std::function<void(const RequestResult<RelatedIdentsResult> &)> Receiver;
SwiftInvocationRef Invok;
bool requiresDeepStack() override { return true; }
#if SWIFT_BUILD_SWIFT_SYNTAX
// FIXME: Don't silently eat errors here.
RelatedIdentsResult getRelatedIdents(SourceFile *SrcFile,