aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorfoobles <buzdav2@gmail.com>2020-05-26 11:55:31 -0500
committerGitHub <noreply@github.com>2020-05-26 12:55:31 -0400
commitcb6bc5bdb5a3ebc95b0ee5fa414c4a2d4449e172 (patch)
treeb1db09ec9d0e5be585ccd93da6431c965a3cbb94 /src/codegen.cpp
parent57b78fff7366c134bfb56084ec353006a7cb39fc (diff)
downloadzig-cb6bc5bdb5a3ebc95b0ee5fa414c4a2d4449e172.tar.gz
zig-cb6bc5bdb5a3ebc95b0ee5fa414c4a2d4449e172.zip
Add caller location tracking for asserts (ir_assert, src_assert, ir_assert_gen) (#5393)
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index bc0e731bea..e91eafa458 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -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;