Skip to content

Commit c3e7707

Browse files
committed
[clang][AST][NFC] Turn a isa<> + cast<> into dynamic_cast<>
1 parent 7143b45 commit c3e7707

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/AST/ExprCXX.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,14 +511,14 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &Context,
511511
}
512512

513513
SourceLocation CXXConstructExpr::getBeginLoc() const {
514-
if (isa<CXXTemporaryObjectExpr>(this))
515-
return cast<CXXTemporaryObjectExpr>(this)->getBeginLoc();
514+
if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(this))
515+
return TOE->getBeginLoc();
516516
return getLocation();
517517
}
518518

519519
SourceLocation CXXConstructExpr::getEndLoc() const {
520-
if (isa<CXXTemporaryObjectExpr>(this))
521-
return cast<CXXTemporaryObjectExpr>(this)->getEndLoc();
520+
if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(this))
521+
return TOE->getEndLoc();
522522

523523
if (ParenOrBraceRange.isValid())
524524
return ParenOrBraceRange.getEnd();

0 commit comments

Comments
 (0)