summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2013-05-09 21:07:43 +0000
committerJordan Rose <jordan_rose@apple.com>2013-05-09 21:07:43 +0000
commit06c5d201c46452119b7c799b9600e32a5a936bcf (patch)
treeb16f5b22972c0b9db1ec3e5051d47cbe4d4fd210 /llvm
parent9c785c217b3f967cc55c54236b9089c3c2d47c6b (diff)
downloadbcm5719-llvm-06c5d201c46452119b7c799b9600e32a5a936bcf.tar.gz
bcm5719-llvm-06c5d201c46452119b7c799b9600e32a5a936bcf.zip
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
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Bitcode/BitstreamWriter.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/include/llvm/Bitcode/BitstreamWriter.h b/llvm/include/llvm/Bitcode/BitstreamWriter.h
index a837211875f..f40a0d1d259 100644
--- a/llvm/include/llvm/Bitcode/BitstreamWriter.h
+++ b/llvm/include/llvm/Bitcode/BitstreamWriter.h
@@ -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]);
}
}
OpenPOWER on IntegriCloud