llvm.org GIT mirror llvm / 8c2a552
Reduce code duplication a bit. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221785 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
2 changed file(s) with 8 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
198198
199199
200200 public:
201 BitstreamCursor() : BitStream(nullptr), NextChar(0) {}
202
203 explicit BitstreamCursor(BitstreamReader &R) : BitStream(&R) {
204 NextChar = 0;
205 CurWord = 0;
206 BitsInCurWord = 0;
207 CurCodeSize = 2;
208 }
209
210 void init(BitstreamReader &R) {
201 BitstreamCursor() { init(nullptr); }
202
203 explicit BitstreamCursor(BitstreamReader &R) { init(&R); }
204
205 void init(BitstreamReader *R) {
211206 freeState();
212207
213 BitStream = &R;
208 BitStream = R;
214209 NextChar = 0;
215210 CurWord = 0;
216211 BitsInCurWord = 0;
34163416 return Error(BitcodeError::InvalidBitcodeWrapperHeader);
34173417
34183418 StreamFile.reset(new BitstreamReader(BufPtr, BufEnd));
3419 Stream.init(*StreamFile);
3419 Stream.init(&*StreamFile);
34203420
34213421 return std::error_code();
34223422 }
34263426 // see it.
34273427 StreamingMemoryObject *Bytes = new StreamingMemoryObject(LazyStreamer);
34283428 StreamFile.reset(new BitstreamReader(Bytes));
3429 Stream.init(*StreamFile);
3429 Stream.init(&*StreamFile);
34303430
34313431 unsigned char buf[16];
34323432 if (Bytes->readBytes(0, 16, buf) == -1)