aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-08-01 08:40:46 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-08-01 08:40:46 +0000
commit0b1bcbf6b87f19402d8aef1ef9f6e527a07de9d4 (patch)
tree0b6e812eb2d2af65ba5b88c394d1e599e3df09a8 /include
parent5a2c607153993fb7f7e04f9482520b64dffe5757 (diff)
downloadexternal_llvm-0b1bcbf6b87f19402d8aef1ef9f6e527a07de9d4.zip
external_llvm-0b1bcbf6b87f19402d8aef1ef9f6e527a07de9d4.tar.gz
external_llvm-0b1bcbf6b87f19402d8aef1ef9f6e527a07de9d4.tar.bz2
Add basic in-bounds asserts to TinyPtrVector::erase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161103 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/ADT/TinyPtrVector.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/llvm/ADT/TinyPtrVector.h b/include/llvm/ADT/TinyPtrVector.h
index 1038c78..d226bc2 100644
--- a/include/llvm/ADT/TinyPtrVector.h
+++ b/include/llvm/ADT/TinyPtrVector.h
@@ -215,6 +215,9 @@ public:
}
iterator erase(iterator I) {
+ assert(I >= begin() && "Iterator to erase is out of bounds.");
+ assert(I < end() && "Erasing at past-the-end iterator.");
+
// If we have a single value, convert to empty.
if (Val.template is<EltTy>()) {
if (I == begin())