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

Method getVariable

lib/symboldatabase.cpp:5267–5284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5265}
5266
5267const Variable *Scope::getVariable(const std::string &varname) const
5268{
5269 auto it = std::find_if(varlist.begin(), varlist.end(), [&varname](const Variable& var) {
5270 return var.name() == varname;
5271 });
5272 if (it != varlist.end())
5273 return &*it;
5274
5275 if (definedType) {
5276 for (const Type::BaseInfo& baseInfo: definedType->derivedFrom) {
5277 if (baseInfo.type && baseInfo.type->classScope) {
5278 if (const Variable* var = baseInfo.type->classScope->getVariable(varname))
5279 return var;
5280 }
5281 }
5282 }
5283 return nullptr;
5284}
5285
5286static const Token* skipPointers(const Token* tok)
5287{

Calls 3

beginMethod · 0.45
endMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected