mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[sourcekit] Change getASTManager() to return shared_ptr
Addressing review feedback: this avoids calling shared_from_this() from outside the implementation. Note: it is not possible to use private inheritance of enable_shared_from_this to prevent this issue in general, because enabled_shared_from_this relies on the shared_ptr constructor being able to detect that the type has this inheritance, which means it must be public.
This commit is contained in:
@@ -1058,7 +1058,7 @@ struct SwiftEditorDocument::Implementation {
|
||||
|
||||
Implementation(StringRef FilePath, SwiftLangSupport &LangSupport,
|
||||
CodeFormatOptions options)
|
||||
: ASTMgr(LangSupport.getASTManager().shared_from_this()),
|
||||
: ASTMgr(LangSupport.getASTManager()),
|
||||
NotificationCtr(LangSupport.getNotificationCenter()),
|
||||
FilePath(FilePath), FormatOptions(options) {
|
||||
SemanticInfo =
|
||||
@@ -1735,7 +1735,7 @@ void SwiftEditorDocument::parse(ImmutableTextSnapshotRef Snapshot,
|
||||
Args.push_back("-");
|
||||
std::string Error;
|
||||
// Ignore possible error(s)
|
||||
Lang.getASTManager().
|
||||
Lang.getASTManager()->
|
||||
initCompilerInvocation(CompInv, Args, StringRef(), Error);
|
||||
}
|
||||
CompInv.getLangOptions().BuildSyntaxTree = BuildSyntaxTree;
|
||||
|
||||
Reference in New Issue
Block a user