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

Function isConstantExpression

addons/misra.py:1052–1063  ·  view source on GitHub ↗
(expr)

Source from the content-addressed store, hash-verified

1050
1051
1052def isConstantExpression(expr):
1053 if expr.isNumber:
1054 return True
1055 if expr.isName and not isEnumConstant(expr):
1056 return False
1057 if simpleMatch(expr.previous, 'sizeof ('):
1058 return True
1059 if expr.astOperand1 and not isConstantExpression(expr.astOperand1):
1060 return False
1061 if expr.astOperand2 and not isConstantExpression(expr.astOperand2):
1062 return False
1063 return True
1064
1065def isUnknownConstantExpression(expr):
1066 if expr.isName and not isEnumConstant(expr) and expr.variable is None:

Callers 1

misra_18_8Method · 0.85

Calls 2

isEnumConstantFunction · 0.85
simpleMatchFunction · 0.70

Tested by

no test coverage detected