| 1811 | } |
| 1812 | |
| 1813 | Error BitcodeReader::parseSyncScopeNames() { |
| 1814 | if (Stream.EnterSubBlock(bitc::SYNC_SCOPE_NAMES_BLOCK_ID)) |
| 1815 | return error("Invalid record"); |
| 1816 | |
| 1817 | if (!SSIDs.empty()) |
| 1818 | return error("Invalid multiple synchronization scope names blocks"); |
| 1819 | |
| 1820 | SmallVector<uint64_t, 64> Record; |
| 1821 | while (true) { |
| 1822 | BitstreamEntry Entry = Stream.advanceSkippingSubblocks(); |
| 1823 | switch (Entry.Kind) { |
| 1824 | case BitstreamEntry::SubBlock: // Handled for us already. |
| 1825 | case BitstreamEntry::Error: |
| 1826 | return error("Malformed block"); |
| 1827 | case BitstreamEntry::EndBlock: |
| 1828 | if (SSIDs.empty()) |
| 1829 | return error("Invalid empty synchronization scope names block"); |
| 1830 | return Error::success(); |
| 1831 | case BitstreamEntry::Record: |
| 1832 | // The interesting case. |
| 1833 | break; |
| 1834 | } |
| 1835 | |
| 1836 | // Synchronization scope names are implicitly mapped to synchronization |
| 1837 | // scope IDs by their order. |
| 1838 | |
| 1839 | if (Stream.readRecord(Entry.ID, Record) != bitc::SYNC_SCOPE_NAME) |
| 1840 | return error("Invalid record"); |
| 1841 | |
| 1842 | SmallString<16> SSN; |
| 1843 | if (convertToString(Record, 0, SSN)) |
| 1844 | return error("Invalid record"); |
| 1845 | |
| 1846 | SSIDs.push_back(Context.getOrInsertSyncScopeID(SSN)); |
| 1847 | Record.clear(); |
| 1848 | } |
| 1849 | } |
| 1850 | |
| 1851 | /// Associate a value with its name from the given index in the provided record. |
| 1852 | Expected<Value *> BitcodeReader::recordValue(SmallVectorImpl<uint64_t> &Record, |
nothing calls this directly
no test coverage detected