Fix typo. Add more comment. Avoid extra hash_map search.
[oota-llvm.git] / tools / lto / lto.cpp
index c4face2712abe163c71a25012719daa41bbefea8..b00f76539b3ce99160464d7d8182aadc719667b4 100644 (file)
@@ -102,6 +102,20 @@ findExternalRefs(Value *value, std::set<std::string> &references,
       findExternalRefs(c->getOperand(i), references, mangler);
 }
 
+/// 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()) 
+    return;
+
+  Module *m = pos->second;
+  allModules.erase(pos);
+  delete m;
+}
+
 /// InputFilename is a LLVM bytecode file. If Module with InputFilename is
 /// available then return it. Otherwise parseInputFilename.
 Module *