[llvm] r181545 - Rewrite assert to avoid warning when the record element type is byte-sized.
Jordan Rose
jordan_rose at apple.com
Thu May 9 14:07:43 PDT 2013
Author: jrose
Date: Thu May 9 16:07:43 2013
New Revision: 181545
URL: http://llvm.org/viewvc/llvm-project?rev=181545&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=181545&r1=181544&r2=181545&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Thu May 9 16:07:43 2013
@@ -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]);
}
}
More information about the llvm-commits
mailing list