From e183340c29db62e3c93c59c403984ad675d72c83 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 16 May 2019 13:24:04 +0000 Subject: Recommit [Object] Change object::SectionRef::getContents() to return Expected r360876 didn't fix 2 call sites in clang. Expected> may be better but use Expected for now. Follow-up of D61781. llvm-svn: 360892 --- 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 debe789..636f152 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()) { - StringRef SecContents; - if (std::error_code EC = Sec.getContents(SecContents)) - return errorCodeToError(EC); - if (SecContents.size() <= 1) + Expected Contents = Sec.getContents(); + if (!Contents) + return Contents.takeError(); + if (Contents->size() <= 1) return errorCodeToError(object_error::bitcode_section_not_found); - return MemoryBufferRef(SecContents, Obj.getFileName()); + return MemoryBufferRef(*Contents, Obj.getFileName()); } } -- cgit v1.1