[cfe-commits] r137780 - /cfe/trunk/lib/Sema/SemaExpr.cpp

Chandler Carruth chandlerc at gmail.com
Tue Aug 16 15:30:10 PDT 2011


Author: chandlerc
Date: Tue Aug 16 17:30:10 2011
New Revision: 137780

URL: http://llvm.org/viewvc/llvm-project?rev=137780&view=rev
Log:
Switch this code to use the more idiomatic 'dyn_cast' pattern.

Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=137780&r1=137779&r2=137780&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Aug 16 17:30:10 2011
@@ -9425,8 +9425,7 @@
   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 @@
     }
 
     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;
 





More information about the cfe-commits mailing list