[adt] SparseBitVector::test() should be const
authorDaniel Sanders <daniel_l_sanders@apple.com>
Wed, 31 Oct 2018 20:05:32 +0000 (20:05 +0000)
committerDaniel Sanders <daniel_l_sanders@apple.com>
Wed, 31 Oct 2018 20:05:32 +0000 (20:05 +0000)
commitf777e8b463da352e63679bfa7968cbec7468f1f9
tree8b7f93667c77477943e5d8203e97af5f50088866
parentb041831a1adaba180cad8d47de8f5a90b38de42b
[adt] SparseBitVector::test() should be const

Summary:
Re-worked SparseBitVector's most-recently-used-word caching (CurrElementIter)
such that SparseBitVector::test() can be made const. This came up when
attempting to test individual bits in a SparseBitVector which was a member of a
const object.

The cached iterator has no bearing on the externally visible state, it's merely
a performance optimization. Therefore it has been made mutable and
FindLowerBound() has been split into a const and non-const function
(FindLowerBound/FindLowerBoundConst) for the const/non-const
interfaces.

Reviewers: rtereshin

Reviewed By: rtereshin

Subscribers: rtereshin, dexonsmith, kristina, llvm-commits

Differential Revision: https://reviews.llvm.org/D53447

llvm-svn: 345772
llvm/include/llvm/ADT/SparseBitVector.h
llvm/unittests/ADT/SparseBitVectorTest.cpp