Add ODIN_DEBUG

This commit is contained in:
gingerBill
2018-01-28 14:42:22 +00:00
parent 1a0877e965
commit dce45e7d58
4 changed files with 4 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ struct BuildContext {
String ODIN_VENDOR; // compiler vendor
String ODIN_VERSION; // compiler version
String ODIN_ROOT; // Odin ROOT
bool ODIN_DEBUG; // Odin in debug mode
// In bytes
i64 word_size; // Size of a pointer, must be >= 4
@@ -22,7 +23,6 @@ struct BuildContext {
i32 optimization_level;
bool show_timings;
bool keep_temp_files;
bool debug;
bool no_bounds_check;
gbAffinity affinity;

View File

@@ -548,6 +548,7 @@ void init_universal_scope(void) {
add_global_string_constant(a, str_lit("ODIN_VENDOR"), bc->ODIN_VENDOR);
add_global_string_constant(a, str_lit("ODIN_VERSION"), bc->ODIN_VERSION);
add_global_string_constant(a, str_lit("ODIN_ROOT"), bc->ODIN_ROOT);
add_global_constant(a, str_lit("ODIN_DEBUG"), t_untyped_bool, exact_value_bool(bc->ODIN_DEBUG));
// Builtin Procedures

View File

@@ -7598,7 +7598,7 @@ void ir_init_module(irModule *m, Checker *c) {
m->info = &c->info;
m->generate_debug_info = false;
if (build_context.debug) {
if (build_context.ODIN_DEBUG) {
m->generate_debug_info = build_context.ODIN_OS == "windows" && build_context.word_size == 8;
}

View File

@@ -505,7 +505,7 @@ bool parse_build_flags(Array<String> args) {
}
case BuildFlag_Debug:
build_context.debug = true;
build_context.ODIN_DEBUG = true;
break;
case BuildFlag_NoBoundsCheck: