aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-11-17 18:50:30 +0000
committergingerBill <bill@gingerbill.org>2020-11-17 18:50:30 +0000
commit2bd0fd932a4eb1c2e6bc8702450c230186bb3c44 (patch)
tree7f3441c0de7036aaa3f67aaa1edf4f610984f35c /src/llvm_backend.cpp
parent11577db6a84d17998478dc22b607a203cdf00a7e (diff)
Begin rudimentary work on implementing `odin test` tooling with `*_test.odin` files
Diffstat (limited to 'src/llvm_backend.cpp')
-rw-r--r--src/llvm_backend.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp
index 50d200551..ea5081be4 100644
--- a/src/llvm_backend.cpp
+++ b/src/llvm_backend.cpp
@@ -12875,11 +12875,21 @@ void lb_generate_code(lbGenerator *gen) {
lb_begin_procedure_body(p);
- lbValue *found = map_get(&m->values, hash_entity(entry_point));
- GB_ASSERT(found != nullptr);
-
LLVMBuildCall2(p->builder, LLVMGetElementType(lb_type(m, startup_runtime->type)), startup_runtime->value, nullptr, 0, "");
- LLVMBuildCall2(p->builder, LLVMGetElementType(lb_type(m, found->type)), found->value, nullptr, 0, "");
+
+ if (build_context.command_kind == Command_test) {
+ for_array(i, m->info->testing_procedures) {
+ Entity *e = m->info->testing_procedures[i];
+ lbValue *found = map_get(&m->values, hash_entity(e));
+ GB_ASSERT(found != nullptr);
+ lb_emit_call(p, *found, {});
+ }
+ } else {
+ lbValue *found = map_get(&m->values, hash_entity(entry_point));
+ GB_ASSERT(found != nullptr);
+ LLVMBuildCall2(p->builder, LLVMGetElementType(lb_type(m, found->type)), found->value, nullptr, 0, "");
+ }
+
LLVMBuildRet(p->builder, LLVMConstInt(lb_type(m, t_i32), 0, false));
lb_end_procedure_body(p);