mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-16 08:01:24 -07:00
Add ODIN_SANITIZER_FLAGS global constant
This commit is contained in:
@@ -510,6 +510,19 @@ Odin_Endian_Type :: type_of(ODIN_ENDIAN)
|
||||
*/
|
||||
Odin_Platform_Subtarget_Type :: type_of(ODIN_PLATFORM_SUBTARGET)
|
||||
|
||||
/*
|
||||
// Defined internally by the compiler
|
||||
Odin_Sanitizer_Flag :: enum u32 {
|
||||
Address = 0,
|
||||
Memory = 1,
|
||||
Thread = 2,
|
||||
}
|
||||
Odin_Sanitizer_Flags :: distinct bitset[Odin_Sanitizer_Flag; u32]
|
||||
|
||||
ODIN_SANITIZER_FLAGS // is a constant
|
||||
*/
|
||||
Odin_Sanitizer_Flags :: type_of(ODIN_SANITIZER_FLAGS)
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Init Startup Procedures //
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user