llvm.org GIT mirror llvm / 9324665
Added two bounds checks to the BitVector class to detect out-of-bounds bit accesses. The checks are only performed in a Debug build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44815 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 12 years ago
1 changed file(s) with 4 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
244244
245245 // Indexing.
246246 reference operator[](unsigned Idx) {
247 assert (Idx < Size && "Out-of-bounds Bit access.");
247248 return reference(*this, Idx);
248249 }
249250
250251 bool operator[](unsigned Idx) const {
252 assert (Idx < Size && "Out-of-bounds Bit access.");
251253 BitWord Mask = 1L << (Idx % BITWORD_SIZE);
252254 return (Bits[Idx / BITWORD_SIZE] & Mask) != 0;
253255 }
374376 // Destroy the old bits.
375377 delete[] Bits;
376378 Bits = NewBits;
379
380 clear_unused_bits();
377381 }
378382
379383 void init_words(BitWord *B, unsigned NumWords, bool t) {