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/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