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

Function isStructuredBindingVariable

lib/astutils.cpp:1176–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1174}
1175
1176bool isStructuredBindingVariable(const Variable* var)
1177{
1178 if (!var || var->isArray())
1179 return false;
1180 const Token* tok = var->nameToken();
1181 while (tok && Token::Match(tok->astParent(), "[|,|:"))
1182 tok = tok->astParent();
1183 return tok && (tok->str() == "[" || Token::simpleMatch(tok->previous(), "] :")); // TODO: remove workaround when #11105 is fixed
1184}
1185
1186/// This takes a token that refers to a variable and it will return the token
1187/// to the expression that the variable is assigned to. If its not valid to

Callers 5

checkVariableScopeMethod · 0.85
checkConstVariableMethod · 0.85
followVariableExpressionFunction · 0.85

Calls 5

isArrayMethod · 0.80
astParentMethod · 0.80
simpleMatchFunction · 0.70
nameTokenMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected