diff options
Diffstat (limited to 'include/llvm/ADT/ilist.h')
-rw-r--r-- | include/llvm/ADT/ilist.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/include/llvm/ADT/ilist.h b/include/llvm/ADT/ilist.h index 1db648b..a451a18 100644 --- a/include/llvm/ADT/ilist.h +++ b/include/llvm/ADT/ilist.h @@ -41,6 +41,21 @@ #include "llvm/ADT/iterator.h" #include <cassert> +#undef LLVM_COMPACTIFY_SENTINELS +/// @brief activate small sentinel structs +/// Comment out if you want better debuggability +/// of ilist<> end() iterators. +/// See also llvm/ADT/ilist_node.h, where the +/// same change must be made. +/// +#define LLVM_COMPACTIFY_SENTINELS 1 + +#if defined(LLVM_COMPACTIFY_SENTINELS) && LLVM_COMPACTIFY_SENTINELS +# define sentinel_tail_assert(COND) +#else +# define sentinel_tail_assert(COND) assert(COND) +#endif + namespace llvm { template<typename NodeTy, typename Traits> class iplist; @@ -189,12 +204,12 @@ public: // Accessors... operator pointer() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); + sentinel_tail_assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); return NodePtr; } reference operator*() const { - assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); + sentinel_tail_assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!"); return *NodePtr; } pointer operator->() const { return &operator*(); } @@ -215,7 +230,7 @@ public: } ilist_iterator &operator++() { // preincrement - Advance NodePtr = Traits::getNext(NodePtr); - assert(NodePtr && "++'d off the end of an ilist!"); + sentinel_tail_assert(NodePtr && "++'d off the end of an ilist!"); return *this; } ilist_iterator operator--(int) { // postdecrement operators... |