From a076ec54bee20c423cf710ea2818d01df84e28b0 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Thu, 16 May 2019 11:33:48 +0000 Subject: [Object] Change object::SectionRef::getContents() to return Expected Expected> may be better but use Expected for now. Follow-up of D61781. llvm-svn: 360876 --- 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 77e27ec3e8f..e2511b7aed0 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) { - StringRef ret; - if (std::error_code ec = (*unwrap(SI))->getContents(ret)) - report_fatal_error(ec.message()); - return ret.data(); + if (Expected E = (*unwrap(SI))->getContents()) + return E->data(); + else + report_fatal_error(E.takeError()); } uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) { -- cgit v1.2.3