[PATCH] D28134: Compilation error when using operator++ (post increment) function of SmallPtrSetIterator class
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 30 04:45:35 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL290749: [ADT] Fix for compilation error when operator++(int) (post-increment function)… (authored by abhandari).
Changed prior to commit:
https://reviews.llvm.org/D28134?vs=82588&id=82726#toc
Repository:
rL LLVM
https://reviews.llvm.org/D28134
Files:
llvm/trunk/include/llvm/ADT/SmallPtrSet.h
llvm/trunk/unittests/ADT/ReverseIterationTest.cpp
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<bool>::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<bool>::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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28134.82726.patch
Type: text/x-patch
Size: 1440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161230/b876ac51/attachment.bin>
More information about the llvm-commits
mailing list