summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2006-10-23 23:57:53 +0000
committerDevang Patel <dpatel@apple.com>2006-10-23 23:57:53 +0000
commitfdf614416848112917bfacefd766c7a42e02a12c (patch)
treec6479bddd17c8e58b9c975530f3630c739531c3a
parentc76d7ac0fa37874e88be62e6c0c3e78efd775636 (diff)
downloadbcm5719-llvm-fdf614416848112917bfacefd766c7a42e02a12c.tar.gz
bcm5719-llvm-fdf614416848112917bfacefd766c7a42e02a12c.zip
Fix typo. Add more comment. Avoid extra hash_map search.
llvm-svn: 31144
-rw-r--r--llvm/tools/lto/lto.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/tools/lto/lto.cpp b/llvm/tools/lto/lto.cpp
index b9d76d67381..b00f76539b3 100644
--- a/llvm/tools/lto/lto.cpp
+++ b/llvm/tools/lto/lto.cpp
@@ -102,16 +102,18 @@ findExternalRefs(Value *value, std::set<std::string> &references,
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
OpenPOWER on IntegriCloud