[PATCH] D26247: [Object/ELF] - Make getSymbol() return Error.
George Rimar via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 3 01:50:28 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL285886: [Object/ELF] - Make getSymbol() return Error. (authored by grimar).
Changed prior to commit:
https://reviews.llvm.org/D26247?vs=76713&id=76821#toc
Repository:
rL LLVM
https://reviews.llvm.org/D26247
Files:
llvm/trunk/include/llvm/Object/ELF.h
llvm/trunk/include/llvm/Object/Error.h
llvm/trunk/lib/Object/Error.cpp
Index: llvm/trunk/lib/Object/Error.cpp
===================================================================
--- llvm/trunk/lib/Object/Error.cpp
+++ llvm/trunk/lib/Object/Error.cpp
@@ -50,6 +50,8 @@
return "Invalid section index";
case object_error::bitcode_section_not_found:
return "Bitcode section not found in object file";
+ case object_error::invalid_symbol_index:
+ return "Invalid symbol index";
}
llvm_unreachable("An enumerator of object_error does not have a message "
"defined.");
Index: llvm/trunk/include/llvm/Object/Error.h
===================================================================
--- llvm/trunk/include/llvm/Object/Error.h
+++ llvm/trunk/include/llvm/Object/Error.h
@@ -34,6 +34,7 @@
string_table_non_null_end,
invalid_section_index,
bitcode_section_not_found,
+ invalid_symbol_index,
};
inline std::error_code make_error_code(object_error e) {
Index: llvm/trunk/include/llvm/Object/ELF.h
===================================================================
--- llvm/trunk/include/llvm/Object/ELF.h
+++ llvm/trunk/include/llvm/Object/ELF.h
@@ -158,10 +158,11 @@
ArrayRef<Elf_Word> ShndxTable) const;
ErrorOr<const Elf_Shdr *> getSection(uint32_t Index) const;
- const Elf_Sym *getSymbol(const Elf_Shdr *Sec, uint32_t Index) const {
+ ErrorOr<const Elf_Sym *> getSymbol(const Elf_Shdr *Sec,
+ uint32_t Index) const {
Elf_Sym_Range Symbols = symbols(Sec);
if (Index >= Symbols.size())
- report_fatal_error("Invalid symbol index");
+ return object_error::invalid_symbol_index;
return &Symbols[Index];
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26247.76821.patch
Type: text/x-patch
Size: 1694 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161103/ed66c016/attachment.bin>
More information about the llvm-commits
mailing list