Fix bug in defer from macros. Ensure debug location on panic functions. Add getcwd.

This commit is contained in:
Christoffer Lerno
2022-12-12 17:13:33 +01:00
committed by Christoffer Lerno
parent 8b0d409695
commit a9ed514fe5
8 changed files with 100 additions and 30 deletions

View File

@@ -3939,8 +3939,7 @@ static inline void llvm_emit_force_unwrap_expr(GenContext *c, BEValue *be_value,
{
// TODO, we should add info about the error.
SourceSpan loc = expr->span;
File *file = source_file_by_id(loc.file_id);
llvm_emit_panic(c, "Runtime error force unwrap!", file->name, c->cur_func.name, loc.row ? loc.row : 1);
llvm_emit_panic(c, "Runtime error force unwrap!", loc);
LLVMBuildUnreachable(c->builder);
c->current_block = NULL;
c->current_block_is_target = false;
@@ -5755,8 +5754,7 @@ static inline void llvm_emit_typeid_info(GenContext *c, BEValue *value, Expr *ex
llvm_emit_cond_br(c, &check, exit, next);
llvm_emit_block(c, next);
}
File *file = source_file_by_id(expr->span.file_id);
llvm_emit_panic(c, "Attempted to access 'inner' on non composite type", file->name, c->cur_func.name, expr->span.row);
llvm_emit_panic(c, "Attempted to access 'inner' on non composite type", expr->span);
c->current_block = NULL;
c->current_block_is_target = false;
LLVMBuildUnreachable(c->builder);
@@ -5788,8 +5786,7 @@ static inline void llvm_emit_typeid_info(GenContext *c, BEValue *value, Expr *ex
llvm_emit_cond_br(c, &check, exit, next);
llvm_emit_block(c, next);
}
File *file = source_file_by_id(expr->span.file_id);
llvm_emit_panic(c, "Attempted to access 'names' on non enum/fault type.", file->name, c->cur_func.name, expr->span.row);
llvm_emit_panic(c, "Attempted to access 'names' on non enum/fault type.", expr->span);
c->current_block = NULL;
c->current_block_is_target = false;
LLVMBuildUnreachable(c->builder);
@@ -5825,8 +5822,7 @@ static inline void llvm_emit_typeid_info(GenContext *c, BEValue *value, Expr *ex
llvm_emit_cond_br(c, &check, exit, next);
llvm_emit_block(c, next);
}
File *file = source_file_by_id(expr->span.file_id);
llvm_emit_panic(c, "Attempted to access 'len' on non array type", file->name, c->cur_func.name, expr->span.row);
llvm_emit_panic(c, "Attempted to access 'len' on non array type", expr->span);
c->current_block = NULL;
c->current_block_is_target = false;
LLVMBuildUnreachable(c->builder);