| 5706 | } |
| 5707 | |
| 5708 | static Expected<StringRef> readBlobInRecord(BitstreamCursor &Stream, |
| 5709 | unsigned Block, unsigned RecordID) { |
| 5710 | if (Stream.EnterSubBlock(Block)) |
| 5711 | return error("Invalid record"); |
| 5712 | |
| 5713 | StringRef Strtab; |
| 5714 | while (true) { |
| 5715 | BitstreamEntry Entry = Stream.advance(); |
| 5716 | switch (Entry.Kind) { |
| 5717 | case BitstreamEntry::EndBlock: |
| 5718 | return Strtab; |
| 5719 | |
| 5720 | case BitstreamEntry::Error: |
| 5721 | return error("Malformed block"); |
| 5722 | |
| 5723 | case BitstreamEntry::SubBlock: |
| 5724 | if (Stream.SkipBlock()) |
| 5725 | return error("Malformed block"); |
| 5726 | break; |
| 5727 | |
| 5728 | case BitstreamEntry::Record: |
| 5729 | StringRef Blob; |
| 5730 | SmallVector<uint64_t, 1> Record; |
| 5731 | if (Stream.readRecord(Entry.ID, Record, &Blob) == RecordID) |
| 5732 | Strtab = Blob; |
| 5733 | break; |
| 5734 | } |
| 5735 | } |
| 5736 | } |
| 5737 | |
| 5738 | //===----------------------------------------------------------------------===// |
| 5739 | // External interface |
no test coverage detected