forked from OSchip/llvm-project
[DebugInfo] Define base function on DWARFDie reverse iterators
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. This fixes https://llvm.org/PR38785 Patch by: Eugene Sharygin Differential revision: https://reviews.llvm.org/D53792 llvm-svn: 345621
This commit is contained in:
parent
98f1dd0bd5
commit
7323259de8
|
@ -404,6 +404,10 @@ public:
|
|||
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();
|
||||
|
|
|
@ -1227,6 +1227,10 @@ TEST(DWARFDebugInfo, TestRelations) {
|
|||
EXPECT_THAT(std::vector<DWARFDie>(A.rbegin(), A.rend()),
|
||||
testing::ElementsAre(D, C, B));
|
||||
|
||||
// Make sure conversion from reverse iterator works as expected.
|
||||
EXPECT_EQ(A.rbegin().base(), A.end());
|
||||
EXPECT_EQ(A.rend().base(), A.begin());
|
||||
|
||||
// Make sure iterator is bidirectional.
|
||||
{
|
||||
auto Begin = A.begin();
|
||||
|
|
Loading…
Reference in New Issue