[Lldb-commits] [PATCH] D103172: [lldb][NFC] Allow range-based for loops over DWARFDIE's children
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 17 03:36:26 PDT 2021
teemperor added inline comments.
================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h:117
+ // (CU, (DIE)nullptr) == (nullptr, nullptr) -> true
+ if (!m_die.IsValid() && !it.m_die.IsValid())
+ return true;
----------------
shafik wrote:
> I think:
>
> ```
> bool operator==(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs) {
> return lhs.GetDIE() == rhs.GetDIE() && lhs.GetCU() == rhs.GetCU();
> }
> ```
>
> will do the same thing but maybe I am confused.
>
> Maybe we should have a unit test?
That's the `DWARFDIE::operator==` implementation called below and this special case is because of the comment one line above (we need to match the end iterator if it's default constructed when `GetSibling()` returns a DWARFDIE that has a valid CU but a `null` DIE).
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103172/new/
https://reviews.llvm.org/D103172
More information about the lldb-commits
mailing list