[PATCH] [Object] Split the ELF interface into 3 parts.

Rafael Espíndola rafael.espindola at gmail.com
Wed Jun 26 13:49:51 PDT 2013


> ================
> Comment at: include/llvm/Object/ELF.h:1550
> @@ +1549,3 @@
> +template <class ELFT>
> +ErrorOr<StringRef>
> +ELFFile<ELFT>::getSectionName(const Elf_Shdr *Section) const {
> ----------------
> Rafael Ávila de Espíndola wrote:
>> This never fails. Please just return a StringRef.
> We will need to verify that Section->sh_name is valid.

I am not convinced that we should not be using fatal errors. The
clients of this library are tools like ld and ar which will just stop
when there is an error.

In any case, we are not checking sh_name right now, so the code should
not return an ErrorOr. If/When we find that we need to handle
corrupted sh_name in a non fatal way, we can make it return ErrorOr
and add a test showing which client needs a non fatal error and why.

At no time we should have an interface that is more generic than needed.

Cheers,
Rafael




More information about the llvm-commits mailing list