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

Method assume

lib/programmemory.cpp:550–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550void ProgramMemoryState::assume(const Token* tok, bool b, bool isEmpty)
551{
552 ProgramMemory pm = state;
553 if (isEmpty)
554 pm.setContainerSizeValue(tok, 0, b);
555 else
556 programMemoryParseCondition(pm, tok, nullptr, settings, b);
557 const Token* origin = tok;
558 const Token* top = tok->astTop();
559 if (Token::Match(top->previous(), "for|while|if (") && !Token::simpleMatch(tok->astParent(), "?")) {
560 origin = top->link()->next();
561 if (!b && origin->link()) {
562 origin = origin->link();
563 }
564 }
565 replace(std::move(pm), origin);
566}
567
568void ProgramMemoryState::removeModifiedVars(const Token* tok)
569{

Callers 4

assumeFunction · 0.80
traverseMethod · 0.80
updateLoopFunction · 0.80
updateRangeFunction · 0.80

Calls 7

replaceFunction · 0.85
setContainerSizeValueMethod · 0.80
astTopMethod · 0.80
astParentMethod · 0.80
nextMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected