summaryrefslogtreecommitdiff
path: root/src/hir/hir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2019-11-03 16:54:12 +0800
committerJohn Hodge <tpg@mutabah.net>2019-11-03 16:54:12 +0800
commitce620c00008eb6cb8d9eb23a13775ec3b8127175 (patch)
tree3cc89fc004bd412e0833999273196fc21dd5e1a4 /src/hir/hir.cpp
parent66353070eba9236219a003023c428cb6f1d1de3e (diff)
downloadmrust-ce620c00008eb6cb8d9eb23a13775ec3b8127175.tar.gz
HIR - Correct enum repr types
Diffstat (limited to 'src/hir/hir.cpp')
-rw-r--r--src/hir/hir.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/hir/hir.cpp b/src/hir/hir.cpp
index 88b1cb8c..2e9b2830 100644
--- a/src/hir/hir.cpp
+++ b/src/hir/hir.cpp
@@ -188,6 +188,22 @@ uint32_t HIR::Enum::get_value(size_t idx) const
throw "";
}
}
+/*static*/ ::HIR::TypeRef HIR::Enum::get_repr_type(Repr r)
+{
+ switch(r)
+ {
+ case ::HIR::Enum::Repr::Rust:
+ case ::HIR::Enum::Repr::C:
+ return ::HIR::CoreType::Isize;
+ break;
+ case ::HIR::Enum::Repr::Usize: return ::HIR::CoreType::Usize; break;
+ case ::HIR::Enum::Repr::U8 : return ::HIR::CoreType::U8 ; break;
+ case ::HIR::Enum::Repr::U16: return ::HIR::CoreType::U16; break;
+ case ::HIR::Enum::Repr::U32: return ::HIR::CoreType::U32; break;
+ case ::HIR::Enum::Repr::U64: return ::HIR::CoreType::U64; break;
+ }
+ throw "";
+}
const ::HIR::SimplePath& ::HIR::Crate::get_lang_item_path(const Span& sp, const char* name) const