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

Method forEach

lib/valueflow.cpp:2066–2084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2064
2065 template<class F>
2066 static void forEach(const TokenList& tokenlist,
2067 ErrorLogger& errorLogger,
2068 const Settings& settings,
2069 const std::vector<const Token*>& argtoks,
2070 const std::string& message,
2071 ValueFlow::Value::LifetimeKind type,
2072 F f) {
2073 std::set<Token*> forwardToks;
2074 for (const Token* arg : argtoks) {
2075 LifetimeStore ls{arg, message, type};
2076 ls.forward = false;
2077 f(ls);
2078 if (ls.forwardTok)
2079 forwardToks.emplace(ls.forwardTok);
2080 }
2081 for (auto* tok : forwardToks) {
2082 valueFlowForwardLifetime(tok, tokenlist, errorLogger, settings);
2083 }
2084 }
2085
2086 static LifetimeStore fromFunctionArg(const Function * f, const Token *tok, const Variable *var, const TokenList &tokenlist, const Settings& settings, ErrorLogger &errorLogger) {
2087 if (!var)

Callers

nothing calls this directly

Calls 2

valueFlowForwardLifetimeFunction · 0.85
fFunction · 0.50

Tested by

no test coverage detected