From dfa7d808cef1fcc6995012d71ce3546851ed9bfb Mon Sep 17 00:00:00 2001 From: imhameed <50922266+imhameed@users.noreply.github.com> Date: Wed, 7 Aug 2019 12:15:55 -0700 Subject: [PATCH] [llvm] Explicitly check for errors when calling LegacyIRCompileLayer::addModule. (mono/mono#16082) [llvm] Explicitly check for errors when calling LegacyIRCompileLayer::addModule. LLVM built with LLVM_ENABLE_ASSERTIONS=On will crash if errors are not explicitly consumed. Commit migrated from https://github.com/mono/mono/commit/4462f10fb66e85b66d8d5497653fdbcd2775eb93 --- src/mono/mono/mini/llvm-jit.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mono/mono/mini/llvm-jit.cpp b/src/mono/mono/mini/llvm-jit.cpp index c35abbf..45e0e63 100644 --- a/src/mono/mono/mini/llvm-jit.cpp +++ b/src/mono/mono/mini/llvm-jit.cpp @@ -176,7 +176,11 @@ struct MonoLLVMJIT { auto resolver = createLegacyLookupResolver (execution_session, lookup_name, on_error); resolvers[k] = std::move (resolver); - compile_layer.addModule (k, std::move(m)); + auto err = compile_layer.addModule (k, std::move(m)); + if (err) { + outs () << "addModule error: " << err << "\n"; + assert (0); + } return k; } -- 2.7.4