| 419 | #define testLifetimeOfX(...) testLifetimeOfX_(__FILE__, __LINE__, __VA_ARGS__) |
| 420 | template<size_t size> |
| 421 | bool testLifetimeOfX_(const char* file, int line, const char (&code)[size], unsigned int linenr, const char value[]) { |
| 422 | // Tokenize.. |
| 423 | SimpleTokenizer tokenizer(settings, *this); |
| 424 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 425 | |
| 426 | const std::size_t len = strlen(value); |
| 427 | for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) { |
| 428 | if (tok->str() == "x" && tok->linenr() == linenr) { |
| 429 | if (std::any_of(tok->values().cbegin(), tok->values().cend(), [&](const ValueFlow::Value& v) { |
| 430 | return v.isLifetimeValue() && v.lifetimeScope == ValueFlow::Value::LifetimeScope::Local && Token::simpleMatch(v.tokvalue, value, len); |
| 431 | })) |
| 432 | return true; |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | return false; |
| 437 | } |
| 438 | |
| 439 | bool testValueOfX_(const char* file, int line, const char code[], unsigned int linenr, int value, ValueFlow::Value::ValueType type) { |
| 440 | // Tokenize.. |
nothing calls this directly
no test coverage detected