diff options
author | George Rimar <grimar@accesssoftek.com> | 2019-10-21 11:06:38 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2019-10-21 11:06:38 +0000 |
commit | 2bf01dcbaa6723c9c41f8d6005a1f69818ddbd23 (patch) | |
tree | f9862a0f5568ba2e6e46f55e85ba2b720c50853e /llvm/tools/llvm-cxxdump | |
parent | bac5f6bd21de81a9041a94c12b49eb108dbc77c4 (diff) | |
download | bcm5719-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/tools/llvm-cxxdump')
-rw-r--r-- | llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp index 83331265578..03e1bab9417 100644 --- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp +++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp @@ -174,7 +174,11 @@ static void dumpCXXData(const ObjectFile *Obj) { SectionRelocMap.clear(); for (const SectionRef &Section : Obj->sections()) { - section_iterator Sec2 = Section.getRelocatedSection(); + Expected<section_iterator> ErrOrSec = Section.getRelocatedSection(); + if (!ErrOrSec) + error(ErrOrSec.takeError()); + + section_iterator Sec2 = *ErrOrSec; if (Sec2 != Obj->section_end()) SectionRelocMap[*Sec2].push_back(Section); } |