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/Object.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/Object.cpp') diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp index e2511b7aed0..77e27ec3e8f 100644 --- a/llvm/lib/Object/Object.cpp +++ b/llvm/lib/Object/Object.cpp @@ -247,10 +247,10 @@ uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) { } const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) { - if (Expected E = (*unwrap(SI))->getContents()) - return E->data(); - else - report_fatal_error(E.takeError()); + StringRef ret; + if (std::error_code ec = (*unwrap(SI))->getContents(ret)) + report_fatal_error(ec.message()); + return ret.data(); } uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) { -- cgit v1.2.3