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

Function pruneConditions

lib/programmemory.cpp:1297–1313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1295}
1296
1297static void pruneConditions(std::vector<const Token*>& conds,
1298 bool b,
1299 const std::unordered_map<nonneg int, ValueFlow::Value>& state)
1300{
1301 conds.erase(std::remove_if(conds.begin(),
1302 conds.end(),
1303 [&](const Token* cond) {
1304 if (cond->exprId() == 0)
1305 return false;
1306 auto it = state.find(cond->exprId());
1307 if (it == state.end())
1308 return false;
1309 const ValueFlow::Value& v = it->second;
1310 return isTrueOrFalse(v, !b);
1311 }),
1312 conds.end());
1313}
1314
1315namespace {
1316 struct Executor {

Callers 1

executeMultiConditionMethod · 0.85

Calls 5

isTrueOrFalseFunction · 0.85
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected