Index: include/llvm/ADT/BitVector.h =================================================================== --- include/llvm/ADT/BitVector.h +++ include/llvm/ADT/BitVector.h @@ -295,6 +295,23 @@ return *this; } + /// Set bit \p Idx to true. This function allows BitVector to be used in + /// contexts expecting std::set/DenseSet like API. + std::pair insert(unsigned Idx) { + reference ref(*this, Idx); + bool Res = !ref; + ref = true; + return std::make_pair(ref, Res); + } + + /// Clear bit \p Idx. This function allows BitVector to be used in contexts + /// expecting std::set/DenseSet like API. + bool erase(unsigned Idx) { + bool Res = test(Idx); + reset(Idx); + return Res; + } + BitVector &flip() { for (unsigned i = 0; i < NumBitWords(size()); ++i) Bits[i] = ~Bits[i];