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

Function getLHSVariableRecursive

lib/astutils.cpp:3602–3615  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3600}
3601
3602static const Token* getLHSVariableRecursive(const Token* tok)
3603{
3604 if (!tok)
3605 return nullptr;
3606 if (Token::Match(tok, "*|&|&&|[")) {
3607 const Token* vartok = getLHSVariableRecursive(tok->astOperand1());
3608 if ((vartok && vartok->variable()) || Token::simpleMatch(tok, "["))
3609 return vartok;
3610 return getLHSVariableRecursive(tok->astOperand2());
3611 }
3612 if (Token::Match(tok->previous(), "this . %var%"))
3613 return tok->next();
3614 return tok;
3615}
3616
3617const Variable *getLHSVariable(const Token *tok)
3618{

Callers 2

getLHSVariableFunction · 0.85
getLHSVariableTokenFunction · 0.85

Calls 5

astOperand1Method · 0.80
variableMethod · 0.80
astOperand2Method · 0.80
nextMethod · 0.80
simpleMatchFunction · 0.70

Tested by

no test coverage detected