[PATCH] D38833: BitstreamWriter: Better assertion when a block's abbrev code size is too small

Jordan Rose via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 14:07:50 PDT 2018


jordan_rose added inline comments.


================
Comment at: unittests/Bitcode/BitstreamWriterTest.cpp:65
+  auto Abbrev = std::make_shared<BitCodeAbbrev>();
+  Abbrev->Add(BitCodeAbbrevOp(42U));
+  unsigned AbbrevCode = W.EmitAbbrev(std::move(Abbrev));
----------------
jordan_rose wrote:
> lebedev.ri wrote:
> > I'd expect to see three tests.
> > One last valid one, the invalid one, and the next after the first invalid one.
> > So `3U`, `4U`, `5U`.
> This is just an arbitrary data value. What makes this too big is the CodeLen of 2 above. But I can certainly test overflowing a CodeLen of 3 as well.
Oh, I see what you mean. Values 0-3 have a special meaning in bitstream mode, so I can't actually do that test, but I'll add one for overflowing 3.


Repository:
  rL LLVM

https://reviews.llvm.org/D38833





More information about the llvm-commits mailing list