diff options
Diffstat (limited to 'tools/standalone_miri/module_tree.hpp')
-rw-r--r-- | tools/standalone_miri/module_tree.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/standalone_miri/module_tree.hpp b/tools/standalone_miri/module_tree.hpp index ca24b06a..5479d9ef 100644 --- a/tools/standalone_miri/module_tree.hpp +++ b/tools/standalone_miri/module_tree.hpp @@ -9,15 +9,14 @@ #include "../../src/mir/mir.hpp" #include "hir_sim.hpp" - -struct Value; +#include "value.hpp" struct Function { ::HIR::Path my_path; ::std::vector<::HIR::TypeRef> args; ::HIR::TypeRef ret_ty; - + // If `link_name` is non-empty, then the function is an external struct { ::std::string link_name; @@ -25,6 +24,11 @@ struct Function } external; ::MIR::Function m_mir; }; +struct Static +{ + ::HIR::TypeRef ty; + Value val; +}; /// Container for loaded code and structures class ModuleTree @@ -34,8 +38,7 @@ class ModuleTree ::std::set<::std::string> loaded_files; ::std::map<::HIR::Path, Function> functions; - ::std::map<::HIR::Path, Value> statics; - // TODO: statics + ::std::map<::HIR::Path, Static> statics; // Hack: Tuples are stored as `::""::<A,B,C,...>` ::std::map<::HIR::GenericPath, ::std::unique_ptr<DataType>> data_types; @@ -47,8 +50,8 @@ public: ::HIR::SimplePath find_lang_item(const char* name) const; const Function& get_function(const ::HIR::Path& p) const; const Function* get_function_opt(const ::HIR::Path& p) const; - Value& get_static(const ::HIR::Path& p); - Value* get_static_opt(const ::HIR::Path& p); + Static& get_static(const ::HIR::Path& p); + Static* get_static_opt(const ::HIR::Path& p); const DataType& get_composite(const ::HIR::GenericPath& p) const { return *data_types.at(p); |