| 1808 | } |
| 1809 | |
| 1810 | Error 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 | |
| 1845 | Error MetadataLoader::MetadataLoaderImpl::parseGlobalObjectAttachment( |
| 1846 | GlobalObject &GO, ArrayRef<uint64_t> Record) { |
nothing calls this directly
no test coverage detected