[PATCH] D26681: [ELF] Move ELF.h to Expected<T>

Michael Spencer via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 15:57:35 PST 2016


Bigcheese accepted this revision.
Bigcheese added a comment.

Looks fine with the following wording changes and what rafael requested.



================
Comment at: include/llvm/Object/ELF.h:267
       Offset + Size > Buf.size())
-    return object_error::parse_failed;
+    return make_error<StringError>("invalid offset",
+                                   object_error::parse_failed);
----------------
invalid section offset


================
Comment at: include/llvm/Object/ELF.h:414
   if (Pos + sizeof(T) > Buf.size())
-    return object_error::parse_failed;
+    return make_error<StringError>("invalid offset",
+                                   object_error::parse_failed);
----------------
invalid section offset


================
Comment at: include/llvm/Object/ELF.h:432
   if (Section->sh_type != ELF::SHT_STRTAB)
-    return object_error::parse_failed;
+    return make_error<StringError>("invalid sh_type",
+                                   object_error::parse_failed);
----------------
invalid sh_type for string table, expected SHT_STRTAB


================
Comment at: include/llvm/Object/ELF.h:494
   if (Sec.sh_type != ELF::SHT_SYMTAB && Sec.sh_type != ELF::SHT_DYNSYM)
-    return object_error::parse_failed;
-  ErrorOr<const Elf_Shdr *> SectionOrErr =
-      object::getSection<ELFT>(Sections, Sec.sh_link);
-  if (std::error_code EC = SectionOrErr.getError())
-    return EC;
+    return make_error<StringError>("invalid sh_type",
+                                   object_error::parse_failed);
----------------
invalid sh_type for symbol table, expected SHT_SYMTAB or SHT_DYNSYM


================
Comment at: include/llvm/Object/ELF.h:521
   if (Offset >= DotShstrtab.size())
-    return object_error::parse_failed;
+    return make_error<StringError>("invalid offset",
+                                   object_error::parse_failed);
----------------
invalid string offset


https://reviews.llvm.org/D26681





More information about the llvm-commits mailing list