[llvm-commits] [llvm] r119708 - /llvm/trunk/lib/Support/APInt.cpp
Dan Gohman
gohman at apple.com
Thu Nov 18 09:14:56 PST 2010
Author: djg
Date: Thu Nov 18 11:14:56 2010
New Revision: 119708
URL: http://llvm.org/viewvc/llvm-project?rev=119708&view=rev
Log:
Bounds-check APInt's operator[].
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=119708&r1=119707&r2=119708&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Thu Nov 18 11:14:56 2010
@@ -483,6 +483,7 @@
}
bool APInt::operator[](unsigned bitPosition) const {
+ assert(bitPosition < getBitWidth() && "Bit position out of bounds!");
return (maskBit(bitPosition) &
(isSingleWord() ? VAL : pVal[whichWord(bitPosition)])) != 0;
}
More information about the llvm-commits
mailing list