[clangd] Keep ModuleCache alive for captured preamble AST (#203952)
Since #164889 made ModuleManager's ModuleCache reference non-owning, the preamble's CompilerInstance solely owns the module buffers so retain the shared_ptr<ModuleCache> in CapturedASTCtx. Fixes #203799
This commit is contained in:
parent
5754a48780
commit
89a086927f
1 changed files with 4 additions and 1 deletions
|
|
@ -36,6 +36,7 @@
|
|||
#include "clang/Frontend/CompilerInvocation.h"
|
||||
#include "clang/Frontend/PrecompiledPreamble.h"
|
||||
#include "clang/Lex/Lexer.h"
|
||||
#include "clang/Serialization/ModuleCache.h"
|
||||
#include "clang/Tooling/CompilationDatabase.h"
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
|
@ -59,7 +60,8 @@ namespace clangd {
|
|||
struct CapturedASTCtx {
|
||||
public:
|
||||
CapturedASTCtx(CompilerInstance &Clang)
|
||||
: Invocation(Clang.getInvocationPtr()),
|
||||
: ModCache(Clang.getModuleCachePtr()),
|
||||
Invocation(Clang.getInvocationPtr()),
|
||||
Diagnostics(Clang.getDiagnosticsPtr()), Target(Clang.getTargetPtr()),
|
||||
AuxTarget(Clang.getAuxTarget()), FileMgr(Clang.getFileManagerPtr()),
|
||||
SourceMgr(Clang.getSourceManagerPtr()), PP(Clang.getPreprocessorPtr()),
|
||||
|
|
@ -79,6 +81,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
std::shared_ptr<ModuleCache> ModCache;
|
||||
std::shared_ptr<CompilerInvocation> Invocation;
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> Diagnostics;
|
||||
IntrusiveRefCntPtr<TargetInfo> Target;
|
||||
|
|
|
|||
Loading…
Reference in a new issue