aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/ADT/SmallBitVector.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/SmallBitVector.h')
-rw-r--r--include/llvm/ADT/SmallBitVector.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/ADT/SmallBitVector.h b/include/llvm/ADT/SmallBitVector.h
index 0922017ea61a..1e2f365b1040 100644
--- a/include/llvm/ADT/SmallBitVector.h
+++ b/include/llvm/ADT/SmallBitVector.h
@@ -54,7 +54,7 @@ class SmallBitVector {
};
public:
- typedef unsigned size_type;
+ typedef unsigned size_type;
// Encapsulation of a single bit.
class reference {
SmallBitVector &TheVector;
@@ -292,8 +292,12 @@ public:
}
SmallBitVector &set(unsigned Idx) {
- if (isSmall())
+ if (isSmall()) {
+ assert(Idx <= static_cast<unsigned>(
+ std::numeric_limits<uintptr_t>::digits) &&
+ "undefined behavior");
setSmallBits(getSmallBits() | (uintptr_t(1) << Idx));
+ }
else
getPointer()->set(Idx);
return *this;