[llvm] r221785 - Reduce code duplication a bit. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Wed Nov 12 06:48:38 PST 2014
Author: rafael
Date: Wed Nov 12 08:48:38 2014
New Revision: 221785
URL: http://llvm.org/viewvc/llvm-project?rev=221785&view=rev
Log:
Reduce code duplication a bit. NFC.
Modified:
llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=221785&r1=221784&r2=221785&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Wed Nov 12 08:48:38 2014
@@ -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;
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=221785&r1=221784&r2=221785&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Nov 12 08:48:38 2014
@@ -3417,7 +3417,7 @@ std::error_code BitcodeReader::InitStrea
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::InitLazyS
// 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)
More information about the llvm-commits
mailing list