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

Function makeConditionValue

lib/valueflow.cpp:3327–3348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3325}
3326
3327static ValueFlow::Value makeConditionValue(long long val,
3328 const Token* condTok,
3329 bool assume,
3330 bool impossible,
3331 const Settings& settings,
3332 SourceLocation loc = SourceLocation::current())
3333{
3334 ValueFlow::Value v(val);
3335 v.setKnown();
3336 if (impossible) {
3337 v.intvalue = !v.intvalue;
3338 v.setImpossible();
3339 }
3340 v.condition = condTok;
3341 if (assume)
3342 v.errorPath.emplace_back(condTok, "Assuming condition '" + condTok->expressionString() + "' is true");
3343 else
3344 v.errorPath.emplace_back(condTok, "Assuming condition '" + condTok->expressionString() + "' is false");
3345 if (settings.debugnormal)
3346 setSourceLocation(v, loc, condTok);
3347 return v;
3348}
3349
3350static std::vector<const Token*> getConditions(const Token* tok, const char* op)
3351{

Callers 1

Calls 2

setSourceLocationFunction · 0.85
expressionStringMethod · 0.45

Tested by

no test coverage detected