[all-commits] [llvm/llvm-project] 77440d: [lldb][NFC] Allow range-based for loops over DWARF...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Jul 22 06:03:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 77440d644b3ba26443c1d14d04a4046fab07d731
      https://github.com/llvm/llvm-project/commit/77440d644b3ba26443c1d14d04a4046fab07d731
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-07-22 (Thu, 22 Jul 2021)

  Changed paths:
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
    M lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
    M lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    M lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
    A lldb/unittests/SymbolFile/DWARF/DWARFDIETest.cpp

  Log Message:
  -----------
  [lldb][NFC] Allow range-based for loops over DWARFDIE's children

This patch adds the ability to get a DWARFDIE's children as an LLVM range.

This way we can use for range loops to iterate over them and we can use LLVM's
algorithms like `llvm::all_of` to query all children.

The implementation has to do some small shenanigans as the iterator needs to
store a DWARFDIE, but a DWARFDIE container is also a DWARFDIE so it can't return
the iterator by value. I just made the `children` getter a templated function to
avoid the cyclic dependency.

Reviewed By: #lldb, werat, JDevlieghere

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




More information about the All-commits mailing list