summaryrefslogtreecommitdiff
path: root/tools/standalone_miri/module_tree.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-08-18 09:23:33 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-08-18 09:23:33 +0800
commit3817f9e19020b04d1a39a5c2a8f30814eb0bc065 (patch)
tree6f343024c9a4b5527503dcad9306d1aa98469cad /tools/standalone_miri/module_tree.hpp
parentfdd60793c48493584f6b2b691207a89a618e656d (diff)
downloadmrust-3817f9e19020b04d1a39a5c2a8f30814eb0bc065.tar.gz
Standalone MIRI - Correct handling of function types
Diffstat (limited to 'tools/standalone_miri/module_tree.hpp')
-rw-r--r--tools/standalone_miri/module_tree.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/standalone_miri/module_tree.hpp b/tools/standalone_miri/module_tree.hpp
index 5da8439f..299aa51c 100644
--- a/tools/standalone_miri/module_tree.hpp
+++ b/tools/standalone_miri/module_tree.hpp
@@ -49,6 +49,8 @@ class ModuleTree
// Hack: Tuples are stored as `::""::<A,B,C,...>`
::std::map<::HIR::GenericPath, ::std::unique_ptr<DataType>> data_types;
+ ::std::set<FunctionType> function_types; // note: insertion doesn't invaliate pointers.
+
::std::map<::std::string, const Function*> ext_functions;
public:
ModuleTree();
@@ -95,3 +97,21 @@ struct DataType
};
::std::vector<VariantValue> variants;
};
+
+struct FunctionType
+{
+ bool unsafe;
+ ::std::string abi;
+ ::std::vector<HIR::TypeRef> args;
+ HIR::TypeRef ret;
+
+ bool operator<(const FunctionType& x) const {
+ #define _(f) if(f != x.f) return f < x.f
+ _(unsafe);
+ _(abi);
+ _(args);
+ _(ret);
+ #undef _
+ return false;
+ }
+};