diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-09 20:28:40 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-09 20:28:40 +0000 |
commit | 24e90d3c5b65844dcd0dbeb83a92a5b35f0de4c8 (patch) | |
tree | d489cf70698a81f8436c7239e00ac013467bb73f /lib/Bytecode | |
parent | 5464b96073626f811d79d56fa37be230552d2264 (diff) | |
download | external_llvm-24e90d3c5b65844dcd0dbeb83a92a5b35f0de4c8.zip external_llvm-24e90d3c5b65844dcd0dbeb83a92a5b35f0de4c8.tar.gz external_llvm-24e90d3c5b65844dcd0dbeb83a92a5b35f0de4c8.tar.bz2 |
Fix a bug where calling materializeModule could corrupt the module, reading
multiple copies of the function into the Function*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Bytecode')
-rw-r--r-- | lib/Bytecode/Reader/Reader.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Bytecode/Reader/Reader.cpp b/lib/Bytecode/Reader/Reader.cpp index ffb731f..fd4a5492 100644 --- a/lib/Bytecode/Reader/Reader.cpp +++ b/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; } |