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

Function isDeadScope

lib/checkautovariables.cpp:462–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460}
461
462static bool isDeadScope(const Token * tok, const Scope * scope)
463{
464 if (!tok)
465 return false;
466 if (!scope)
467 return false;
468 const Variable * var = tok->variable();
469 if (var && (!var->isLocal() || var->isStatic() || var->isExtern()))
470 return false;
471 if (tok->scope() && tok->scope()->bodyEnd != scope->bodyEnd && precedes(tok->scope()->bodyEnd, scope->bodyEnd))
472 return true;
473 return false;
474}
475
476static int getPointerDepth(const Token *tok)
477{

Callers 1

checkVarLifetimeScopeMethod · 0.85

Calls 3

precedesFunction · 0.85
variableMethod · 0.80
scopeMethod · 0.80

Tested by

no test coverage detected