aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/formal/SMTChecker.h
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-10-05 21:23:25 +0800
committerchriseth <chris@ethereum.org>2017-11-30 08:20:21 +0800
commit19e067465a058ca9f40238cb3a928a1113531c9d (patch)
tree6b4f83892d5fd76194bd3794669cc59f02e86d37 /libsolidity/formal/SMTChecker.h
parentffb3a3c06c4d436aaf03efccf31301b472cd8137 (diff)
downloaddexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar.gz
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar.bz2
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar.lz
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar.xz
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.tar.zst
dexon-solidity-19e067465a058ca9f40238cb3a928a1113531c9d.zip
Unary operators and division.
Diffstat (limited to 'libsolidity/formal/SMTChecker.h')
-rw-r--r--libsolidity/formal/SMTChecker.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/libsolidity/formal/SMTChecker.h b/libsolidity/formal/SMTChecker.h
index 8e07d74d..cc3aca81 100644
--- a/libsolidity/formal/SMTChecker.h
+++ b/libsolidity/formal/SMTChecker.h
@@ -57,6 +57,7 @@ private:
virtual void endVisit(ExpressionStatement const& _node) override;
virtual void endVisit(Assignment const& _node) override;
virtual void endVisit(TupleExpression const& _node) override;
+ virtual void endVisit(UnaryOperation const& _node) override;
virtual void endVisit(BinaryOperation const& _node) override;
virtual void endVisit(FunctionCall const& _node) override;
virtual void endVisit(Identifier const& _node) override;
@@ -66,7 +67,8 @@ private:
void compareOperation(BinaryOperation const& _op);
void booleanOperation(BinaryOperation const& _op);
- void assignment(Declaration const& _variable, Expression const& _value);
+ void assignment(Declaration const& _variable, Expression const& _value, SourceLocation const& _location);
+ void assignment(Declaration const& _variable, smt::Expression const& _value, SourceLocation const& _location);
// Visits the branch given by the statement, pushes and pops the SMT checker.
// @param _condition if present, asserts that this condition is true within the branch.
@@ -88,6 +90,9 @@ private:
Expression const& _condition,
std::string const& _description
);
+ /// Checks that the value is in the range given by the type.
+ void checkUnderOverflow(smt::Expression _value, IntegerType const& _Type, SourceLocation const& _location);
+
std::pair<smt::CheckResult, std::vector<std::string>>
checkSatisifableAndGenerateModel(std::vector<smt::Expression> const& _expressionsToEvaluate);
@@ -126,9 +131,12 @@ private:
using VariableSequenceCounters = std::map<Declaration const*, int>;
- /// Returns the expression corresponding to the AST node. Creates a new expression
- /// if it does not exist yet.
+ /// Returns the expression corresponding to the AST node. Throws if the expression does not exist.
smt::Expression expr(Expression const& _e);
+ /// Creates the expression (value can be arbitrary)
+ void createExpr(Expression const& _e);
+ /// Creates the expression and sets its value.
+ void defineExpr(Expression const& _e, smt::Expression _value);
/// Returns the function declaration corresponding to the given variable.
/// The function takes one argument which is the "sequence number".
smt::Expression var(Declaration const& _decl);