From ed067c45d4b668db740fbb1728200fc51f4b9b51 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 3 Jul 2015 18:19:00 +0000 Subject: Return ErrorOr from getSymbolAddress. It can fail trying to get the section on ELF and COFF. This makes sure the error is handled. llvm-svn: 241366 --- llvm/lib/Object/MachOObjectFile.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Object/MachOObjectFile.cpp') diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 53ea444..9671833 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -376,10 +376,8 @@ uint64_t MachOObjectFile::getSymbolValue(DataRefImpl Sym) const { return NValue; } -std::error_code MachOObjectFile::getSymbolAddress(DataRefImpl Sym, - uint64_t &Res) const { - Res = getSymbolValue(Sym); - return std::error_code(); +ErrorOr MachOObjectFile::getSymbolAddress(DataRefImpl Sym) const { + return getSymbolValue(Sym); } uint32_t MachOObjectFile::getSymbolAlignment(DataRefImpl DRI) const { -- cgit v1.1