| OLD | NEW |
| 1 //===- NaClBitstreamWriter.h - NaCl bitstream writer ------------*- C++ -*-===// | 1 //===- NaClBitstreamWriter.h - NaCl bitstream writer ------------*- C++ -*-===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This header defines the BitstreamWriter class. This class can be used to | 10 // This header defines the BitstreamWriter class. This class can be used to |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 unsigned Offset = GetBufferOffset(); | 116 unsigned Offset = GetBufferOffset(); |
| 117 assert((Offset & 3) == 0 && "Not 32-bit aligned"); | 117 assert((Offset & 3) == 0 && "Not 32-bit aligned"); |
| 118 return Offset / 4; | 118 return Offset / 4; |
| 119 } | 119 } |
| 120 | 120 |
| 121 public: | 121 public: |
| 122 explicit NaClBitstreamWriter(SmallVectorImpl<char> &O) | 122 explicit NaClBitstreamWriter(SmallVectorImpl<char> &O) |
| 123 : Out(O), CurBit(0), CurValue(0), CurCodeSize() {} | 123 : Out(O), CurBit(0), CurValue(0), CurCodeSize() {} |
| 124 | 124 |
| 125 ~NaClBitstreamWriter() { | 125 ~NaClBitstreamWriter() { |
| 126 assert(CurBit == 0 && "Unflused data remaining"); | 126 assert(CurBit == 0 && "Unflushed data remaining"); |
| 127 assert(BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance"); | 127 assert(BlockScope.empty() && CurAbbrevs.empty() && "Block imbalance"); |
| 128 | 128 |
| 129 // Free the BlockInfoRecords. | 129 // Free the BlockInfoRecords. |
| 130 while (!BlockInfoRecords.empty()) { | 130 while (!BlockInfoRecords.empty()) { |
| 131 BlockInfo &Info = BlockInfoRecords.back(); | 131 BlockInfo &Info = BlockInfoRecords.back(); |
| 132 // Free blockinfo abbrev info. | 132 // Free blockinfo abbrev info. |
| 133 for (unsigned i = 0, e = static_cast<unsigned>(Info.Abbrevs.size()); | 133 for (unsigned i = 0, e = static_cast<unsigned>(Info.Abbrevs.size()); |
| 134 i != e; ++i) | 134 i != e; ++i) |
| 135 Info.Abbrevs[i]->dropRef(); | 135 Info.Abbrevs[i]->dropRef(); |
| 136 BlockInfoRecords.pop_back(); | 136 BlockInfoRecords.pop_back(); |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 Info.Abbrevs.push_back(Abbv); | 503 Info.Abbrevs.push_back(Abbv); |
| 504 | 504 |
| 505 return Info.Abbrevs.size()-1+naclbitc::FIRST_APPLICATION_ABBREV; | 505 return Info.Abbrevs.size()-1+naclbitc::FIRST_APPLICATION_ABBREV; |
| 506 } | 506 } |
| 507 }; | 507 }; |
| 508 | 508 |
| 509 | 509 |
| 510 } // End llvm namespace | 510 } // End llvm namespace |
| 511 | 511 |
| 512 #endif | 512 #endif |
| OLD | NEW |