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

Function useFunctionArgs

lib/checkunusedvar.cpp:683–697  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

681}
682
683static void useFunctionArgs(const Token *tok, Variables& variables)
684{
685 // TODO: Match function args to see if they are const or not. Assume that const data is not written.
686 if (!tok)
687 return;
688 if (tok->str() == ",") {
689 useFunctionArgs(tok->astOperand1(), variables);
690 useFunctionArgs(tok->astOperand2(), variables);
691 } else if (Token::Match(tok, "[+:]") && (!tok->valueType() || tok->valueType()->pointer)) {
692 useFunctionArgs(tok->astOperand1(), variables);
693 useFunctionArgs(tok->astOperand2(), variables);
694 } else if (tok->variable() && tok->variable()->isArray()) {
695 variables.use(tok->varId(), tok);
696 }
697}
698
699//---------------------------------------------------------------------------
700// Usage of function variables

Calls 6

astOperand1Method · 0.80
astOperand2Method · 0.80
variableMethod · 0.80
isArrayMethod · 0.80
strMethod · 0.45
useMethod · 0.45

Tested by

no test coverage detected