| 419 | } |
| 420 | |
| 421 | Action isGlobalModified(const Token* tok) const |
| 422 | { |
| 423 | if (tok->function()) { |
| 424 | if (!tok->function()->isConstexpr() && !isConstFunctionCall(tok, getSettings().library)) |
| 425 | return Action::Invalid; |
| 426 | } else if (getSettings().library.getFunction(tok)) { |
| 427 | // Assume library function doesn't modify user-global variables |
| 428 | return Action::None; |
| 429 | } else if (Token::simpleMatch(tok->astParent(), ".") && astIsContainer(tok->astParent()->astOperand1())) { |
| 430 | // Assume container member function doesn't modify user-global variables |
| 431 | return Action::None; |
| 432 | } else if (tok->tokType() == Token::eType && astIsPrimitive(tok->next())) { |
| 433 | // Function cast does not modify global variables |
| 434 | return Action::None; |
| 435 | } else if (!tok->isKeyword() && Token::Match(tok, "%name% (")) { |
| 436 | return Action::Invalid; |
| 437 | } |
| 438 | return Action::None; |
| 439 | } |
| 440 | |
| 441 | static const std::string& invertAssign(const std::string& assign) |
| 442 | { |
no test coverage detected