[all-commits] [llvm/llvm-project] b7acb3: [DebugInfo] Force users of DWARFDebugAbbrev to cal...

Alex via All-commits all-commits at lists.llvm.org
Thu Jul 13 11:34:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b7acb3d4a5d769f014ce850efa197862616c2baa
      https://github.com/llvm/llvm-project/commit/b7acb3d4a5d769f014ce850efa197862616c2baa
  Author: Alex Langford <alangford at apple.com>
  Date:   2023-07-13 (Thu, 13 Jul 2023)

  Changed paths:
    M llvm/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h
    M llvm/tools/obj2yaml/dwarf2yaml.cpp

  Log Message:
  -----------
  [DebugInfo] Force users of DWARFDebugAbbrev to call parse before iterating

In an attempt to make it easier to catch errors when parsing the
debug_abbrev section, we should force users to call `parse` before
calling `begin`. In a follow-up change, I will change the return type of
`parse` from `void` to `Error`.

I also explored using the fallible_iterator pattern instead of forcing
users to parse everything up front. I think it would be a useful and
interesting pattern to implement, but it would require more extensive
changes to both DWARFDebugAbbrev and its users. Because my top priority
is improving the safety around parsing debug_abbrev, I'm opting to
preserve existing behavior until I or somebody else has time to refactor
to be able to implement a fallible_iterator.

Differential Revision: https://reviews.llvm.org/D154655




More information about the All-commits mailing list