diff options
Diffstat (limited to 'llvm/lib/Object/IRObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/IRObjectFile.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Object/IRObjectFile.cpp b/llvm/lib/Object/IRObjectFile.cpp index 636f152..debe789 100644 --- a/llvm/lib/Object/IRObjectFile.cpp +++ b/llvm/lib/Object/IRObjectFile.cpp @@ -74,12 +74,12 @@ Expected<MemoryBufferRef> IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) { for (const SectionRef &Sec : Obj.sections()) { if (Sec.isBitcode()) { - Expected<StringRef> Contents = Sec.getContents(); - if (!Contents) - return Contents.takeError(); - if (Contents->size() <= 1) + StringRef SecContents; + if (std::error_code EC = Sec.getContents(SecContents)) + return errorCodeToError(EC); + if (SecContents.size() <= 1) return errorCodeToError(object_error::bitcode_section_not_found); - return MemoryBufferRef(*Contents, Obj.getFileName()); + return MemoryBufferRef(SecContents, Obj.getFileName()); } } |