Add caller location tracking for asserts (ir_assert, src_assert, ir_assert_gen) (#5393)

This commit is contained in:
foobles
2020-05-26 11:55:31 -05:00
committed by GitHub
parent 57b78fff73
commit cb6bc5bdb5
4 changed files with 21 additions and 12 deletions

View File

@@ -870,11 +870,13 @@ static LLVMValueRef get_handle_value(CodeGen *g, LLVMValueRef ptr, ZigType *type
}
}
static void ir_assert(bool ok, IrInstGen *source_instruction) {
static void ir_assert_impl(bool ok, IrInstGen *source_instruction, const char *file, unsigned int line) {
if (ok) return;
src_assert(ok, source_instruction->base.source_node);
src_assert_impl(ok, source_instruction->base.source_node, file, line);
}
#define ir_assert(OK, SOURCE_INSTRUCTION) ir_assert_impl((OK), (SOURCE_INSTRUCTION), __FILE__, __LINE__)
static bool ir_want_fast_math(CodeGen *g, IrInstGen *instruction) {
// TODO memoize
Scope *scope = instruction->base.scope;