| 3837 | } |
| 3838 | |
| 3839 | static bool checkEvaluationOrderCpp17(const Token * tok, const Token * tok2, const Token * parent, const Settings & settings, bool & foundUnspecified) |
| 3840 | { |
| 3841 | if (tok->isAssignmentOp()) |
| 3842 | return false; |
| 3843 | bool foundUndefined{false}; |
| 3844 | visitAstNodes((parent->astOperand1() != tok2) ? parent->astOperand1() : parent->astOperand2(), [&](const Token *tok3) { |
| 3845 | if (tok3->str() == "&" && !tok3->astOperand2()) |
| 3846 | return ChildrenToVisit::none; // don't handle address-of for now |
| 3847 | if (tok3->str() == "(" && Token::simpleMatch(tok3->previous(), "sizeof")) |
| 3848 | return ChildrenToVisit::none; // don't care about sizeof usage |
| 3849 | if (isSameExpression(false, tok->astOperand1(), tok3, settings, true, false) && parent->isArithmeticalOp() && parent->isBinaryOp()) |
| 3850 | foundUndefined = true; |
| 3851 | if (tok3->tokType() == Token::eIncDecOp && isSameExpression(false, tok->astOperand1(), tok3->astOperand1(), settings, true, false)) { |
| 3852 | if (parent->isArithmeticalOp() && parent->isBinaryOp()) |
| 3853 | foundUndefined = true; |
| 3854 | else |
| 3855 | foundUnspecified = true; |
| 3856 | } |
| 3857 | return (foundUndefined || foundUnspecified) ? ChildrenToVisit::done : ChildrenToVisit::op1_and_op2; |
| 3858 | }); |
| 3859 | |
| 3860 | return foundUndefined || foundUnspecified; |
| 3861 | } |
| 3862 | |
| 3863 | void CheckOtherImpl::checkEvaluationOrder() |
| 3864 | { |
no test coverage detected