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

Function createArrayChildrenDefs

addons/misra_9.py:456–472  ·  view source on GitHub ↗
(ed, token, var, rawTokens = None)

Source from the content-addressed store, hash-verified

454 return ed
455
456def createArrayChildrenDefs(ed, token, var, rawTokens = None):
457 if token and token.str == '[':
458 if rawTokens is not None:
459 foundToken = next((rawToken for rawToken in rawTokens
460 if rawToken.file == token.file
461 and rawToken.linenr == token.linenr
462 and rawToken.column == token.column
463 ), None)
464
465 if foundToken and foundToken.next and foundToken.next.str == ']':
466 ed.markAsFlexibleArray(token)
467
468 if (token.astOperand2 is not None) and (token.astOperand2.getKnownIntValue() is not None):
469 for i in range(token.astOperand2.getKnownIntValue()):
470 createChild(ed, token, i, var)
471 else:
472 ed.markAsFlexibleArray(token)
473
474
475def createChild(ed, token, name, var):

Callers 2

getElementDefFunction · 0.85
createChildFunction · 0.85

Calls 4

nextFunction · 0.85
createChildFunction · 0.85
markAsFlexibleArrayMethod · 0.80
getKnownIntValueMethod · 0.80

Tested by

no test coverage detected