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

Brian Gesiak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 09:01:40 PST 2018


modocache added a comment.

Very smart idea, @davide! I'll do that.



================
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);
----------------
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?


https://reviews.llvm.org/D41979





More information about the llvm-commits mailing list