| 209 | } |
| 210 | |
| 211 | static Expected<std::string> readIdentificationCode(BitstreamCursor &Stream) { |
| 212 | // We expect a number of well-defined blocks, though we don't necessarily |
| 213 | // need to understand them all. |
| 214 | while (true) { |
| 215 | if (Stream.AtEndOfStream()) |
| 216 | return ""; |
| 217 | |
| 218 | BitstreamEntry Entry = Stream.advance(); |
| 219 | switch (Entry.Kind) { |
| 220 | case BitstreamEntry::EndBlock: |
| 221 | case BitstreamEntry::Error: |
| 222 | return error("Malformed block"); |
| 223 | |
| 224 | case BitstreamEntry::SubBlock: |
| 225 | if (Entry.ID == bitc::IDENTIFICATION_BLOCK_ID) |
| 226 | return readIdentificationBlock(Stream); |
| 227 | |
| 228 | // Ignore other sub-blocks. |
| 229 | if (Stream.SkipBlock()) |
| 230 | return error("Malformed block"); |
| 231 | continue; |
| 232 | case BitstreamEntry::Record: |
| 233 | Stream.skipRecord(Entry.ID); |
| 234 | continue; |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | static Expected<bool> hasObjCCategoryInModule(BitstreamCursor &Stream) { |
| 240 | if (Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID)) |
no test coverage detected