summaryrefslogtreecommitdiff
path: root/src/mir
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir')
-rw-r--r--src/mir/from_hir.cpp8
-rw-r--r--src/mir/mir_ptr.hpp9
2 files changed, 12 insertions, 5 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index dc3b78a7..84d60082 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -1805,6 +1805,14 @@ namespace {
mv$(values)
}));
}
+ if( fcn.m_abi == "platform-intrinsic" )
+ {
+ m_builder.end_block(::MIR::Terminator::make_Call({
+ next_block, panic_block,
+ res.clone(), ::MIR::CallTarget::make_Intrinsic({ "platform:"+gpath.m_path.m_components.back(), gpath.m_params.clone() }),
+ mv$(values)
+ }));
+ }
// rustc has drop_in_place as a lang item, mrustc uses an intrinsic
if( gpath.m_path == m_builder.crate().get_lang_item_path_opt("drop_in_place") )
diff --git a/src/mir/mir_ptr.hpp b/src/mir/mir_ptr.hpp
index 9133dd44..27dd6b22 100644
--- a/src/mir/mir_ptr.hpp
+++ b/src/mir/mir_ptr.hpp
@@ -7,7 +7,6 @@
*/
#pragma once
-
namespace MIR {
class Function;
@@ -32,10 +31,10 @@ public:
void reset();
- ::MIR::Function* operator->() { return ptr; }
- ::MIR::Function& operator*() { return *ptr; }
- const ::MIR::Function* operator->() const { return ptr; }
- const ::MIR::Function& operator*() const { return *ptr; }
+ ::MIR::Function* operator->() { if(!ptr) throw ""; return ptr; }
+ const ::MIR::Function* operator->() const { if(!ptr) throw ""; return ptr; }
+ ::MIR::Function& operator*() { if(!ptr) throw ""; return *ptr; }
+ const ::MIR::Function& operator*() const { if(!ptr) throw ""; return *ptr; }
operator bool() const { return ptr != nullptr; }
};