diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp index e61c11dffd884..a775beadff9da 100644 --- a/clang/lib/AST/ExprCXX.cpp +++ b/clang/lib/AST/ExprCXX.cpp @@ -511,14 +511,14 @@ DependentScopeDeclRefExpr::CreateEmpty(const ASTContext &Context, } SourceLocation CXXConstructExpr::getBeginLoc() const { - if (isa(this)) - return cast(this)->getBeginLoc(); + if (const auto *TOE = dyn_cast(this)) + return TOE->getBeginLoc(); return getLocation(); } SourceLocation CXXConstructExpr::getEndLoc() const { - if (isa(this)) - return cast(this)->getEndLoc(); + if (const auto *TOE = dyn_cast(this)) + return TOE->getEndLoc(); if (ParenOrBraceRange.isValid()) return ParenOrBraceRange.getEnd();