MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isOppositeExpression

Function isOppositeExpression

lib/astutils.cpp:2026–2037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2024}
2025
2026bool isOppositeExpression(const Token * const tok1, const Token * const tok2, const Settings& settings, bool pure, bool followVar, ErrorPath* errors)
2027{
2028 if (!tok1 || !tok2)
2029 return false;
2030 if (isOppositeCond(true, tok1, tok2, settings, pure, followVar, errors))
2031 return true;
2032 if (tok1->isUnaryOp("-") && !(tok2->astParent() && tok2->astParent()->tokType() == Token::eBitOp))
2033 return isSameExpression(true, tok1->astOperand1(), tok2, settings, pure, followVar, errors);
2034 if (tok2->isUnaryOp("-") && !(tok2->astParent() && tok2->astParent()->tokType() == Token::eBitOp))
2035 return isSameExpression(true, tok2->astOperand1(), tok1, settings, pure, followVar, errors);
2036 return false;
2037}
2038
2039static bool functionModifiesArguments(const Function* f)
2040{

Callers 1

Calls 5

isOppositeCondFunction · 0.85
isSameExpressionFunction · 0.85
isUnaryOpMethod · 0.80
astParentMethod · 0.80
astOperand1Method · 0.80

Tested by

no test coverage detected