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

Method parseMetadataStrings

src/lib/Bitcode/Reader/MetadataLoader.cpp:1810–1843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1808}
1809
1810Error MetadataLoader::MetadataLoaderImpl::parseMetadataStrings(
1811 ArrayRef<uint64_t> Record, StringRef Blob,
1812 function_ref<void(StringRef)> CallBack) {
1813 // All the MDStrings in the block are emitted together in a single
1814 // record. The strings are concatenated and stored in a blob along with
1815 // their sizes.
1816 if (Record.size() != 2)
1817 return error("Invalid record: metadata strings layout");
1818
1819 unsigned NumStrings = Record[0];
1820 unsigned StringsOffset = Record[1];
1821 if (!NumStrings)
1822 return error("Invalid record: metadata strings with no strings");
1823 if (StringsOffset > Blob.size())
1824 return error("Invalid record: metadata strings corrupt offset");
1825
1826 StringRef Lengths = Blob.slice(0, StringsOffset);
1827 SimpleBitstreamCursor R(Lengths);
1828
1829 StringRef Strings = Blob.drop_front(StringsOffset);
1830 do {
1831 if (R.AtEndOfStream())
1832 return error("Invalid record: metadata strings bad length");
1833
1834 unsigned Size = R.ReadVBR(6);
1835 if (Strings.size() < Size)
1836 return error("Invalid record: metadata strings truncated chars");
1837
1838 CallBack(Strings.slice(0, Size));
1839 Strings = Strings.drop_front(Size);
1840 } while (--NumStrings);
1841
1842 return Error::success();
1843}
1844
1845Error MetadataLoader::MetadataLoaderImpl::parseGlobalObjectAttachment(
1846 GlobalObject &GO, ArrayRef<uint64_t> Record) {

Callers

nothing calls this directly

Calls 8

CallBackClass · 0.85
successFunction · 0.85
AtEndOfStreamMethod · 0.80
ReadVBRMethod · 0.80
errorFunction · 0.70
sizeMethod · 0.45
sliceMethod · 0.45
drop_frontMethod · 0.45

Tested by

no test coverage detected