C++: rename effectivelyConstant to likelySmall

This reflects the existing QLDoc better and makes it more clear why it
includes char-typed expressions.
This commit is contained in:
Jonas Jensen
2018-09-24 14:31:19 +02:00
parent 4d2e4c53f1
commit a56376a2df

View File

@@ -27,13 +27,13 @@ import semmle.code.cpp.controlflow.SSA
* In these cases the value of `e` is likely to be small and
* controlled, so we consider it less likely to cause an overflow.
*/
predicate effectivelyConstant(Expr e) {
predicate likelySmall(Expr e) {
e.isConstant() or
e.getType().getSize() <= 1 or
e.(ArrayExpr).getArrayBase().getType().(ArrayType).getBaseType().isConst() or
exists(SsaDefinition def, Variable v |
def.getAUse(v) = e and
effectivelyConstant(def.getDefiningValue(v))
likelySmall(def.getDefiningValue(v))
)
}
@@ -58,7 +58,7 @@ int getEffectiveMulOperands(MulExpr me) {
result = count(Expr op |
op = getMulOperand*(me) and
not op instanceof MulExpr and
not effectivelyConstant(op)
not likelySmall(op)
)
}