aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lto
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
commit2a4dd685357e2fd248ab458d3bed4ea21350815b (patch)
treed2e1c2466bb48d337aebc6f47de6600b501a7235 /tools/lto
parent34ea07692f4cd7c007f1c5062bcebb6d03131077 (diff)
downloadexternal_llvm-2a4dd685357e2fd248ab458d3bed4ea21350815b.zip
external_llvm-2a4dd685357e2fd248ab458d3bed4ea21350815b.tar.gz
external_llvm-2a4dd685357e2fd248ab458d3bed4ea21350815b.tar.bz2
Fix typo. Add more comment. Avoid extra hash_map search.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto')
-rw-r--r--tools/lto/lto.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index b9d76d6..b00f765 100644
--- a/tools/lto/lto.cpp
+++ b/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