Skip to content

Commit 8b467eb

Browse files
committed
C++: Allow multiple results in getValue
1 parent 1a5282a commit 8b467eb

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

cpp/ql/src/semmle/code/cpp/rangeanalysis/SimpleRangeAnalysis.qll

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,18 @@ private float wideningUpperBounds(ArithmeticType t) {
9696
* This predicate also handles the case of constant variables initialized in compilation units,
9797
* which doesn't necessarily have a getValue() result from the extractor.
9898
*/
99-
private string getValue0(Expr e) {
99+
private string getValue(Expr e) {
100100
if exists(e.getValue())
101101
then result = e.getValue()
102102
else
103103
exists(VariableAccess access, Variable v |
104104
e = access and
105105
v = access.getTarget() and
106106
v.getUnderlyingType().isConst() and
107-
result = getValue0(v.getAnAssignedValue())
107+
result = getValue(v.getAnAssignedValue())
108108
)
109109
}
110110

111-
private string getValue(Expr e) {
112-
result = min(getValue0(e)) and
113-
result = max(getValue0(e))
114-
}
115-
116111
/** Set of expressions which we know how to analyze. */
117112
private predicate analyzableExpr(Expr e) {
118113
// The type of the expression must be arithmetic. We reuse the logic in

0 commit comments

Comments
 (0)