From 30910bf1c9842935c1c044578fe2d1d0ca9fa32a Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 6 Apr 2009 21:37:10 +0000 Subject: [PATCH] split ReadAbbreviatedLiteral out of ReadAbbreviatedField. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68463 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Bitcode/BitstreamReader.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/include/llvm/Bitcode/BitstreamReader.h b/include/llvm/Bitcode/BitstreamReader.h index 182ef39d815..da78731f2d6 100644 --- a/include/llvm/Bitcode/BitstreamReader.h +++ b/include/llvm/Bitcode/BitstreamReader.h @@ -337,13 +337,17 @@ private: //===--------------------------------------------------------------------===// private: + void ReadAbbreviatedLiteral(const BitCodeAbbrevOp &Op, + SmallVectorImpl &Vals) { + assert(Op.isLiteral() && "Not a literal"); + // If the abbrev specifies the literal value to use, use it. + Vals.push_back(Op.getLiteralValue()); + } + void ReadAbbreviatedField(const BitCodeAbbrevOp &Op, SmallVectorImpl &Vals) { - if (Op.isLiteral()) { - // If the abbrev specifies the literal value to use, use it. - Vals.push_back(Op.getLiteralValue()); - return; - } + assert(!Op.isLiteral() && "Use ReadAbbreviatedLiteral for literals!"); + // Decode the value as we are commanded. switch (Op.getEncoding()) { default: assert(0 && "Unknown encoding!"); @@ -374,7 +378,9 @@ public: for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) { const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i); - if (Op.isLiteral() || Op.getEncoding() != BitCodeAbbrevOp::Array) { + if (Op.isLiteral()) { + ReadAbbreviatedLiteral(Op, Vals); + } else if (Op.getEncoding() != BitCodeAbbrevOp::Array) { ReadAbbreviatedField(Op, Vals); } else { // Array case. Read the number of elements as a vbr6.