diff options
| author | gingerBill <bill@gingerbill.org> | 2017-11-09 22:58:44 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2017-11-09 22:58:44 +0000 |
| commit | e5c39fb2a98d878b0cf5ca6fcea3a776527628a1 (patch) | |
| tree | 9917f1557b9671e03726499ba550b3358d04b839 /src | |
| parent | eb4b3f5976d1563cd97841964e829fc638179cc5 (diff) | |
Fix opening file without close; Minor fixes
Diffstat (limited to 'src')
| -rw-r--r-- | src/checker.cpp | 1 | ||||
| -rw-r--r-- | src/ir.cpp | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index cfa1d30cc..f48eef16e 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -2865,6 +2865,7 @@ void check_add_foreign_import_decl(Checker *c, AstNode *decl) { gbFile f = {}; gbFileError file_err = gb_file_open(&f, c_str); + defer (gb_file_close(&f)); switch (file_err) { case gbFileError_Invalid: diff --git a/src/ir.cpp b/src/ir.cpp index 88c20d312..5eb380f9f 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -1129,6 +1129,9 @@ irValue *ir_emit(irProcedure *proc, irValue *instr) { irValue *ir_const_int(gbAllocator a, i64 i) { return ir_value_constant(a, t_int, exact_value_i64(i)); } +irValue *ir_const_uintptr(gbAllocator a, u64 i) { + return ir_value_constant(a, t_uintptr, exact_value_i64(i)); +} irValue *ir_const_i32(gbAllocator a, i32 i) { return ir_value_constant(a, t_i32, exact_value_i64(i)); } @@ -1735,7 +1738,7 @@ irValue *ir_gen_map_header(irProcedure *proc, irValue *map_val, Type *map_type) ir_emit_store(proc, ir_emit_struct_ep(proc, h, 2), ir_const_int(a, entry_size)); ir_emit_store(proc, ir_emit_struct_ep(proc, h, 3), ir_const_int(a, entry_align)); - ir_emit_store(proc, ir_emit_struct_ep(proc, h, 4), ir_const_int(a, value_offset)); + ir_emit_store(proc, ir_emit_struct_ep(proc, h, 4), ir_const_uintptr(a, value_offset)); ir_emit_store(proc, ir_emit_struct_ep(proc, h, 5), ir_const_int(a, value_size)); |