| 644 | } |
| 645 | |
| 646 | Action analyze(const Token* tok, Direction d) const override { |
| 647 | if (invalid()) |
| 648 | return Action::Invalid; |
| 649 | // Follow references |
| 650 | // TODO: avoid copy |
| 651 | auto refs = tok->refs(); |
| 652 | const bool inconclusiveRefs = refs.size() != 1; |
| 653 | if (std::none_of(refs.cbegin(), refs.cend(), [&](const ReferenceToken& ref) { |
| 654 | return tok == ref.token; |
| 655 | })) |
| 656 | refs.emplace_back(ReferenceToken{tok, {}}); |
| 657 | for (const ReferenceToken& ref:refs) { |
| 658 | Action a = analyzeToken(ref.token, tok, d, inconclusiveRefs && ref.token != tok); |
| 659 | if (internalMatch(ref.token)) |
| 660 | a |= Action::Internal; |
| 661 | if (a != Action::None) |
| 662 | return a; |
| 663 | } |
| 664 | if (dependsOnThis() && exprDependsOnThis(tok, !isClassVariable())) |
| 665 | return isThisModified(tok); |
| 666 | |
| 667 | // bailout: global non-const variables |
| 668 | if (isGlobal() && !dependsOnThis() && Token::Match(tok, "%name% (") && !tok->variable() && |
| 669 | !Token::simpleMatch(tok->linkAt(1), ") {")) { |
| 670 | return isGlobalModified(tok); |
| 671 | } |
| 672 | return Action::None; |
| 673 | } |
| 674 | |
| 675 | template<class F> |
| 676 | std::vector<MathLib::bigint> evaluateInt(const Token* tok, F getProgramMemoryFunc) const |
no test coverage detected