Index: clang/lib/Analysis/ThreadSafety.cpp =================================================================== --- clang/lib/Analysis/ThreadSafety.cpp +++ clang/lib/Analysis/ThreadSafety.cpp @@ -1935,6 +1935,10 @@ CapDiagKind); if (isScopedVar) { + // The default value for the argument VD to the current function is + // nullptr. So we assert that VD is non null because we deref VD here. + assert(VD && "!VD"); + // Add the managing object as a dummy mutex, mapped to the underlying mutex. SourceLocation MLoc = VD->getLocation(); DeclRefExpr DRE(VD->getASTContext(), VD, false, VD->getType(), VK_LValue,