MCPcopy Create free account
hub / github.com/GANGE666/xVMP / readModuleTriple

Function readModuleTriple

src/lib/Bitcode/Reader/BitcodeReader.cpp:308–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306}
307
308static 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
347static Expected<std::string> readTriple(BitstreamCursor &Stream) {
348 // We expect a number of well-defined blocks, though we don't necessarily

Callers 1

readTripleFunction · 0.85

Calls 6

EnterSubBlockMethod · 0.80
errorFunction · 0.70
convertToStringFunction · 0.70
readRecordMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected