llvm.org GIT mirror llvm / d044f65
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181545 91177308-0d34-0410-b5e6-96231b3b80d8 Jordan Rose 7 years ago
1 changed file(s) with 2 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
380380 BlobData = 0;
381381 } else {
382382 for (unsigned e = Vals.size(); RecordIdx != e; ++RecordIdx) {
383 assert(Vals[RecordIdx] < 256 && "Value too large to emit as blob");
383 assert(isUInt<8>(Vals[RecordIdx]) &&
384 "Value too large to emit as blob");
384385 WriteByte((unsigned char)Vals[RecordIdx]);
385386 }
386387 }