diff --git a/src/llvm/parser.c b/src/llvm/parser.c index 47eac0e..7ca9545 100644 --- a/src/llvm/parser.c +++ b/src/llvm/parser.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -205,6 +206,15 @@ static BackendError build_module(LLVMBackendCompileUnit* unit, // TODO: implement functions err = impl_functions(unit, global_scope, module->functions); + char* error = NULL; + LLVMVerifyModule(unit->module, LLVMAbortProcessAction, &error); + + if (error) { + print_message(Error, "Unable to compile due to: %s", error); + LLVMDisposeMessage(error); + err = new_backend_impl_error(Implementation, NULL, "LLVM backend verification error, see stdout"); + } + return err; }