Add removeModule().

llvm-svn: 31142
This commit is contained in:
Devang Patel 2006-10-23 23:12:26 +00:00
parent ebdb1d6724
commit 6c01383118
2 changed files with 14 additions and 0 deletions

View File

@ -91,6 +91,7 @@ namespace llvm {
std::vector<const char*> &,
std::string &) = 0;
virtual void getTargetTriple(const std::string &, std::string &) = 0;
virtual void removeModule (const std::string &InputFilename) = 0;
virtual ~LinkTimeOptimizer() = 0;
};
@ -111,6 +112,7 @@ namespace llvm {
std::vector<const char*> &exportList,
std::string &targetTriple);
void getTargetTriple(const std::string &InputFilename, std::string &targetTriple);
void removeModule (const std::string &InputFilename);
private:
Module *getModule (const std::string &InputFilename);

View File

@ -102,6 +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.
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;
}
}
/// InputFilename is a LLVM bytecode file. If Module with InputFilename is
/// available then return it. Otherwise parseInputFilename.
Module *