diff --git a/clang/lib/Frontend/CompileJobCache.cpp b/clang/lib/Frontend/CompileJobCache.cpp index 549d2c9c15c88..b08d99cfe82b1 100644 --- a/clang/lib/Frontend/CompileJobCache.cpp +++ b/clang/lib/Frontend/CompileJobCache.cpp @@ -78,7 +78,8 @@ class ObjectStoreCachingOutputs : public CompileJobCache::CachingOutputs { std::shared_ptr Cache) : CachingOutputs(Clang, std::move(Mapper)), CAS(std::move(DB)), Cache(std::move(Cache)) { - CASOutputs = llvm::makeIntrusiveRefCnt(*CAS); + if (CAS) + CASOutputs = llvm::makeIntrusiveRefCnt(*CAS); } Expected>