Browse Source

Add ODIN_DEBUG

gingerBill 7 years ago
parent
commit
dce45e7d58
4 changed files with 4 additions and 3 deletions
  1. 1 1
      src/build_settings.cpp
  2. 1 0
      src/checker.cpp
  3. 1 1
      src/ir.cpp
  4. 1 1
      src/main.cpp

+ 1 - 1
src/build_settings.cpp

@@ -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;

+ 1 - 0
src/checker.cpp

@@ -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

+ 1 - 1
src/ir.cpp

@@ -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;
 	}
 

+ 1 - 1
src/main.cpp

@@ -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: