[SourceKit] Hold CompletionInstance with std::shared_ptr

So we can pin it on the threads.
This commit is contained in:
Rintaro Ishizaki
2019-12-17 12:29:51 -08:00
parent f2466deed8
commit c5b1ada982
4 changed files with 15 additions and 6 deletions

View File

@@ -172,7 +172,10 @@ static bool swiftCodeCompleteImpl(
Error = "no input filenames specified";
return false;
}
CompilerInstance *CI = Lang.getCompletionInstance().getCompilerInstance(
// Pin completion instance.
auto CompletionInst = Lang.getCompletionInstance();
CompilerInstance *CI = CompletionInst->getCompilerInstance(
Invocation, FileSystem, newBuffer.get(), Offset, Error, &CIDiags);
if (!CI)
return false;