Add removeModule().
authorDevang Patel <dpatel@apple.com>
Mon, 23 Oct 2006 23:12:26 +0000 (23:12 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 23 Oct 2006 23:12:26 +0000 (23:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31142 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/LinkTimeOptimizer.h
tools/lto/lto.cpp

index 654623adff85a5bc289d49e3ec488477d8aed441..6c58706cf93ba8a38dd25c5bd5f40c7e7916b284 100644 (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);
index c4face2712abe163c71a25012719daa41bbefea8..b9d76d67381a692cc8540153d6cdf6e76f3e4392 100644 (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 *