[PATCH] D49679: [DebugInfo] Have custom DWARFDie:: reverse_iterator

Jonas Devlieghere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 23 14:02:01 PDT 2018


JDevlieghere added a comment.

In https://reviews.llvm.org/D49679#1172143, @labath wrote:

> What's the reason for not specializing std::reverse_iterator? AFAIK, that is officially permitted by the standard.


What exactly would you do difference? I can see a solution where we make the current `__tmp` a class member of the iterator adapter, but maybe you have something more straightforward in mind?

> This way somebody can still construct a `std::reverse_iterator<DWARFDie::iterator>` (via `make_reverse_iterator` or whatever) and get UB.

That's not entirely true because it's no longer a bidirectional iterator. Regardless of the specialization, both `*++iterator` and `*--iterator` will remain UB.


https://reviews.llvm.org/D49679





More information about the llvm-commits mailing list