<html><head></head><body>LGTM<br><br><div class="gmail_quote">On November 2, 2016 11:38:56 AM EDT, George Rimar <grimar@accesssoftek.com> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">grimar created this revision.<br />grimar added reviewers: rafael, ruiu.<br />grimar added subscribers: llvm-commits, grimar, evgeny777.<br /><br />That is consisten with other methods around<br />and helps to handle error on a caller side.<br /><br /><br /><a href="https://reviews.llvm.org/D26247">https://reviews.llvm.org/D26247</a><br /><br />Files:<br /> include/llvm/Object/ELF.h<br /> include/llvm/Object/Error.h<br /> lib/Object/Error.cpp<br /><br /><br />Index: lib/Object/Error.cpp<br /><hr /><br />--- lib/Object/Error.cpp<br />+++ lib/Object/Error.cpp<br />@@ -50,6 +50,8 @@<br /> return "Invalid section index";<br /> case object_error::bitcode_section_not_found:<br /> return "Bitcode section not found in object file";<br />+ case object_error::invalid_symbol_index:<br />+ return "Invalid symbol index";<br /> }<br /> llvm_unreachable("An enumerator of object_error does not have a message "<br /> "defined.");<br
/>Index: include/llvm/Object/Error.h<br /><hr /><br />--- include/llvm/Object/Error.h<br />+++ include/llvm/Object/Error.h<br />@@ -34,6 +34,7 @@<br /> string_table_non_null_end,<br /> invalid_section_index,<br /> bitcode_section_not_found,<br />+ invalid_symbol_index,<br /> };<br /> <br /> inline std::error_code make_error_code(object_error e) {<br />Index: include/llvm/Object/ELF.h<br /><hr /><br />--- include/llvm/Object/ELF.h<br />+++ include/llvm/Object/ELF.h<br />@@ -167,10 +167,11 @@<br /> ArrayRef<Elf_Word> ShndxTable) const;<br /> ErrorOr<const Elf_Shdr *> getSection(uint32_t Index) const;<br /> <br />- const Elf_Sym *getSymbol(const Elf_Shdr *Sec, uint32_t Index) const {<br />+ ErrorOr<const Elf_Sym *> getSymbol(const Elf_Shdr *Sec,<br />+ uint32_t Index) const {<br /> Elf_Sym_Range Symbols = symbols(Sec);<br /> if (Index >= Symbols.size())<br />-
report_fatal_error("Invalid symbol index");<br />+ return object_error::invalid_symbol_index;<br /> return &Symbols[Index];<br /> }<br /> <br /><br /><br /></pre></blockquote></div><br>
-- <br>
Sent from my Android device with K-9 Mail. Please excuse my brevity.</body></html>