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