[sourcekit] Remove reference to global context from SwiftLangSupport NFC

While the SwiftLangSupport doesn't currently outlive the global context
it clarifies the ownership to just store the weak reference we care
about instead of referencing the owning context. In the future we may
want to ref-count the lang support, in which case we'd need to do this
to avoid a cycle anyway.
This commit is contained in:
Ben Langmuir
2018-09-19 15:36:10 -07:00
parent cc22c61d92
commit 1015da026e
3 changed files with 9 additions and 5 deletions

View File

@@ -173,7 +173,8 @@ UIdent UIdentVisitor::visitExtensionDecl(const ExtensionDecl *D) {
}
SwiftLangSupport::SwiftLangSupport(SourceKit::Context &SKCtx)
: SKCtx(SKCtx), CCCache(new SwiftCompletionCache) {
: NotificationCtr(SKCtx.getNotificationCenter()),
CCCache(new SwiftCompletionCache) {
llvm::SmallString<128> LibPath(SKCtx.getRuntimeLibPath());
llvm::sys::path::append(LibPath, "swift");
RuntimeResourcePath = LibPath.str();