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

Function is_variable_changed

addons/misra.py:880–891  ·  view source on GitHub ↗

Check if variable is updated between body_start and body_end

(start_token, end_token, var)

Source from the content-addressed store, hash-verified

878
879
880def is_variable_changed(start_token, end_token, var):
881 """Check if variable is updated between body_start and body_end"""
882 tok = start_token
883 while tok != end_token:
884 if tok.isAssignmentOp:
885 vartok = tok.astOperand1
886 while vartok.astOperand1:
887 vartok = vartok.astOperand1
888 if vartok and vartok.variable == var:
889 return True
890 tok = tok.next
891 return False
892
893def getForLoopCounterVariables(forToken, cfg):
894 """ Return a set of Variable objects defined in ``for`` statement and

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected