diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp index 877b43b6de92..33731c63ed89 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(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(P)->getCond();