Preserve the error message when MemoryBuffer creation fails

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D86326
This commit is contained in:
Aden Grue 2020-08-21 18:03:00 +00:00 committed by Mehdi Amini
parent 02e02f5398
commit 670063eb22
1 changed files with 2 additions and 1 deletions

View File

@ -251,7 +251,8 @@ Expected<std::unique_ptr<ExecutionEngine>> ExecutionEngine::create(
for (auto libPath : sharedLibPaths) {
auto mb = llvm::MemoryBuffer::getFile(libPath);
if (!mb) {
errs() << "Fail to create MemoryBuffer for: " << libPath << "\n";
errs() << "Failed to create MemoryBuffer for: " << libPath
<< "\nError: " << mb.getError().message() << "\n";
continue;
}
auto &JD = session.createBareJITDylib(std::string(libPath));