[PATCH] D48899: [dsymutil] Convert recursion in lookForDIEsToKeep into worklist.

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 03:36:57 PDT 2018


JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.


================
Comment at: llvm/tools/dsymutil/DwarfLinker.cpp:878-880
+    std::vector<DWARFDie> Children(Current.Die.begin(), Current.Die.end());
+    std::reverse(Children.begin(), Children.end());
+    for (auto Child : Children)
----------------
dblaikie wrote:
> JDevlieghere wrote:
> > friss wrote:
> > > Can you use something like make_reverse_iterator to avoid copying the list?
> > The iterator is a forward iterator (it uses getSibling to advance) so unfortunately not. 
> I think, maybe, getPreviousSibling could be implemented without great cost & this could be made into a bidirectional iterator? (looks like getSibling works by scanning forward in the list of DIEs until it finds another DIE with the same depth (or bailing out if it finds a DIE with a shallower depth) - the reverse search coudl be done the same way, I think?)
Makes sense! Implemented your suggestion in D49173


https://reviews.llvm.org/D48899





More information about the llvm-commits mailing list