Commit a0a1599c authored by Dmitry Rogozhkin's avatar Dmitry Rogozhkin Committed by gbsbuild

Check llvm::Expected before use. Fixes #77

Change-Id: If54338d7f0056bbb474f9523f3f661191440ace3
parent 17d9e620
......@@ -402,7 +402,10 @@ bool PreCompiledFuncImport::runOnModule(Module &M)
// llvm::getLazyBitcodeModule(MemoryBufferRef(BitRef.str(), ""), M.getContext());
llvm::Expected<std::unique_ptr<llvm::Module>> ModuleOrErr =
llvm::parseBitcodeFile(MemoryBufferRef(BitRef.str(), ""), M.getContext());
assert(ModuleOrErr && "llvm getLazyBitcodeModule - FAILED to parse bitcode");
if (llvm::Error EC = ModuleOrErr.takeError())
{
assert(0 && "llvm getLazyBitcodeModule - FAILED to parse bitcode");
}
std::unique_ptr<llvm::Module> m_pBuiltinModule = std::move(*ModuleOrErr);
assert(m_pBuiltinModule && "llvm version mismatch - could not load llvm module");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment