Index: include/llvm/ADT/IntervalMap.h =================================================================== --- include/llvm/ADT/IntervalMap.h +++ include/llvm/ADT/IntervalMap.h @@ -150,6 +150,12 @@ return a+1 == b; } + /// nonEmpty - Return true if [a;b] is non-empty. + /// This is a <= b for a closed interval, a < b for [a;b) half-open intervals. + static inline bool nonEmpty(const T &a, const T &b) { + return a <= b; + } + }; template @@ -170,6 +176,11 @@ return a == b; } + /// nonEmpty - Return true if [a;b) is non-empty. + static inline bool nonEmpty(const T &a, const T &b) { + return a < b; + } + }; /// IntervalMapImpl - Namespace used for IntervalMap implementation details. @@ -1669,7 +1680,7 @@ template void IntervalMap:: iterator::setStart(KeyT a) { - assert(Traits::stopLess(a, this->stop()) && "Cannot move start beyond stop"); + assert(Traits::nonEmpty(a, this->stop()) && "Cannot move start beyond stop"); KeyT &CurStart = this->unsafeStart(); if (!Traits::startLess(a, CurStart) || !canCoalesceLeft(a, this->value())) { CurStart = a; @@ -1685,7 +1696,7 @@ template void IntervalMap:: iterator::setStop(KeyT b) { - assert(Traits::stopLess(this->start(), b) && "Cannot move stop beyond start"); + assert(Traits::nonEmpty(this->start(), b) && "Cannot move stop beyond start"); if (Traits::startLess(b, this->stop()) || !canCoalesceRight(b, this->value())) { setStopUnchecked(b);