[PATCH] D53792: [DebugInfo] Define base function on DWARFDie reverse iterators

Eugene Sharygin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 27 03:43:27 PDT 2018


eush created this revision.
eush added reviewers: JDevlieghere, dblaikie, labath, matthiaskrgr.
Herald added a subscriber: aprantl.

This defines member function `base` on the specialization of
`std::reverse_iterator` for `DWARFDie::iterator` as required by C++
[reverse.iter.conv].

This fixes unit test `DWARFDebugInfoTest.cpp` under EXPENSIVE_CHECKS
which currently can't be built due to GNU C++ Library calling this
member function in debug mode:

  /usr/include/c++/8.2.1/debug/stl_iterator.h:42:35: error: ‘const class std::reverse_iterator<llvm::DWARFDie::iterator>’ has no member named ‘base’
       { return __valid_range(__last.base(), __first.base(), __dist); }
                              ~~~~~~~^~~~

This fixes https://bugs.llvm.org/show_bug.cgi?id=38785.


Repository:
  rL LLVM

https://reviews.llvm.org/D53792

Files:
  include/llvm/DebugInfo/DWARF/DWARFDie.h


Index: include/llvm/DebugInfo/DWARF/DWARFDie.h
===================================================================
--- include/llvm/DebugInfo/DWARF/DWARFDie.h
+++ include/llvm/DebugInfo/DWARF/DWARFDie.h
@@ -404,6 +404,10 @@
       Die = Die.getPreviousSibling();
   }
 
+  llvm::DWARFDie::iterator base() const {
+    return llvm::DWARFDie::iterator(AtEnd ? Die : Die.getSibling());
+  }
+
   reverse_iterator<llvm::DWARFDie::iterator> &operator++() {
     assert(!AtEnd && "Incrementing rend");
     llvm::DWARFDie D = Die.getPreviousSibling();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53792.171394.patch
Type: text/x-patch
Size: 546 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181027/28423707/attachment.bin>


More information about the llvm-commits mailing list