aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2013-06-12 13:32:42 -0700
committerStephen Hines <srhines@google.com>2013-06-12 13:32:42 -0700
commit1878f9a7874b1ff569d745c0269f49d3daf7203d (patch)
tree19a8dbaaedf6a056c617e87596b32d3f452af137 /lib/Bitcode
parent7a57f27b857ec4b243d83d392a399f02fc196c0a (diff)
parent100fbdd06be7590b23c4707a98cd605bdb519498 (diff)
downloadexternal_llvm-1878f9a7874b1ff569d745c0269f49d3daf7203d.zip
external_llvm-1878f9a7874b1ff569d745c0269f49d3daf7203d.tar.gz
external_llvm-1878f9a7874b1ff569d745c0269f49d3daf7203d.tar.bz2
Merge commit '100fbdd06be7590b23c4707a98cd605bdb519498' into merge_20130612
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp4
-rw-r--r--lib/Bitcode/Reader/BitstreamReader.cpp13
2 files changed, 12 insertions, 5 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index f348843..cf827c5 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -405,7 +405,7 @@ Value *BitcodeReaderMDValueList::getValueFwdRef(unsigned Idx) {
}
// Create and return a placeholder, which will later be RAUW'd.
- Value *V = MDNode::getTemporary(Context, ArrayRef<Value*>());
+ Value *V = MDNode::getTemporary(Context, None);
MDValuePtrs[Idx] = V;
return V;
}
@@ -3010,7 +3010,7 @@ bool BitcodeReader::InitLazyStream() {
Stream.init(*StreamFile);
unsigned char buf[16];
- if (Bytes->readBytes(0, 16, buf, NULL) == -1)
+ if (Bytes->readBytes(0, 16, buf) == -1)
return Error("Bitcode stream must be at least 16 bytes in length");
if (!isBitcode(buf, buf + 16))
diff --git a/lib/Bitcode/Reader/BitstreamReader.cpp b/lib/Bitcode/Reader/BitstreamReader.cpp
index 9dafe2a..1fd9abd 100644
--- a/lib/Bitcode/Reader/BitstreamReader.cpp
+++ b/lib/Bitcode/Reader/BitstreamReader.cpp
@@ -204,7 +204,16 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
const BitCodeAbbrev *Abbv = getAbbrev(AbbrevID);
- for (unsigned i = 0, e = Abbv->getNumOperandInfos(); i != e; ++i) {
+ // Read the record code first.
+ assert(Abbv->getNumOperandInfos() != 0 && "no record code in abbreviation?");
+ const BitCodeAbbrevOp &CodeOp = Abbv->getOperandInfo(0);
+ if (CodeOp.isLiteral())
+ readAbbreviatedLiteral(CodeOp, Vals);
+ else
+ readAbbreviatedField(CodeOp, Vals);
+ unsigned Code = (unsigned)Vals.pop_back_val();
+
+ for (unsigned i = 1, e = Abbv->getNumOperandInfos(); i != e; ++i) {
const BitCodeAbbrevOp &Op = Abbv->getOperandInfo(i);
if (Op.isLiteral()) {
readAbbreviatedLiteral(Op, Vals);
@@ -264,8 +273,6 @@ unsigned BitstreamCursor::readRecord(unsigned AbbrevID,
JumpToBit(NewEnd);
}
- unsigned Code = (unsigned)Vals[0];
- Vals.erase(Vals.begin());
return Code;
}