[clang-tidy][NFC] Prefer isa<T> over T::classof (#172772)

We overwhelmingly prefer `isa` already, and I would argue it's more
readable.
This commit is contained in:
Victor Chernyakin 2025-12-17 21:14:45 -07:00 committed by GitHub
parent 8a0cdb88f9
commit 686c2a1476
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,7 @@ namespace {
AST_MATCHER(SwitchStmt, hasDefaultCase) {
const SwitchCase *Case = Node.getSwitchCaseList();
while (Case) {
if (DefaultStmt::classof(Case))
if (isa<DefaultStmt>(Case))
return true;
Case = Case->getNextSwitchCase();

View File

@ -17,7 +17,7 @@ namespace clang::tidy::cppcoreguidelines {
namespace {
AST_MATCHER(LambdaExpr, hasCoroutineBody) {
const Stmt *Body = Node.getBody();
return Body != nullptr && CoroutineBodyStmt::classof(Body);
return Body != nullptr && isa<CoroutineBodyStmt>(Body);
}
AST_MATCHER(LambdaExpr, hasCaptures) { return Node.capture_size() != 0U; }

View File

@ -30,7 +30,7 @@ DiagnosticBuilder NoexceptMoveConstructorCheck::reportMissingNoexcept(
return diag(FuncDecl->getLocation(),
"move %select{assignment operator|constructor}0s should "
"be marked noexcept")
<< CXXConstructorDecl::classof(FuncDecl);
<< isa<CXXConstructorDecl>(FuncDecl);
}
void NoexceptMoveConstructorCheck::reportNoexceptEvaluatedToFalse(
@ -38,7 +38,7 @@ void NoexceptMoveConstructorCheck::reportNoexceptEvaluatedToFalse(
diag(NoexceptExpr->getExprLoc(),
"noexcept specifier on the move %select{assignment "
"operator|constructor}0 evaluates to 'false'")
<< CXXConstructorDecl::classof(FuncDecl);
<< isa<CXXConstructorDecl>(FuncDecl);
}
} // namespace clang::tidy::performance