The function operator++ (post increment) in the SmallPtrSetIterator class has been recently changed to handle reverse iterations through command line option. The new change leads to a compilation error when operator++ is used.
The compilation error is:
/mySandBox/llvm/include/llvm/ADT/SmallPtrSet.h: In instantiation of 'llvm::SmallPtrSetIterator<PtrTy> llvm::SmallPtrSetIterator<PtrTy>::operator++(int) [with PtrTy = llvm::User*]':
/mySandBox/llvm/lib/Transforms/Scalar/myopt.cpp:418:32: required from here
/mySandBox/llvm/include/llvm/ADT/SmallPtrSet.h:295:7: error: no match for 'operator--' (operand type is 'llvm::SmallPtrSetIterator<llvm::User*>')
--*this; ^
make[2]: * [lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/myopt.cpp.o] Error 1
make[1]: * [lib/Transforms/Scalar/CMakeFiles/LLVMScalarOpts.dir/all] Error 2
make: *** [all] Error 2
The compilation fails stating that operator-- is not defined for SmallPtrSetIterator.
I see that, operator++ (post-increment) function internally calls operator++ (pre-increment). Since pre-increment already handles reverse iteration, I feel we do not need to specifically handle reverse iterations in the post-increment function.
This patch contains the corresponding changes.
The differential for the early changes: https://reviews.llvm.org/D26718