[PATCH] D28134: Compilation error when using operator++ (post increment) function of SmallPtrSetIterator class
Abhilash Bhandari via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 28 04:38:10 PST 2016
Abhilash updated this revision to Diff 82588.
Abhilash added a comment.
ReverseIterationTest has been updated.
Repository:
rL LLVM
https://reviews.llvm.org/D28134
Files:
include/llvm/ADT/SmallPtrSet.h
unittests/ADT/ReverseIterationTest.cpp
Index: unittests/ADT/ReverseIterationTest.cpp
===================================================================
--- unittests/ADT/ReverseIterationTest.cpp
+++ 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
Index: include/llvm/ADT/SmallPtrSet.h
===================================================================
--- include/llvm/ADT/SmallPtrSet.h
+++ 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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28134.82588.patch
Type: text/x-patch
Size: 1374 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161228/200fb924/attachment.bin>
More information about the llvm-commits
mailing list