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

Function isReturnedByRef

lib/checkunusedvar.cpp:1166–1174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164}
1165
1166static bool isReturnedByRef(const Variable* var, const Function* func)
1167{
1168 if (!func || !Function::returnsReference(func, true))
1169 return false;
1170 const std::vector<const Token*> returns = Function::findReturns(func);
1171 return std::any_of(returns.begin(), returns.end(), [var](const Token* tok) {
1172 return tok->varId() == var->declarationId();
1173 });
1174}
1175
1176void CheckUnusedVarImpl::checkFunctionVariableUsage()
1177{

Callers 1

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected