[PATCH] D43313: [DebugInfo] Support parsing DWARF expressions

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 13:17:53 PST 2018


Rafael Auler via Phabricator <reviews at reviews.llvm.org> writes:

> +template <typename ELFT>
> +class PrinterContext {
> +  using Elf_Sym  = typename object::ELFFile<ELFT>::Elf_Sym;
> +  using Elf_Shdr = typename object::ELFFile<ELFT>::Elf_Shdr;
> +  using Elf_Phdr = typename object::ELFFile<ELFT>::Elf_Phdr;
> +  using Elf_Rel  = typename object::ELFFile<ELFT>::Elf_Rel;
> +  using Elf_Word = typename object::ELFFile<ELFT>::Elf_Word;

You can use ELFT::Sym for example. That may or may not be short enough
to avoid the name alias completely.

> +  ScopedPrinter &W;
> +  const object::ELFFile<ELFT> *Obj;
> +
> +  void PrintEHFrameHdr(uint64_t Offset, uint64_t Address, uint64_t Size) const;

Function names should start with a lowercase letter.

> +template <class ELFO>
> +static const typename ELFO::Elf_Shdr *findSectionByAddress(const ELFO *Obj,
> +                                                           uint64_t Addr) {
> +  auto Sections = Obj->sections();
> +  if (!Sections)
> +    return nullptr;

Sections returns an Expected, so you have to handle the error. If you
really want to eat it, you can use errorToBool, but returning Expected
or calling report_fatal_error is probably best.

Cheers,
Rafael


More information about the llvm-commits mailing list