[sourcekit] Stop storing a bare reference to LangSupport in ASTManager

This fixes a use-after-free when an AST build finishes after shutdown().
This commit is contained in:
Ben Langmuir
2018-09-25 14:00:59 -07:00
parent 1015da026e
commit b3422c1e9d
6 changed files with 47 additions and 42 deletions

View File

@@ -49,7 +49,7 @@ public:
struct Implementation;
Implementation &Impl;
explicit ASTUnit(uint64_t Generation, SwiftStatistics &Statistics);
explicit ASTUnit(uint64_t Generation, std::shared_ptr<SwiftStatistics> Stats);
~ASTUnit();
swift::CompilerInstance &getCompilerInstance() const;
@@ -86,7 +86,9 @@ typedef std::shared_ptr<SwiftASTConsumer> SwiftASTConsumerRef;
class SwiftASTManager : public std::enable_shared_from_this<SwiftASTManager> {
public:
explicit SwiftASTManager(SwiftLangSupport &LangSupport);
explicit SwiftASTManager(std::shared_ptr<SwiftEditorDocumentFileMap>,
std::shared_ptr<SwiftStatistics> Stats,
StringRef RuntimeResourcePath);
~SwiftASTManager();
SwiftInvocationRef getInvocation(ArrayRef<const char *> Args,