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

Function isWithinScope

lib/astutils.cpp:2328–2339  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2326}
2327
2328bool isWithinScope(const Token* tok, const Variable* var, ScopeType type)
2329{
2330 if (!tok || !var)
2331 return false;
2332 const Scope* scope = tok->scope();
2333 while (scope && scope != var->scope()) {
2334 if (scope->type == type)
2335 return true;
2336 scope = scope->nestedIn;
2337 }
2338 return false;
2339}
2340
2341bool isVariableChangedByFunctionCall(const Token *tok, int indirect, nonneg int varid, const Settings &settings, bool *inconclusive)
2342{

Callers 2

checkStructVariableMethod · 0.85
checkVariableScopeMethod · 0.85

Calls 1

scopeMethod · 0.80

Tested by

no test coverage detected