[PATCH] D41979: [bcanalyzer] Recognize more stream types

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 18 08:06:26 PST 2018


aprantl added inline comments.


================
Comment at: tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp:799
   CurStreamType = UnknownBitstream;
-  if (Signature[0] == 'B' && Signature[1] == 'C' &&
-      Signature[2] == 0x0 && Signature[3] == 0xC &&
-      Signature[4] == 0xE && Signature[5] == 0xD)
-    CurStreamType = LLVMIRBitstream;
+  if (Signature[0] == 'C' && Signature[1] == 'P') {
+    Signature[2] = Stream.Read(8);
----------------
modocache wrote:
> aprantl wrote:
> > Half-serious: How many implementations of this check do we have now (including clang)? It might be nice to we could add a checkMagic(stdd::array<char, 4>) function to BitStreamReader.
> Oh, great point!
> 
> I think @davide's suggestion to add a test for this is a good one. What do you think of me landing this with a test first, and then in another commit I can consolidate the logic?
Could you add a helper function for comparing a magic number read from a bitstream?


https://reviews.llvm.org/D41979





More information about the llvm-commits mailing list