diff options
author | Leonardo Alt <leo@ethereum.org> | 2018-10-15 23:32:17 +0800 |
---|---|---|
committer | Leonardo Alt <leo@ethereum.org> | 2018-10-17 21:58:13 +0800 |
commit | ec39fdcb3c6b3d5eb07ea6768fb3926fe54dc47e (patch) | |
tree | 01b86486f2cf8554d236a1b02cf728e9342bfb0a /libsolidity/formal/SymbolicVariable.h | |
parent | af3300b86caee20efe9df4b75800f73d8f027a85 (diff) | |
download | dexon-solidity-ec39fdcb3c6b3d5eb07ea6768fb3926fe54dc47e.tar.gz dexon-solidity-ec39fdcb3c6b3d5eb07ea6768fb3926fe54dc47e.tar.zst dexon-solidity-ec39fdcb3c6b3d5eb07ea6768fb3926fe54dc47e.zip |
[SMTChecker] Refactoring types
Diffstat (limited to 'libsolidity/formal/SymbolicVariable.h')
-rw-r--r-- | libsolidity/formal/SymbolicVariable.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/libsolidity/formal/SymbolicVariable.h b/libsolidity/formal/SymbolicVariable.h index 977515f8..9ed5ce01 100644 --- a/libsolidity/formal/SymbolicVariable.h +++ b/libsolidity/formal/SymbolicVariable.h @@ -17,6 +17,8 @@ #pragma once +#include <libsolidity/formal/SSAVariable.h> + #include <libsolidity/formal/SolverInterface.h> #include <libsolidity/ast/Types.h> @@ -43,25 +45,35 @@ public: ); virtual ~SymbolicVariable() = default; - smt::Expression operator()(int _seq) const + smt::Expression current() const { - return valueAtSequence(_seq); + return valueAtSequence(m_ssa->index()); } - std::string uniqueSymbol(int _seq) const; + virtual smt::Expression valueAtSequence(int _seq) const = 0; + + smt::Expression increase() + { + ++(*m_ssa); + return current(); + } + + int index() const { return m_ssa->index(); } + int& index() { return m_ssa->index(); } /// Sets the var to the default value of its type. - virtual void setZeroValue(int _seq) = 0; + virtual void setZeroValue() = 0; /// The unknown value is the full range of valid values, /// and that's sub-type dependent. - virtual void setUnknownValue(int _seq) = 0; + virtual void setUnknownValue() = 0; protected: - virtual smt::Expression valueAtSequence(int _seq) const = 0; + std::string uniqueSymbol(int _seq) const; Type const& m_type; std::string m_uniqueName; smt::SolverInterface& m_interface; + std::shared_ptr<SSAVariable> m_ssa = nullptr; }; } |