MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / lifetimeValues_

Method lifetimeValues_

test/testvalueflow.cpp:521–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 3

tokenizeMethod · 0.80
push_backMethod · 0.45
expressionStringMethod · 0.45

Tested by

no test coverage detected