From 5eb02e45e38a907f3354c68734492184467d5ee2 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 1 Jun 2015 00:27:26 +0000 Subject: Simplify another function that doesn't fail. llvm-svn: 238703 --- llvm/lib/Object/COFFObjectFile.cpp | 10 +++------- llvm/lib/Object/MachOObjectFile.cpp | 9 +++------ llvm/lib/Object/Object.cpp | 5 +---- 3 files changed, 7 insertions(+), 17 deletions(-) (limited to 'llvm/lib/Object') diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index 74709c88ba2..96c7fae79eb 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -236,16 +236,12 @@ uint32_t COFFObjectFile::getSymbolFlags(DataRefImpl Ref) const { return Result; } -std::error_code COFFObjectFile::getSymbolSize(DataRefImpl Ref, - uint64_t &Result) const { +uint64_t COFFObjectFile::getSymbolSize(DataRefImpl Ref) const { COFFSymbolRef Symb = getCOFFSymbol(Ref); if (Symb.isCommon()) - Result = Symb.getValue(); - else - Result = UnknownAddressOrSize; - - return object_error::success; + return Symb.getValue(); + return UnknownAddressOrSize; } std::error_code diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index cae5b799ac1..e1ace497ca2 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -410,16 +410,13 @@ uint32_t MachOObjectFile::getSymbolAlignment(DataRefImpl DRI) const { return 0; } -std::error_code MachOObjectFile::getSymbolSize(DataRefImpl DRI, - uint64_t &Result) const { +uint64_t MachOObjectFile::getSymbolSize(DataRefImpl DRI) const { uint64_t Value; getSymbolAddress(DRI, Value); uint32_t flags = getSymbolFlags(DRI); if (flags & SymbolRef::SF_Common) - Result = Value; - else - Result = UnknownAddressOrSize; - return object_error::success; + return Value; + return UnknownAddressOrSize; } std::error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, diff --git a/llvm/lib/Object/Object.cpp b/llvm/lib/Object/Object.cpp index 84a5df089cb..67e50243a49 100644 --- a/llvm/lib/Object/Object.cpp +++ b/llvm/lib/Object/Object.cpp @@ -187,10 +187,7 @@ uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI) { } uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI) { - uint64_t ret; - if (std::error_code ec = (*unwrap(SI))->getSize(ret)) - report_fatal_error(ec.message()); - return ret; + return (*unwrap(SI))->getSize(); } // RelocationRef accessors -- cgit v1.2.3