[sourcekit] Use a shared_ptr for the SwiftASTManager

When the server shuts down we may still have outstanding async work to
build an AST, so use a shared_ptr + weak_ptr instead of unique_ptr +
unowned references.
This commit is contained in:
Ben Langmuir
2018-09-19 14:56:29 -07:00
parent c6776db83d
commit cc22c61d92
5 changed files with 31 additions and 23 deletions

View File

@@ -272,7 +272,7 @@ struct SwiftStatistics {
class SwiftLangSupport : public LangSupport {
SourceKit::Context &SKCtx;
std::string RuntimeResourcePath;
std::unique_ptr<SwiftASTManager> ASTMgr;
std::shared_ptr<SwiftASTManager> ASTMgr;
SwiftEditorDocumentFileMap EditorDocuments;
SwiftInterfaceGenMap IFaceGenContexts;
ThreadSafeRefCntPtr<SwiftCompletionCache> CCCache;