From 647b1b3f8c55a5d0a7c48e722184b95f1d1dc6dd Mon Sep 17 00:00:00 2001 From: John Hodge Date: Fri, 28 Apr 2017 21:22:26 +0800 Subject: MIR Helpers - Move visit_mir_lvalue* to somewhere common --- src/mir/helpers.hpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/mir/helpers.hpp') 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 cb); + extern bool visit_mir_lvalue(const ::MIR::Param& p, ValUsage u, ::std::function cb); + extern bool visit_mir_lvalues(const ::MIR::RValue& rval, ::std::function cb); + extern bool visit_mir_lvalues(const ::MIR::Statement& stmt, ::std::function cb); + extern bool visit_mir_lvalues(const ::MIR::Terminator& term, ::std::function cb); +} // namespace visit + } // namespace MIR extern ::MIR::ValueLifetimes MIR_Helper_GetLifetimes(::MIR::TypeResolve& state, const ::MIR::Function& fcn, bool dump_debug); -- cgit v1.2.3