aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm/include/llvm/ADT/BitVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/include/llvm/ADT/BitVector.h')
-rw-r--r--contrib/llvm/include/llvm/ADT/BitVector.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/contrib/llvm/include/llvm/ADT/BitVector.h b/contrib/llvm/include/llvm/ADT/BitVector.h
index f58dd7356c7d..ad00d51f99e9 100644
--- a/contrib/llvm/include/llvm/ADT/BitVector.h
+++ b/contrib/llvm/include/llvm/ADT/BitVector.h
@@ -34,7 +34,7 @@ class BitVector {
BitWord *Bits; // Actual bits.
unsigned Size; // Size of bitvector in bits.
- unsigned Capacity; // Size of allocated memory in BitWord.
+ unsigned Capacity; // Number of BitWords allocated in the Bits array.
public:
typedef unsigned size_type;
@@ -566,8 +566,16 @@ private:
if (AddBits)
clear_unused_bits();
}
+
+public:
+ /// Return the size (in bytes) of the bit vector.
+ size_t getMemorySize() const { return Capacity * sizeof(BitWord); }
};
+static inline size_t capacity_in_bytes(const BitVector &X) {
+ return X.getMemorySize();
+}
+
} // End llvm namespace
namespace std {