From f7cd52aca92f4a3a0312c90f053b4fc3ce43eb1d Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Fri, 25 Aug 2023 11:40:07 -0700 Subject: [PATCH] [clang/CompileJobCache] Fix UBSan issue --- clang/lib/Frontend/CompileJobCache.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Frontend/CompileJobCache.cpp b/clang/lib/Frontend/CompileJobCache.cpp index 048edec9c38c5a..8f279aa324eb6b 100644 --- a/clang/lib/Frontend/CompileJobCache.cpp +++ b/clang/lib/Frontend/CompileJobCache.cpp @@ -87,7 +87,8 @@ class ObjectStoreCachingOutputs : public CompileJobCache::CachingOutputs { UseCASBackend), ComputedJobNeedsReplay(WriteOutputAsCASID || UseCASBackend), MCOutputID(MCOutputID), CAS(std::move(DB)), Cache(std::move(Cache)) { - CASOutputs = llvm::makeIntrusiveRefCnt(*CAS); + if (CAS) + CASOutputs = llvm::makeIntrusiveRefCnt(*CAS); } Expected>