Rewrite assert to avoid warning when the record element type is byte-sized.

BitstreamWriter asserts that when blob data is written from the record
element vector, each element fits in a byte. However, if the record
elements are specified as a SmallVector of 'char', this causes a warning
from -Wtautological-constant-out-of-range-compare. Fix this by using
llvm::isUInt<8> instead of a plain comparison against 256.

llvm-svn: 181545
This commit is contained in:
Jordan Rose 2013-05-09 21:07:43 +00:00
parent 9c785c217b
commit 06c5d201c4
1 changed files with 2 additions and 1 deletions

View File

@ -381,7 +381,8 @@ private:
BlobData = 0;
} else {
for (unsigned e = Vals.size(); RecordIdx != e; ++RecordIdx) {
assert(Vals[RecordIdx] < 256 && "Value too large to emit as blob");
assert(isUInt<8>(Vals[RecordIdx]) &&
"Value too large to emit as blob");
WriteByte((unsigned char)Vals[RecordIdx]);
}
}