| 306 | } |
| 307 | |
| 308 | static Expected<std::string> readModuleTriple(BitstreamCursor &Stream) { |
| 309 | if (Stream.EnterSubBlock(bitc::MODULE_BLOCK_ID)) |
| 310 | return error("Invalid record"); |
| 311 | |
| 312 | SmallVector<uint64_t, 64> Record; |
| 313 | |
| 314 | std::string Triple; |
| 315 | |
| 316 | // Read all the records for this module. |
| 317 | while (true) { |
| 318 | BitstreamEntry Entry = Stream.advanceSkippingSubblocks(); |
| 319 | |
| 320 | switch (Entry.Kind) { |
| 321 | case BitstreamEntry::SubBlock: // Handled for us already. |
| 322 | case BitstreamEntry::Error: |
| 323 | return error("Malformed block"); |
| 324 | case BitstreamEntry::EndBlock: |
| 325 | return Triple; |
| 326 | case BitstreamEntry::Record: |
| 327 | // The interesting case. |
| 328 | break; |
| 329 | } |
| 330 | |
| 331 | // Read a record. |
| 332 | switch (Stream.readRecord(Entry.ID, Record)) { |
| 333 | default: break; // Default behavior, ignore unknown content. |
| 334 | case bitc::MODULE_CODE_TRIPLE: { // TRIPLE: [strchr x N] |
| 335 | std::string S; |
| 336 | if (convertToString(Record, 0, S)) |
| 337 | return error("Invalid record"); |
| 338 | Triple = S; |
| 339 | break; |
| 340 | } |
| 341 | } |
| 342 | Record.clear(); |
| 343 | } |
| 344 | llvm_unreachable("Exit infinite loop"); |
| 345 | } |
| 346 | |
| 347 | static Expected<std::string> readTriple(BitstreamCursor &Stream) { |
| 348 | // We expect a number of well-defined blocks, though we don't necessarily |
no test coverage detected