aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2023-09-21 11:34:40 +0100
committergingerBill <bill@gingerbill.org>2023-09-21 11:34:40 +0100
commit098c09835b1b1dd08431a59f076e77bb0125d93a (patch)
tree1ddec02e5b32550cf35cfec0b084a88e7291106d /src/checker.cpp
parent4aa9d34b3d8495404d91c18743438671be1a6168 (diff)
Add `ODIN_SANITIZER_FLAGS` global constant
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index cda7d50a0..984a00a90 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -1086,6 +1086,33 @@ gb_internal void init_universal(void) {
add_global_bool_constant("__ODIN_LLVM_F16_SUPPORTED", lb_use_new_pass_system());
+ {
+ GlobalEnumValue values[3] = {
+ {"Address", 0},
+ {"Memory", 1},
+ {"Thread", 2},
+ };
+
+ Type *enum_type = nullptr;
+ auto flags = add_global_enum_type(str_lit("Odin_Sanitizer_Flag"), values, gb_count_of(values), &enum_type);
+ Type *bit_set_type = alloc_type_bit_set();
+ bit_set_type->BitSet.elem = enum_type;
+ bit_set_type->BitSet.underlying = t_u32;
+ bit_set_type->BitSet.lower = 0;
+ bit_set_type->BitSet.upper = 2;
+ type_size_of(bit_set_type);
+
+ String type_name = str_lit("Odin_Sanitizer_Flags");
+ Scope *scope = create_scope(nullptr, builtin_pkg->scope);
+ Entity *entity = alloc_entity_type_name(scope, make_token_ident(type_name), nullptr, EntityState_Resolved);
+
+ Type *named_type = alloc_type_named(type_name, bit_set_type, entity);
+ set_base_type(named_type, bit_set_type);
+
+ add_global_constant("ODIN_SANITIZER_FLAGS", named_type, exact_value_u64(bc->sanitizer_flags));
+ }
+
+
// Builtin Procedures
for (isize i = 0; i < gb_count_of(builtin_procs); i++) {