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

Method hasOperand

lib/fwdanalysis.cpp:488–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

486}
487
488bool FwdAnalysis::hasOperand(const Token *tok, const Token *lhs) const
489{
490 if (!tok)
491 return false;
492 std::deque<const Token*> nodes{ tok };
493 while (!nodes.empty()) {
494 const Token* node = nodes.front();
495 if (isSameExpression(false, node, lhs, mSettings, false, false, nullptr))
496 return true;
497 if (node->astOperand1())
498 nodes.emplace_back(node->astOperand1());
499 if (node->astOperand2())
500 nodes.emplace_back(node->astOperand2());
501 nodes.pop_front();
502 }
503 return false;
504}
505
506const Token *FwdAnalysis::reassign(const Token *expr, const Token *startToken, const Token *endToken)
507{

Callers 1

Calls 5

isSameExpressionFunction · 0.85
frontMethod · 0.80
astOperand1Method · 0.80
astOperand2Method · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected