aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-03-27 02:43:03 +0000
committerChris Lattner <sabre@nondot.org>2008-03-27 02:43:03 +0000
commit2896652be29de97a6e08b5cccc015096f4ed17b5 (patch)
tree7bbfe66024d6c41e526efff49514b8c345de11f1 /include
parent53b87db8d31dd8593f256189ec504274035713ab (diff)
downloadexternal_llvm-2896652be29de97a6e08b5cccc015096f4ed17b5.zip
external_llvm-2896652be29de97a6e08b5cccc015096f4ed17b5.tar.gz
external_llvm-2896652be29de97a6e08b5cccc015096f4ed17b5.tar.bz2
when a node is removed from an ilist, set its next/prev pointers to
null. This means that uses of invalidated iterators will explode violently with: ilist:143: failed assertion `NodePtr && "++'d off the end of an ilist!"' instead of happening to work "most of the time". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48859 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/ilist8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/ilist b/include/llvm/ADT/ilist
index fe55f5c..4e6ea00 100644
--- a/include/llvm/ADT/ilist
+++ b/include/llvm/ADT/ilist
@@ -356,6 +356,14 @@ public:
setPrev(NextNode, PrevNode);
IT = NextNode;
removeNodeFromList(Node); // Notify traits that we removed a node...
+
+ // Set the next/prev pointers of the current node to null. This isn't
+ // strictly required, but this catches errors where a node is removed from
+ // an ilist (and potentially deleted) with iterators still pointing at it.
+ // When those iterators are incremented or decremented, they will assert on
+ // the null next/prev pointer instead of "usually working".
+ setNext(Node, 0);
+ setPrev(Node, 0);
return Node;
}