[cfe-commits] r68628 - /cfe/trunk/lib/AST/ParentMap.cpp

Ted Kremenek kremenek at apple.com
Wed Apr 8 11:49:36 PDT 2009


Author: kremenek
Date: Wed Apr  8 13:49:36 2009
New Revision: 68628

URL: http://llvm.org/viewvc/llvm-project?rev=68628&view=rev
Log:
Fix bug in ParentMap::isConsumedExpr. A BinaryOperator always "consumes" the
value of its subexpressions unless it is a comma (in which case it doesn't
consume the left subexpression).

Modified:
    cfe/trunk/lib/AST/ParentMap.cpp

Modified: cfe/trunk/lib/AST/ParentMap.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ParentMap.cpp?rev=68628&r1=68627&r2=68628&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ParentMap.cpp (original)
+++ cfe/trunk/lib/AST/ParentMap.cpp Wed Apr  8 13:49:36 2009
@@ -66,7 +66,9 @@
       return true;
     case Stmt::BinaryOperatorClass: {
       BinaryOperator *BE = cast<BinaryOperator>(P);
-      return BE->getOpcode()==BinaryOperator::Comma && DirectChild==BE->getLHS();
+      // If it is a comma, only the left side is consumed.
+      // If it isn't a comma, both sides are consumed.
+      return BE->getOpcode()!=BinaryOperator::Comma || DirectChild==BE->getLHS();
     }
     case Stmt::ForStmtClass:
       return DirectChild == cast<ForStmt>(P)->getCond();





More information about the cfe-commits mailing list