| 519 | #define lifetimeValues(...) lifetimeValues_(__FILE__, __LINE__, __VA_ARGS__) |
| 520 | template<size_t size> |
| 521 | std::vector<std::string> lifetimeValues_(const char* file, int line, const char (&code)[size], const char tokstr[]) { |
| 522 | std::vector<std::string> result; |
| 523 | SimpleTokenizer tokenizer(settings, *this); |
| 524 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 525 | const Token *tok = Token::findmatch(tokenizer.tokens(), tokstr); |
| 526 | if (!tok) |
| 527 | return result; |
| 528 | for (const ValueFlow::Value& value:tok->values()) { |
| 529 | if (!value.isLifetimeValue()) |
| 530 | continue; |
| 531 | if (!value.tokvalue) |
| 532 | continue; |
| 533 | result.push_back(value.tokvalue->expressionString()); |
| 534 | } |
| 535 | return result; |
| 536 | } |
| 537 | |
| 538 | #define valueOfTok(...) valueOfTok_(__FILE__, __LINE__, __VA_ARGS__) |
| 539 | ValueFlow::Value valueOfTok_(const char* file, int line, const char code[], const char tokstr[], const Settings *s = nullptr, bool cpp = true) { |
nothing calls this directly
no test coverage detected