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

Function isBasicForLoop

lib/programmemory.cpp:322–338  ·  view source on GitHub ↗

If the scope is a non-range for loop

Source from the content-addressed store, hash-verified

320
321// If the scope is a non-range for loop
322static bool isBasicForLoop(const Token* tok)
323{
324 if (!tok)
325 return false;
326 if (Token::simpleMatch(tok, "}"))
327 return isBasicForLoop(tok->link());
328 if (!Token::simpleMatch(tok->previous(), ") {"))
329 return false;
330 const Token* start = tok->linkAt(-1);
331 if (!start)
332 return false;
333 if (!Token::simpleMatch(start->previous(), "for ("))
334 return false;
335 if (!Token::simpleMatch(start->astOperand2(), ";"))
336 return false;
337 return true;
338}
339
340static void programMemoryParseCondition(ProgramMemory& pm, const Token* tok, const Token* endTok, const Settings& settings, bool then)
341{

Callers 1

Calls 3

linkAtMethod · 0.80
astOperand2Method · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected