aboutsummaryrefslogtreecommitdiff
path: root/src/types.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-15 12:14:56 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-15 12:14:56 +0100
commit23f9f9064e99e559f57b35a5f84a9525f8023bd9 (patch)
tree6884a9ed6133485f38d78d0d3c3c359e6a5118cc /src/types.cpp
parenta134307dcde9aac03323c15f8dfc5642f438fe56 (diff)
Add CheckerInfo API functions
Diffstat (limited to 'src/types.cpp')
-rw-r--r--src/types.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/types.cpp b/src/types.cpp
index 51c77d383..4b1f276c0 100644
--- a/src/types.cpp
+++ b/src/types.cpp
@@ -95,6 +95,8 @@ struct TypeRecord {
Entity * union__tag;
i64 variant_block_size; // NOTE(bill): Internal use only
+ Type * variant_parent;
+ i32 variant_index;
i64 * offsets;
bool are_offsets_set;
@@ -838,6 +840,14 @@ bool is_type_union(Type *t) {
t = base_type(t);
return (t->kind == Type_Record && t->Record.kind == TypeRecord_Union);
}
+bool is_type_variant(Type *t) {
+ t = base_type(t);
+ if (t->kind == Type_Record) {
+ return t->Record.kind == TypeRecord_Struct && t->Record.variant_parent != NULL;
+ }
+ return false;
+}
+
bool is_type_raw_union(Type *t) {
t = base_type(t);
return (t->kind == Type_Record && t->Record.kind == TypeRecord_RawUnion);