Index: llvm/trunk/include/llvm/ADT/SmallPtrSet.h =================================================================== --- llvm/trunk/include/llvm/ADT/SmallPtrSet.h +++ llvm/trunk/include/llvm/ADT/SmallPtrSet.h @@ -290,12 +290,6 @@ SmallPtrSetIterator operator++(int) { // Postincrement SmallPtrSetIterator tmp = *this; -#if LLVM_ENABLE_ABI_BREAKING_CHECKS - if (ReverseIterate::value) { - --*this; - return tmp; - } -#endif ++*this; return tmp; } Index: llvm/trunk/unittests/ADT/ReverseIterationTest.cpp =================================================================== --- llvm/trunk/unittests/ADT/ReverseIterationTest.cpp +++ llvm/trunk/unittests/ADT/ReverseIterationTest.cpp @@ -31,9 +31,22 @@ for (const auto &Tuple : zip(Set, Ptrs)) ASSERT_EQ(std::get<0>(Tuple), std::get<1>(Tuple)); + // Check operator++ (post-increment) in forward iteration. + int i = 0; + for (auto begin = Set.begin(), end = Set.end(); + begin != end; i++) + ASSERT_EQ(*begin++, Ptrs[i]); + // Check reverse iteration. ReverseIterate::value = true; for (const auto &Tuple : zip(Set, ReversePtrs)) ASSERT_EQ(std::get<0>(Tuple), std::get<1>(Tuple)); + + // Check operator++ (post-increment) in reverse iteration. + i = 0; + for (auto begin = Set.begin(), end = Set.end(); + begin != end; i++) + ASSERT_EQ(*begin++, ReversePtrs[i]); + } #endif