[llvm-commits] CVS: llvm/tools/lto/lto.cpp

Devang Patel dpatel at apple.com
Mon Oct 23 16:58:07 PDT 2006



Changes in directory llvm/tools/lto:

lto.cpp updated: 1.21 -> 1.22
---
Log message:

Fix typo. Add more comment. Avoid extra hash_map search.


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

 lto.cpp |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)


Index: llvm/tools/lto/lto.cpp
diff -u llvm/tools/lto/lto.cpp:1.21 llvm/tools/lto/lto.cpp:1.22
--- llvm/tools/lto/lto.cpp:1.21	Mon Oct 23 18:12:26 2006
+++ llvm/tools/lto/lto.cpp	Mon Oct 23 18:57:53 2006
@@ -102,16 +102,18 @@
       findExternalRefs(c->getOperand(i), references, mangler);
 }
 
-/// If Moduel with InputFilename is available then remove it.
+/// If Module with InputFilename is available then remove it from allModules
+/// and call delete on it.
 void
 LTO::removeModule (const std::string &InputFilename)
 {
   NameToModuleMap::iterator pos = allModules.find(InputFilename.c_str());
-  if (pos != allModules.end()) {
-    Module *m = allModules[InputFilename.c_str()];
-    allModules.erase(pos);
-    delete m;
-  }
+  if (pos == allModules.end()) 
+    return;
+
+  Module *m = pos->second;
+  allModules.erase(pos);
+  delete m;
 }
 
 /// InputFilename is a LLVM bytecode file. If Module with InputFilename is






More information about the llvm-commits mailing list