From 4da9ff9fcfe8987472dc894489597bd338aac85e Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Thu, 16 May 2019 12:08:34 +0000 Subject: Revert r360876 "[Object] Change object::SectionRef::getContents() to return Expected" It broke the Clang build, see llvm-commits thread. > Expected> may be better but use Expected for now. > > Follow-up of D61781. llvm-svn: 360878 --- llvm/lib/Object/IRObjectFile.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Object/IRObjectFile.cpp') 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 IRObjectFile::findBitcodeInObject(const ObjectFile &Obj) { for (const SectionRef &Sec : Obj.sections()) { if (Sec.isBitcode()) { - Expected 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()); } } -- cgit v1.1