summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-07-03 18:19:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-07-03 18:19:00 +0000
commited067c45d4b668db740fbb1728200fc51f4b9b51 (patch)
treecc50ae3d78954ad1e634cbd4278eec6095a50bdb /llvm/lib/DebugInfo
parente2df87f24b0af7fa80789e8da15c9cef9e6996f7 (diff)
downloadbcm5719-llvm-ed067c45d4b668db740fbb1728200fc51f4b9b51.tar.gz
bcm5719-llvm-ed067c45d4b668db740fbb1728200fc51f4b9b51.zip
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
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index c25ddad33b7..96bcf15e0af 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -677,7 +677,13 @@ DWARFContextInMemory::DWARFContextInMemory(const object::ObjectFile &Obj,
// First calculate the address of the symbol or section as it appears
// in the objct file
if (Sym != Obj.symbol_end()) {
- Sym->getAddress(SymAddr);
+ ErrorOr<uint64_t> SymAddrOrErr = Sym->getAddress();
+ if (std::error_code EC = SymAddrOrErr.getError()) {
+ errs() << "error: failed to compute symbol address: "
+ << EC.message() << '\n';
+ continue;
+ }
+ SymAddr = *SymAddrOrErr;
// Also remember what section this symbol is in for later
Sym->getSection(RSec);
} else if (auto *MObj = dyn_cast<MachOObjectFile>(&Obj)) {
OpenPOWER on IntegriCloud