Browse Source

Make sure builder uses the `InContext` version

gingerBill 4 years ago
parent
commit
3a5245dcce
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/llvm_backend.cpp

+ 5 - 1
src/llvm_backend.cpp

@@ -3117,7 +3117,7 @@ void lb_begin_procedure_body(lbProcedure *p) {
 		}
 	}
 
-	p->builder = LLVMCreateBuilder();
+	p->builder = LLVMCreateBuilderInContext(p->module->ctx);
 
 	p->decl_block  = lb_create_block(p, "decls", true);
 	p->entry_block = lb_create_block(p, "entry", true);
@@ -12898,7 +12898,11 @@ lbAddr lb_build_addr(lbProcedure *p, Ast *expr) {
 void lb_init_module(lbModule *m, Checker *c) {
 	m->info = &c->info;
 
+#if 1
 	m->ctx = LLVMGetGlobalContext();
+#else
+	m->ctx = LLVMContextCreate();
+#endif
 	m->mod = LLVMModuleCreateWithNameInContext("odin_module", m->ctx);
 	// m->debug_builder = nullptr;
 	if (build_context.ODIN_DEBUG) {