Author: Timm Bäder
Date: 2024-01-24T15:17:33+01:00
New Revision: c3e77070489979788788ef479f8932ac460b675b

URL: 
https://github.com/llvm/llvm-project/commit/c3e77070489979788788ef479f8932ac460b675b
DIFF: 
https://github.com/llvm/llvm-project/commit/c3e77070489979788788ef479f8932ac460b675b.diff

LOG: [clang][AST][NFC] Turn a isa<> + cast<> into dynamic_cast<>

Added: 
    

Modified: 
    clang/lib/AST/ExprCXX.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index e61c11dffd8841f..a775beadff9da53 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<CXXTemporaryObjectExpr>(this))
-    return cast<CXXTemporaryObjectExpr>(this)->getBeginLoc();
+  if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(this))
+    return TOE->getBeginLoc();
   return getLocation();
 }
 
 SourceLocation CXXConstructExpr::getEndLoc() const {
-  if (isa<CXXTemporaryObjectExpr>(this))
-    return cast<CXXTemporaryObjectExpr>(this)->getEndLoc();
+  if (const auto *TOE = dyn_cast<CXXTemporaryObjectExpr>(this))
+    return TOE->getEndLoc();
 
   if (ParenOrBraceRange.isValid())
     return ParenOrBraceRange.getEnd();


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to