summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-10-21 11:06:38 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-10-21 11:06:38 +0000
commit2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23 (patch)
treef9862a0f5568ba2e6e46f55e85ba2b720c50853e /llvm/lib/DebugInfo
parentbac5f6bd21de81a9041a94c12b49eb108dbc77c4 (diff)
downloadbcm5719-llvm-2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23.tar.gz
bcm5719-llvm-2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23.zip
[llvm/Object] - Make ELFObjectFile::getRelocatedSection return Expected<section_iterator>
It returns just a section_iterator currently and have a report_fatal_error call inside. This change adds a way to return errors and handle them on caller sides. The patch also changes/improves current users and adds test cases. Differential revision: https://reviews.llvm.org/D69167 llvm-svn: 375408
Diffstat (limited to 'llvm/lib/DebugInfo')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 8cb665967dd..c06d85d5060 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -1527,10 +1527,19 @@ public:
continue;
StringRef Data;
- section_iterator RelocatedSection = Section.getRelocatedSection();
+ Expected<section_iterator> SecOrErr = Section.getRelocatedSection();
+ if (!SecOrErr) {
+ ErrorPolicy EP = HandleError(createError(
+ "failed to get relocated section: ", SecOrErr.takeError()));
+ if (EP == ErrorPolicy::Halt)
+ return;
+ continue;
+ }
+
// Try to obtain an already relocated version of this section.
// Else use the unrelocated section from the object file. We'll have to
// apply relocations ourselves later.
+ section_iterator RelocatedSection = *SecOrErr;
if (!L || !L->getLoadedSectionContents(*RelocatedSection, Data)) {
Expected<StringRef> E = Section.getContents();
if (E)
OpenPOWER on IntegriCloud