aboutsummaryrefslogtreecommitdiff
path: root/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-26 03:27:58 +0000
committerChris Lattner <sabre@nondot.org>2007-04-26 03:27:58 +0000
commit198f34ac359c48018c6e1f784cf3770ead63b253 (patch)
tree1c1ad5f52cfed048089a3aec007ec27de6dac99f /lib/Bitcode/Reader/BitcodeReader.cpp
parenteb0107af86b9dde84cc1f57876f0cefc6707a919 (diff)
move some code around, fix a bug in the reader reading globalinits (which
I just introduced), stub out function reading, purge aggregate values from the value table before reading functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 6f18f7e6cf..8f8ab9d3ff 100644
--- a/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -408,10 +408,10 @@ bool BitcodeReader::ResolveGlobalAndAliasInits() {
AliasInitWorklist.swap(AliasInits);
while (!GlobalInitWorklist.empty()) {
- unsigned ValID = GlobalInits.back().second;
+ unsigned ValID = GlobalInitWorklist.back().second;
if (ValID >= ValueList.size()) {
// Not ready to resolve this yet, it requires something later in the file.
- GlobalInitWorklist.push_back(GlobalInits.back());
+ GlobalInits.push_back(GlobalInitWorklist.back());
} else {
if (Constant *C = dyn_cast<Constant>(ValueList[ValID]))
GlobalInitWorklist.back().first->setInitializer(C);
@@ -826,7 +826,7 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
break;
}
// ALIAS: [alias type, aliasee val#, linkage]
- case bitc::MODULE_CODE_ALIAS:
+ case bitc::MODULE_CODE_ALIAS: {
if (Record.size() < 3)
return Error("Invalid MODULE_ALIAS record");
const Type *Ty = getTypeByID(Record[0]);
@@ -839,6 +839,14 @@ bool BitcodeReader::ParseModule(BitstreamReader &Stream,
AliasInits.push_back(std::make_pair(NewGA, Record[1]));
break;
}
+ /// MODULE_CODE_PURGEVALS: [numvals]
+ case bitc::MODULE_CODE_PURGEVALS:
+ // Trim down the value list to the specified size.
+ if (Record.size() < 1 || Record[0] > ValueList.size())
+ return Error("Invalid MODULE_PURGEVALS record");
+ ValueList.shrinkTo(Record[0]);
+ break;
+ }
Record.clear();
}