mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-20 02:58:10 +00:00
Reduce code duplication a bit. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221785 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e4e7ad3101
commit
8c2a55264a
@ -199,19 +199,14 @@ class BitstreamCursor {
|
||||
|
||||
|
||||
public:
|
||||
BitstreamCursor() : BitStream(nullptr), NextChar(0) {}
|
||||
BitstreamCursor() { init(nullptr); }
|
||||
|
||||
explicit BitstreamCursor(BitstreamReader &R) : BitStream(&R) {
|
||||
NextChar = 0;
|
||||
CurWord = 0;
|
||||
BitsInCurWord = 0;
|
||||
CurCodeSize = 2;
|
||||
}
|
||||
explicit BitstreamCursor(BitstreamReader &R) { init(&R); }
|
||||
|
||||
void init(BitstreamReader &R) {
|
||||
void init(BitstreamReader *R) {
|
||||
freeState();
|
||||
|
||||
BitStream = &R;
|
||||
BitStream = R;
|
||||
NextChar = 0;
|
||||
CurWord = 0;
|
||||
BitsInCurWord = 0;
|
||||
|
@ -3417,7 +3417,7 @@ std::error_code BitcodeReader::InitStreamFromBuffer() {
|
||||
return Error(BitcodeError::InvalidBitcodeWrapperHeader);
|
||||
|
||||
StreamFile.reset(new BitstreamReader(BufPtr, BufEnd));
|
||||
Stream.init(*StreamFile);
|
||||
Stream.init(&*StreamFile);
|
||||
|
||||
return std::error_code();
|
||||
}
|
||||
@ -3427,7 +3427,7 @@ std::error_code BitcodeReader::InitLazyStream() {
|
||||
// see it.
|
||||
StreamingMemoryObject *Bytes = new StreamingMemoryObject(LazyStreamer);
|
||||
StreamFile.reset(new BitstreamReader(Bytes));
|
||||
Stream.init(*StreamFile);
|
||||
Stream.init(&*StreamFile);
|
||||
|
||||
unsigned char buf[16];
|
||||
if (Bytes->readBytes(0, 16, buf) == -1)
|
||||
|
Loading…
Reference in New Issue
Block a user