diff --git a/src/ContextUtils.cpp b/src/ContextUtils.cpp index 60ab4591..f5c5b9d8 100644 --- a/src/ContextUtils.cpp +++ b/src/ContextUtils.cpp @@ -57,7 +57,7 @@ static std::string nameForContext(DeclContext *context) return rec->getNameAsString(); } else if (auto *method = dyn_cast(context)) { return method->getNameAsString(); - } else if (dyn_cast(context)) { + } else if (isa(context)) { return {}; } else { llvm::errs() << "Unhandled kind: " << context->getDeclKindName() << "\n"; diff --git a/src/ContextUtils.h b/src/ContextUtils.h index def281a5..4be8c219 100644 --- a/src/ContextUtils.h +++ b/src/ContextUtils.h @@ -55,7 +55,7 @@ namespace clazy inline bool isValueDeclInFunctionContext(const clang::ValueDecl *valueDecl) { const auto *context = valueDecl ? valueDecl->getDeclContext() : nullptr; - return context && llvm::isa(context) && !llvm::isa(valueDecl); + return llvm::isa_and_nonnull(context) && !llvm::isa(valueDecl); } /** diff --git a/src/checks/level0/strict-iterators.cpp b/src/checks/level0/strict-iterators.cpp index 3153928d..f05c238f 100644 --- a/src/checks/level0/strict-iterators.cpp +++ b/src/checks/level0/strict-iterators.cpp @@ -131,7 +131,7 @@ bool StrictIterators::handleImplicitCast(ImplicitCastExpr *implicitCast) } auto *p = m_context->parentMap->getParent(implicitCast); - if (dyn_cast(p)) { + if (isa(p)) { return false; } diff --git a/src/checks/level0/temporary-iterator.cpp b/src/checks/level0/temporary-iterator.cpp index 999c3d4a..ba5dbdae 100644 --- a/src/checks/level0/temporary-iterator.cpp +++ b/src/checks/level0/temporary-iterator.cpp @@ -146,7 +146,7 @@ void TemporaryIterator::VisitStmt(clang::Stmt *stm) } Stmt *firstChild = clazy::getFirstChild(impl); - if (firstChild && isa(firstChild) && dyn_cast(firstChild)->getCastKind() == CK_LValueToRValue) { + if (isa_and_nonnull(firstChild) && dyn_cast(firstChild)->getCastKind() == CK_LValueToRValue) { return; } }