From 90aaaceba00c528b8543a3fd8a28cc1643a6ebf0 Mon Sep 17 00:00:00 2001 From: Marin Baron Date: Sun, 20 Oct 2019 21:42:59 +0200 Subject: [PATCH] Debug build : Check ObjectFile before reading. Check LLVM ObjectFile state before access to avoid llvm assertion failure. Expected must be checked before access or destruction. Expected value was in success state. (Note: Expected values in success mode must still be checked prior to being destroyed). --- Utilities/JIT.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Utilities/JIT.cpp b/Utilities/JIT.cpp index 0c991de479..378427182a 100644 --- a/Utilities/JIT.cpp +++ b/Utilities/JIT.cpp @@ -832,7 +832,16 @@ void jit_compiler::add(std::unique_ptr module) void jit_compiler::add(const std::string& path) { - m_engine->addObjectFile(std::move(llvm::object::ObjectFile::createObjectFile(*ObjectCache::load(path)).get())); + auto cache = ObjectCache::load(path); + + if (auto object_file = llvm::object::ObjectFile::createObjectFile(*cache)) + { + m_engine->addObjectFile( std::move(*object_file) ); + } + else + { + LOG_ERROR(GENERAL, "ObjectCache: Adding failed: %s", path); + } } void jit_compiler::fin()