summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bytecode
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-09 20:28:40 +0000
committerChris Lattner <sabre@nondot.org>2007-04-09 20:28:40 +0000
commit09d78fc3cfb2c0842413920a737f5783af65ab71 (patch)
treed9b166c8edc31dd916511d7e3a3dfaa94dd0af8f /llvm/lib/Bytecode
parent854197884bb8e467f481eb5c85f988016c00670e (diff)
downloadbcm5719-llvm-09d78fc3cfb2c0842413920a737f5783af65ab71.tar.gz
bcm5719-llvm-09d78fc3cfb2c0842413920a737f5783af65ab71.zip
Fix a bug where calling materializeModule could corrupt the module, reading
multiple copies of the function into the Function*. llvm-svn: 35831
Diffstat (limited to 'llvm/lib/Bytecode')
-rw-r--r--llvm/lib/Bytecode/Reader/Reader.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/Bytecode/Reader/Reader.cpp b/llvm/lib/Bytecode/Reader/Reader.cpp
index ffb731f3141..fd4a54920f4 100644
--- a/llvm/lib/Bytecode/Reader/Reader.cpp
+++ b/llvm/lib/Bytecode/Reader/Reader.cpp
@@ -1672,15 +1672,14 @@ bool BytecodeReader::ParseAllFunctionBodies(std::string* ErrMsg) {
return true;
}
- LazyFunctionMap::iterator Fi = LazyFunctionLoadMap.begin();
- LazyFunctionMap::iterator Fe = LazyFunctionLoadMap.end();
-
- while (Fi != Fe) {
- Function* Func = Fi->first;
- BlockStart = At = Fi->second.Buf;
- BlockEnd = Fi->second.EndBuf;
- ParseFunctionBody(Func);
- ++Fi;
+ for (LazyFunctionMap::iterator I = LazyFunctionLoadMap.begin(),
+ E = LazyFunctionLoadMap.end(); I != E; ++I) {
+ Function *Func = I->first;
+ if (Func->hasNotBeenReadFromBytecode()) {
+ BlockStart = At = I->second.Buf;
+ BlockEnd = I->second.EndBuf;
+ ParseFunctionBody(Func);
+ }
}
return false;
}
OpenPOWER on IntegriCloud