summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-23 16:04:05 +0000
committerChris Lattner <sabre@nondot.org>2007-04-23 16:04:05 +0000
commit4b00d92a093fd58435ddb536a3ea88d4a0d5c617 (patch)
tree490805a2e2fb87adb50c8017f682338f4cd50d50 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent4bbd4187556b23da0f891abedb600ba2a9236462 (diff)
downloadbcm5719-llvm-4b00d92a093fd58435ddb536a3ea88d4a0d5c617.tar.gz
bcm5719-llvm-4b00d92a093fd58435ddb536a3ea88d4a0d5c617.zip
first part of implementation of abbrevs. The writer isn't fully there yet and the
reader doesn't handle them at all yet. llvm-svn: 36363
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index be05f45619c..f464e33f6a0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -93,7 +93,7 @@ bool BitcodeReader::ParseTypeTable(BitstreamReader &Stream) {
continue;
}
- if (Code == bitc::DEFINE_ABBREVS) {
+ if (Code == bitc::DEFINE_ABBREV) {
assert(0 && "Abbrevs not implemented yet!");
}
@@ -230,7 +230,7 @@ bool BitcodeReader::ParseTypeSymbolTable(BitstreamReader &Stream) {
continue;
}
- if (Code == bitc::DEFINE_ABBREVS) {
+ if (Code == bitc::DEFINE_ABBREV) {
assert(0 && "Abbrevs not implemented yet!");
}
@@ -293,7 +293,7 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
continue;
}
- if (Code == bitc::DEFINE_ABBREVS) {
+ if (Code == bitc::DEFINE_ABBREV) {
assert(0 && "Abbrevs not implemented yet!");
}
@@ -345,7 +345,7 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
// GLOBALVAR: [type, isconst, initid,
// linkage, alignment, section, visibility, threadlocal]
case bitc::MODULE_CODE_GLOBALVAR: {
- if (Record.size() < 8)
+ if (Record.size() < 6)
return Error("Invalid MODULE_CODE_GLOBALVAR record");
const Type *Ty = getTypeByID(Record[0]);
if (!isa<PointerType>(Ty))
@@ -361,8 +361,10 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
return Error("Invalid section ID");
Section = SectionTable[Record[5]-1];
}
- GlobalValue::VisibilityTypes Visibility = GetDecodedVisibility(Record[6]);
- bool isThreadLocal = Record[7];
+ GlobalValue::VisibilityTypes Visibility = GlobalValue::DefaultVisibility;
+ if (Record.size() >= 6) Visibility = GetDecodedVisibility(Record[6]);
+ bool isThreadLocal = false;
+ if (Record.size() >= 7) isThreadLocal = Record[7];
GlobalVariable *NewGV =
new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule);
OpenPOWER on IntegriCloud