diff options
author | John Hodge <tpg@ucc.asn.au> | 2017-04-28 21:22:26 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2017-04-28 21:22:26 +0800 |
commit | 647b1b3f8c55a5d0a7c48e722184b95f1d1dc6dd (patch) | |
tree | f9cc3f59e0945617294f670c0fb9a886403bf95f /src/mir/helpers.hpp | |
parent | 4de1bdb03d48b2741ec1075a55f5d726facb6f91 (diff) | |
download | mrust-647b1b3f8c55a5d0a7c48e722184b95f1d1dc6dd.tar.gz |
MIR Helpers - Move visit_mir_lvalue* to somewhere common
Diffstat (limited to 'src/mir/helpers.hpp')
-rw-r--r-- | src/mir/helpers.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mir/helpers.hpp b/src/mir/helpers.hpp index 3a37ed8e..8b4e8424 100644 --- a/src/mir/helpers.hpp +++ b/src/mir/helpers.hpp @@ -23,6 +23,10 @@ class Function; class LValue; class Constant; class BasicBlock; +class Terminator; +class Statement; +class RValue; +class Param; typedef unsigned int BasicBlockId; @@ -164,6 +168,21 @@ struct ValueLifetimes } }; +namespace visit { + enum class ValUsage { + Move, + Read, + Write, + Borrow, + }; + + extern bool visit_mir_lvalue(const ::MIR::LValue& lv, ValUsage u, ::std::function<bool(const ::MIR::LValue& , ValUsage)> cb); + extern bool visit_mir_lvalue(const ::MIR::Param& p, ValUsage u, ::std::function<bool(const ::MIR::LValue& , ValUsage)> cb); + extern bool visit_mir_lvalues(const ::MIR::RValue& rval, ::std::function<bool(const ::MIR::LValue& , ValUsage)> cb); + extern bool visit_mir_lvalues(const ::MIR::Statement& stmt, ::std::function<bool(const ::MIR::LValue& , ValUsage)> cb); + extern bool visit_mir_lvalues(const ::MIR::Terminator& term, ::std::function<bool(const ::MIR::LValue& , ValUsage)> cb); +} // namespace visit + } // namespace MIR extern ::MIR::ValueLifetimes MIR_Helper_GetLifetimes(::MIR::TypeResolve& state, const ::MIR::Function& fcn, bool dump_debug); |