Helper to read the header common to all bitcode files.
| 108 | |
| 109 | /// Helper to read the header common to all bitcode files. |
| 110 | static bool hasValidBitcodeHeader(BitstreamCursor &Stream) { |
| 111 | // Sniff for the signature. |
| 112 | if (!Stream.canSkipToPos(4) || |
| 113 | Stream.Read(8) != 'B' || |
| 114 | Stream.Read(8) != 'C' || |
| 115 | Stream.Read(4) != 0x0 || |
| 116 | Stream.Read(4) != 0xC || |
| 117 | Stream.Read(4) != 0xE || |
| 118 | Stream.Read(4) != 0xD) |
| 119 | return false; |
| 120 | return true; |
| 121 | } |
| 122 | |
| 123 | static Expected<BitstreamCursor> initStream(MemoryBufferRef Buffer) { |
| 124 | const unsigned char *BufPtr = (const unsigned char *)Buffer.getBufferStart(); |
no test coverage detected