[cfe-commits] r46376 - /cfe/trunk/AST/CFG.cpp

Ted Kremenek kremenek at apple.com
Fri Jan 25 15:22:28 PST 2008


Author: kremenek
Date: Fri Jan 25 17:22:27 2008
New Revision: 46376

URL: http://llvm.org/viewvc/llvm-project?rev=46376&view=rev
Log:
Reverting r46361 (http://llvm.org/viewvc/llvm-project?rev=46361&view=rev) until
I diagnose the source of the failures it causes in the test suite.

Modified:
    cfe/trunk/AST/CFG.cpp

Modified: cfe/trunk/AST/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/CFG.cpp?rev=46376&r1=46375&r2=46376&view=diff

==============================================================================
--- cfe/trunk/AST/CFG.cpp (original)
+++ cfe/trunk/AST/CFG.cpp Fri Jan 25 17:22:27 2008
@@ -991,53 +991,26 @@
   typedef llvm::DenseMap<const Stmt*,unsigned> BlkExprMapTy;
 }
 
-static void FindSubExprAssignments(Stmt* S, llvm::SmallPtrSet<Expr*,50>& Set) {
-  for (Stmt::child_iterator I=S->child_begin(), E=S->child_end(); I!=E; ++I) {
-    if (BinaryOperator* B = dyn_cast<BinaryOperator>(*I))
-      if (B->isAssignmentOp()) Set.insert(B);
-    
-    FindSubExprAssignments(*I, Set);
-  }
-}
-
 static BlkExprMapTy* PopulateBlkExprMap(CFG& cfg) {
   BlkExprMapTy* M = new BlkExprMapTy();
   
-  // Look for assignments that are used as subexpressions.  These are the
-  // only assignments that we want to register as a block-level expression.
-  llvm::SmallPtrSet<Expr*,50> SubExprAssignments;
-  
   for (CFG::iterator I=cfg.begin(), E=cfg.end(); I != E; ++I)
     for (CFGBlock::iterator BI=I->begin(), EI=I->end(); BI != EI; ++BI)
-      FindSubExprAssignments(*BI, SubExprAssignments);
+      if (const Expr* E = dyn_cast<Expr>(*BI)) {
+        unsigned x = M->size();
+        (*M)[E] = x;
 
-  // Iterate over the statements again on identify the Expr* and Stmt* at
-  // the block-level that are block-level expressions.
-  for (CFG::iterator I=cfg.begin(), E=cfg.end(); I != E; ++I)
-    for (CFGBlock::iterator BI=I->begin(), EI=I->end(); BI != EI; ++BI)
-      if (Expr* E = dyn_cast<Expr>(*BI)) {
-        
-        if (BinaryOperator* B = dyn_cast<BinaryOperator>(E)) {
-          // Assignment expressions that are not nested within another
-          // expression are really "statements" whose value is never
-          // used by another expression.
-          if (B->isAssignmentOp() && !SubExprAssignments.count(E))
-            continue;
-        }
-        else if (const StmtExpr* S = dyn_cast<StmtExpr>(E)) {
-          // Special handling for statement expressions.  The last statement
-          // in the statement expression is also a block-level expr.
+        // Special handling for statement expressions.  The last statement
+        // in the statement expression is also a block-level expr.
+        if (const StmtExpr* S = dyn_cast<StmtExpr>(E)) {
           const CompoundStmt* C = S->getSubStmt();
           if (!C->body_empty()) {
-            unsigned x = M->size();
+            x = M->size();
             (*M)[C->body_back()] = x;
           }
         }
-
-        unsigned x = M->size();
-        (*M)[E] = x;
       }
-    
+
   return M;
 }
 





More information about the cfe-commits mailing list