summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ParentMap.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-08 18:49:36 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-08 18:49:36 +0000
commitd43aaad1b1347ce7fdc2b728f735fb482bd50bdf (patch)
tree8b3b25d071fa5deffa01db2c65c7a298d38ace59 /clang/lib/AST/ParentMap.cpp
parent58a1eb0ba0e0b573e7fbe1004db30ee5423fa8a6 (diff)
downloadbcm5719-llvm-d43aaad1b1347ce7fdc2b728f735fb482bd50bdf.tar.gz
bcm5719-llvm-d43aaad1b1347ce7fdc2b728f735fb482bd50bdf.zip
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). llvm-svn: 68628
Diffstat (limited to 'clang/lib/AST/ParentMap.cpp')
-rw-r--r--clang/lib/AST/ParentMap.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp
index 877b43b6de9..33731c63ed8 100644
--- a/clang/lib/AST/ParentMap.cpp
+++ b/clang/lib/AST/ParentMap.cpp
@@ -66,7 +66,9 @@ bool ParentMap::isConsumedExpr(Expr* E) const {
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();
OpenPOWER on IntegriCloud