[cfe-commits] r92087 - /cfe/trunk/lib/Analysis/CFG.cpp

Ted Kremenek kremenek at apple.com
Wed Dec 23 15:37:11 PST 2009


Author: kremenek
Date: Wed Dec 23 17:37:10 2009
New Revision: 92087

URL: http://llvm.org/viewvc/llvm-project?rev=92087&view=rev
Log:
Tidy up FindSubExprAssignments to not deference the child_iterator multiple times.

Modified:
    cfe/trunk/lib/Analysis/CFG.cpp

Modified: cfe/trunk/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFG.cpp?rev=92087&r1=92086&r2=92087&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFG.cpp (original)
+++ cfe/trunk/lib/Analysis/CFG.cpp Wed Dec 23 17:37:10 2009
@@ -1548,17 +1548,20 @@
   typedef llvm::DenseMap<const Stmt*,unsigned> BlkExprMapTy;
 }
 
-static void FindSubExprAssignments(Stmt* Terminator, llvm::SmallPtrSet<Expr*,50>& Set) {
-  if (!Terminator)
+static void FindSubExprAssignments(Stmt *S,
+                                   llvm::SmallPtrSet<Expr*,50>& Set) {
+  if (!S)
     return;
 
-  for (Stmt::child_iterator I=Terminator->child_begin(), E=Terminator->child_end(); I!=E; ++I) {
-    if (!*I) continue;
-
-    if (BinaryOperator* B = dyn_cast<BinaryOperator>(*I))
+  for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I) {
+    Stmt *child = *I;    
+    if (!child)
+      continue;
+    
+    if (BinaryOperator* B = dyn_cast<BinaryOperator>(child))
       if (B->isAssignmentOp()) Set.insert(B);
 
-    FindSubExprAssignments(*I, Set);
+    FindSubExprAssignments(child, Set);
   }
 }
 





More information about the cfe-commits mailing list