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

Function getConditions

lib/valueflow.cpp:3350–3366  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3348}
3349
3350static std::vector<const Token*> getConditions(const Token* tok, const char* op)
3351{
3352 std::vector<const Token*> conds = {tok};
3353 if (tok->str() == op) {
3354 std::vector<const Token*> args = astFlatten(tok, op);
3355 std::copy_if(args.cbegin(), args.cend(), std::back_inserter(conds), [&](const Token* tok2) {
3356 if (tok2->exprId() == 0)
3357 return false;
3358 if (tok2->hasKnownIntValue())
3359 return false;
3360 if (Token::Match(tok2, "%var%|.") && !astIsBool(tok2))
3361 return false;
3362 return true;
3363 });
3364 }
3365 return conds;
3366}
3367
3368static bool isBreakOrContinueScope(const Token* endToken)
3369{

Callers 1

Calls 4

astFlattenFunction · 0.85
astIsBoolFunction · 0.85
strMethod · 0.45
hasKnownIntValueMethod · 0.45

Tested by

no test coverage detected