From 802912743ef73ea794cb3c66a8cb2211735a12c3 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 8 Oct 2014 15:28:58 +0000 Subject: Remove bogus std::error_code returns form SectionRef. There are two methods in SectionRef that can fail: * getName: The index into the string table can be invalid. * getContents: The section might point to invalid contents. Every other method will always succeed and returning and std::error_code just complicates the code. For example, a section can have an invalid alignment, but if we are able to get to the section structure at all and create a SectionRef, we will always be able to read that invalid alignment. llvm-svn: 219314 --- llvm/lib/Object/Object.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'llvm/lib/Object/Object.cpp') diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp index fea34113285..84a5df089cb 100644 --- a/llvm/lib/Object/Object.cpp +++ b/llvm/lib/Object/Object.cpp @@ -132,10 +132,7 @@ const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) { } uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) { - uint64_t ret; - if (std::error_code ec = (*unwrap(SI))->getSize(ret)) - report_fatal_error(ec.message()); - return ret; + return (*unwrap(SI))->getSize(); } const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) { @@ -146,18 +143,12 @@ const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) { } uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) { - uint64_t ret; - if (std::error_code ec = (*unwrap(SI))->getAddress(ret)) - report_fatal_error(ec.message()); - return ret; + return (*unwrap(SI))->getAddress(); } LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI, LLVMSymbolIteratorRef Sym) { - bool ret; - if (std::error_code ec = (*unwrap(SI))->containsSymbol(**unwrap(Sym), ret)) - report_fatal_error(ec.message()); - return ret; + return (*unwrap(SI))->containsSymbol(**unwrap(Sym)); } // Section Relocation iterators -- cgit v1.2.3