mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-21 02:24:22 +00:00
Made Deserializer a friend class of BitstreamReader.
Moved some of the logic in BitstreamReader::ExitBlock into a utility function BitstreamReader::PopBlockScope. The latter is a private method. It will also be called by Deserializer to manipulate the current "block scope." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43972 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -20,9 +20,12 @@
|
|||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
|
class Deserializer;
|
||||||
|
|
||||||
class BitstreamReader {
|
class BitstreamReader {
|
||||||
const unsigned char *NextChar;
|
const unsigned char *NextChar;
|
||||||
const unsigned char *LastChar;
|
const unsigned char *LastChar;
|
||||||
|
friend class Deserializer;
|
||||||
|
|
||||||
/// CurWord - This is the current data we have pulled from the stream but have
|
/// CurWord - This is the current data we have pulled from the stream but have
|
||||||
/// not returned to the client.
|
/// not returned to the client.
|
||||||
@ -269,8 +272,8 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, read and enter
|
/// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, enter
|
||||||
/// the block, returning the BlockID of the block we just entered.
|
/// the block, and return true if the block is valid.
|
||||||
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0) {
|
bool EnterSubBlock(unsigned BlockID, unsigned *NumWordsP = 0) {
|
||||||
// Save the current block's state on BlockScope.
|
// Save the current block's state on BlockScope.
|
||||||
BlockScope.push_back(Block(CurCodeSize));
|
BlockScope.push_back(Block(CurCodeSize));
|
||||||
@ -303,6 +306,13 @@ public:
|
|||||||
// Block tail:
|
// Block tail:
|
||||||
// [END_BLOCK, <align4bytes>]
|
// [END_BLOCK, <align4bytes>]
|
||||||
SkipToWord();
|
SkipToWord();
|
||||||
|
|
||||||
|
PopBlockScope();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void PopBlockScope() {
|
||||||
CurCodeSize = BlockScope.back().PrevCodeSize;
|
CurCodeSize = BlockScope.back().PrevCodeSize;
|
||||||
|
|
||||||
// Delete abbrevs from popped scope.
|
// Delete abbrevs from popped scope.
|
||||||
@ -311,9 +321,8 @@ public:
|
|||||||
|
|
||||||
BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
|
BlockScope.back().PrevAbbrevs.swap(CurAbbrevs);
|
||||||
BlockScope.pop_back();
|
BlockScope.pop_back();
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// Record Processing
|
// Record Processing
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user