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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 08:52:13 PST 2018


Rafael Auler via Phabricator via llvm-commits
<llvm-commits at lists.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;

Please use the types in ELFT: ELFT::Sym, ELFT::Shdr, etc.

> +
> +  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.

> +  void PrintEHFrame(const Elf_Shdr *EHFrameShdr) const;
> +
> +public:
> +  PrinterContext(ScopedPrinter &W, const object::ELFFile<ELFT> *Obj)
> +      : W(W), Obj(Obj) {}
> +
> +  void PrintUnwindInformation() const;
> +};
> +
> +template <class ELFO>
> +static const typename ELFO::Elf_Shdr *findSectionByAddress(const ELFO *Obj,
> +                                                           uint64_t Addr) {
> +  auto Sections = Obj->sections();
> +  if (!Sections)
> +    return nullptr;

You can't handle Expected like this. You have to explicitly eat the
error if you really want to.

Cheers,
Rafael


More information about the llvm-commits mailing list