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:
@@ -1335,7 +1335,7 @@ void SwiftLangSupport::findLocalRenameRanges(
|
||||
/// FIXME: When request cancellation is implemented and Xcode adopts it,
|
||||
/// don't use 'OncePerASTToken'.
|
||||
static const char OncePerASTToken = 0;
|
||||
getASTManager().processASTAsync(Invok, ASTConsumer, &OncePerASTToken);
|
||||
getASTManager()->processASTAsync(Invok, ASTConsumer, &OncePerASTToken);
|
||||
}
|
||||
|
||||
SourceFile *SwiftLangSupport::getSyntacticSourceFile(
|
||||
@@ -1343,7 +1343,7 @@ SourceFile *SwiftLangSupport::getSyntacticSourceFile(
|
||||
CompilerInstance &ParseCI, std::string &Error) {
|
||||
CompilerInvocation Invocation;
|
||||
|
||||
bool Failed = getASTManager().initCompilerInvocationNoInputs(
|
||||
bool Failed = getASTManager()->initCompilerInvocationNoInputs(
|
||||
Invocation, Args, ParseCI.getDiags(), Error);
|
||||
if (Failed) {
|
||||
Error = "Compiler invocation init failed";
|
||||
@@ -1398,7 +1398,7 @@ void SwiftLangSupport::getDocInfo(llvm::MemoryBuffer *InputBuf,
|
||||
|
||||
CompilerInvocation Invocation;
|
||||
std::string Error;
|
||||
bool Failed = getASTManager().initCompilerInvocationNoInputs(
|
||||
bool Failed = getASTManager()->initCompilerInvocationNoInputs(
|
||||
Invocation, Args, CI.getDiags(), Error, /*AllowInputs=*/false);
|
||||
|
||||
if (Failed) {
|
||||
@@ -1434,7 +1434,7 @@ findModuleGroups(StringRef ModuleName, ArrayRef<const char *> Args,
|
||||
CI.addDiagnosticConsumer(&PrintDiags);
|
||||
std::vector<StringRef> Groups;
|
||||
std::string Error;
|
||||
if (getASTManager().initCompilerInvocationNoInputs(Invocation, Args,
|
||||
if (getASTManager()->initCompilerInvocationNoInputs(Invocation, Args,
|
||||
CI.getDiags(), Error)) {
|
||||
Receiver(Groups, Error);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user