diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-18 17:14:56 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-18 17:14:56 +0000 |
commit | 5ed61fe6a108636a6f3de37d21ad80452f4c05a3 (patch) | |
tree | 2b324fb0fd6f3c30f89e353a131b0dd78c4c15aa /llvm/lib/Support | |
parent | 21a968364110442986077e86bd7a51fd0d86f974 (diff) | |
download | bcm5719-llvm-5ed61fe6a108636a6f3de37d21ad80452f4c05a3.tar.gz bcm5719-llvm-5ed61fe6a108636a6f3de37d21ad80452f4c05a3.zip |
Bounds-check APInt's operator[].
llvm-svn: 119708
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 88f9ac63f7e..6bbe9ab4632 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -483,6 +483,7 @@ APInt APInt::operator-(const APInt& RHS) const { } bool APInt::operator[](unsigned bitPosition) const { + assert(bitPosition < getBitWidth() && "Bit position out of bounds!"); return (maskBit(bitPosition) & (isSingleWord() ? VAL : pVal[whichWord(bitPosition)])) != 0; } |