diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-29 21:49:05 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-29 21:49:05 +0000 |
commit | 8d89f1fbb618a4501d7696cb0f6a7c60ee41456b (patch) | |
tree | 9f333de00dd7cd39c8704d489d17256cffd0231b /include/llvm/Bitcode/BitstreamReader.h | |
parent | b30c925046db68928aabaca0cac1f5c669aa977f (diff) |
add some helpers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36580 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Bitcode/BitstreamReader.h')
-rw-r--r-- | include/llvm/Bitcode/BitstreamReader.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index c6394b6c99..71cb5bb33d 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -79,6 +79,8 @@ public: return (NextChar-FirstChar)*8 + (32-BitsInCurWord); } + /// GetAbbrevIDWidth - Return the number of bits used to encode an abbrev #. + unsigned GetAbbrevIDWidth() const { return CurCodeSize; } uint32_t Read(unsigned NumBits) { // If the field is fully contained by CurWord, return it quickly. @@ -205,7 +207,7 @@ public: /// EnterSubBlock - Having read the ENTER_SUBBLOCK abbrevid, read and enter /// the block, returning the BlockID of the block we just entered. - bool EnterSubBlock() { + bool EnterSubBlock(unsigned *NumWordsP = 0) { BlockScope.push_back(Block(CurCodeSize)); BlockScope.back().PrevAbbrevs.swap(CurAbbrevs); @@ -213,6 +215,7 @@ public: CurCodeSize = ReadVBR(bitc::CodeLenWidth); SkipToWord(); unsigned NumWords = Read(bitc::BlockSizeWidth); + if (NumWordsP) *NumWordsP = NumWords; // Validate that this block is sane. if (CurCodeSize == 0 || AtEndOfStream() || NextChar+NumWords*4 > LastChar) |