OLD | NEW |
1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// | 1 //===- NaClBitcodeReader.cpp ----------------------------------------------===// |
2 // Internal NaClBitcodeReader implementation | 2 // Internal NaClBitcodeReader implementation |
3 // | 3 // |
4 // The LLVM Compiler Infrastructure | 4 // The LLVM Compiler Infrastructure |
5 // | 5 // |
6 // This file is distributed under the University of Illinois Open Source | 6 // This file is distributed under the University of Illinois Open Source |
7 // License. See LICENSE.TXT for details. | 7 // License. See LICENSE.TXT for details. |
8 // | 8 // |
9 //===----------------------------------------------------------------------===// | 9 //===----------------------------------------------------------------------===// |
10 | 10 |
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 return true; | 1518 return true; |
1519 case NaClBitstreamEntry::EndBlock: | 1519 case NaClBitstreamEntry::EndBlock: |
1520 return GlobalCleanup(); | 1520 return GlobalCleanup(); |
1521 | 1521 |
1522 case NaClBitstreamEntry::SubBlock: | 1522 case NaClBitstreamEntry::SubBlock: |
1523 switch (Entry.ID) { | 1523 switch (Entry.ID) { |
1524 default: // Skip unknown content. | 1524 default: // Skip unknown content. |
1525 if (Stream.SkipBlock()) | 1525 if (Stream.SkipBlock()) |
1526 return Error("Malformed block record"); | 1526 return Error("Malformed block record"); |
1527 break; | 1527 break; |
1528 case bitc::BLOCKINFO_BLOCK_ID: | 1528 case naclbitc::BLOCKINFO_BLOCK_ID: |
1529 if (Stream.ReadBlockInfoBlock()) | 1529 if (Stream.ReadBlockInfoBlock()) |
1530 return Error("Malformed BlockInfoBlock"); | 1530 return Error("Malformed BlockInfoBlock"); |
1531 break; | 1531 break; |
1532 case naclbitc::PARAMATTR_BLOCK_ID: | 1532 case naclbitc::PARAMATTR_BLOCK_ID: |
1533 if (ParseAttributeBlock()) | 1533 if (ParseAttributeBlock()) |
1534 return true; | 1534 return true; |
1535 break; | 1535 break; |
1536 case naclbitc::PARAMATTR_GROUP_BLOCK_ID: | 1536 case naclbitc::PARAMATTR_GROUP_BLOCK_ID: |
1537 if (ParseAttributeGroupBlock()) | 1537 if (ParseAttributeGroupBlock()) |
1538 return true; | 1538 return true; |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 | 1818 |
1819 switch (Entry.Kind) { | 1819 switch (Entry.Kind) { |
1820 case NaClBitstreamEntry::Error: | 1820 case NaClBitstreamEntry::Error: |
1821 Error("malformed module file"); | 1821 Error("malformed module file"); |
1822 return true; | 1822 return true; |
1823 case NaClBitstreamEntry::EndBlock: | 1823 case NaClBitstreamEntry::EndBlock: |
1824 return false; | 1824 return false; |
1825 | 1825 |
1826 case NaClBitstreamEntry::SubBlock: | 1826 case NaClBitstreamEntry::SubBlock: |
1827 switch (Entry.ID) { | 1827 switch (Entry.ID) { |
1828 case bitc::BLOCKINFO_BLOCK_ID: | 1828 case naclbitc::BLOCKINFO_BLOCK_ID: |
1829 if (Stream.ReadBlockInfoBlock()) | 1829 if (Stream.ReadBlockInfoBlock()) |
1830 return Error("Malformed BlockInfoBlock"); | 1830 return Error("Malformed BlockInfoBlock"); |
1831 break; | 1831 break; |
1832 case naclbitc::MODULE_BLOCK_ID: | 1832 case naclbitc::MODULE_BLOCK_ID: |
1833 // Reject multiple MODULE_BLOCK's in a single bitstream. | 1833 // Reject multiple MODULE_BLOCK's in a single bitstream. |
1834 if (TheModule) | 1834 if (TheModule) |
1835 return Error("Multiple MODULE_BLOCKs in same stream"); | 1835 return Error("Multiple MODULE_BLOCKs in same stream"); |
1836 TheModule = M; | 1836 TheModule = M; |
1837 if (ParseModule(false)) | 1837 if (ParseModule(false)) |
1838 return true; | 1838 return true; |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3115 if (M->MaterializeAllPermanently(ErrMsg)) { | 3115 if (M->MaterializeAllPermanently(ErrMsg)) { |
3116 delete M; | 3116 delete M; |
3117 return 0; | 3117 return 0; |
3118 } | 3118 } |
3119 | 3119 |
3120 // TODO: Restore the use-lists to the in-memory state when the bitcode was | 3120 // TODO: Restore the use-lists to the in-memory state when the bitcode was |
3121 // written. We must defer until the Module has been fully materialized. | 3121 // written. We must defer until the Module has been fully materialized. |
3122 | 3122 |
3123 return M; | 3123 return M; |
3124 } | 3124 } |
OLD | NEW |