diff options
Diffstat (limited to 'include/llvm/Bitcode/BitstreamWriter.h')
-rw-r--r-- | include/llvm/Bitcode/BitstreamWriter.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/Bitcode/BitstreamWriter.h b/include/llvm/Bitcode/BitstreamWriter.h index 31d513c..bfb3a4e 100644 --- a/include/llvm/Bitcode/BitstreamWriter.h +++ b/include/llvm/Bitcode/BitstreamWriter.h @@ -88,7 +88,7 @@ public: //===--------------------------------------------------------------------===// void Emit(uint32_t Val, unsigned NumBits) { - assert(NumBits <= 32 && "Invalid value size!"); + assert(NumBits && NumBits <= 32 && "Invalid value size!"); assert((Val & ~(~0U >> (32-NumBits))) == 0 && "High bits set!"); CurValue |= Val << CurBit; if (CurBit + NumBits < 32) { @@ -277,10 +277,12 @@ private: switch (Op.getEncoding()) { default: assert(0 && "Unknown encoding!"); case BitCodeAbbrevOp::Fixed: - Emit((unsigned)V, (unsigned)Op.getEncodingData()); + if (Op.getEncodingData()) + Emit((unsigned)V, (unsigned)Op.getEncodingData()); break; case BitCodeAbbrevOp::VBR: - EmitVBR64(V, (unsigned)Op.getEncodingData()); + if (Op.getEncodingData()) + EmitVBR64(V, (unsigned)Op.getEncodingData()); break; case BitCodeAbbrevOp::Char6: Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6); |