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

Function getFunctionForArgumentvariable

lib/symboldatabase.cpp:2172–2186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2170
2171namespace {
2172 const Function* getFunctionForArgumentvariable(const Variable * const var)
2173 {
2174 if (const Scope* scope = var->nameToken()->scope()) {
2175 auto it = std::find_if(scope->functionList.begin(), scope->functionList.end(), [&](const Function& function) {
2176 for (nonneg int arg = 0; arg < function.argCount(); ++arg) {
2177 if (var == function.getArgumentVar(arg))
2178 return true;
2179 }
2180 return false;
2181 });
2182 if (it != scope->functionList.end())
2183 return &*it;
2184 }
2185 return nullptr;
2186 }
2187}
2188
2189void SymbolDatabase::validateVariables() const

Callers 1

validateVariablesMethod · 0.85

Calls 5

scopeMethod · 0.80
getArgumentVarMethod · 0.80
nameTokenMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected