diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -4141,8 +4141,8 @@ assert(vecType->isBuiltinType() || vecType->isDependentType() || (vecType->isBitIntType() && // Only support _BitInt elements with byte-sized power of 2 NumBits. - llvm::isPowerOf2_32(vecType->getAs()->getNumBits()) && - vecType->getAs()->getNumBits() >= 8)); + llvm::isPowerOf2_32(vecType->castAs()->getNumBits()) && + vecType->castAs()->getNumBits() >= 8)); // Check if we've already instantiated a vector of this type. llvm::FoldingSetNodeID ID; diff --git a/clang/lib/Frontend/FrontendActions.cpp b/clang/lib/Frontend/FrontendActions.cpp --- a/clang/lib/Frontend/FrontendActions.cpp +++ b/clang/lib/Frontend/FrontendActions.cpp @@ -458,6 +458,8 @@ return; } + assert(NamedCtx && "NamedCtx cannot be null"); + if (const auto *Decl = dyn_cast(NamedTemplate)) { OS << "unnamed function parameter " << Decl->getFunctionScopeIndex() << " "; diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -2790,7 +2790,7 @@ // Only support _BitInt elements with byte-sized power of 2 NumBits. if (T->isBitIntType()) { - unsigned NumBits = T->getAs()->getNumBits(); + unsigned NumBits = T->castAs()->getNumBits(); if (!llvm::isPowerOf2_32(NumBits) || NumBits < 8) { Diag(AttrLoc, diag::err_attribute_invalid_bitint_vector_type) << (NumBits < 8); diff --git a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp --- a/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp @@ -321,7 +321,9 @@ if (!IvarRegion) return nullptr; - return IvarRegion->getSymbolicBase()->getSymbol(); + const SymbolicRegion *SR = IvarRegion->getSymbolicBase(); + assert(SR && "Symbolic base should not be nullptr"); + return SR->getSymbol(); } /// If we are in -dealloc or -dealloc is on the stack, handle the call if it is diff --git a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp @@ -291,6 +291,7 @@ // Existence in DestroyRetVal ensures existence in LockMap. // Existence in Destroyed also ensures that the lock state for lockR is either // UntouchedAndPossiblyDestroyed or UnlockedAndPossiblyDestroyed. + assert(lstate); assert(lstate->isUntouchedAndPossiblyDestroyed() || lstate->isUnlockedAndPossiblyDestroyed());