From d044f65e37f09a6c69da4d002c1e8957bd4d99c0 Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Thu, 9 May 2013 21:07:43 +0000 Subject: [PATCH] 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 --- include/llvm/Bitcode/BitstreamWriter.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h index a837211875f..f40a0d1d259 100644 --- a/include/llvm/Bitcode/BitstreamWriter.h +++ b/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]); } } -- 2.34.1