| 376 | |
| 377 | #define getErrorPathForX(...) getErrorPathForX_(__FILE__, __LINE__, __VA_ARGS__) |
| 378 | std::string getErrorPathForX_(const char* file, int line, const char code[], unsigned int linenr) { |
| 379 | // Tokenize.. |
| 380 | SimpleTokenizer tokenizer(settings, *this); |
| 381 | ASSERT_LOC(tokenizer.tokenize(code), file, line); |
| 382 | |
| 383 | for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) { |
| 384 | if (tok->str() != "x" || tok->linenr() != linenr) |
| 385 | continue; |
| 386 | |
| 387 | std::ostringstream ostr; |
| 388 | for (const ValueFlow::Value &v : tok->values()) { |
| 389 | for (const ErrorPathItem &ep : v.errorPath) { |
| 390 | const Token *eptok = ep.first; |
| 391 | const std::string &msg = ep.second; |
| 392 | ostr << eptok->linenr() << ',' << msg << '\n'; |
| 393 | } |
| 394 | } |
| 395 | return ostr.str(); |
| 396 | } |
| 397 | |
| 398 | return ""; |
| 399 | } |
| 400 | |
| 401 | bool testValueOfX_(const char* file, int line, const char code[], unsigned int linenr, const char value[], ValueFlow::Value::ValueType type) { |
| 402 | // Tokenize.. |