C++: Allow multiple results in getValue

This commit is contained in:
Mathias Vorreiter Pedersen
2020-03-10 09:50:28 +01:00
parent 1a5282ae21
commit 8b467eb9a7

View File

@@ -96,7 +96,7 @@ private float wideningUpperBounds(ArithmeticType t) {
* This predicate also handles the case of constant variables initialized in compilation units,
* which doesn't necessarily have a getValue() result from the extractor.
*/
private string getValue0(Expr e) {
private string getValue(Expr e) {
if exists(e.getValue())
then result = e.getValue()
else
@@ -104,15 +104,10 @@ private string getValue0(Expr e) {
e = access and
v = access.getTarget() and
v.getUnderlyingType().isConst() and
result = getValue0(v.getAnAssignedValue())
result = getValue(v.getAnAssignedValue())
)
}
private string getValue(Expr e) {
result = min(getValue0(e)) and
result = max(getValue0(e))
}
/** Set of expressions which we know how to analyze. */
private predicate analyzableExpr(Expr e) {
// The type of the expression must be arithmetic. We reuse the logic in