]> granicus.if.org Git - clang/commitdiff
Switch this code to use the more idiomatic 'dyn_cast' pattern.
authorChandler Carruth <chandlerc@gmail.com>
Tue, 16 Aug 2011 22:30:10 +0000 (22:30 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Tue, 16 Aug 2011 22:30:10 +0000 (22:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137780 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp

index 20d129da99908b2dcc1066edb057c57b48f6469b..19cd1184ffdb7a12cdd1e05594886357fcf0589a 100644 (file)
@@ -9425,8 +9425,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
   unsigned diagnostic = diag::warn_condition_is_assignment;
   bool IsOrAssign = false;
 
-  if (isa<BinaryOperator>(E)) {
-    BinaryOperator *Op = cast<BinaryOperator>(E);
+  if (BinaryOperator *Op = dyn_cast<BinaryOperator>(E)) {
     if (Op->getOpcode() != BO_Assign && Op->getOpcode() != BO_OrAssign)
       return;
 
@@ -9447,8 +9446,7 @@ void Sema::DiagnoseAssignmentAsCondition(Expr *E) {
     }
 
     Loc = Op->getOperatorLoc();
-  } else if (isa<CXXOperatorCallExpr>(E)) {
-    CXXOperatorCallExpr *Op = cast<CXXOperatorCallExpr>(E);
+  } else if (CXXOperatorCallExpr *Op = dyn_cast<CXXOperatorCallExpr>(E)) {
     if (Op->getOperator() != OO_Equal && Op->getOperator() != OO_PipeEqual)
       return;