[llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp

Chris Lattner sabre at nondot.org
Mon Apr 9 13:28:58 PDT 2007



Changes in directory llvm/lib/Bytecode/Reader:

Reader.cpp updated: 1.246 -> 1.247
---
Log message:

Fix a bug where calling materializeModule could corrupt the module, reading
multiple copies of the function into the Function*.


---
Diffs of the changes:  (+8 -9)

 Reader.cpp |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)


Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.246 llvm/lib/Bytecode/Reader/Reader.cpp:1.247
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.246	Mon Apr  9 01:14:31 2007
+++ llvm/lib/Bytecode/Reader/Reader.cpp	Mon Apr  9 15:28:40 2007
@@ -1672,15 +1672,14 @@
     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;
 }






More information about the llvm-commits mailing list