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

Function fillProgramMemoryFromConditions

lib/programmemory.cpp:401–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401static void fillProgramMemoryFromConditions(ProgramMemory& pm, const Scope* scope, const Token* endTok, const Settings& settings)
402{
403 if (!scope)
404 return;
405 if (!scope->isLocal())
406 return;
407 assert(scope != scope->nestedIn);
408 fillProgramMemoryFromConditions(pm, scope->nestedIn, endTok, settings);
409 if (scope->type == ScopeType::eIf || scope->type == ScopeType::eWhile || scope->type == ScopeType::eElse || scope->type == ScopeType::eFor) {
410 const Token* condTok = getCondTokFromEnd(scope->bodyEnd);
411 if (!condTok)
412 return;
413 MathLib::bigint result = 0;
414 bool error = false;
415 execute(condTok, pm, &result, &error, settings);
416 if (error)
417 programMemoryParseCondition(pm, condTok, endTok, settings, scope->type != ScopeType::eElse);
418 }
419}
420
421static void fillProgramMemoryFromConditions(ProgramMemory& pm, const Token* tok, const Settings& settings)
422{

Callers 3

getInitialProgramStateFunction · 0.85
addStateMethod · 0.85
getProgramMemoryFunction · 0.85

Calls 4

getCondTokFromEndFunction · 0.85
executeFunction · 0.85
scopeMethod · 0.80

Tested by

no test coverage detected